colour.recovery.XYZ_to_sd_Otsu2018

colour.recovery.XYZ_to_sd_Otsu2018(XYZ: ArrayLike, cmfs: Optional[colour.colorimetry.spectrum.MultiSpectralDistributions] = None, illuminant: Optional[colour.colorimetry.spectrum.SpectralDistribution] = None, dataset: colour.recovery.otsu2018.Dataset_Otsu2018 = DATASET_REFERENCE_OTSU2018, clip: bool = True) colour.colorimetry.spectrum.SpectralDistribution[source]

Recover the spectral distribution of given CIE XYZ tristimulus values using Otsu et al. (2018) method.

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

  • cmfs (Optional[colour.colorimetry.spectrum.MultiSpectralDistributions]) – Standard observer colour matching functions, default to the CIE 1931 2 Degree Standard Observer.

  • illuminant (Optional[colour.colorimetry.spectrum.SpectralDistribution]) – Illuminant spectral distribution, default to CIE Standard Illuminant D65.

  • dataset (colour.recovery.otsu2018.Dataset_Otsu2018) – Dataset to use for reconstruction. The default is to use the published data.

  • clip (bool) – If True, the default, values below zero and above unity in the recovered spectral distributions will be clipped. This ensures that the returned reflectance is physical and conserves energy, but will cause noticeable colour differences in case of very saturated colours.

Returns

Recovered spectral distribution. Its shape is always that of the colour.recovery.SPECTRAL_SHAPE_OTSU2018 class instance.

Return type

colour.SpectralDistribution

Raises

ValueError – If the dataset shape is undefined.

References

[OYH18]

Examples

>>> from colour import (
...     CCS_ILLUMINANTS, SDS_ILLUMINANTS, MSDS_CMFS, XYZ_to_sRGB)
>>> from colour.colorimetry import sd_to_XYZ_integration
>>> 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(SPECTRAL_SHAPE_OTSU2018)
... )
>>> illuminant = SDS_ILLUMINANTS['D65'].copy().align(cmfs.shape)
>>> sd = XYZ_to_sd_Otsu2018(XYZ, cmfs, illuminant)
>>> with numpy_print_options(suppress=True):
...     sd  
SpectralDistribution([[ 380.        ,    0.0601939...],
                      [ 390.        ,    0.0568063...],
                      [ 400.        ,    0.0517429...],
                      [ 410.        ,    0.0495841...],
                      [ 420.        ,    0.0502007...],
                      [ 430.        ,    0.0506489...],
                      [ 440.        ,    0.0510020...],
                      [ 450.        ,    0.0493782...],
                      [ 460.        ,    0.0468046...],
                      [ 470.        ,    0.0437132...],
                      [ 480.        ,    0.0416957...],
                      [ 490.        ,    0.0403783...],
                      [ 500.        ,    0.0405197...],
                      [ 510.        ,    0.0406031...],
                      [ 520.        ,    0.0416912...],
                      [ 530.        ,    0.0430956...],
                      [ 540.        ,    0.0444474...],
                      [ 550.        ,    0.0459336...],
                      [ 560.        ,    0.0507631...],
                      [ 570.        ,    0.0628967...],
                      [ 580.        ,    0.0844661...],
                      [ 590.        ,    0.1334277...],
                      [ 600.        ,    0.2262428...],
                      [ 610.        ,    0.3599330...],
                      [ 620.        ,    0.4885571...],
                      [ 630.        ,    0.5752546...],
                      [ 640.        ,    0.6193023...],
                      [ 650.        ,    0.6450744...],
                      [ 660.        ,    0.6610548...],
                      [ 670.        ,    0.6688673...],
                      [ 680.        ,    0.6795426...],
                      [ 690.        ,    0.6887933...],
                      [ 700.        ,    0.7003469...],
                      [ 710.        ,    0.7084128...],
                      [ 720.        ,    0.7154674...],
                      [ 730.        ,    0.7234334...]],
                     interpolator=SpragueInterpolator,
                     interpolator_kwargs={},
                     extrapolator=Extrapolator,
                     extrapolator_kwargs={...})
>>> sd_to_XYZ_integration(sd, cmfs, illuminant) / 100  
array([ 0.2065494...,  0.1219712...,  0.0514002...])