colour.wavelength_to_XYZ#

colour.wavelength_to_XYZ(wavelength: FloatingOrNDArray, cmfs: Optional[MultiSpectralDistributions] = None) ndarray[source]#

Convert given wavelength \(\lambda\) to CIE XYZ tristimulus values using given colour matching functions.

If the wavelength \(\lambda\) is not available in the colour matching function, its value will be calculated according to CIE 15:2004 recommendation: the method developed by Sprague (1880) will be used for interpolating functions having a uniformly spaced independent variable and the Cubic Spline method for non-uniformly spaced independent variable.

Parameters:
  • wavelength (FloatingOrNDArray) – Wavelength \(\lambda\) in nm.

  • cmfs (Optional[MultiSpectralDistributions]) – Standard observer colour matching functions, default to the CIE 1931 2 Degree Standard Observer.

Returns:

CIE XYZ tristimulus values.

Return type:

numpy.ndarray

Raises:

ValueError – If wavelength \(\lambda\) is not contained in the colour matching functions domain.

Notes

Range

Scale - Reference

Scale - 1

XYZ

[0, 1]

[0, 1]

Examples

>>> from colour import MSDS_CMFS
>>> cmfs = MSDS_CMFS['CIE 1931 2 Degree Standard Observer']
>>> wavelength_to_XYZ(480, cmfs)  
array([ 0.09564  ,  0.13902  ,  0.8129501...])
>>> wavelength_to_XYZ(480.5, cmfs)  
array([ 0.0914287...,  0.1418350...,  0.7915726...])