Colord.Spectrum¶
Fields¶
None
Methods¶
| class | new() | 
| class | planckian_new(temperature) | 
| class | planckian_new_full(temperature, start, end, resolution) | 
| class | sized_new(reserved_size) | 
| add_value(data) | |
| dup() | |
| free() | |
| get_data() | |
| get_end() | |
| get_id() | |
| get_norm() | |
| get_resolution() | |
| get_size() | |
| get_start() | |
| get_value(idx) | |
| get_value_for_nm(wavelength) | |
| get_value_max() | |
| get_value_min() | |
| get_value_raw(idx) | |
| get_wavelength(idx) | |
| get_wavelength_cal(c1, c2, c3) | |
| limit_max(value) | |
| limit_min(value) | |
| multiply(s2, resolution) | |
| multiply_scalar(value) | |
| normalize(wavelength, value) | |
| normalize_max(value) | |
| resample(start, end, resolution) | |
| resample_to_size(size) | |
| set_data(value) | |
| set_end(end) | |
| set_id(id) | |
| set_norm(norm) | |
| set_start(start) | |
| set_value(idx, data) | |
| set_wavelength_cal(c1, c2, c3) | |
| subtract(s2, resolution) | |
| to_string(max_width, max_height) | 
Details¶
- 
class Colord.Spectrum¶
- 
classmethod new()[source]¶
- Returns: - A newly allocated - Colord.Spectrumobject- Return type: - Colord.Spectrum- 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.Spectrumobject- Return type: - Colord.Spectrum- 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.Spectrumobject- 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.Spectrumobject- Return type: - Colord.Spectrum- 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. 
 - 
dup()[source]¶
- Return type: - Colord.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: - float- 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: - str- Gets the spectral data. - New in version 1.1.6. 
 - 
get_norm()[source]¶
- Returns: - the value - Return type: - float- 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: - float- 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: - int- Gets the size of the spectrum data. - New in version 1.1.6. 
 - 
get_start()[source]¶
- Returns: - the value in nm - Return type: - float- 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: - float- 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: - float- Gets the value from the spectral data for a given wavelength. - New in version 1.1.6. 
 - 
get_value_max()[source]¶
- Return type: - float- Gets the largest normalised value in the spectrum. - New in version 1.3.1. 
 - 
get_value_min()[source]¶
- Return type: - float- 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: - float- 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: - float- 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.Spectruminstance, possibly an absorption spectrum.
- resolution (float) – the step size in nm
 - Returns: - a - Colord.Spectruminstance- Return type: - Multiplies two spectra together. - New in version 1.1.6. 
- s2 (
 - 
multiply_scalar(value)[source]¶
- Parameters: - value ( - float) – a scalar value- Returns: - a - Colord.Spectruminstance- Return type: - Colord.Spectrum- Multiplies a spectra with a scalar value. - New in version 1.3.5. 
 - 
normalize(wavelength, value)[source]¶
- Parameters: - 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.Spectruminstance- 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.Spectruminstance- Return type: - Colord.Spectrum- 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]¶
- Parameters: - 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.Spectruminstance, e.g. a dark calibration
- resolution (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. - New in version 1.3.1. 
- s2 (
 
- 
classmethod