colour.XYZ_to_msds#

colour.XYZ_to_msds(XYZ: ArrayLike, method: Literal['Gaussian', 'Smits 1999'] | str = 'Gaussian') NDArrayFloat[source]#

Recover spectral values from the specified CIE XYZ tristimulus values using the specified method.

Parameters:
  • XYZ (ArrayLike) – CIE XYZ tristimulus values to recover the spectral values from. The last dimension must be size 3.

  • method (Literal['Gaussian', 'Smits 1999'] | str) – Computation method.

Returns:

Recovered spectral values with shape (*XYZ.shape[:-1], wavelengths).

Return type:

numpy.ndarray

Notes

Domain

Scale - Reference

Scale - 1

XYZ

1

1

  • Both methods will internally convert specified CIE XYZ tristimulus values to RGB colourspace array assuming sRGB primaries and equal energy illuminant E.

References

[Smi99]

Examples

Gaussian reflectance recovery:

>>> import numpy as np
>>> XYZ = np.array(
...     [
...         [0.20654008, 0.12197225, 0.05136952],
...         [0.14223761, 0.23042375, 0.10498415],
...         [0.07820260, 0.06157595, 0.28106183],
...     ]
... )
>>> XYZ_to_msds(XYZ, method="Gaussian").shape
(3, 421)
>>> float(XYZ_to_msds(XYZ, method="Gaussian")[0, 300])
0.3785...

Smits (1999) reflectance recovery:

>>> XYZ_to_msds(XYZ, method="Smits 1999").shape
(3, 10)
>>> float(XYZ_to_msds(XYZ, method="Smits 1999")[0, 6])
0.3207...