Add sensible error message for specutils
loaders
#1709
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.
When users try to ingest a
spec1d
file into a Spectrum1D object, the currentscheme ends badly with an obscure error message like:
Because PypeIt
spec1d
files may have multiple extensions, by convention weload these into SpectrumList objects in specutils, even if there is only a
single spectrum. This commit catches the case when a user tries to load a
spec1d
file into a Spectrum1D object. Previously, such an attempt ended upwith specutils loading in the
spec1d
file as a tabular FITS format, thendidn't know what to do about the spectral axis (leading to the above obscure
error).
This commit specifically includes a loader for
spec1d
files into Spectrum1Dobjects, but emits a sensible error message in this case rather than trying to
actually load the file.
As it happens, in order to properly do this, I needed to make an adjustment in
specutils
itself. That PR (astropy/specutils#1068), wasfinally included in
specutils
version 1.12 (released 2023-10-17).The
specutils
optional dependency has been updated to require this version.