Skip to content

Commit

Permalink
Round rand_peak_enlarge to be at least 1 to avoid empty peak_time_range
Browse files Browse the repository at this point in the history
  • Loading branch information
JW-Kraft committed Apr 16, 2024
1 parent 03cb5cb commit c5937c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ramp/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit c5937c9

Please sign in to comment.