colour.XYZ_to_sd¶
-
colour.
XYZ_to_sd
(XYZ, method='Meng 2015', **kwargs)[source]¶ Recovers the spectral distribution of given CIE XYZ tristimulus values using given method.
Parameters: - XYZ (array_like) – CIE XYZ tristimulus values to recover the spectral distribution from.
- method (unicode, optional) – {‘Meng 2015’, ‘Smits 1999’}, Computation method.
Other Parameters: - cmfs (XYZ_ColourMatchingFunctions) – {
colour.recovery.XYZ_to_sd_Meng2015()
}, Standard observer colour matching functions. - interval (numeric, optional) – {
colour.recovery.XYZ_to_sd_Meng2015()
}, Wavelength \(\lambda_{i}\) range interval in nm. The smallerinterval
is, the longer the computations will be. - optimisation_parameters (dict_like, optional) – {
colour.recovery.XYZ_to_sd_Meng2015()
}, Parameters forscipy.optimize.minimize()
definition.
Returns: Recovered spectral distribution.
Return type: Notes
Domain Scale - Reference Scale - 1 XYZ
[0, 1] [0, 1] - Smits (1999) method will internally convert given CIE XYZ tristimulus values to RGB colourspace array assuming equal energy illuminant E.
References
Examples
Meng (2015) reflectance recovery:
>>> import numpy as np >>> from colour.utilities import numpy_print_options >>> from colour.colorimetry import sd_to_XYZ_integration >>> XYZ = np.array([0.21781186, 0.12541048, 0.04697113]) >>> sd = XYZ_to_sd(XYZ, interval=10) >>> with numpy_print_options(suppress=True): ... # Doctests skip for Python 2.x compatibility. ... sd # doctest: +SKIP SpectralDistribution([[ 360. , 0.0741540...], [ 370. , 0.0741409...], [ 380. , 0.0741287...], [ 390. , 0.0740876...], [ 400. , 0.0740215...], [ 410. , 0.0738692...], [ 420. , 0.0731412...], [ 430. , 0.0705798...], [ 440. , 0.0647359...], [ 450. , 0.0551962...], [ 460. , 0.0425597...], [ 470. , 0.0283678...], [ 480. , 0.0147370...], [ 490. , 0.0044271...], [ 500. , 0.0000302...], [ 510. , 0. ...], [ 520. , 0. ...], [ 530. , 0. ...], [ 540. , 0.0051962...], [ 550. , 0.0289516...], [ 560. , 0.0687006...], [ 570. , 0.1204130...], [ 580. , 0.1789378...], [ 590. , 0.2383451...], [ 600. , 0.2930157...], [ 610. , 0.3387433...], [ 620. , 0.3734033...], [ 630. , 0.3972820...], [ 640. , 0.4125508...], [ 650. , 0.4215782...], [ 660. , 0.4265503...], [ 670. , 0.4292647...], [ 680. , 0.4307000...], [ 690. , 0.4313993...], [ 700. , 0.4316316...], [ 710. , 0.4317109...], [ 720. , 0.4317684...], [ 730. , 0.4317864...], [ 740. , 0.4317972...], [ 750. , 0.4318385...], [ 760. , 0.4318576...], [ 770. , 0.4318455...], [ 780. , 0.4317877...], [ 790. , 0.4318119...], [ 800. , 0.4318070...], [ 810. , 0.4318089...], [ 820. , 0.4317781...], [ 830. , 0.4317733...]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) >>> sd_to_XYZ_integration(sd) / 100 # doctest: +ELLIPSIS array([ 0.2178552..., 0.1254142..., 0.0470105...])
Smits (1999) reflectance recovery:
>>> sd = XYZ_to_sd(XYZ, method='Smits 1999') >>> with numpy_print_options(suppress=True): ... sd # doctest: +ELLIPSIS SpectralDistribution([[ 380. , 0.07691923], [ 417.7778 , 0.0587005 ], [ 455.5556 , 0.03943195], [ 493.3333 , 0.03024978], [ 531.1111 , 0.02750692], [ 568.8889 , 0.02808645], [ 606.6667 , 0.34298985], [ 644.4444 , 0.41185795], [ 682.2222 , 0.41185795], [ 720. , 0.41180754]], interpolator=LinearInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) >>> sd_to_XYZ_integration(sd) / 100 # doctest: +ELLIPSIS array([ 0.2004540..., 0.1105632..., 0.0420963...])