fix output name having colon by default, add 2026 dataset and test for logfilter with polarization
This commit is contained in:
@@ -109,7 +109,7 @@ class ReflectivityReduction:
|
||||
# output
|
||||
if self.config.output.is_default('outputName'):
|
||||
import datetime
|
||||
_date = datetime.datetime.now().replace(microsecond=0).isoformat()
|
||||
_date = datetime.datetime.now().replace(microsecond=0).isoformat().replace(':', '-')
|
||||
if self.header.sample.name:
|
||||
_sampleName = self.header.sample.name.replace(' ', '_')
|
||||
else:
|
||||
|
||||
BIN
test_data/amor2026n000826.hdf
LFS
Normal file
BIN
test_data/amor2026n000826.hdf
LFS
Normal file
Binary file not shown.
@@ -45,21 +45,16 @@ class FullAmorTest(TestCase):
|
||||
|
||||
def test_time_slicing(self):
|
||||
experiment_config = options.ExperimentConfig(
|
||||
chopperSpeed=self._field_defaults['ExperimentConfig']['chopperSpeed'],
|
||||
chopperPhase=-13.5,
|
||||
chopperPhaseOffset=-5,
|
||||
monitorType=self._field_defaults['ExperimentConfig']['monitorType'],
|
||||
lowCurrentThreshold=self._field_defaults['ExperimentConfig']['lowCurrentThreshold'],
|
||||
yRange=(18, 48),
|
||||
lambdaRange=(3., 11.5),
|
||||
incidentAngle=self._field_defaults['ExperimentConfig']['incidentAngle'],
|
||||
mu=0,
|
||||
nu=0,
|
||||
muOffset=0.0,
|
||||
sampleModel='air | 10 H2O | D2O'
|
||||
)
|
||||
reduction_config = options.ReflectivityReductionConfig(
|
||||
normalisationMethod=self._field_defaults['ReflectivityReductionConfig']['normalisationMethod'],
|
||||
qResolution=0.01,
|
||||
qzRange=(0.01, 0.15),
|
||||
thetaRange=(-0.75, 0.75),
|
||||
@@ -84,22 +79,16 @@ class FullAmorTest(TestCase):
|
||||
|
||||
def test_noslicing(self):
|
||||
experiment_config = options.ExperimentConfig(
|
||||
chopperSpeed=self._field_defaults['ExperimentConfig']['chopperSpeed'],
|
||||
chopperPhase=-13.5,
|
||||
chopperPhaseOffset=-5,
|
||||
monitorType=self._field_defaults['ExperimentConfig']['monitorType'],
|
||||
lowCurrentThreshold=self._field_defaults['ExperimentConfig']['lowCurrentThreshold'],
|
||||
yRange=(18, 48),
|
||||
lambdaRange=(3., 11.5),
|
||||
incidentAngle=self._field_defaults['ExperimentConfig']['incidentAngle'],
|
||||
mu=0,
|
||||
nu=0,
|
||||
muOffset=0.0,
|
||||
)
|
||||
reduction_config = options.ReflectivityReductionConfig(
|
||||
normalisationMethod=self._field_defaults['ReflectivityReductionConfig']['normalisationMethod'],
|
||||
qResolution=0.01,
|
||||
qzRange=self._field_defaults['ReflectivityReductionConfig']['qzRange'],
|
||||
thetaRange=(-0.75, 0.75),
|
||||
fileIdentifier=["6003", "6004", "6005"],
|
||||
scale=[1],
|
||||
@@ -117,3 +106,24 @@ class FullAmorTest(TestCase):
|
||||
# run second time to reuse norm file
|
||||
reducer = reduction_reflectivity.ReflectivityReduction(config)
|
||||
reducer.reduce()
|
||||
|
||||
def test_eventfilter(self):
|
||||
self.reader_config.year = 2026
|
||||
experiment_config = options.ExperimentConfig()
|
||||
reduction_config = options.ReflectivityReductionConfig(fileIdentifier=["826"],
|
||||
logfilter=['polarization_config_label==2'])
|
||||
output_config = options.ReflectivityOutputConfig(
|
||||
outputFormats=[options.OutputFomatOption.Rqz_ort],
|
||||
outputName='test',
|
||||
outputPath='test_results',
|
||||
)
|
||||
config=options.ReflectivityConfig(self.reader_config, experiment_config, reduction_config, output_config)
|
||||
reducer = reduction_reflectivity.ReflectivityReduction(config)
|
||||
reducer.reduce()
|
||||
espin_up = reducer.dataset.data.events.shape[0]
|
||||
reduction_config.logfilter = ['polarization_config_label==3']
|
||||
reducer = reduction_reflectivity.ReflectivityReduction(config)
|
||||
reducer.reduce()
|
||||
espin_down = reducer.dataset.data.events.shape[0]
|
||||
# measurement should have about 2x as many counts in spin_down
|
||||
self.assertAlmostEqual(espin_down/espin_up, 2., 2)
|
||||
|
||||
Reference in New Issue
Block a user