diff --git a/ramp/core/core.py b/ramp/core/core.py index 3cf3d824..f811c921 100644 --- a/ramp/core/core.py +++ b/ramp/core/core.py @@ -356,11 +356,12 @@ def calc_peak_time_range(self, peak_enlarge=None): sigma=1 / 3 * (peak_window[-1] - peak_window[0]), ) ) - rand_peak_enlarge = round( + # Rand_peak_enlarge is rounded to be at least 1 -> if rounded to 0 peak_time_range would be empty + rand_peak_enlarge = max(round( math.fabs( peak_time - random.gauss(mu=peak_time, sigma=peak_enlarge * peak_time) ) - ) + ), 1) # The peak_time is randomly enlarged based on the calibration parameter peak_enlarge return np.arange(peak_time - rand_peak_enlarge, peak_time + rand_peak_enlarge)