validate_wavelength_array

speclite.filters.validate_wavelength_array(wavelength, min_length=0)[source] [edit on github]

Validate a wavelength array for filter operations.

This function will not perform any copying or allocation if the input is already a numpy array or astropy Quantity.

Parameters:
wavelengtharray

A 1D array of strictly increasing wavelength values with optional units. If units are included, they must be convertible to default_wavelength_unit. Otherwise, the default_wavelength_unit is assumed.

min_lengthint

The minimum required length of the wavelength array.

Returns:
numpy.ndarray

Array of validated wavelengths without any units, but with values given in default_wavelength_unit.

Raises:
ValueError

Wavelength array is not 1D, or not strictly increasing, or below the minimum length.

astropy.units.UnitConversionError

The wavelength array has units that are not convertible to default_wavelength_unit