desihub / desispec

DESI spectral pipeline
BSD 3-Clause "New" or "Revised" License
33 stars 24 forks source link

fix QuasarNET afterburner parsing of Redrock templates #2232

Closed sbailey closed 2 months ago

sbailey commented 2 months ago

This PR fixes #2231 to update the qsoqn (quasarnet) afterburner to correctly parse the new structure of redrock-templates. It will raise an exception if it doesn't find any templates, and it will log an error but not crash if the number found isn't 2 (HIZ and LOZ expected, but potentially could be different in the future).

This is required for correct qsoqn afterburner runs in Jura (current main silently finds 0 templates and never does the "rerun Redrock with a prior around the QN redshift" step).

I'll leave this open for an hour or so if there are rapid comments, but we need to merge it for testing tonight after Perlmutter is back. Heads up @dylanagreen @echaussidon @akremin @ashleyjross @geordie666 .

I tested this with

desispec.scripts.qsoqn.main([
  '--coadd', '/global/cfs/cdirs/desi/users/sjbailey/spectro/redux/badampcals/tiles/cumulative/2824/20240408/coadd-0-2824-thru20240408.fits',
  '--redrock', '/global/cfs/cdirs/desi/users/sjbailey/spectro/redux/badampcals/tiles/cumulative/2824/20240408/redrock-0-2824-thru20240408.fits',
  '--output', '/global/cfs/cdirs/desi/users/sjbailey/spectro/redux/badampcals/tiles/cumulative/2824/20240408/qso_qn-0-2824-thru20240408.fits',
  '--target_selection', 'all', '--save_target', 'all'])

and verified that previously it wasn't running rrdesi at all, and now it re-runs it for LOZ and HIZ templates as expected.

echaussidon commented 2 months ago

Sounds good to me.

I even not realized that the template names were modified.