XYZcie1931_from_spd#

colorsynth.XYZcie1931_from_spd(spd, wavelength, axis=-1)[source]#

Calculate the CIE 1931 tristimulus values, \(XYZ\), for the given spectral power distribution.

Parameters:
  • spd (ndarray) – the spectral power distribution of an emitting source as a function of wavelength

  • wavelength (Quantity) – the wavelength grid corresponding to the spectral power distribution. Must be sorted to yield positive \(XYZ\) values

  • axis (int) – the wavelength axis, or the axis along which to integrate

Return type:

ndarray

Notes

If wavelength varies only along axis, which is the ordinary case, this function evaluates the color matching functions on the 1D wavelength grid and computes the integral as a weighted contraction, which never allocates an array larger than spd. Otherwise, it falls back to broadcasting wavelength against spd, which allocates several arrays three times larger than spd.