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

support astropy 5.x masked columns #1526

Merged
merged 1 commit into from Dec 12, 2021
Merged

support astropy 5.x masked columns #1526

merged 1 commit into from Dec 12, 2021

Conversation

sbailey
Copy link
Contributor

@sbailey sbailey commented Dec 12, 2021

This PR updates desi_qso_mgii_afterburner to support astropy 5.x which (IMHO) incorrectly interprets FITS table blank strings as masked values instead of just passing forward blank strings. This is the same issue as the fibermap reading problem in PR #1454, but here I'm just fixing the impacted column (SUBTYPE) instead of bringing in an fitsio dependency. The relevant change is:

    if hasattr(redshifts['SUBTYPE'], 'mask'):
        redshifts['SUBTYPE'][redshifts['SUBTYPE'].mask] = ''

Without this change, desi_qso_mgii_afterburner fails with:

Traceback (most recent call last):
  File "/global/common/software/desi/users/malvarez/desiconda2/code/desispec/master/bin/desi_qso_mgii_afterburner", line 265, in <module>
    QSO_from_MGII = select_targets_with_mgii_fitter(redrock, fibermap, sel_to_mgii, args.coadd, args.redrock, param_mgii_fitter, DESI_TARGET, args.save_target)
  File "/global/common/software/desi/users/malvarez/desiconda2/code/desispec/master/bin/desi_qso_mgii_afterburner", line 86, in select_targets_with_mgii_fitter
    index_with_mgii_fit) = mgii_fitter(spectra_name, redrock_name, sel_to_mgii,
  File "/global/common/software/desi/users/malvarez/desiconda2/code/desispec/master/py/desispec/mgii_afterburner.py", line 401, in mgii_fitter
    index_with_fit) = get_spectra(spectra_name,
  File "/global/common/software/desi/users/malvarez/desiconda2/code/desispec/master/py/desispec/mgii_afterburner.py", line 174, in get_spectra
    model_wave, model_flux = create_model(spectra,
  File "/global/common/software/desi/users/malvarez/desiconda2/code/desispec/master/py/desispec/mgii_afterburner.py", line 93, in create_model
    tx    = templates[(zb['SPECTYPE'], zb['SUBTYPE'])]
TypeError: unhashable type: 'MaskedConstant'

While I'm at it, I also updated some 2-space indentation to 4-space indentation to match our code style.

Thanks for @marcelo-alvarez for the pipeline testing with updated dependencies that identified this.

@sbailey sbailey added this to In progress in Fuji via automation Dec 12, 2021
@sbailey sbailey merged commit 1273d08 into master Dec 12, 2021
Fuji automation moved this from In progress to Done Dec 12, 2021
@sbailey sbailey deleted the qso_mgii branch December 12, 2021 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Fuji
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant