eradiate.contexts.CKDSpectralContext#

class eradiate.contexts.CKDSpectralContext(bindex=_Nothing.NOTHING, bin_set='10nm')[source]#

Bases: eradiate.contexts.SpectralContext

CKD spectral context data structure.

Parameters
  • bindex (Bindex or tuple or dict, optional) – The bindex value corresponding to this spectral context. The default value is a simple placeholder used for testing purposes.

  • bin_set (BinSet or str, optional, default: "10nm") – If relevant, the bin set from which bindex originates.

Fields
  • bindex (Bindex) – The bindex value corresponding to this spectral context.

  • bin_set (BinSet or None) – If relevant, the bin set from which bindex originates.

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 bin#

Bin associated with spectral context. Alias for self.bindex.bin.

Type

Bin

property spectral_index#

Spectral index associated with spectral context, equal to active bindex (bin ID, quadrature point index pair).

Type

tuple[str, int]

property spectral_index_formatted#

Formatted spectral index (human-readable string).

Type

str

property wavelength#

Wavelength associated with spectral context. Alias for self.bindex.bin.wcenter.

Type

quantity