Update test case to new data, fix sample model from config parameter, add git attributes for lfs of test files

This commit is contained in:
2025-10-06 08:29:51 +02:00
parent 9f0de521ee
commit 2a10597dc3
8 changed files with 54 additions and 12 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.hdf filter=lfs diff=lfs merge=lfs -text

View File

@@ -44,7 +44,7 @@ class ApplyParameterOverwrites(EventDataAction):
def update_header(self, header:Header) ->None:
if self.config.sampleModel:
import yaml
from orsopy.fileio import Sample
from orsopy.fileio.model_language import SampleModel
if 'yml' in self.config.sampleModel or 'yaml' in self.config.sampleModel:
if os.path.isfile(self.config.sampleModel):
with open(self.config.sampleModel, 'r') as model_yml:
@@ -54,7 +54,7 @@ class ApplyParameterOverwrites(EventDataAction):
else:
model = dict(stack=self.config.sampleModel)
logging.debug(f' set sample.model = {self.config.sampleModel}')
header.sample.model = Sample.from_dict(model)
header.sample.model = SampleModel.from_dict(model)
class CorrectChopperPhase(EventDataAction):

BIN
test_data/amor2025n005952.hdf LFS Normal file

Binary file not shown.

BIN
test_data/amor2025n006003.hdf LFS Normal file

Binary file not shown.

BIN
test_data/amor2025n006004.hdf LFS Normal file

Binary file not shown.

BIN
test_data/amor2025n006005.hdf LFS Normal file

Binary file not shown.

31
tests/analyze_hdf.py Normal file
View File

@@ -0,0 +1,31 @@
"""
Small helper to find information about hdf datafiles for debugging
"""
import h5py
def rec_tree(group, min_size=128):
if hasattr(group, 'keys'):
output = {}
total_size = 0
for key in group.keys():
subkeys, size = rec_tree(group[key], min_size)
total_size += size
if size>min_size:
if subkeys:
output[key] = subkeys
else:
output[key] = size
return output, size
elif hasattr(group, 'size'):
return None, group.size
else:
return None, 0
if __name__ == "__main__":
import sys
for fi in sys.argv[1:]:
print(fi)
print(rec_tree(sys.argv[1]))

View File

@@ -50,8 +50,8 @@ class FullAmorTest(TestCase):
chopperPhaseOffset=-5,
monitorType=self._field_defaults['ExperimentConfig']['monitorType'],
lowCurrentThreshold=self._field_defaults['ExperimentConfig']['lowCurrentThreshold'],
yRange=(11, 41),
lambdaRange=(2., 15.),
yRange=(18, 48),
lambdaRange=(3., 11.5),
incidentAngle=self._field_defaults['ExperimentConfig']['incidentAngle'],
mu=0,
nu=0,
@@ -62,9 +62,8 @@ class FullAmorTest(TestCase):
normalisationMethod=self._field_defaults['ReductionConfig']['normalisationMethod'],
qResolution=0.01,
qzRange=self._field_defaults['ReductionConfig']['qzRange'],
thetaRange=(-12., 12.),
thetaRangeR=(-12., 12.),
fileIdentifier=["5980", "5981", "5983-5985"],
thetaRange=(-0.75, 0.75),
fileIdentifier=["6003-6005"],
scale=[1],
normalisationFileIdentifier=[],
timeSlize=[300.0]
@@ -90,8 +89,8 @@ class FullAmorTest(TestCase):
chopperPhaseOffset=-5,
monitorType=self._field_defaults['ExperimentConfig']['monitorType'],
lowCurrentThreshold=self._field_defaults['ExperimentConfig']['lowCurrentThreshold'],
yRange=(11, 41),
lambdaRange=(2., 15.),
yRange=(18, 48),
lambdaRange=(3., 11.5),
incidentAngle=self._field_defaults['ExperimentConfig']['incidentAngle'],
mu=0,
nu=0,
@@ -101,9 +100,8 @@ class FullAmorTest(TestCase):
normalisationMethod=self._field_defaults['ReductionConfig']['normalisationMethod'],
qResolution=0.01,
qzRange=self._field_defaults['ReductionConfig']['qzRange'],
thetaRange=(-12., 12.),
thetaRangeR=(-12., 12.),
fileIdentifier=["5980"],
thetaRange=(-0.75, 0.75),
fileIdentifier=["6003", "6004", "6005"],
scale=[1],
normalisationFileIdentifier=["5952"],
autoscale=(0.0, 0.05),