Update test cases and make old datafile work

This commit is contained in:
2024-09-24 14:51:27 +02:00
parent 128a8da358
commit a7e88db425
2 changed files with 17 additions and 6 deletions

View File

@@ -352,11 +352,14 @@ class AmorData:
self.pixelID_e = np.array(self.hdf['/entry1/Amor/detector/data/event_id'][:], dtype=int)
self.dataPacket_p = np.array(self.hdf['/entry1/Amor/detector/data/event_index'][:], dtype=np.uint64)
#self.dataPacketTime_p = np.array(self.hdf['/entry1/Amor/detector/data/event_time_zero'][:], dtype=np.uint64)/1e9
self.dataPacketTime_p = np.array(self.hdf['/entry1/Amor/detector/data/event_time_zero'][:], dtype=int)
self.dataPacketTime_p = np.array(self.hdf['/entry1/Amor/detector/data/event_time_zero'][:], dtype=float)
try:
self.currentTime = np.array(self.hdf['entry1/Amor/detector/proton_current/time'][:], dtype=int)
self.current = np.array(self.hdf['entry1/Amor/detector/proton_current/value'][:,0], dtype=float)
self.monitorType = 'protonCharge'
if len(self.current)>0:
self.monitorType = 'protonCharge'
else:
self.monitorType = 'countingTime'
except(KeyError, IndexError):
self.monitorType = 'countingTime'

View File

@@ -6,6 +6,8 @@ from libeos import options, reduction, logconfig
logconfig.setup_logging()
logconfig.update_loglevel(True, False)
# TODO: add test for new features like proton charge normalization
class FullAmorTest(TestCase):
@classmethod
def setUpClass(cls):
@@ -19,7 +21,9 @@ class FullAmorTest(TestCase):
self.pr.enable()
self.reader_config = options.ReaderConfig(
year=2023,
dataPath=os.path.join('..', "test_data"))
dataPath=os.path.join('..', "test_data"),
raw=(os.path.join('..', "test_data"),)
)
def tearDown(self):
self.pr.disable()
@@ -37,14 +41,16 @@ class FullAmorTest(TestCase):
yRange=(11., 41.),
lambdaRange=(2., 15.),
qzRange=(0.005, 0.30),
offSpecular=False,
incidentAngle=options.Defaults.incidentAngle,
mu=0,
nu=0,
muOffset=0.0,
sampleModel='air | 10 H2O | D2O'
)
reduction_config = options.ReductionConfig(
normalisationMethod=options.Defaults.normalisationMethod,
qResolution=0.01,
qzRange=options.Defaults.qzRange,
thetaRange=(-12., 12.),
thetaRangeR=(-12., 12.),
fileIdentifier=["610"],
@@ -72,19 +78,21 @@ class FullAmorTest(TestCase):
yRange=(11., 41.),
lambdaRange=(2., 15.),
qzRange=(0.005, 0.30),
offSpecular=False,
incidentAngle=options.Defaults.incidentAngle,
mu=0,
nu=0,
muOffset=0.0
)
reduction_config = options.ReductionConfig(
qResolution=0.01,
qzRange=options.Defaults.qzRange,
normalisationMethod=options.Defaults.normalisationMethod,
thetaRange=(-12., 12.),
thetaRangeR=(-12., 12.),
fileIdentifier=["610", "611", "608,612-613", "609"],
scale=[1],
normalisationFileIdentifier=["614"],
autoscale=(0.005, 0.008)
autoscale=(True, True)
)
output_config = options.OutputConfig(
outputFormats=["Rqz.ort"],