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

cross-tile spectra stack header cleanup #2340

Merged
merged 1 commit into from
Aug 23, 2024
Merged

cross-tile spectra stack header cleanup #2340

merged 1 commit into from
Aug 23, 2024

Conversation

sbailey
Copy link
Contributor

@sbailey sbailey commented Aug 23, 2024

This is a bookkeeping cleanup PR for desispec.spectra.stack for the case of stacking multiple tile-based spectra across different tiles. Previously this case generates a bunch of warnings like:

from desispec.io import read_spectra
from desispec.spectra import stack as stack_spectra
c1 = read_spectra('21/20210503/coadd-0-21-thru20210503.fits')
c2 = read_spectra('211/20210501/coadd-3-211-thru20210501.fits')
cx = stack_spectra([c1,c2])
...
WARNING: MergeConflictWarning: Cannot merge meta key 'TILEID' types <class 'int'> and <class 'int'>, choosing TILEID=211 [astropy.utils.metadata.merge]
WARNING: MergeConflictWarning: Cannot merge meta key 'TILERA' types <class 'float'> and <class 'float'>, choosing TILERA=217.828 [astropy.utils.metadata.merge]

and it incorrectly propagated per-tile keywords from the first spectra object. This PR detects the multi-tile case and removes the per-tile keywords if present before stacking, while also not modifying the input spectra.

I added unit tests to check the behavior (previously failing on main, now passing), and also tested on a tilenight+ztile run to make sure I didn't break the regular pipeline. This isn't strictly needed for Kibo, but I would like to get it in for the Kibo tag for convenience.

@sbailey sbailey merged commit 2919ae2 into main Aug 23, 2024
26 checks passed
@sbailey sbailey deleted the cross_tile_stack branch August 23, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant