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

Package infrastructure update and other fixes #199

Merged
merged 8 commits into from
Oct 11, 2024
Merged

Conversation

weaverba137
Copy link
Member

This PR

Remaining work:

  • Definitions are needed for these columns:
    • NUMEXP
    • NUMTILE
    • IN_COADD_(B|R|Z).

@weaverba137 weaverba137 added the WIP Work in Progress label Sep 18, 2024
@weaverba137 weaverba137 self-assigned this Sep 18, 2024
@coveralls
Copy link

coveralls commented Sep 18, 2024

Coverage Status

coverage: 100.0%. remained the same
when pulling e81dcb3 on package-updates
into 44e0708 on main.

@weaverba137
Copy link
Member Author

I've fixed some header descriptions for SKYLEVEL, which should also close #191.

@weaverba137
Copy link
Member Author

@sbailey, pinging you for review. Note that there are some unresolved questions about new columns, see above.

@weaverba137
Copy link
Member Author

weaverba137 commented Oct 7, 2024

@sbailey: I think I found where IN_COADD_[BRZ] come from: desihub/desispec#2100.

So the definition would appear to be "If True, this exposure was used in the coadd of camera B,R,Z."

When I was generating the zcatalog files for daily, these columns appeared in the EXP_FIBERMAP HDU, which is fine.

I was able to find references to COADD_NUMEXP and COADD_NUMTILE, but not "bare" NUMEXP or NUMTILE. For reference these columns appeared in the ZCATALOG HDU of the daily zcatalog files, along with COADD_NUMEXP and COADD_NUMTILE. So that's potentially confusing on top of still needing a definition.

Is it possibly a bug that NUMEXP and NUMTILE are showing up?

@weaverba137
Copy link
Member Author

Possibly more precise: "If True, this fiber in this exposure was used in the coadd of camera B,R,Z."

@sbailey
Copy link
Contributor

sbailey commented Oct 8, 2024

Possibly more precise: "If True, this fiber in this exposure was used in the coadd of camera B,R,Z."

Looks good for long form. For short form for FITS headers, maybe something like "fiber/exp used in coadd of camera B,R,Z"

NUMEXP vs. COADD_NUMEXP and NUMTILE vs. COADD_NUMTILE: I only see the "COADD_*" versions of these in Kibo. If you ended up with all 4 columns when making daily zcatalogs, that's likely due to a leftover format when propagating upstream files before the FIBERMAP / EXP_FIBERMAP split. Please point me to an example output file that has all for columns and the command that generated it. I'm guessing that non-zero entries of NUMEXP and NUMTILE could be traced back to old data, and we'll need to add another special case to some reader to intercept and rename that.

@weaverba137
Copy link
Member Author

You should look in $DESI_SPECTRO_REDUX/dailydb/zcatalog/v1. For each .fits file, there is a corresponding .txt file which is the output of fitsverify -l, so you can compare them without actually opening the files.

I hadn't done this previously, but there is some detective work to be done, because I'm seeing different survey/program having different columns.

@sbailey
Copy link
Contributor

sbailey commented Oct 8, 2024

It appears that all flavors of ztile-*-dark-cumulative.fits have a NUMEXP column, but they also appear to be all zeros. I don't see from the code where this is appearing. Please trace upstream to the input files to see where this column first appears. Thanks.

@weaverba137
Copy link
Member Author

Sure, will do.

@weaverba137
Copy link
Member Author

I'm still working on tracing the origin of NUMEXP, but I have some interesting updates:

It appears that all flavors of ztile-*-dark-cumulative.fits have a NUMEXP column, but they also appear to be all zeros.

It turns out this isn't actually true. NUMEXP does not appear in main-backup or special-backup. I don't know why but it may be a clue.

I did a thorough analysis of all of the columns in the dailydb ztile files, and the results are interesting.

For the ZCATALOG HDU:

Column 'NUMEXP' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'special-backup'].
Column 'NUMTILE' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'special-backup'].
Column 'PLATE_RA' in HDU 'ZCATALOG' is missing for these files: ['cmx-other', 'sv1-backup', 'sv1-bright', 'sv1-dark', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup'].
Column 'PLATE_DEC' in HDU 'ZCATALOG' is missing for these files: ['cmx-other', 'sv1-backup', 'sv1-bright', 'sv1-dark', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup'].
Column 'MIN_MJD' in HDU 'ZCATALOG' is missing for these files: ['special-backup'].
Column 'MAX_MJD' in HDU 'ZCATALOG' is missing for these files: ['special-backup'].
Column 'MEAN_MJD' in HDU 'ZCATALOG' is missing for these files: ['special-backup'].
Column 'DESINAME' in HDU 'ZCATALOG' is missing for these files: ['cmx-other', 'special-backup', 'sv1-backup', 'sv1-bright', 'sv1-dark', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].
Column 'FITMETHOD' in HDU 'ZCATALOG' is missing for these files: ['cmx-other', 'special-backup', 'special-bright', 'sv1-backup', 'sv1-bright', 'sv1-dark', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].
Column 'NUMTARGET' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'main-bright', 'main-dark', 'special-backup', 'special-bright', 'special-dark', 'sv1-backup', 'sv1-bright', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].
Column 'BLOBDIST' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'main-bright', 'main-dark', 'special-backup', 'special-bright', 'special-dark', 'sv1-backup', 'sv1-bright', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].
Column 'FIBERFLUX_IVAR_G' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'main-bright', 'main-dark', 'special-backup', 'special-bright', 'special-dark', 'sv1-backup', 'sv1-bright', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].
Column 'FIBERFLUX_IVAR_R' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'main-bright', 'main-dark', 'special-backup', 'special-bright', 'special-dark', 'sv1-backup', 'sv1-bright', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].
Column 'FIBERFLUX_IVAR_Z' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'main-bright', 'main-dark', 'special-backup', 'special-bright', 'special-dark', 'sv1-backup', 'sv1-bright', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].
Column 'HPXPIXEL' in HDU 'ZCATALOG' is missing for these files: ['main-backup', 'main-bright', 'main-dark', 'special-backup', 'special-bright', 'special-dark', 'sv1-backup', 'sv1-bright', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].

Some of the targeting columns aren't present in all of the files, but I verified that they are missing where they are expected to be missing:

Column 'CMX_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV1_DESI_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV1_BGS_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV1_MWS_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV1_SCND_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV2_DESI_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV2_BGS_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV2_MWS_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV2_SCND_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV3_DESI_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV3_BGS_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV3_MWS_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SV3_SCND_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.
Column 'SCND_TARGET' in HDU 'ZCATALOG' is missing from some files, but that is expected.

And there is a type mismatch for RELEASE, although it is present in all files:

Column 'RELEASE' in HDU 'ZCATALOG' with type 'I' has a different type in these files: ['cmx-other', 'sv1-dark'].
Column 'RELEASE' in HDU 'ZCATALOG' with type 'J' has a different type in these files: ['main-backup', 'main-bright', 'main-dark', 'special-backup', 'special-bright', 'special-dark', 'sv1-backup', 'sv1-bright', 'sv1-other', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup', 'sv3-bright', 'sv3-dark'].

For the EXP_FIBERMAP HDU:

Column 'PLATE_RA' in HDU 'EXP_FIBERMAP' is missing for these files: ['cmx-other', 'sv1-backup', 'sv1-bright', 'sv1-dark', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup'].
Column 'PLATE_DEC' in HDU 'EXP_FIBERMAP' is missing for these files: ['cmx-other', 'sv1-backup', 'sv1-bright', 'sv1-dark', 'sv2-backup', 'sv2-bright', 'sv2-dark', 'sv3-backup'].
Column 'PSF_TO_FIBER_SPECFLUX' in HDU 'EXP_FIBERMAP' is missing for these files: ['cmx-other'].
Column 'IN_COADD_B' in HDU 'EXP_FIBERMAP' is missing for these files: ['special-backup'].
Column 'IN_COADD_R' in HDU 'EXP_FIBERMAP' is missing for these files: ['special-backup'].
Column 'IN_COADD_Z' in HDU 'EXP_FIBERMAP' is missing for these files: ['special-backup'].

@weaverba137
Copy link
Member Author

So far, I've only found NUMEXP, NUMTILE in the ZBEST HDU of zbest files, but I'm still searching.

@sbailey
Copy link
Contributor

sbailey commented Oct 11, 2024

It looks like zbest*.fits files have NUMEXP, and redrock*.fits files have COADD_NUMEXP. In that case I think the solution would be to intercept and rename NUMEXP as part of read_redrock. Ditto for NUMTILE.

@weaverba137
Copy link
Member Author

I will certainly do that, however, I am not convinced that NUMEXP appears exclusively in zbest files and COADD_NUMEXP appears exclusively in redrock files. The prevalence of NUMEXP even in main survey zcatalog files suggests otherwise, unless some tiles with zbest files are actually in the main survey.

@sbailey
Copy link
Contributor

sbailey commented Oct 11, 2024

At minimum I think it would be save to apply something like:

if 'NUMEXP' in fibermap.colnames and 'COADD_NUMEXP' not in fibermap.colnames:
    fibermap.rename_column('NUMEXP', 'COADD_NUMEXP')
if 'NUMTILE' in fibermap.colnames and 'COADD_NUMTILE' not in fibermap.colnames:
    fibermap.rename_column('NUMTILE', 'COADD_NUMTILE')

Then rerun desi_zcatalog and see if problems remain...

@weaverba137
Copy link
Member Author

Sure, I'll try that.

@weaverba137
Copy link
Member Author

@sbailey, assuming we completely get rid of NUMEXP, NUMTILE, and I remove the placeholders for those columns in the CSV file, is there any reason not to merge this PR?

@sbailey sbailey merged commit dab9a68 into main Oct 11, 2024
34 checks passed
@sbailey sbailey deleted the package-updates branch October 11, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP Work in Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search function is not working installed desidatamodel drops data/column_descriptions.csv
3 participants