fix FIRSTNIGHT/LASTNIGHT when missing petals #2118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR moves the FIRSTNIGHT,LASTNIGHT calculation from
desispec.coaddition.coadd_fibermap
todesi_zcatalog
(the script the stacks N>>1 redrock files into the final redshift catalogs) to fix a problem on tiles that are missing different petals on different nights. Althoughcoadd_fibermap
was correctly considering all nights in its input fibermap, the problem is that those per-petal input fibermaps can have a different set of nights per petal, resulting in different FIRSTNIGHT,LASTNIGHT values per-petal when they are supposed to be per-tile values. This is especially important for LASTNIGHT which is used to trace back to the original spectra in tiles/cumulative/TILEID/LASTNIGHT/spectra-PETAL-*.fits.gz (same LASTNIGHT for all PETALs, even if some PETAL wasn't included on that LASTNIGHT)For example, tile 80730 was missing petal 3 on the first night it was observed (20210218), and missing petal 6 on the last night it was observed (20210322), resulting in a mix of FIRSTNIGHT, LASTNIGHT values different per petal.
Example outputs are in $CFS/desi/users/sjbailey/dev/coadd_lastnight:
Issues / differences to note:
for each file
(like the original iron coadded FIBERMAPs)
the first and last nights the tile was observed on any petal.
There were other changes to consolidate the MIN/MAX/MEAN_MJD calculations
(which remain per-target, not per-petal nor per-tile); remove no-longer necessary special casing of RA/DEC/MJD; and remove comments pointing out problems that have been fixed.
Code snippets used to generate example files
Python snippets to evaluate files
Current main has different values of FIRSTNIGHT, LASTNIGHT per petal:
This PR fixes LASTNIGHT to a single value matching iron, while also having FIRSTNIGHT=earliest night of any petal
@akremin please review; @stephjuneau heads up if you are available too.
This is a blocking factor for regenerating patched DR1 redshift catalogs, but the issues are subtle enough that I would appreciate a careful independent review. Thanks.