diff --git a/src/toolbox_scs/detectors/dssc.py b/src/toolbox_scs/detectors/dssc.py index 58cb59b4d6d4510c5d94acddb295ee7afeeeef12..04ef5e4774988099f45b97366d0bda0f06cfd666 100644 --- a/src/toolbox_scs/detectors/dssc.py +++ b/src/toolbox_scs/detectors/dssc.py @@ -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.") diff --git a/src/toolbox_scs/test/test_dssc_cls.py b/src/toolbox_scs/test/test_dssc_cls.py index e548a5433bee7f7ceb683337c8bb5edccac9adae..68a229043885bc08294a8fd9bc9b2f660cadfce5 100644 --- a/src/toolbox_scs/test/test_dssc_cls.py +++ b/src/toolbox_scs/test/test_dssc_cls.py @@ -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))