cd-spectrum

cd-spectrum — A single set of spectral values

Functions

Object Hierarchy

    GBoxed
    ╰── CdSpectrum

Description

Functions to manipulate spectral values.

Functions

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.

Parameters

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.

Parameters

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.

Parameters

spectrum

the spectrum

 

Since 1.1.6


cd_spectrum_dup ()

CdSpectrum *
cd_spectrum_dup (const CdSpectrum *spectrum);

Parameters

spectrum

a CdSpectrum instance.

 

Returns

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.

Parameters

spectrum

a CdSpectrum instance

 

wavelength

the wavelength in nm

 

value

the value to normalize to

 

Since 1.1.6


cd_spectrum_get_id ()

const gchar *
cd_spectrum_get_id (const CdSpectrum *spectrum);

Gets the spectral data.

Parameters

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

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

spectrum

a CdSpectrum instance.

 

Returns

the value

Since 1.1.6


cd_spectrum_get_size ()

guint
cd_spectrum_get_size (const CdSpectrum *spectrum);

Gets the size of the spectrum data.

Parameters

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.

Parameters

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_wavelength ()

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

Gets the wavelenth that corresponds to the specified index.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

spectrum

a CdSpectrum instance.

 

norm

the end value of the spectral data

 

Since 1.1.6


cd_spectrum_add_value ()

void
cd_spectrum_add_value (CdSpectrum *spectrum,
                       gdouble data);

Adds a value in nm to the spectrum.

Parameters

spectrum

the spectrum

 

Since 1.1.6


cd_spectrum_multiply ()

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

Multiplies two spectra together.

Parameters

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

Types and Values