Skip to content

Commit ae76127

Browse files
committed
Skip drs4 corrections already applied by EVB
1 parent 3307ed0 commit ae76127

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ctapipe_io_lst/calibration.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from .compat import CTAPIPE_GE_0_21
2020
from .containers import LSTArrayEventContainer
21+
from .evb_preprocessing import EVBPreprocessingFlag
2122

2223

2324
from .constants import (
@@ -225,6 +226,9 @@ def __init__(self, subarray, config=None, parent=None, **kwargs):
225226
def apply_drs4_corrections(self, event: LSTArrayEventContainer):
226227

227228
for tel_id in event.trigger.tels_with_trigger:
229+
tdp_action = event.lst.tel[tel_id].evt.tdp_action
230+
preprocessing = EVBPreprocessingFlag(tdp_action or 0)
231+
228232
r1 = event.r1.tel[tel_id]
229233
# If r1 was not yet filled, copy of r0 converted
230234
if r1.waveform is None:
@@ -244,21 +248,20 @@ def apply_drs4_corrections(self, event: LSTArrayEventContainer):
244248
r1.waveform = r1.waveform.astype(np.float32, copy=False)
245249

246250
# apply drs4 corrections
247-
if self.apply_drs4_pedestal_correction:
251+
if self.apply_drs4_pedestal_correction and EVBPreprocessingFlag.BASELINE_SUBTRACTION not in preprocessing:
248252
self.subtract_pedestal(event, tel_id)
249253

250-
if self.apply_timelapse_correction:
254+
if self.apply_timelapse_correction and EVBPreprocessingFlag.DELTA_T_CORRECTION not in preprocessing:
251255
self.time_lapse_corr(event, tel_id)
252256
else:
253257
self.update_last_readout_times(event, tel_id)
254258

255-
if self.apply_spike_correction:
259+
if self.apply_spike_correction and EVBPreprocessingFlag.SPIKE_REMOVAL not in preprocessing:
256260
if self.spike_correction_method == 'subtraction':
257261
self.subtract_spikes(event, tel_id)
258262
else:
259263
self.interpolate_spikes(event, tel_id)
260264

261-
262265
# remove samples at beginning / end of waveform
263266
start = self.r1_sample_start.tel[tel_id]
264267
end = self.r1_sample_end.tel[tel_id]

0 commit comments

Comments
 (0)