cd-spectrum

cd-spectrum — A single set of spectral values

Synopsis

CdSpectrum *        cd_spectrum_new                     (void);
CdSpectrum *        cd_spectrum_sized_new               (guint reserved_size);
CdSpectrum *        cd_spectrum_planckian_new           (gdouble temperature);
void                cd_spectrum_free                    (CdSpectrum *spectrum);
CdSpectrum *        cd_spectrum_dup                     (const CdSpectrum *spectrum);
void                cd_spectrum_normalize               (CdSpectrum *spectrum,
                                                         gdouble wavelength,
                                                         gdouble value);
void                cd_spectrum_normalize_max           (CdSpectrum *spectrum,
                                                         gdouble value);
const gchar *       cd_spectrum_get_id                  (const CdSpectrum *spectrum);
GArray *            cd_spectrum_get_data                (const CdSpectrum *spectrum);
gdouble             cd_spectrum_get_start               (const CdSpectrum *spectrum);
gdouble             cd_spectrum_get_end                 (const CdSpectrum *spectrum);
gdouble             cd_spectrum_get_norm                (const CdSpectrum *spectrum);
gdouble             cd_spectrum_get_resolution          (const CdSpectrum *spectrum);
guint               cd_spectrum_get_size                (const CdSpectrum *spectrum);
gdouble             cd_spectrum_get_value               (const CdSpectrum *spectrum,
                                                         guint idx);
gdouble             cd_spectrum_get_value_raw           (const CdSpectrum *spectrum,
                                                         guint idx);
gdouble             cd_spectrum_get_wavelength          (const CdSpectrum *spectrum,
                                                         guint idx);
gdouble             cd_spectrum_get_value_for_nm        (const CdSpectrum *spectrum,
                                                         gdouble wavelength);
void                cd_spectrum_set_id                  (CdSpectrum *spectrum,
                                                         const gchar *id);
void                cd_spectrum_set_data                (CdSpectrum *spectrum,
                                                         GArray *value);
void                cd_spectrum_set_start               (CdSpectrum *spectrum,
                                                         gdouble start);
void                cd_spectrum_set_end                 (CdSpectrum *spectrum,
                                                         gdouble end);
void                cd_spectrum_set_norm                (CdSpectrum *spectrum,
                                                         gdouble norm);
void                cd_spectrum_set_value               (CdSpectrum *spectrum,
                                                         guint idx,
                                                         gdouble data);
void                cd_spectrum_add_value               (CdSpectrum *spectrum,
                                                         gdouble data);
CdSpectrum *        cd_spectrum_multiply                (CdSpectrum *s1,
                                                         CdSpectrum *s2,
                                                         gdouble resolution);

Description

Functions to manipulate spectral values.

Details

cd_spectrum_new ()

CdSpectrum *        cd_spectrum_new                     (void);

Allocates a spectrum.

Returns :

A newly allocated CdSpectrum object

Since 1.1.6


cd_spectrum_sized_new ()

CdSpectrum *        cd_spectrum_sized_new               (guint reserved_size);

Allocates a spectrum with a preallocated size.

reserved_size :

the future size of the spectrum

Returns :

A newly allocated CdSpectrum object

Since 1.1.6


cd_spectrum_planckian_new ()

CdSpectrum *        cd_spectrum_planckian_new           (gdouble temperature);

Allocates a Planckian spectrum at a specific temperature.

temperature :

the temperature in Kelvin

Returns :

A newly allocated CdSpectrum object

Since 1.1.6


cd_spectrum_free ()

void                cd_spectrum_free                    (CdSpectrum *spectrum);

Deallocates a color spectrum.

spectrum :

the spectrum

Since 1.1.6


cd_spectrum_dup ()

CdSpectrum *        cd_spectrum_dup                     (const CdSpectrum *spectrum);

spectrum :

a CdSpectrum instance.

Since 1.1.6


cd_spectrum_normalize ()

void                cd_spectrum_normalize               (CdSpectrum *spectrum,
                                                         gdouble wavelength,
                                                         gdouble value);

Normalizes a spectrum to a specific value at a specific wavelength.

spectrum :

a CdSpectrum instance

wavelength :

the wavelength in nm

value :

the value to normalize to

Since 1.1.6


cd_spectrum_normalize_max ()

void                cd_spectrum_normalize_max           (CdSpectrum *spectrum,
                                                         gdouble value);

Normalizes a spectrum to a specific value at its maximum value.

spectrum :

a CdSpectrum instance

value :

the value to normalize to

Since 1.2.6


cd_spectrum_get_id ()

const gchar *       cd_spectrum_get_id                  (const CdSpectrum *spectrum);

Gets the spectral data.

spectrum :

a CdSpectrum instance.

Returns :

the textual ID of the sample

Since 1.1.6


cd_spectrum_get_data ()

GArray *            cd_spectrum_get_data                (const CdSpectrum *spectrum);

Gets the spectral data. NOTE: This is not normalized

spectrum :

a CdSpectrum instance.

Returns :

spectral data. [transfer none][element-type gdouble]

Since 1.1.6


cd_spectrum_get_start ()

gdouble             cd_spectrum_get_start               (const CdSpectrum *spectrum);

Gets the start value of the spectral data.

spectrum :

a CdSpectrum instance.

Returns :

the value in nm

Since 1.1.6


cd_spectrum_get_end ()

gdouble             cd_spectrum_get_end                 (const CdSpectrum *spectrum);

Gets the end value of the spectral data.

spectrum :

a CdSpectrum instance.

Returns :

the value in nm

Since 1.1.6


cd_spectrum_get_norm ()

gdouble             cd_spectrum_get_norm                (const CdSpectrum *spectrum);

Gets the normalization value of the spectral data. NOTE: This affects every value in the spectrum.

spectrum :

a CdSpectrum instance.

Returns :

the value

Since 1.1.6


cd_spectrum_get_resolution ()

gdouble             cd_spectrum_get_resolution          (const CdSpectrum *spectrum);

Gets the divisor of the spectra, for instance a .

spectrum :

a CdSpectrum instance.

Returns :

the value

Since 1.2.6


cd_spectrum_get_size ()

guint               cd_spectrum_get_size                (const CdSpectrum *spectrum);

Gets the size of the spectrum data.

spectrum :

a CdSpectrum instance.

Returns :

number of data items in this spectrum

Since 1.1.6


cd_spectrum_get_value ()

gdouble             cd_spectrum_get_value               (const CdSpectrum *spectrum,
                                                         guint idx);

Gets the spectrum data at a specified index.

spectrum :

a CdSpectrum instance.

idx :

an index into the data

Returns :

spectral data value, or -1 for invalid

Since 1.1.6


cd_spectrum_get_value_raw ()

gdouble             cd_spectrum_get_value_raw           (const CdSpectrum *spectrum,
                                                         guint idx);

Gets the spectrum data at a specified index, without any normalization applied. Most people should use cd_spectrum_get_value() instead.

spectrum :

a CdSpectrum instance.

idx :

an index into the data

Returns :

spectral data value, or -1 for invalid

Since 1.2.6


cd_spectrum_get_wavelength ()

gdouble             cd_spectrum_get_wavelength          (const CdSpectrum *spectrum,
                                                         guint idx);

Gets the wavelenth that corresponds to the specified index.

spectrum :

a CdSpectrum instance.

idx :

an index into the data

Returns :

wavelenth value in nm, or -1 for invalid

Since 1.1.6


cd_spectrum_get_value_for_nm ()

gdouble             cd_spectrum_get_value_for_nm        (const CdSpectrum *spectrum,
                                                         gdouble wavelength);

Gets the value from the spectral data for a given wavelength.

spectrum :

a CdSpectrum instance.

wavelength :

the wavelength in nm

Returns :

the value for the wavelength

Since 1.1.6


cd_spectrum_set_id ()

void                cd_spectrum_set_id                  (CdSpectrum *spectrum,
                                                         const gchar *id);

Sets a spectrum id.

spectrum :

the destination spectrum

id :

component id

Since 1.1.6


cd_spectrum_set_data ()

void                cd_spectrum_set_data                (CdSpectrum *spectrum,
                                                         GArray *value);

Sets the spectrum data.

spectrum :

the destination spectrum

value :

component value. [element-type gdouble]

Since 1.1.6


cd_spectrum_set_start ()

void                cd_spectrum_set_start               (CdSpectrum *spectrum,
                                                         gdouble start);

Set the start value of the spectal data in nm.

spectrum :

a CdSpectrum instance.

start :

the start value of the spectral data

Since 1.1.6


cd_spectrum_set_end ()

void                cd_spectrum_set_end                 (CdSpectrum *spectrum,
                                                         gdouble end);

Set the end value of the spectal data in nm.

spectrum :

a CdSpectrum instance.

end :

the end value of the spectral data

Since 1.1.6


cd_spectrum_set_norm ()

void                cd_spectrum_set_norm                (CdSpectrum *spectrum,
                                                         gdouble norm);

Set the normalization value of the spectrum. NOTE: This affects every value in the spectrum.

spectrum :

a CdSpectrum instance.

norm :

the end value of the spectral data

Since 1.1.6


cd_spectrum_set_value ()

void                cd_spectrum_set_value               (CdSpectrum *spectrum,
                                                         guint idx,
                                                         gdouble data);

Overwrites the spectrum data at a specified index.

spectrum :

a CdSpectrum instance.

idx :

an index into the data

data :

a data value

Since 1.2.6


cd_spectrum_add_value ()

void                cd_spectrum_add_value               (CdSpectrum *spectrum,
                                                         gdouble data);

Adds a value in nm to the spectrum.

spectrum :

the spectrum

Since 1.1.6


cd_spectrum_multiply ()

CdSpectrum *        cd_spectrum_multiply                (CdSpectrum *s1,
                                                         CdSpectrum *s2,
                                                         gdouble resolution);

Multiplies two spectra together.

s1 :

a CdSpectrum instance, possibly an illuminant.

s2 :

a CdSpectrum instance, possibly an absorption spectrum.

resolution :

the step size in nm

Returns :

a CdSpectrum instance

Since 1.1.6