eradiate.scenes.measure._core.MonoMeasureSpectralConfig#

class eradiate.scenes.measure._core.MonoMeasureSpectralConfig(srf=_Nothing.NOTHING, wavelengths=<Quantity([550.], 'nanometer')>)[source]#

Bases: MeasureSpectralConfig

A data structure specifying the spectral configuration of a Measure in monochromatic modes.

Parameters:
  • srf (Path or str or Spectrum or dict or float, default: UniformSpectrum(value=1.0)) – Spectral response function (SRF). If a path is passed, it attempts to load a dataset from that location. If a keyword is passed, e.g., 'sentinel_2a-msi-4' it tries to serve the corresponding dataset from the Eradiate data store. By default, the prepared version of the SRF is served unless it does not exist in which case the raw version is served. To request that the raw version is served, append '-raw' to the keyword, e.g., 'sentinel_2a-msi-4-raw'. Note that the prepared SRF provide a better speed versus accuracy trade-off, but for the best accuracy, the raw SRF should be used. Other types will be converted by spectrum_factory.

  • wavelengths (quantity or array-like, default: [550.0] nm) – List of wavelengths on which to perform the monochromatic spectral loop.

    Unit-enabled field (default: ucc[‘wavelength’]).

Fields:

srf (Spectrum) – Spectral response function (SRF).

static convert(value)#

Object converter method.

If value is a dictionary, this method uses from_dict() to create a SpectralContext.

Otherwise, it returns value.

static from_dict(d)#

Create from a dictionary. This class method will additionally pre-process the passed dictionary to merge any field with an associated "_units" field into a pint.Quantity container.

Parameters:

d (dict) – Configuration dictionary used for initialisation.

Returns:

spectral_cfg (MeasureSpectralConfig) – Created object.

static new(**kwargs)#

Create a new instance of one of the SpectralContext child classes. The instantiated class is defined based on the currently active mode. Keyword arguments are passed to the instantiated class’s constructor.

Parameters:
  • **kwargs (dict, optional) – Keyword arguments depending on the currently active mode (see below for a list of actual keyword arguments).

  • wavelengths (quantity, default: [550] nm) – Monochromatic modes [MonoMeasureSpectralConfig]. List of wavelengths (automatically converted to a Numpy array). Unit-enabled field (default: ucc[wavelength]).

  • bin_set (BinSet or str, default: "10nm") – CKD modes [CKDMeasureSpectralConfig]. CKD bin set definition. If a string is passed, the data repository is queried for the corresponding identifier using BinSet.from_db().

  • bins (list of (str or tuple or dict or callable)) – CKD modes [CKDSpectralContext]. List of CKD bins on which to perform the spectral loop. If unset, all the bins defined by the selected bin set will be covered.

spectral_ctxs()[source]#

Return a list of SpectralContext objects based on the stored spectral configuration. These data structures can be used to drive the evaluation of spectrally dependent components during a spectral loop.

Returns:

list of SpectralContext – List of generated spectral contexts. The concrete class (MonoSpectralContext, CKDSpectralContext, etc.) depends on the active mode.