Decide if not-in-order spectra should be supported
- Dominant language
- Python
- Stars
- 204
- Forks
- 134
- Avg merge
- 12h 55m
- Merged PRs (30d)
- 1
Description
In spacetelescope/specviz#471 an issue came up that at it's core is about a spectrum being "out of order" - that is, some of the other specutils machinery assumes the `spectral_axis` is strictly ordered.
While it's of course possible to fix the associated specutils machinery, it's almost certain that user-written analysis tools might make this assumption. So what is to be done? Here are the options I see:
1. Have a warning be issued when a `Spectrum1D` is created and the inputs are out-of-order (both the array *and* the wcs case, probably by just checking `spectral_axis`). This warning would basically just say "this might work for some things... but be aware here there be dragons because it's tricky to get this right".
1. Raise an *exception* if the input is a `Quantity` `spectral_axis`, saying "you should sort your spectral_axis" (and a warning for wcs, which is impossible to fix-up)
1. Forcibly re-order the inputs
1. Do nothing in code, but document clearly what the expectation is - i.e., should user code assume in-order or not?
cc @brechmos-stsci @nluetzge @crawfordsm @nmearl
Contributor guide
Research direction
No file or test is named. Start with this issue and spacetelescope/specviz#471, then trace Spectrum1D's spectral_axis handling; done means selecting and documenting a supported policy for out-of-order spectra, including the array and WCS cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design, data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100