eradiate.contexts.MonoSpectralContext#

class eradiate.contexts.MonoSpectralContext(wavelength=<Quantity(550.0, 'nanometer')>)[source]#

Bases: eradiate.contexts.SpectralContext

Monochromatic spectral context data structure.

Parameters

wavelength (quantity or float, default: 550.0 nm) – A single wavelength value.

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

static convert(value)#

Object converter method.

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

Otherwise, it returns value.

evolve(**changes)#

Create a copy of self with changes applied.

Parameters

**changes – Keyword changes in the new copy.

Returns

<same type as self> – A copy of self with changes incorporated.

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

SpectralContext – Created object. The actual type depends on context.

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 – Keyword arguments depending on the currently active mode (see below for a list of actual keyword arguments).

  • wavelength (quantity or float, default: 550 nm) – (Monochromatic modes [MonoSpectralContext]) Wavelength. Unit-enabled field (default: ucc[wavelength]).

  • bindex (Bindex, optional, default: 1st quadrature point for the "550" bin of the "10nm" bin set (test value)) – (CKD modes [CKDSpectralContext]) CKD bindex.

  • bin_set (BinSet or str or None, optional, default: "10nm" (test value)) – (CKD modes [CKDSpectralContext]) Bin set from which the bindex originates.

property spectral_index#

Spectral index associated with spectral context, equal to active wavelength magnitude in config units.

property spectral_index_formatted#

Formatted spectral index (human-readable string).

Type

str

property wavelength#

Wavelength associated with spectral context.

Type

quantity