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

Make pulse_id continuous in chunks #233

Merged
merged 1 commit into from
Jun 6, 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
15 changes: 11 additions & 4 deletions fuse/plugins/pmt_and_daq/photon_pulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PulseWindow(FuseBasePlugin):
for each propagated photon to identify the pulse window it belongs to.
"""

__version__ = "0.2.0"
__version__ = "0.2.1"

depends_on = "photon_summary"

Expand All @@ -42,6 +42,8 @@ class PulseWindow(FuseBasePlugin):

save_when = strax.SaveWhen.TARGET

pulse_ids_seen = 0

# Config options
dt = straxen.URLConfig(
default="take://resource://"
Expand Down Expand Up @@ -128,14 +130,19 @@ def compute(self, propagated_photons, start, end):
start,
end,
)
photon_pulses = strax.sort_by_time(photon_pulses)
photon_pulses["pulse_id"] += self.pulse_ids_seen

pulse_ids = np.zeros(len(photon_id), self.dtype["pulse_ids"])
pulse_ids["pulse_id"] = photon_id
pulse_ids["pulse_id"] = photon_id + self.pulse_ids_seen
pulse_ids["time"] = propagated_photons["time"]
pulse_ids["endtime"] = propagated_photons["endtime"]

return {"pulse_windows": photon_pulses, "pulse_ids": pulse_ids}
self.pulse_ids_seen += photon_id.max()

return {
"pulse_windows": strax.sort_by_time(photon_pulses),
"pulse_ids": strax.sort_by_time(pulse_ids),
}


# Modified code taken from strax:
Expand Down