Skip to content

Commit

Permalink
Fixed bug in BaseTrace.add_to_trace
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinRavn committed Feb 3, 2025
1 parent 56ca4a2 commit 9e9fef7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions NuRadioReco/framework/base_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,11 @@ def add_to_trace(self, channel):
if t0_channel < t0_readout:
i_start_readout = 0
t_start_readout = t0_readout
i_start_channel = int((t0_readout-t0_channel) * sampling_rate_channel) + 1 # The first bin of channel inside readout
i_start_channel = int(np.ceil((t0_readout - t0_channel) * sampling_rate_channel)) # The first bin of channel inside readout
t_start_channel = tt_channel[i_start_channel]
# 3. Channel starts after readout window:
elif t0_channel >= t0_readout:
i_start_readout = int((t0_channel-t0_readout) * sampling_rate_readout) # The bin of readout right before channel starts
i_start_readout = int(np.floor((t0_channel - t0_readout) * sampling_rate_readout)) # The bin of readout right before channel starts
t_start_readout = tt_readout[i_start_readout]
i_start_channel = 0
t_start_channel = t0_channel
Expand All @@ -349,11 +349,11 @@ def add_to_trace(self, channel):
if t1_channel >= t1_readout:
i_end_readout = n_samples_readout - 1
t_end_readout = t1_readout
i_end_channel = int((t1_readout - t0_channel) * sampling_rate_channel) + 1 # The bin of channel right after readout ends
i_end_channel = int(np.ceil((t1_readout - t0_channel) * sampling_rate_channel)) # The bin of channel right after readout ends
t_end_channel = tt_channel[i_end_channel]
# 5. Channel ends before readout window:
elif t1_channel < t1_readout:
i_end_readout = int((t1_channel - t0_readout) * sampling_rate_readout) # The bin of readout right before channel ends
i_end_readout = int(np.floor((t1_channel - t0_readout) * sampling_rate_readout)) # The bin of readout right before channel ends
t_end_readout = tt_readout[i_end_readout]
i_end_channel = n_samples_channel - 1
t_end_channel = t1_channel
Expand Down

0 comments on commit 9e9fef7

Please sign in to comment.