Skip to content
Snippets Groups Projects
Commit 9ed96117 authored by Rafael Gort's avatar Rafael Gort
Browse files

added missing masking when binning xgm data for post-process normalization

parent 9e2b7655
No related branches found
Tags 1.1.1-rc1
2 merge requests!98WIP: Separate digitizers from XGM, assign absolute pulse ID to XGM and digitizers data,!87Introduce package structure, generalized binning principle, ...
......@@ -171,11 +171,14 @@ class DSSCBinner:
"""
if self.xgm is not None:
xgm_data = self.xgm.to_dataset(name='xgm')
if self.pulsemask is not None:
xgm_data = xgm_data.where(self.pulsemask)
for b in self.binners:
if b in ['trainId', 'pulse']:
xgm_data[b+"_binned"] = self.binners[b]
xgm_data = xgm_data.groupby(b+"_binned").mean(b)
xgm_data = xgm_data.rename(name_dict={b+"_binned": b})
log.info('binned xgm data according to dssc binners.')
return xgm_data.transpose('trainId', 'pulse')
else:
log.warning("no xgm data. Use load_xgm() to load the xgm data.")
......
......@@ -79,6 +79,7 @@ class TestDSSC(unittest.TestCase):
run235.add_binner('pulse', binner2)
xgm_threshold=(300.0, 8000.0)
run235.create_xgm_mask(xgm_threshold, 1)
self.assertIsNotNone(run235.get_xgm_binned())
self.assertEqual(run235.binners['trainId'].values[0],
np.float32(7585.52))
......
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