Skip to content

Commit

Permalink
ML feature bugfix, remove recent photometry addition due to latency (#…
Browse files Browse the repository at this point in the history
…251)

minor ML feature bugfix, and remove extra photometry block for latency sake
  • Loading branch information
Theodlz authored Sep 29, 2023
1 parent 9f4c155 commit 63c1258
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
31 changes: 0 additions & 31 deletions kowalski/alert_brokers/alert_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1802,37 +1802,6 @@ def alert_sentinel_skyportal(self, alert, prv_candidates, passed_filters):
# post alert photometry in single call to /api/photometry
alert["prv_candidates"] = prv_candidates

# also get all the alerts for this object, to make sure to have all the detections
try:
all_alerts = list(
retry(self.mongo.db[self.collection_alerts].find)(
{
"objectId": alert["objectId"],
"candid": {"$ne": alert["candid"]},
},
{
"candidate": 1,
},
)
)
all_alerts = [
{**a["candidate"]} for a in all_alerts if "candidate" in a
]
# add to prv_candidates the detections that are not already in there
# use the jd and the fid to match
for a in all_alerts:
if not any(
[
(a["jd"] == p["jd"]) and (a["fid"] == p["fid"])
for p in alert["prv_candidates"]
]
):
alert["prv_candidates"].append(a)
del all_alerts
except Exception as e:
# this should never happen, but just in case
log(f"Failed to get all alerts for {alert['objectId']}: {e}")

self.alert_put_photometry(alert)

if len(autosave_group_ids):
Expand Down
2 changes: 1 addition & 1 deletion kowalski/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ def __init__(self, alert, alert_history, models, label=None, **kwargs):
alert["candidate"].get("jdstarthist", None),
min(
[alert["candidate"]["jd"]]
+ [a["jd"] for a in alert_history if a["magpsf"] is not None]
+ [a["jd"] for a in alert_history if a.get("magpsf", None) is not None]
),
)

Expand Down

0 comments on commit 63c1258

Please sign in to comment.