jaxlayerlumos.colors.composite

Composite color transformation functions for spectral data.

This module provides high-level functions that combine spectral-to-XYZ conversion with color space transformations to directly convert spectral data to various color spaces in a single function call.

jaxlayerlumos.colors.composite.spectrum_to_Lab(wavelengths, values, str_color_space='cie1931', str_illuminant='d65')

Convert spectral data directly to CIE Lab color space.

This is a convenience function that combines spectrum_to_XYZ and XYZ_to_Lab to directly convert spectral data to CIE Lab color space.

Parameters:
  • wavelengths (jnp.ndarray) – Wavelengths in meters.

  • values (jnp.ndarray) – Spectral values (reflectance, transmittance, etc.).

  • str_color_space (str, optional) – Color space for color matching functions. Defaults to “cie1931”.

  • str_illuminant (str, optional) – Illuminant name. Defaults to “d65”.

Returns:

CIE Lab values [L, a, b].

Return type:

jnp.ndarray

jaxlayerlumos.colors.composite.spectrum_to_sRGB(wavelengths, values, str_color_space='cie1931', str_illuminant='d65', use_clipping=False)

Convert spectral data directly to sRGB color space.

This is a convenience function that combines spectrum_to_XYZ and XYZ_to_sRGB to directly convert spectral data to sRGB color space.

Parameters:
  • wavelengths (jnp.ndarray) – Wavelengths in meters.

  • values (jnp.ndarray) – Spectral values (reflectance, transmittance, etc.).

  • str_color_space (str, optional) – Color space for color matching functions. Defaults to “cie1931”.

  • str_illuminant (str, optional) – Illuminant name. Defaults to “d65”.

  • use_clipping (bool, optional) – Whether to clip RGB values to [0, 1]. Defaults to False.

Returns:

sRGB values [R, G, B] in the range [0, 1].

Return type:

jnp.ndarray

jaxlayerlumos.colors.composite.spectrum_to_xyY(wavelengths, values, str_color_space='cie1931', str_illuminant='d65')

Convert spectral data directly to xyY chromaticity coordinates.

This is a convenience function that combines spectrum_to_XYZ and XYZ_to_xyY to directly convert spectral data to xyY chromaticity coordinates.

Parameters:
  • wavelengths (jnp.ndarray) – Wavelengths in meters.

  • values (jnp.ndarray) – Spectral values (reflectance, transmittance, etc.).

  • str_color_space (str, optional) – Color space for color matching functions. Defaults to “cie1931”.

  • str_illuminant (str, optional) – Illuminant name. Defaults to “d65”.

Returns:

xyY chromaticity coordinates [x, y, Y].

Return type:

jnp.ndarray