desihub / redrock

Redshift fitting for spectroperfectionism
BSD 3-Clause "New" or "Revised" License
22 stars 14 forks source link

fix read_zscan; add make_fulltype, parse_fulltype #297

Closed sbailey closed 5 months ago

sbailey commented 5 months ago

@moustakas this PR fixes the bug you discovered in PR #295, where read_zscan was returning results missing the QSO:::LOZ zfit table. It turned out to be a spectype vs. fulltype=spectype:::subtype confusion. I took the opportunity to add fulltype = make_fulltype(spectype, subtype) and spectype, subtype = parse_fulltype(fulltype) helper functions instead of fragile parsing in multiple locations.

Your example from PR #295 should now work, using the details file that you generated before.

Side note: the details file keeps the best 3 fits per SPECTYPE, but not per (SPECTYPE, SUBTYPE). So if you are fitting both QSO:::LOZ and QSO:::HIZ and all of the best fits are QSO:::HIZ, then the details file doesn't have zfit info for the QSO:::LOZ minima and the QSO:::LOZ zfit table will still be length 0, while the QSO:::HIZ table will be length 3. In the example case you ran, the best fits were QSO:::LOZ and they should have been in the table, but weren't due to the spectype vs. fulltype bug fixed in this PR.

coveralls commented 5 months ago

Coverage Status

coverage: 39.186% (-0.04%) from 39.23% when pulling d0fdfa1f193a3c772a293e720610fdde018bdaac on read_zscan into def03b4583b1293ec890facfbe4d951fc2a44cc7 on main.