diff --git a/straxen/plugins/merged_s2s/merged_s2s.py b/straxen/plugins/merged_s2s/merged_s2s.py index e01a567d9..484d13a1a 100644 --- a/straxen/plugins/merged_s2s/merged_s2s.py +++ b/straxen/plugins/merged_s2s/merged_s2s.py @@ -70,7 +70,16 @@ def setup(self): self.to_pe = self.gain_model def infer_dtype(self): - return strax.unpack_dtype(self.deps["peaklets"].dtype_for("peaklets")) + peaklet_classification_dtype = self.deps["peaklet_classification"].dtype_for( + "peaklet_classification" + ) + peaklets_dtype = self.deps["peaklets"].dtype_for("peaklets") + # The merged dtype is argument position dependent! + # It must be first classification then peaklet + # Otherwise strax will raise an error + # when checking for the returned dtype! + merged_s2s_dtype = strax.merged_dtype((peaklet_classification_dtype, peaklets_dtype)) + return merged_s2s_dtype def get_window_size(self): return self.merged_s2s_get_window_size_factor * ( @@ -132,7 +141,7 @@ def compute(self, peaklets, lone_hits): lh = strax.sort_by_time(lh) # If sum_waveform_top_array is false, don't digitize the top array - n_top_pmts_if_digitize_top = self.n_top_pmts if self.sum_waveform_top_array else -1 + n_top_pmts_if_digitize_top = self.n_top_pmts if "data_top" in self.dtype.names else -1 strax.add_lone_hits(merged_s2s, lh, self.to_pe, n_top_channels=n_top_pmts_if_digitize_top) strax.compute_widths(merged_s2s) diff --git a/straxen/plugins/peaks/peaks.py b/straxen/plugins/peaks/peaks.py index 18226abcb..9e5d1e815 100644 --- a/straxen/plugins/peaks/peaks.py +++ b/straxen/plugins/peaks/peaks.py @@ -65,4 +65,7 @@ def compute(self, peaklets, merged_s2s): assert np.all( peaks["time"][to_check][1:] >= strax.endtime(peaks)[to_check][:-1] ), "Peaks not disjoint" - return peaks + + result = np.zeros(len(peaks), self.dtype) + strax.copy_to_buffer(peaks, result, "_copy_requested_peak_fields") + return result