colour.volume.spectrum Module

Visible Spectrum Volume Computations

Defines objects related to visible spectrum volume computations.

colour.volume.spectrum.is_within_visible_spectrum(XYZ, cmfs=<colour.colorimetry.cmfs.XYZ_ColourMatchingFunctions object at 0x2abef8d86c10>, tolerance=None)[source]

Returns if given CIE XYZ tristimulus values are within visible spectrum volume / given colour matching functions volume.

Parameters:
  • XYZ (array_like) – CIE XYZ tristimulus values.
  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.
  • tolerance (numeric, optional) – Tolerance allowed in the inside-triangle check.
Returns:

Is within visible spectrum.

Return type:

bool

Notes

  • Input CIE XYZ tristimulus values are in domain [0, 1].
  • This definition requires scipy to be installed.

Examples

>>> import numpy as np
>>> is_within_visible_spectrum(np.array([0.3205, 0.4131, 0.51]))
array(True, dtype=bool)
>>> a = np.array([[0.3205, 0.4131, 0.51],
...               [-0.0005, 0.0031, 0.001]])
>>> is_within_visible_spectrum(a)
array([ True, False], dtype=bool)