Skip to content

Decide if not-in-order spectra should be supported #368

@eteq

Description

@eteq

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".
  2. 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)
  3. Forcibly re-order the inputs
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions