# colour.colorimetry.sd_to_XYZ_integration#

colour.colorimetry.sd_to_XYZ_integration(sd: Union[ArrayLike, SpectralDistribution, MultiSpectralDistributions], cmfs: = None, illuminant: = None, k: Optional[Number] = None, shape: = None) [source]#

Convert given spectral distribution to CIE XYZ tristimulus values using given colour matching functions and illuminant according to classical integration method.

The spectral distribution can be either a colour.SpectralDistribution class instance or an ArrayLike in which case the shape must be passed.

Parameters:
• sd (Union[ArrayLike, SpectralDistribution, MultiSpectralDistributions]) – Spectral distribution, if an ArrayLike the wavelengths are expected to be in the last axis, e.g. for a spectral array with 77 bins, sd shape could be (77, ) or (1, 77).

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

• illuminant (Optional[SpectralDistribution]) – Illuminant spectral distribution, default to CIE Illuminant E.

• k (Optional[Number]) – Normalisation constant $$k$$. For reflecting or transmitting object colours, $$k$$ is chosen so that $$Y = 100$$ for objects for which the spectral reflectance factor $$R(\lambda)$$ of the object colour or the spectral transmittance factor $$\tau(\lambda)$$ of the object is equal to unity for all wavelengths. For self-luminous objects and illuminants, the constants $$k$$ is usually chosen on the grounds of convenience. If, however, in the CIE 1931 standard colorimetric system, the $$Y$$ value is required to be numerically equal to the absolute value of a photometric quantity, the constant, $$k$$, must be put equal to the numerical value of $$K_m$$, the maximum spectral luminous efficacy (which is equal to 683 $$lm\cdot W^{-1}$$) and $$\Phi_\lambda(\lambda)$$ must be the spectral concentration of the radiometric quantity corresponding to the photometric quantity required.

• shape (Optional[SpectralShape]) – Spectral shape of the spectral distribution, cmfs and illuminant will be aligned to it if sd is an ArrayLike.

Returns:

CIE XYZ tristimulus values.

Return type:

numpy.ndarray

Notes

Range

Scale - Reference

Scale - 1

XYZ

[0, 100]

[0, 1]

• When $$k$$ is set to a value other than None, the computed CIE XYZ tristimulus values are assumed to be absolute and are thus converted from percentages by a final division by 100.

• The code path using the ArrayLike spectral distribution produces results different to the code path using a colour.SpectralDistribution class instance: the former favours execution speed by aligning the colour matching functions and illuminant to the given spectral shape while the latter favours precision by aligning the spectral distribution to the colour matching functions.

References

[WS00c]

Examples

>>> from colour import MSDS_CMFS, SDS_ILLUMINANTS, SpectralDistribution
>>> cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]
>>> illuminant = SDS_ILLUMINANTS["D65"]
>>> shape = SpectralShape(400, 700, 20)
>>> data = np.array(
...     [
...         0.0641,
...         0.0645,
...         0.0562,
...         0.0537,
...         0.0559,
...         0.0651,
...         0.0705,
...         0.0772,
...         0.0870,
...         0.1128,
...         0.1360,
...         0.1511,
...         0.1688,
...         0.1996,
...         0.2397,
...         0.2852,
...     ]
... )
>>> sd = SpectralDistribution(data, shape)
>>> sd_to_XYZ_integration(sd, cmfs, illuminant)
...
array([ 10.8404805...,   9.6838697...,   6.2115722...])
>>> sd_to_XYZ_integration(data, cmfs, illuminant, shape=shape)
...
array([ 10.8993917...,   9.6986145...,   6.2540301...])


The default CMFS are the CIE 1931 2 Degree Standard Observer, and the default illuminant is CIE Illuminant E:

>>> sd_to_XYZ_integration(sd)
...
array([ 11.7786939...,   9.9583972...,   5.7371816...])