colour.wavelength_to_XYZ

colour.wavelength_to_XYZ(wavelength, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...))[source]

Converts 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 (numeric or array_like) – Wavelength \(\lambda\) in nm.

  • cmfs (XYZ_ColourMatchingFunctions, optional) – Standard observer colour matching functions.

Returns

CIE XYZ tristimulus values.

Return type

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 CMFS
>>> cmfs = 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...])