Skip to content

Commit

Permalink
added a filter for the forced
Browse files Browse the repository at this point in the history
  • Loading branch information
AlxEnashi committed May 30, 2024
1 parent c34d440 commit 45a2faa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions prv_candidates_step/prv_candidates_step/core/strategy/ztf.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,24 @@ def extract_detections_and_non_detections(alert: dict) -> dict:
prv_candidates = pickle.loads(prv_candidates) if prv_candidates else []

forced_photometries = alert["extra_fields"].pop("fp_hists", [])

# filter forced photometry by value
# potencial bugs from ztf
def filter_fp(fp):
forcediffimflux_bad_values = [
None, 0
]
# if the value is not close to -99999 return true
good_fp = (
fp["forcediffimflux"] not in forcediffimflux_bad_values
and
not np.isclose(fp["forcediffimflux"], -99999)
)
return good_fp

# use the filter funcion to remove bad fp
forced_photometries = filter(filter_fp, forced_photometries)

forced_photometries = (
pickle.loads(forced_photometries) if forced_photometries else []
)
Expand Down

0 comments on commit 45a2faa

Please sign in to comment.