Skip to content

Commit

Permalink
Add data_start to temporary dtype for events_nv (#1447)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx authored Oct 12, 2024
1 parent ee37dc5 commit 9d2a6b6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions straxen/plugins/events_nv/event_waveform_nv.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ def setup(self):
self.to_pe[self.channel_range[0] :] = to_pe[:]

def compute(self, events_nv, records_nv, start, end):
events = events_nv
events_waveform = np.zeros(len(events), self.dtype)
events_waveform = np.zeros(len(events_nv), self.dtype)

# Compute shape like properties:
_tmp_events = np.zeros(len(events_nv), dtype=_temp_event_data_type())
strax.copy_to_buffer(events_nv, _tmp_events, "_temp_nv_evts_wf_cpy")
_tmp_events["length"] = (events_nv["endtime"] - events_nv["time"]) // 2
_tmp_events["dt"] = 2
print(records_nv)
strax.simple_summed_waveform(records_nv, _tmp_events, self.to_pe)
strax.compute_widths(_tmp_events)

Expand All @@ -79,11 +77,7 @@ def veto_event_waveform_dtype(
return dtype


def _temp_event_data_type(
n_samples_wf: int = 150,
n_pmts: int = 120,
n_widths: int = 11,
) -> list:
def _temp_event_data_type(n_samples_wf: int = 150, n_widths: int = 11) -> list:
"""Temp.
data type which adds field required to use some of the functions used to compute the shape of
Expand All @@ -101,6 +95,11 @@ def _temp_event_data_type(
np.float32,
n_samples_wf,
),
(
("Dummy first waveform data in PE/sample (not PE/ns!)", "data_start"),
np.float32,
n_samples_wf,
),
(("Peak widths in range of central area fraction [ns]", "width"), np.float32, n_widths),
(
("Peak widths: time between nth and 5th area decile [ns]", "area_decile_from_midpoint"),
Expand Down

0 comments on commit 9d2a6b6

Please sign in to comment.