colour.sd_to_XYZ

colour.sd_to_XYZ(sd, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...), illuminant=SpectralDistribution(name='1 Constant', ...), k=None, method='ASTM E308', **kwargs)[source]

Converts given spectral distribution to CIE XYZ tristimulus values using given colour matching functions, illuminant and method.

Parameters
  • sd (SpectralDistribution) – Spectral distribution.

  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.

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

  • k (numeric, optional) – 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.

  • method (unicode, optional) – {‘ASTM E308’, ‘Integration’}, Computation method.

Other Parameters
  • mi_5nm_omission_method (bool, optional) – {colour.colorimetry.sd_to_XYZ_ASTME308()}, 5 nm measurement intervals spectral distribution conversion to tristimulus values will use a 5 nm version of the colour matching functions instead of a table of tristimulus weighting factors.

  • mi_20nm_interpolation_method (bool, optional) – {colour.colorimetry.sd_to_XYZ_ASTME308()}, 20 nm measurement intervals spectral distribution conversion to tristimulus values will use a dedicated interpolation method instead of a table of tristimulus weighting factors.

  • use_practice_range (bool, optional) – {colour.colorimetry.sd_to_XYZ_ASTME308()}, Practise ASTM E308-15 working wavelengths range is [360, 780], if True this argument will trim the colour matching functions appropriately.

Returns

CIE XYZ tristimulus values.

Return type

ndarray, (3,)

Notes

Range

Scale - Reference

Scale - 1

XYZ

[0, 100]

[0, 1]

References

[ASTMInternational11], [ASTMInternational15], [WS00f]

Examples

>>> from colour import (
...     CMFS, ILLUMINANTS_SDS, SpectralDistribution)
>>> cmfs = CMFS['CIE 1931 2 Degree Standard Observer']
>>> data = {
...     400: 0.0641,
...     420: 0.0645,
...     440: 0.0562,
...     460: 0.0537,
...     480: 0.0559,
...     500: 0.0651,
...     520: 0.0705,
...     540: 0.0772,
...     560: 0.0870,
...     580: 0.1128,
...     600: 0.1360,
...     620: 0.1511,
...     640: 0.1688,
...     660: 0.1996,
...     680: 0.2397,
...     700: 0.2852
... }
>>> sd = SpectralDistribution(data)
>>> illuminant = ILLUMINANTS_SDS['D65']
>>> sd_to_XYZ(sd, cmfs, illuminant)
... 
array([ 10.8399031...,   9.6840375...,   6.2164159...])
>>> sd_to_XYZ(sd, cmfs, illuminant, use_practice_range=False)
... 
array([ 10.8399852...,   9.6840602...,   6.2164085...])
>>> sd_to_XYZ(sd, cmfs, illuminant, method='Integration')
... 
array([ 10.8401846...,   9.6837311...,   6.2120912...])