colour.recovery.XYZ_to_sd_Meng2015#

colour.recovery.XYZ_to_sd_Meng2015(XYZ: Annotated[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], 1], cmfs: MultiSpectralDistributions | None = None, illuminant: SpectralDistribution | None = None, optimisation_kwargs: dict | None = None) SpectralDistribution[source]#

Recover the spectral distribution from the specified CIE XYZ tristimulus values using the Meng et al. (2015) method.

Parameters:
  • XYZ (Annotated[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], 1]) – CIE XYZ tristimulus values from which to recover the spectral distribution.

  • cmfs (MultiSpectralDistributions | None) – Standard observer colour matching functions. The wavelength \(\lambda_{i}\) range interval of the colour matching functions directly affects the computation time. The current default interval of 5 provides a good compromise between precision and computation time. Defaults to the CIE 1931 2 Degree Standard Observer.

  • illuminant (SpectralDistribution | None) – Illuminant spectral distribution. Defaults to CIE Standard Illuminant D65.

  • optimisation_kwargs (dict | None) – Parameters for the scipy.optimize.minimize() definition.

Returns:

Recovered spectral distribution.

Return type:

colour.SpectralDistribution

Raises:

RuntimeError – If the optimisation fails.

Notes

Domain

Scale - Reference

Scale - 1

XYZ

1

1

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

References

[MSHD15]

Examples

>>> from colour import MSDS_CMFS, SDS_ILLUMINANTS
>>> from colour.utilities import numpy_print_options
>>> XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
>>> cmfs = (
...     MSDS_CMFS["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):
...     sd
SpectralDistribution([[ 360.        ,    0.0762005...],
                      [ 370.        ,    0.0761792...],
                      [ 380.        ,    0.0761363...],
                      [ 390.        ,    0.0761194...],
                      [ 400.        ,    0.0762539...],
                      [ 410.        ,    0.0761671...],
                      [ 420.        ,    0.0754649...],
                      [ 430.        ,    0.0731519...],
                      [ 440.        ,    0.0676701...],
                      [ 450.        ,    0.0577800...],
                      [ 460.        ,    0.0441993...],
                      [ 470.        ,    0.0285064...],
                      [ 480.        ,    0.0138728...],
                      [ 490.        ,    0.0033585...],
                      [ 500.        ,    0.       ...],
                      [ 510.        ,    0.       ...],
                      [ 520.        ,    0.       ...],
                      [ 530.        ,    0.       ...],
                      [ 540.        ,    0.0055767...],
                      [ 550.        ,    0.0317581...],
                      [ 560.        ,    0.0754491...],
                      [ 570.        ,    0.1314115...],
                      [ 580.        ,    0.1937649...],
                      [ 590.        ,    0.2559311...],
                      [ 600.        ,    0.3123173...],
                      [ 610.        ,    0.3584966...],
                      [ 620.        ,    0.3927335...],
                      [ 630.        ,    0.4159458...],
                      [ 640.        ,    0.4306660...],
                      [ 650.        ,    0.4391040...],
                      [ 660.        ,    0.4439497...],
                      [ 670.        ,    0.4463618...],
                      [ 680.        ,    0.4474625...],
                      [ 690.        ,    0.4479868...],
                      [ 700.        ,    0.4482116...],
                      [ 710.        ,    0.4482800...],
                      [ 720.        ,    0.4483472...],
                      [ 730.        ,    0.4484251...],
                      [ 740.        ,    0.4484633...],
                      [ 750.        ,    0.4485071...],
                      [ 760.        ,    0.4484969...],
                      [ 770.        ,    0.4484853...],
                      [ 780.        ,    0.4485134...]],
                     interpolator=SpragueInterpolator,
                     interpolator_kwargs={},
                     extrapolator=Extrapolator,
                     extrapolator_kwargs={...})
>>> sd_to_XYZ_integration(sd, cmfs, illuminant) / 100
array([ 0.2065400...,  0.1219722...,  0.0513695...])