colour.colorimetry.msds_to_XYZ_ASTME308#

colour.colorimetry.msds_to_XYZ_ASTME308(msds: MultiSpectralDistributions, cmfs: Optional[MultiSpectralDistributions] = None, illuminant: Optional[SpectralDistribution] = None, k: Optional[Number] = None, use_practice_range: bool = True, mi_5nm_omission_method: bool = True, mi_20nm_interpolation_method: bool = True) ndarray[source]#

Convert given multi-spectral distributions to CIE XYZ tristimulus values using given colour matching functions and illuminant according to practise ASTM E308-15 method.

Parameters:
  • msds (MultiSpectralDistributions) – Multi-spectral distributions.

  • 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.

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

  • mi_5nm_omission_method (bool) – 5 nm measurement intervals multi-spectral distributions 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) – 20 nm measurement intervals multi-spectral distributions conversion to tristimulus values will use a dedicated interpolation method instead of a table of tristimulus weighting factors.

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.

References

[WS00c]

Examples

>>> from colour import MSDS_CMFS, SDS_ILLUMINANTS
>>> cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"]
>>> illuminant = SDS_ILLUMINANTS["D65"]
>>> shape = SpectralShape(400, 700, 60)
>>> data = np.array(
...     [
...         [
...             0.0137,
...             0.0159,
...             0.0096,
...             0.0111,
...             0.0179,
...             0.1057,
...             0.0433,
...             0.0258,
...             0.0248,
...             0.0186,
...             0.0310,
...             0.0473,
...         ],
...         [
...             0.0913,
...             0.3145,
...             0.2582,
...             0.0709,
...             0.2971,
...             0.4620,
...             0.2683,
...             0.0831,
...             0.1203,
...             0.1292,
...             0.1682,
...             0.3221,
...         ],
...         [
...             0.0152,
...             0.0842,
...             0.4139,
...             0.0220,
...             0.5630,
...             0.1918,
...             0.2373,
...             0.0430,
...             0.0054,
...             0.0079,
...             0.3719,
...             0.2268,
...         ],
...         [
...             0.0281,
...             0.0907,
...             0.2228,
...             0.1249,
...             0.2375,
...             0.5625,
...             0.0518,
...             0.3230,
...             0.0065,
...             0.4006,
...             0.0861,
...             0.3161,
...         ],
...         [
...             0.1918,
...             0.7103,
...             0.0041,
...             0.1817,
...             0.0024,
...             0.4209,
...             0.0118,
...             0.2302,
...             0.1860,
...             0.9404,
...             0.0041,
...             0.1124,
...         ],
...         [
...             0.0430,
...             0.0437,
...             0.3744,
...             0.0020,
...             0.5819,
...             0.0027,
...             0.0823,
...             0.0081,
...             0.3625,
...             0.3213,
...             0.7849,
...             0.0024,
...         ],
...     ]
... )
>>> msds = MultiSpectralDistributions(data, shape)
>>> msds = msds.align(SpectralShape(400, 700, 20))
>>> msds_to_XYZ_ASTME308(msds, cmfs, illuminant)
... 
array([[  7.5052758...,   3.9557516...,   8.38929  ...],
       [ 26.9408494...,  15.0987746...,  28.6631260...],
       [ 16.7047370...,  28.2089815...,  25.6556751...],
       [ 11.5711808...,   8.6445071...,   6.5587827...],
       [ 18.7428858...,  35.0626352...,  30.1778517...],
       [ 45.1224886...,  39.6238997...,  43.5813345...],
       [  8.1786985...,  13.0950215...,  25.9326459...],
       [ 22.4462888...,  19.3115133...,   7.9304333...],
       [  6.5764361...,   2.5305945...,  11.07253  ...],
       [ 43.9113380...,  28.0003541...,  11.6852531...],
       [  8.5496209...,  19.6913570...,  17.7400079...],
       [ 23.8866733...,  26.2147704...,  30.6297684...]])

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

>>> msds_to_XYZ_ASTME308(msds)
... 
array([[  8.2439318...,   4.2617641...,   7.5977409...],
       [ 29.6290771...,  16.1443076...,  25.8640484...],
       [ 16.6819067...,  27.2271403...,  22.9490590...],
       [ 12.5543694...,   9.0705685...,   5.9516323...],
       [ 18.5921357...,  33.6508573...,  26.9511144...],
       [ 47.6698072...,  40.4630866...,  39.5612904...],
       [  7.8336896...,  12.3711768...,  23.3654245...],
       [ 24.1486630...,  20.0621956...,   7.2438655...],
       [  7.2323703...,   2.8033217...,  10.0510790...],
       [ 48.7322793...,  30.2614779...,  10.6377135...],
       [  8.3365770...,  18.6690888...,  15.8517212...],
       [ 24.6240657...,  26.0805317...,  27.6706915...]])