(Which is required by common astro-python packages like specutils, etc.) This PR adds (a relatively convoluted, but tested) strict monotonically increasing check to the wavelength property Filter.wave, if parameter monotonic is True (the default).
We also add a test for this working with a known filter profile that breaks it (the ZTF one).
Fixes #35.
Some details:
Repeated entries are slightly incremented by 1/1000th of the minimum difference step in the wavelength axis, to make them pass strict monotonic checks. Custom increments, or smaller or larger 1/X of minimum step sizes are possible.
We not only check for 2 repeated entries, but N repeated entries using a breadth first (1D) graph search strategy.
The calculation quits and returns the input if wavelength is already strictly monotonically increasing.
We handle both astropy.unit.quantity inputs and simple unitless array_like (e.g. numpy array) inputs using isinstance checks.
(Which is required by common astro-python packages like specutils, etc.) This PR adds (a relatively convoluted, but tested) strict monotonically increasing check to the wavelength property
Filter.wave
, if parametermonotonic
isTrue
(the default).We also add a test for this working with a known filter profile that breaks it (the ZTF one).
Fixes #35.
Some details:
astropy.unit.quantity
inputs and simple unitlessarray_like
(e.g. numpy array) inputs usingisinstance
checks.