From 3f49453f13476378574698682917285d42e7113e Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Mon, 26 Feb 2024 11:05:38 -0600 Subject: [PATCH] did what daniel did --- saltax/plugins/s_peaklets.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/saltax/plugins/s_peaklets.py b/saltax/plugins/s_peaklets.py index 456b4d9..f4c9bed 100644 --- a/saltax/plugins/s_peaklets.py +++ b/saltax/plugins/s_peaklets.py @@ -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 @@ -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]