Skip to content

Commit

Permalink
fix incorrect jd_at_peak_mag
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodlz committed Aug 28, 2023
1 parent aae914b commit 2703ab1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions kowalski/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,13 +1183,12 @@ def __init__(self, alert, alert_history, models, label=None, **kwargs):

# we define days_to_peak as the time between the first alert and the alert with the lowest magpsf
# and we define days_since_peak as the time between the alert with the lowest magpsf and the current alert
# first we define jd_at_peak_mag as the jd of the alert with the lowest magpsf
jd_at_peak_mag = min(
[
a["jd"]
for a in alert_history
if a["magpsf"] == self.alert["candidate"]["peakmag"]
]
)
[a for a in alert_history if a.get("magpsf", None) is not None],
key=lambda x: x["magpsf"],
)["jd"]

self.alert["candidate"]["days_to_peak"] = (
jd_at_peak_mag - self.alert["candidate"]["jd_first_alert"]
)
Expand Down

0 comments on commit 2703ab1

Please sign in to comment.