Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitlets boundary #76

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading