fix read_spectra skipping exp_fibermap #2137
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 is a followup to #2052, fixing a bug with
read_spectra(..., skip_hdus=['EXP_FIBERMAP', ...])
The original code looping over HDUs had
The problem was that if "EXP_FIBERMAP" was in skip_hdus, then it would continue down the elif chain and eventually get interpreted as a catchall user-provided "BAND_EXTRANAME" image HDU, which would then trip on reading a table as an image.
The fix is
so that if it finds "EXP_FIBERMAP" but it is in
skip_hdus
then it will stop checking rather than continuing to try to parse the name as meaning other things. I applied that same pattern to all other cases of known HDU names that might be in the skip_hdu list.This includes a unit test that would have caught the original problem, but now passes.
@dirkscholte I'm pretty sure that I introduced this bug when updating your PR #2052, but if you could double-check my fix here I would appreciate it. Thanks.