eradiate.spectral.SpectralGrid#

class eradiate.spectral.SpectralGrid[source]#

Bases: ABC

Abstract interface for all spectral grids.

static arange(start, stop, step)[source]#

Generate a spectral grid from equally-spaced wavelengths.

Parameters:
  • start (quantity or float) – Central wavelength of the first bin. If a unitless value is passed, it is interpreted in default wavelength units (usually nm).

  • stop (quantity or float) – Wavelength after which bin generation stops. If a unitless value is passed, it is interpreted in default wavelength units (usually nm).

  • step (quantity or float) – Spectral bin size. If a unitless value is passed, it is interpreted in default wavelength units (usually nm).

Returns:

SpectralGrid – Generated spectral grid.

static default()[source]#

Generate a default spectral grid depending on the active mode.

static from_absorption_database(abs_db)[source]#

Retrieve the spectral grid from an absorption database. The returned type depends on the currently active mode.

abstract merge(other)[source]#

Merge two spectral grids, applying a boolean “OR” operation.

Parameters:

other (SpectralGrid) – Other spectral, of the same type, to merge with the current one.

Returns:

SpectralGrid – A new spectral grid of the same type that merges the two.

select(srf)[source]#

Select a subset of the spectral grid based on a spectral response function.

Parameters:

srf – A value that is either a SpectralResponseFunction instance or convertible to a SpectralResponseFunction by the SpectralResponseFunction.convert() method.

Returns:

SpectralGrid – New spectral grid instance covering the extent of the filtering SRF.

Notes

The implementation of this method uses single dispatch based on the type of the srf parameter.

abstract walk_indices(**kwargs)[source]#

A generator that yields a sequence of spectral index values.

Yields:

SpectralIndex – Generated spectral index of a type aligned with the current active mode.

abstract property wavelengths#

Convenience accessor to characteristic wavelengths of this spectral grid.