eradiate.spectral.BandSRF#

class eradiate.spectral.BandSRF(wavelengths, values)[source]#

Bases: SpectralResponseFunction

The spectral response function for a single band of an instrument.

Parameters:
  • wavelengths (quantity) – Wavelengths defining the interpolation grid. Values must be monotonically increasing.

  • values (array-like) – Spectrum values. If a quantity is passed, units are checked for consistency. If a unitless array is passed, it is automatically converted to appropriate default configuration units, depending on the value of the quantity field. If no quantity is specified, this field can be a unitless value.

Fields:
  • wavelengths (quantity) – Wavelengths defining the interpolation grid.

  • values (quantity) – Spectrum values.

static convert(value)#

Converter for the Measure.srf field.

Notes

Supported conversion protocols:

  • dict: Dispatch to subclass based on ‘type’ entry, then pass dictionary to constructor as keyword arguments.

  • Dataset, DataArray: Call BandSRF.from_dataarray().

  • Path-like: Attempt loading a dataset from the hard drive, then call BandSRF.from_dataarray().

  • str: Perform a NetCDF file lookup in the SRF database and load it.

Anything else will pass through this converter without modification.

eval(w)[source]#

Evaluate the spectral response function for one or several wavelengths. Evaluation is vectorized.

Parameters:

w (array-like) – One or several wavelengths at which the SRF is evaluated.

Returns:

quantity – The returned value as the same shape as w.

integrate(wmin, wmax)[source]#

Return the integral of the SRF on the specified interval, using the trapezoid rule.

Parameters:

wmin, wmax (float or quantity) – Lower and upper bounds of the integration domain. Floats are interpreted as being specified in default configuration units.

Returns:

integral (quantity) – Integral as a scalar quantity.

integrate_cumulative(w)[source]#

Return the cumulative integral of the SRF on the specified mesh, using the trapezoid rule.

Parameters:

w (array-like) – Nodes of the spectral integration mesh. If a dimensionless array is passed, it is interpreted as being specified in default configuration units.

Returns:

integral (quantity) – Cumulative integral as an array of shape (N-1,), where wavelength has shape (N,).

support()[source]#

Return the interval in which the SRF is nonzero.

Returns:

quantity

Note

This method does not actually compute the support: it assumes that any leading and trailing zeros are already removed.