diff --git a/eos/reduction_reflectivity.py b/eos/reduction_reflectivity.py index d95ab0f..cc8a1af 100644 --- a/eos/reduction_reflectivity.py +++ b/eos/reduction_reflectivity.py @@ -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: diff --git a/test_data/amor2026n000826.hdf b/test_data/amor2026n000826.hdf new file mode 100644 index 0000000..60298c2 --- /dev/null +++ b/test_data/amor2026n000826.hdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5df5f428116f9594f8d067a84ccb8f0894e001943786997715494638cd2483eb +size 68269303 diff --git a/tests/test_full_analysis.py b/tests/test_full_analysis.py index 1821c59..ac6177b 100644 --- a/tests/test_full_analysis.py +++ b/tests/test_full_analysis.py @@ -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)