colour.is_within_visible_spectrum

colour.is_within_visible_spectrum(XYZ, cmfs=XYZ_ColourMatchingFunctions(name='CIE 1931 2 Degree Standard Observer', ...), 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].

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)