increased readebility

This commit is contained in:
2024-03-06 13:35:21 +01:00
parent 65f2383124
commit 4235666d7e
2 changed files with 36 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
import argparse
from datetime import datetime
from datetime import date
from .logconfig import update_loglevel
from .options import ReaderConfig, EOSConfig, ExperimentConfig, OutputConfig, ReductionConfig
@@ -29,7 +29,7 @@ def commandLineArgs():
default = '.',
help = "relative path to directory with .hdf files")
input_data.add_argument("-Y", "--year",
default = datetime.year,
default = date.today().year,
type = int,
help = "year the measurement was performed")
input_data.add_argument("-sub", "--subtract",
@@ -161,33 +161,35 @@ def command_line_options():
update_loglevel(clas.verbose, clas.debug)
reader_config = ReaderConfig(
year=clas.year,
dataPath=clas.dataPath)
year = clas.year,
dataPath = clas.dataPath
)
experiment_config = ExperimentConfig(
sampleModel=clas.sampleModel,
chopperPhase=clas.chopperPhase,
chopperPhaseOffset=clas.chopperPhaseOffset,
yRange=clas.yRange,
lambdaRange=clas.lambdaRange,
qzRange=clas.qzRange,
offSpecular=clas.offSpecular,
mu=clas.mu,
nu=clas.nu,
muOffset=clas.muOffset
sampleModel = clas.sampleModel,
chopperPhase = clas.chopperPhase,
chopperPhaseOffset = clas.chopperPhaseOffset,
yRange = clas.yRange,
lambdaRange = clas.lambdaRange,
qzRange = clas.qzRange,
offSpecular = clas.offSpecular,
mu = clas.mu,
nu = clas.nu,
muOffset = clas.muOffset
)
reduction_config = ReductionConfig(
qResolution=clas.qResolution,
autoscale=clas.autoscale,
thetaRange=clas.thetaRange,
thetaRangeR=clas.thetaRangeR,
fileIdentifier=clas.fileIdentifier,
scale=clas.scale,
subtract=clas.subtract,
normalisationFileIdentifier=clas.normalisationFileIdentifier,
timeSlize=clas.timeSlize
qResolution = clas.qResolution,
autoscale = clas.autoscale,
thetaRange = clas.thetaRange,
thetaRangeR = clas.thetaRangeR,
fileIdentifier = clas.fileIdentifier,
scale = clas.scale,
subtract = clas.subtract,
normalisationFileIdentifier = clas.normalisationFileIdentifier,
timeSlize = clas.timeSlize
)
output_config = OutputConfig(
outputFormats=output_format_list(clas.outputFormat),
outputName=clas.outputName
outputFormats = output_format_list(clas.outputFormat),
outputName = clas.outputName
)
return EOSConfig(reader_config, experiment_config, reduction_config, output_config)
return EOSConfig(reader_config, experiment_config, reduction_config, output_config)

View File

@@ -25,7 +25,7 @@ class Header:
self.reduction = fileio.Reduction(
software = fileio.Software('eos', version=__version__),
call = ' '.join(sys.argv),
call = self.create_call_string(),
computer = platform.node(),
timestamp = datetime.now(),
creator = None,
@@ -54,7 +54,7 @@ class Header:
fileio.ErrorColumn(error_of='Qz', error_type='resolution', distribution='gaussian', value_is='sigma'),
]
return cols
#-------------------------------------------------------------------------------------------------
def orso_header(self, columns=None, extra_columns=[]):
"""
Generate ORSO header from a copy of this class' data.
@@ -64,3 +64,9 @@ class Header:
if columns is None:
columns = self.columns()
return fileio.Orso(ds, red, columns+extra_columns)
#-------------------------------------------------------------------------------------------------
def create_call_string(self):
callString = ' '.join(sys.argv)
if '-Y' not in callString:
callString += f' -Y {datetime.now().year}'
return callString