color_matching_xyz#

colorsynth.color_matching_xyz(wavelength, axis=-1)[source]#

The CIE 1931 \(\overline{x}(\lambda)\), \(\overline{y}(\lambda)\), and \(\overline{z}(\lambda)\) color matching functions.

Stack the results of color_matching_x(), color_matching_y(), and color_matching_z() into a single array.

Parameters:
  • wavelength (Quantity) – the wavelengths at which to evaluate the color-matching function

  • axis (int) – the axis in the result along which the \(\overline{x}(\lambda)\), \(\overline{y}(\lambda)\), and \(\overline{z}(\lambda)\) arrays are stacked.

Return type:

Quantity

Examples

Plot \(\overline{x}(\lambda)\), \(\overline{y}(\lambda)\), and \(\overline{z}(\lambda)\) over the entire human visible wavelength range.

import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
import astropy.visualization
import colorsynth

wavelength = np.linspace(380, 780, num=101) * u.nm
xyz = colorsynth.color_matching_xyz(wavelength, axis=0)

with astropy.visualization.quantity_support():
    plt.figure()
    plt.plot(wavelength, xyz[0], color="red", label=r"$\overline{x}(\lambda)$")
    plt.plot(wavelength, xyz[1], color="green", label=r"$\overline{y}(\lambda)$")
    plt.plot(wavelength, xyz[2], color="blue", label=r"$\overline{z}(\lambda)$")
    plt.legend()
../_images/colorsynth.color_matching_xyz_0_0.png