colour.spectral_to_XYZ¶
-
colour.
spectral_to_XYZ
(spd, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...), illuminant=SpectralPowerDistribution(name='1 Constant', ...), method=u'ASTM E308-15', **kwargs)[source]¶ Converts given spectral power distribution to CIE XYZ tristimulus values using given colour matching functions, illuminant and method.
Parameters: - spd (SpectralPowerDistribution) – Spectral power distribution.
- cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.
- illuminant (SpectralPowerDistribution, optional) – Illuminant spectral power distribution.
- method (unicode, optional) – {‘ASTM E308-15’, ‘Integration’}, Computation method.
Other Parameters: - use_practice_range (bool, optional) – {
colour.colorimetry.spectral_to_XYZ_ASTME30815()
}, 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, optional) – {
colour.colorimetry.spectral_to_XYZ_ASTME30815()
}, 5 nm measurement intervals spectral power 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.spectral_to_XYZ_ASTME30815()
}, 20 nm measurement intervals spectral power distribution 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: ndarray, (3,)
Warning
The output range of that definition is non standard!
Notes
- Output CIE XYZ tristimulus values are in range [0, 100].
References
Examples
>>> from colour import ( ... CMFS, ILLUMINANTS_RELATIVE_SPDS, SpectralPowerDistribution) >>> 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 ... } >>> spd = SpectralPowerDistribution(data) >>> illuminant = ILLUMINANTS_RELATIVE_SPDS['D50'] >>> spectral_to_XYZ(spd, cmfs, illuminant) ... array([ 11.5290265..., 9.9502091..., 4.7098882...]) >>> spectral_to_XYZ(spd, cmfs, illuminant, use_practice_range=False) ... array([ 11.5291275..., 9.9502369..., 4.7098811...]) >>> spectral_to_XYZ(spd, cmfs, illuminant, method='Integration') ... array([ 11.5296285..., 9.9499467..., 4.7066079...])