Colord.Spectrum¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Colord.Spectrum¶
- classmethod new()[source]¶
- Returns:
A newly allocated
Colord.Spectrumobject- Return type:
Allocates a spectrum.
Added in version 1.1.6.
- classmethod planckian_new(temperature)[source]¶
- Parameters:
temperature (
float) – the temperature in Kelvin- Returns:
A newly allocated
Colord.Spectrumobject- Return type:
Allocates a Planckian spectrum at a specific temperature.
Added in version 1.1.6.
- classmethod planckian_new_full(temperature, start, end, resolution)[source]¶
- Parameters:
- Returns:
A newly allocated
Colord.Spectrumobject- Return type:
Allocates a Planckian spectrum at a specific temperature.
Added 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.Spectrumobject- Return type:
Allocates a spectrum with a preallocated size.
Added in version 1.1.6.
- add_value(data)[source]¶
- Parameters:
data (
float)
Adds a value in nm to the spectrum.
Added in version 1.1.6.
- get_data()[source]¶
- Returns:
spectral data
- Return type:
[
float]
Gets the spectral data. NOTE: This is not normalized
Added in version 1.1.6.
- get_end()[source]¶
- Returns:
the value in nm
- Return type:
Gets the end value of the spectral data.
Added in version 1.1.6.
- get_id()[source]¶
- Returns:
the textual ID of the sample
- Return type:
Gets the spectral data.
Added 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.
Added in version 1.1.6.
- get_resolution()[source]¶
- Returns:
the value
- Return type:
Gets the divisor of the spectra, for instance a .
Added 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.
Added in version 1.1.6.
- get_start()[source]¶
- Returns:
the value in nm
- Return type:
Gets the start value of the spectral data.
Added 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.
Added 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.
Added in version 1.1.6.
- get_value_max()[source]¶
- Return type:
Gets the largest normalised value in the spectrum.
Added in version 1.3.1.
- get_value_min()[source]¶
- Return type:
Gets the smallest normalised value in the spectrum.
Added 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.Added 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.
Added in version 1.1.6.
- get_wavelength_cal(c1, c2, c3)[source]¶
- Parameters:
Gets the calibration coefficients used to map pixel indexes to wavelengths.
Added 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.
Added 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.
Added in version 1.3.1.
- multiply(s2, resolution)[source]¶
- Parameters:
s2 (
Colord.Spectrum) – aColord.Spectruminstance, possibly an absorption spectrum.resolution (
float) – the step size in nm
- Returns:
a
Colord.Spectruminstance- Return type:
Multiplies two spectra together.
Added in version 1.1.6.
- multiply_scalar(value)[source]¶
- Parameters:
value (
float) – a scalar value- Returns:
a
Colord.Spectruminstance- Return type:
Multiplies a spectra with a scalar value.
Added in version 1.3.5.
- normalize(wavelength, value)[source]¶
-
Normalizes a spectrum to a specific value at a specific wavelength.
Added 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.
Added in version 1.2.6.
- resample(start, end, resolution)[source]¶
- Parameters:
- Returns:
a
Colord.Spectruminstance- Return type:
Resample a new spectrum with linear index to wavelength coefficients.
Added in version 1.3.1.
- resample_to_size(size)[source]¶
- Parameters:
size (
int) – the output spectrum size- Returns:
a
Colord.Spectruminstance- Return type:
Resample a new spectrum with the desired number of points.
Added in version 1.3.4.
- set_data(value)[source]¶
- Parameters:
value ([
float]) – component value
Sets the spectrum data.
Added 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.
Added 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.
Added 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.
Added in version 1.1.6.
- set_value(idx, data)[source]¶
-
Overwrites the spectrum data at a specified index.
Added 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().Added in version 1.3.1.
- subtract(s2, resolution)[source]¶
- Parameters:
s2 (
Colord.Spectrum) – aColord.Spectruminstance, e.g. a dark calibrationresolution (
float) – the resolution to use when resampling
- Returns:
a
Colord.Spectruminstance- 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.
Added in version 1.3.1.