Skip to content

Commit

Permalink
did what daniel did
Browse files Browse the repository at this point in the history
  • Loading branch information
FaroutYLq committed Feb 26, 2024
1 parent 57e3e29 commit 3f49453
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions saltax/plugins/s_peaklets.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,13 @@ def compute(self, records, start, end):
hitlets = hits
del hits

# Extend hits into hitlets and clip at chunk boundaries:
hitlets['time'] -= (hitlets['left'] - hitlets['left_integration']) * hitlets['dt']
hitlets['length'] = hitlets['right_integration'] - hitlets['left_integration']

hitlets = strax.sort_by_time(hitlets)
hitlets_time = np.copy(hitlets["time"])
self.clip_peaklet_times(hitlets, start, end)
rlinks = strax.record_links(records)

# If sum_waveform_top_array is false, don't digitize the top array
Expand Down Expand Up @@ -319,15 +323,17 @@ def compute(self, records, start, end):
# Compute the width again for corrected peaks
strax.compute_widths(peaklets, select_peaks_indices=peak_list)

hitlet_time_shift = (hitlets['left'] - hitlets['left_integration']) * hitlets['dt']
hit_max_times = hitlets['time'] + hitlet_time_shift # add time shift again to get correct maximum
hit_max_times += hitlets['dt'] * hit_max_sample(records, hitlets)

# Compute tight coincidence level.
# Making this a separate plugin would
# (a) doing hitfinding yet again (or storing hits)
# (b) increase strax memory usage / max_messages,
# possibly due to its currently primitive scheduling.
hitlet_time_shift = (hitlets['left'] - hitlets['left_integration']) * hitlets['dt']
hit_max_times = (
hitlets['time'] + hitlet_time_shift
) # add time shift again to get correct maximum
hit_max_times += hitlets['dt'] * hit_max_sample(records, hitlets)

hit_max_times_argsort = np.argsort(hit_max_times)
sorted_hit_max_times = hit_max_times[hit_max_times_argsort]
sorted_hit_channels = hitlets['channel'][hit_max_times_argsort]
Expand Down

0 comments on commit 3f49453

Please sign in to comment.