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

LoadWAND should add the duration log

parent 566283d9
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ class LoadWAND(DataProcessorAlgorithm): ...@@ -37,7 +37,7 @@ class LoadWAND(DataProcessorAlgorithm):
issues = dict() issues = dict()
if not self.getProperty("Filename").value: if not self.getProperty("Filename").value:
if (self.getProperty("IPTS").value == Property.EMPTY_INT) or len(self.getProperty("RunNumbers").value) is 0: if (self.getProperty("IPTS").value == Property.EMPTY_INT) or len(self.getProperty("RunNumbers").value) == 0:
issues["Filename"] = 'Must specify either Filename or IPTS AND RunNumbers' issues["Filename"] = 'Must specify either Filename or IPTS AND RunNumbers'
return issues return issues
...@@ -63,6 +63,7 @@ class LoadWAND(DataProcessorAlgorithm): ...@@ -63,6 +63,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)
...@@ -92,6 +93,8 @@ class LoadWAND(DataProcessorAlgorithm): ...@@ -92,6 +93,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']
......
...@@ -21,6 +21,7 @@ class LoadWANDTest(unittest.TestCase): ...@@ -21,6 +21,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