Skip to content

Commit

Permalink
Set to nan if out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
watsonjj committed Apr 4, 2019
1 parent e510fd9 commit ca6c2a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ctapipe/image/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def extract_pulse_time_weighted_average(waveforms):
"""
samples_i = np.indices(waveforms.shape)[2]
pulse_time = np.average(samples_i, weights=waveforms, axis=2)
pulse_time[pulse_time < 0] = 0
pulse_time[pulse_time > waveforms.shape[2]] = waveforms.shape[2]
outside = np.logical_or(pulse_time < 0, pulse_time >= waveforms.shape[2])
pulse_time[outside] = np.nan
return pulse_time


Expand Down

0 comments on commit ca6c2a3

Please sign in to comment.