Colord.Spectrum¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Colord.Spectrum¶
- classmethod new()[source]¶
- Returns:
A newly allocated
Colord.Spectrum
object- Return type:
Allocates a spectrum.
New in version 1.1.6.
- classmethod planckian_new(temperature)[source]¶
- Parameters:
temperature (
float
) – the temperature in Kelvin- Returns:
A newly allocated
Colord.Spectrum
object- Return type:
Allocates a Planckian spectrum at a specific temperature.
New in version 1.1.6.
- classmethod planckian_new_full(temperature, start, end, resolution)[source]¶
- Parameters:
- Returns:
A newly allocated
Colord.Spectrum
object- Return type:
Allocates a Planckian spectrum at a specific temperature.
New in version 1.3.1.
- classmethod sized_new(reserved_size)[source]¶
- Parameters:
reserved_size (
int
) – the future size of the spectrum- Returns:
A newly allocated
Colord.Spectrum
object- Return type:
Allocates a spectrum with a preallocated size.
New in version 1.1.6.
- add_value(data)[source]¶
- Parameters:
data (
float
) –
Adds a value in nm to the spectrum.
New in version 1.1.6.
- get_data()[source]¶
- Returns:
spectral data
- Return type:
[
float
]
Gets the spectral data. NOTE: This is not normalized
New in version 1.1.6.
- get_end()[source]¶
- Returns:
the value in nm
- Return type:
Gets the end value of the spectral data.
New in version 1.1.6.
- get_id()[source]¶
- Returns:
the textual ID of the sample
- Return type:
Gets the spectral data.
New in version 1.1.6.
- get_norm()[source]¶
- Returns:
the value
- Return type:
Gets the normalization value of the spectral data. NOTE: This affects every value in the spectrum.
New in version 1.1.6.
- get_resolution()[source]¶
- Returns:
the value
- Return type:
Gets the divisor of the spectra, for instance a .
New in version 1.2.6.
- get_size()[source]¶
- Returns:
number of data items in this spectrum
- Return type:
Gets the size of the spectrum data.
New in version 1.1.6.
- get_start()[source]¶
- Returns:
the value in nm
- Return type:
Gets the start value of the spectral data.
New in version 1.1.6.
- get_value(idx)[source]¶
- Parameters:
idx (
int
) – an index into the data- Returns:
spectral data value, or -1 for invalid
- Return type:
Gets the spectrum data at a specified index.
New in version 1.1.6.
- get_value_for_nm(wavelength)[source]¶
- Parameters:
wavelength (
float
) – the wavelength in nm- Returns:
the value for the wavelength
- Return type:
Gets the value from the spectral data for a given wavelength.
New in version 1.1.6.
- get_value_max()[source]¶
- Return type:
Gets the largest normalised value in the spectrum.
New in version 1.3.1.
- get_value_min()[source]¶
- Return type:
Gets the smallest normalised value in the spectrum.
New in version 1.3.1.
- get_value_raw(idx)[source]¶
- Parameters:
idx (
int
) – an index into the data- Returns:
spectral data value, or -1 for invalid
- Return type:
Gets the spectrum data at a specified index, without any normalization applied. Most people should use
Colord.Spectrum.get_value
() instead.New in version 1.2.6.
- get_wavelength(idx)[source]¶
- Parameters:
idx (
int
) – an index into the data- Returns:
wavelenth value in nm, or -1 for invalid
- Return type:
Gets the wavelenth that corresponds to the specified index.
New in version 1.1.6.
- get_wavelength_cal(c1, c2, c3)[source]¶
- Parameters:
Gets the calibration coefficients used to map pixel indexes to wavelengths.
New in version 1.3.1.
- limit_max(value)[source]¶
- Parameters:
value (
float
) – the threshold value to limit the spectrum
Ensures no values in the spectrum fall above a set limit. If they are found, set them to value.
New in version 1.3.1.
- limit_min(value)[source]¶
- Parameters:
value (
float
) – the threshold value to limit the spectrum
Ensures no values in the spectrum fall below a set limit. If they are found, set them to value.
New in version 1.3.1.
- multiply(s2, resolution)[source]¶
- Parameters:
s2 (
Colord.Spectrum
) – aColord.Spectrum
instance, possibly an absorption spectrum.resolution (
float
) – the step size in nm
- Returns:
a
Colord.Spectrum
instance- Return type:
Multiplies two spectra together.
New in version 1.1.6.
- multiply_scalar(value)[source]¶
- Parameters:
value (
float
) – a scalar value- Returns:
a
Colord.Spectrum
instance- Return type:
Multiplies a spectra with a scalar value.
New in version 1.3.5.
- normalize(wavelength, value)[source]¶
-
Normalizes a spectrum to a specific value at a specific wavelength.
New in version 1.1.6.
- normalize_max(value)[source]¶
- Parameters:
value (
float
) – the value to normalize to
Normalizes a spectrum to a specific value at its maximum value.
New in version 1.2.6.
- resample(start, end, resolution)[source]¶
- Parameters:
- Returns:
a
Colord.Spectrum
instance- Return type:
Resample a new spectrum with linear index to wavelength coefficients.
New in version 1.3.1.
- resample_to_size(size)[source]¶
- Parameters:
size (
int
) – the output spectrum size- Returns:
a
Colord.Spectrum
instance- Return type:
Resample a new spectrum with the desired number of points.
New in version 1.3.4.
- set_data(value)[source]¶
- Parameters:
value ([
float
]) – component value
Sets the spectrum data.
New in version 1.1.6.
- set_end(end)[source]¶
- Parameters:
end (
float
) – the end value of the spectral data
Set the end value of the spectal data in nm.
If there is already spectral data, the wavelength calibration will also be set automatically.
New in version 1.1.6.
- set_norm(norm)[source]¶
- Parameters:
norm (
float
) – the end value of the spectral data
Set the normalization value of the spectrum. NOTE: This affects every value in the spectrum.
New in version 1.1.6.
- set_start(start)[source]¶
- Parameters:
start (
float
) – the start value of the spectral data
Set the start value of the spectal data in nm.
New in version 1.1.6.
- set_value(idx, data)[source]¶
-
Overwrites the spectrum data at a specified index.
New in version 1.2.6.
- set_wavelength_cal(c1, c2, c3)[source]¶
- Parameters:
Sets the calibration coefficients used to map pixel indexes to wavelengths.
This function will set the ‘end’ wavelength automatically, potentially overwriting the value set by
Colord.Spectrum.set_end
().New in version 1.3.1.
- subtract(s2, resolution)[source]¶
- Parameters:
s2 (
Colord.Spectrum
) – aColord.Spectrum
instance, e.g. a dark calibrationresolution (
float
) – the resolution to use when resampling
- Returns:
a
Colord.Spectrum
instance- Return type:
Subtracts one spectral plot from another. If the spectra have the same start, end and the same number of data points they are not resampled.
New in version 1.3.1.