Skip to content
Snippets Groups Projects
Commit 94a1b201 authored by Savici, Andrei T.'s avatar Savici, Andrei T.
Browse files

LoadWAND should add the duration log

parent a3b28090
No related merge requests found
...@@ -61,6 +61,7 @@ class LoadWAND(DataProcessorAlgorithm): ...@@ -61,6 +61,7 @@ class LoadWAND(DataProcessorAlgorithm):
data = np.zeros((512*480*8),dtype=np.int64) data = np.zeros((512*480*8),dtype=np.int64)
with h5py.File(run, 'r') as f: with h5py.File(run, 'r') as f:
monitor_count = f['/entry/monitor1/total_counts'].value[0] monitor_count = f['/entry/monitor1/total_counts'].value[0]
duration = f['/entry/duration'].value[0]
run_number = f['/entry/run_number'].value[0] run_number = f['/entry/run_number'].value[0]
for b in range(8): for b in range(8):
data += np.bincount(f['/entry/bank'+str(b+1)+'_events/event_id'].value,minlength=512*480*8) data += np.bincount(f['/entry/bank'+str(b+1)+'_events/event_id'].value,minlength=512*480*8)
...@@ -90,6 +91,8 @@ class LoadWAND(DataProcessorAlgorithm): ...@@ -90,6 +91,8 @@ class LoadWAND(DataProcessorAlgorithm):
AddSampleLog('__tmp_load', LogName="Ei", LogType='Number', NumberType='Double', AddSampleLog('__tmp_load', LogName="Ei", LogType='Number', NumberType='Double',
LogText=str(UnitConversion.run('Wavelength', 'Energy', wavelength, 0, 0, 0, Elastic, 0)), EnableLogging=False) LogText=str(UnitConversion.run('Wavelength', 'Energy', wavelength, 0, 0, 0, Elastic, 0)), EnableLogging=False)
AddSampleLog('__tmp_load', LogName="run_number", LogText=run_number, EnableLogging=False) AddSampleLog('__tmp_load', LogName="run_number", LogText=run_number, EnableLogging=False)
AddSampleLog('__tmp_load', LogName="duration", LogType='Number',
LogText=str(duration), NumberType='Double', EnableLogging=False)
if grouping > 1: # Fix detector IDs per spectrum before loading instrument if grouping > 1: # Fix detector IDs per spectrum before loading instrument
__tmp_load = mtd['__tmp_load'] __tmp_load = mtd['__tmp_load']
......
...@@ -20,6 +20,7 @@ class LoadWANDTest(unittest.TestCase): ...@@ -20,6 +20,7 @@ class LoadWANDTest(unittest.TestCase):
self.assertAlmostEqual(ws.run().getGoniometer().getEulerAngles()[0], -142.6) self.assertAlmostEqual(ws.run().getGoniometer().getEulerAngles()[0], -142.6)
self.assertEqual(ws.run().getLogData('Wavelength').value, 1.488) self.assertEqual(ws.run().getLogData('Wavelength').value, 1.488)
self.assertAlmostEqual(ws.run().getLogData('Ei').value, 36.94619794) self.assertAlmostEqual(ws.run().getLogData('Ei').value, 36.94619794)
self.assertAlmostEqual(ws.run().getLogData('duration').value, 40.05)
# Check masking # Check masking
self.assertTrue(ws.detectorInfo().isMasked(0)) self.assertTrue(ws.detectorInfo().isMasked(0))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment