Skip to content

Commit

Permalink
Handle the case where no hitlets are fully contained in peaklets (#1529)
Browse files Browse the repository at this point in the history
* Handle the case where no hitlets are fully contained in peaklets

* Set default values first
  • Loading branch information
dachengx authored Jan 18, 2025
1 parent 6e0a79d commit a1d6760
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions straxen/plugins/peaklets/peaklets.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,14 @@ def create_outside_peaks_region(peaklets, start, end):
@staticmethod
def add_hit_features(hitlets, peaklets):
"""Create hits timing features."""
peaklets["max_diff"] = -1
peaklets["min_diff"] = -1
peaklets["first_channel"] = DIGITAL_SUM_WAVEFORM_CHANNEL
peaklets["last_channel"] = DIGITAL_SUM_WAVEFORM_CHANNEL
split_hits = strax.split_by_containment(hitlets, peaklets)
for peaklet, _hitlets in zip(peaklets, split_hits):
if len(_hitlets) == 0:
continue
argsort = strax.stable_argsort(_hitlets["max_time"])
sorted_hitlets = _hitlets[argsort]
time_diff = np.diff(sorted_hitlets["max_time"])
Expand Down

0 comments on commit a1d6760

Please sign in to comment.