colour.complementary_wavelength#

colour.complementary_wavelength(xy: ArrayLike, xy_n: ArrayLike, cmfs: MultiSpectralDistributions | None = None) Tuple[NDArrayFloat, NDArrayFloat, NDArrayFloat][source]#

Return the complementary wavelength \(\lambda_c\) for given colour stimulus \(xy\) and the related \(xy_wl\) first and \(xy_{cw}\) second intersection coordinates with the spectral locus.

In the eventuality where the \(xy_wl\) first intersection coordinates are on the line of purples, the dominant wavelength will be computed in lieu.

The dominant wavelength is indicated by a negative sign and the \(xy_{cw}\) second intersection coordinates which are set by default to the same value than \(xy_wl\) first intersection coordinates will be set to the dominant wavelength intersection coordinates with the spectral locus.

Parameters:
  • xy (ArrayLike) – Colour stimulus CIE xy chromaticity coordinates.

  • xy_n (ArrayLike) – Achromatic stimulus CIE xy chromaticity coordinates.

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

Returns:

Complementary wavelength, first intersection point CIE xy chromaticity coordinates, second intersection point CIE xy chromaticity coordinates.

Return type:

tuple

References

[CIET14804b], [Erdb]

Examples

Complementary wavelength computation:

>>> from colour.colorimetry import MSDS_CMFS
>>> from pprint import pprint
>>> cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]
>>> xy = np.array([0.37605506, 0.24452225])
>>> xy_n = np.array([0.31270000, 0.32900000])
>>> pprint(complementary_wavelength(xy, xy_n, cmfs))  
(array(509.0),
 array([ 0.0104096...,  0.7320745...]),
 array([ 0.0104096...,  0.7320745...]))

Dominant wavelength is returned if the first intersection is located on the line of purples:

>>> xy = np.array([0.54369557, 0.32107944])
>>> pprint(complementary_wavelength(xy, xy_n))  
(array(492.0),
 array([ 0.0364795 ,  0.3384712...]),
 array([ 0.0364795 ,  0.3384712...]))