Skip to content

Commit

Permalink
finalize the targets by returning them to a more data-systems like da…
Browse files Browse the repository at this point in the history
…ta model (no NaNs, IVARs)
  • Loading branch information
geordie666 committed Apr 16, 2024
1 parent ac874a6 commit ec8537d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions py/desitarget/streams/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from desitarget.targets import initial_priority_numobs, set_obsconditions, \
encode_targetid
from desitarget.streams.utilities import errors_to_ivars

# ADM set up the DESI default logger.
from desiutil.log import get_logger
Expand Down Expand Up @@ -109,6 +110,16 @@ def finalize(targets, desi_target, bgs_target, mws_target, scnd_target):
# ADM set the OBSCONDITIONS.
done["OBSCONDITIONS"] = set_obsconditions(done, scnd=True)

# ADM replace any NaNs with zeros.
for col in ["PHOT_G_MEAN_MAG", "PHOT_BP_MEAN_MAG", "PHOT_RP_MEAN_MAG",
"PARALLAX", "PMRA", "PMDEC"]:
ii = np.isnan(done[col])
done[col][ii] = 0.

# ADM change errors to IVARs.
done = errors_to_ivars(
done, colnames=["PARALLAX_ERROR", "PMRA_ERROR", "PMDEC_ERROR"])

# ADM some final checks that the targets conform to expectations...
# ADM check that each target has a unique ID.
if len(done["TARGETID"]) != len(np.unique(done["TARGETID"])):
Expand Down

0 comments on commit ec8537d

Please sign in to comment.