colour.XYZ_to_msds#
- colour.XYZ_to_msds(XYZ: ArrayLike, method: Literal['Gaussian', 'Smits 1999'] | str = 'Gaussian', *, as_array: Literal[False] = False) MultiSpectralDistributions[source]#
- colour.XYZ_to_msds(XYZ: ArrayLike, method: Literal['Gaussian', 'Smits 1999'] | str = 'Gaussian', *, as_array: Literal[True]) NDArrayFloat
Recover the multi-spectral distributions 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.
as_array (bool) – Whether to return raw spectral values as a
numpy.ndarrayof shape(*XYZ.shape[:-1], wavelengths)instead of aMultiSpectralDistributionsinstance. Defaults to False.
- Returns:
Recovered multi-spectral distributions, or the underlying spectral values when
as_array=True.- Return type:
Notes
Domain
Scale - Reference
Scale - 1
XYZ1
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", as_array=True).shape (3, 421) >>> float(XYZ_to_msds(XYZ, method="Gaussian", as_array=True)[0, 300]) ... 0.3785...
Smits (1999) reflectance recovery:
>>> XYZ_to_msds(XYZ, method="Smits 1999", as_array=True).shape (3, 10) >>> float(XYZ_to_msds(XYZ, method="Smits 1999", as_array=True)[0, 6]) ... 0.3207...