diff --git a/strax/dtypes.py b/strax/dtypes.py index b18bfa57..53c3cf21 100644 --- a/strax/dtypes.py +++ b/strax/dtypes.py @@ -115,6 +115,7 @@ def record_dtype(samples_per_record=DEFAULT_RECORD_LENGTH): (("Internal (temporary) index of fragment in which hit was found", "record_i"), np.int32), (("ADC threshold applied in order to find hits", "threshold"), np.float32), (("Maximum amplitude above baseline [ADC counts]", "height"), np.float32), + (("Time when hit reach maximum amplitude [ns]", "max_time"), np.int64), ] diff --git a/strax/processing/pulse_processing.py b/strax/processing/pulse_processing.py index 825218ce..a546660a 100644 --- a/strax/processing/pulse_processing.py +++ b/strax/processing/pulse_processing.py @@ -249,6 +249,8 @@ def _find_hits(records, min_amplitude, min_height_over_noise, _result_buffer=Non # Start of a hit in_interval = True hit_start = i + if x > height: + max_time = r["time"] + i * r["dt"] height = max(x, height) if in_interval: @@ -258,7 +260,9 @@ def _find_hits(records, min_amplitude, min_height_over_noise, _result_buffer=Non in_interval = False else: area += x - height = max(height, x) + if x > height: + max_time = r["time"] + i * r["dt"] + height = max(x, height) if i == n_samples - 1: # Hit ends at the *end* of this sample @@ -289,6 +293,7 @@ def _find_hits(records, min_amplitude, min_height_over_noise, _result_buffer=Non area += res["length"] * baseline_fpart res["area"] = area res["height"] = height + baseline_fpart + res["max_time"] = max_time area = height = 0 # Yield buffer to caller if needed