colour.recovery.XYZ_to_sd_Meng2015

colour.recovery.XYZ_to_sd_Meng2015(XYZ, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...), illuminant=SpectralDistribution(name='D65', ...), optimisation_kwargs=None, **kwargs)[source]

Recovers the spectral distribution of given CIE XYZ tristimulus values using Meng et al. (2015) method.

Parameters
  • XYZ (array_like, (3,)) – CIE XYZ tristimulus values to recover the spectral distribution from.

  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions. The wavelength \(\lambda_{i}\) range interval of the colour matching functions affects directly the time the computations take. The current default interval of 5 is a good compromise between precision and time spent.

  • illuminant (SpectralDistribution, optional) – Illuminant spectral distribution.

  • optimisation_kwargs (dict_like, optional) – Parameters for scipy.optimize.minimize() definition.

  • **kwargs (dict, optional) – Keywords arguments for deprecation management.

Returns

Recovered spectral distribution.

Return type

SpectralDistribution

Notes

Domain

Scale - Reference

Scale - 1

XYZ

[0, 1]

[0, 1]

  • The definition used to convert spectrum to CIE XYZ tristimulus values is colour.colorimetry.spectral_to_XYZ_integration() definition because it processes any measurement interval opposed to colour.colorimetry.sd_to_XYZ_ASTME308() definition that handles only measurement interval of 1, 5, 10 or 20nm.

References

[]

Examples

>>> from colour.utilities import numpy_print_options
>>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
>>> cmfs = (
...     MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'].
...     copy().align(SpectralShape(360, 780, 10))
... )
>>> illuminant = SDS_ILLUMINANTS['D65'].copy().align(cmfs.shape)
>>> sd = XYZ_to_sd_Meng2015(XYZ, cmfs, illuminant)
>>> with numpy_print_options(suppress=True):
...     # Doctests skip for Python 2.x compatibility.
...     sd  
SpectralDistribution([[ 360.        ,    0.0765153...],
                      [ 370.        ,    0.0764771...],
                      [ 380.        ,    0.0764286...],
                      [ 390.        ,    0.0764329...],
                      [ 400.        ,    0.0765863...],
                      [ 410.        ,    0.0764339...],
                      [ 420.        ,    0.0757213...],
                      [ 430.        ,    0.0733091...],
                      [ 440.        ,    0.0676493...],
                      [ 450.        ,    0.0577616...],
                      [ 460.        ,    0.0440805...],
                      [ 470.        ,    0.0284802...],
                      [ 480.        ,    0.0138019...],
                      [ 490.        ,    0.0033557...],
                      [ 500.        ,    0.       ...],
                      [ 510.        ,    0.       ...],
                      [ 520.        ,    0.       ...],
                      [ 530.        ,    0.       ...],
                      [ 540.        ,    0.0055360...],
                      [ 550.        ,    0.0317335...],
                      [ 560.        ,    0.075457 ...],
                      [ 570.        ,    0.1314930...],
                      [ 580.        ,    0.1938219...],
                      [ 590.        ,    0.2559747...],
                      [ 600.        ,    0.3122869...],
                      [ 610.        ,    0.3584363...],
                      [ 620.        ,    0.3927112...],
                      [ 630.        ,    0.4158866...],
                      [ 640.        ,    0.4305832...],
                      [ 650.        ,    0.4391142...],
                      [ 660.        ,    0.4439484...],
                      [ 670.        ,    0.4464121...],
                      [ 680.        ,    0.4475718...],
                      [ 690.        ,    0.4481182...],
                      [ 700.        ,    0.4483734...],
                      [ 710.        ,    0.4484743...],
                      [ 720.        ,    0.4485753...],
                      [ 730.        ,    0.4486474...],
                      [ 740.        ,    0.4486629...],
                      [ 750.        ,    0.4486995...],
                      [ 760.        ,    0.4486925...],
                      [ 770.        ,    0.4486794...],
                      [ 780.        ,    0.4486982...]],
                     interpolator=SpragueInterpolator,
                     interpolator_kwargs={},
                     extrapolator=Extrapolator,
                     extrapolator_kwargs={...})
>>> sd_to_XYZ_integration(sd, cmfs, illuminant) / 100  
array([ 0.2065400...,  0.1219722...,  0.0513695...])