diff --git a/libeos/file_reader.py b/libeos/file_reader.py index ebe44a8..5948b36 100644 --- a/libeos/file_reader.py +++ b/libeos/file_reader.py @@ -204,8 +204,9 @@ class AmorData: self.extract_walltime(norm) # following lines: debugging output to trace the time-offset of proton current and neutron pulses - cpp, t_bins = np.histogram(self.wallTime_e, self.pulseTimeS) - np.savetxt('tme.hst', np.vstack((self.pulseTimeS[:-1], cpp, self.monitorPerPulse[:-1])).T) + if self.config.monitorType == 'p': + cpp, t_bins = np.histogram(self.wallTime_e, self.pulseTimeS) + np.savetxt('tme.hst', np.vstack((self.pulseTimeS[:-1], cpp, self.monitorPerPulse[:-1])).T) self.average_events_per_pulse() @@ -258,7 +259,7 @@ class AmorData: # filter low-current pulses self.monitorPerPulse = np.where(self.monitorPerPulse > 2*self.tau * self.config.lowCurrentThreshold * 1e-3, self.monitorPerPulse, 0) elif self.config.monitorType == 't': # countingTime - self.monitorPerPulse = self.tau + self.monitorPerPulse = np.ones(np.shape(self.pulseTimeS)[0])*self.tau else: self.monitorPerPulse = 1./np.shape(pulseTimeS)[1] @@ -375,7 +376,7 @@ class AmorData: try: self.currentTime = np.array(self.hdf['entry1/Amor/detector/proton_current/time'][:], dtype=np.int64) self.current = np.array(self.hdf['entry1/Amor/detector/proton_current/value'][:,0], dtype=float) - if len(self.current)>0: + if len(self.current)>4: self.config.monitorType = 'p' else: self.config.monitorType = 't' diff --git a/libeos/reduction.py b/libeos/reduction.py index d064844..d03fde6 100644 --- a/libeos/reduction.py +++ b/libeos/reduction.py @@ -22,6 +22,8 @@ class AmorReduction: self.header = Header() self.header.reduction.call = config.call_string() + self.monitorUnit = {'n': 'cnts', 'p': 'mC', 't': 's'} + def reduce(self): if not os.path.exists(f'{self.output_config.outputPath}'): logging.debug(f'Creating destination path {self.output_config.outputPath}') @@ -77,7 +79,7 @@ class AmorReduction: lamda_e = self.file_reader.lamda_e detZ_e = self.file_reader.detZ_e self.monitor = np.sum(self.file_reader.monitorPerPulse) - logging.warning(f' monitor = {self.monitor:8.2f} ({self.experiment_config.monitorType})') + logging.warning(f' monitor = {self.monitor:8.2f} {self.monitorUnit[self.experiment_config.monitorType]}') qz_lz, qx_lz, ref_lz, err_lz, res_lz, lamda_lz, theta_lz, int_lz, self.mask_lz = self.project_on_lz( self.file_reader, self.norm_lz, self.normAngle, lamda_e, detZ_e) #if self.monitor>1 : @@ -193,7 +195,7 @@ class AmorReduction: detZ_e = self.file_reader.detZ_e[filter_e] filter_m = np.where((time