Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/empty peak time range #132

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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