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 bug where data types are altered when override MTLs are empty #803

Merged
merged 5 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ desitarget Change Log
2.6.1 (unreleased)
------------------

* Fix bug where empty override MTLs can alter data types [`PR #803`_].
* Updates to run targets for Legacy Surveys DR10 [`PR #801`_]. Includes:
* Add `RELEASE` number of `10000` (a "southern" release).
* DR10 has `REF_CAT == 'GE'` for Gaia EDR3 instead of `'G2`.
* Update data model to reflect altered columns in DR10.
* Parse both `drXX` and `drX` strings in output filenames.

.. _`PR #801`: https://github.com/desihub/desitarget/pull/801
.. _`PR #803`: https://github.com/desihub/desitarget/pull/803

2.6.0 (2022-12-08)
------------------
Expand Down
12 changes: 7 additions & 5 deletions py/desitarget/mtl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,11 +1239,13 @@ def standard_override_columns(mtl):
TARGET_STATE updated to be OVERRIDE, the git VERSION updated, and
ZTILEID set to -1.
"""
mtl["TIMESTAMP"] = get_utc_date(survey="main")
newts = ["{}|OVERRIDE".format(t.split("|")[0]) for t in mtl["TARGET_STATE"]]
mtl["TARGET_STATE"] = np.array(newts)
mtl["VERSION"] = dt_version
mtl["ZTILEID"] = -1
# ADM this ensures that data types are not altered for empty arrays.
if len(mtl) > 0:
mtl["TIMESTAMP"] = get_utc_date(survey="main")
newts = ["{}|OVERRIDE".format(t.split("|")[0]) for t in mtl["TARGET_STATE"]]
mtl["TARGET_STATE"] = np.array(newts)
mtl["VERSION"] = dt_version
mtl["ZTILEID"] = -1

return mtl

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ healpy
speclite
sqlalchemy
fitsio
photutils
photutils==1.6.0
# Install desiutil separately since it is needed for the other installs.
# git+https://github.com/desihub/[email protected]#egg=desiutil
git+https://github.com/desihub/[email protected]#egg=specter
Expand Down
Loading