colour.colorimetry.handle_spectral_arguments#

colour.colorimetry.handle_spectral_arguments(cmfs: MultiSpectralDistributions | None = None, illuminant: SpectralDistribution | None = None, cmfs_default: str = 'CIE 1931 2 Degree Standard Observer', illuminant_default: str = 'D65', shape_default: SpectralShape = SPECTRAL_SHAPE_DEFAULT, issue_runtime_warnings: bool = True) Tuple[MultiSpectralDistributions, SpectralDistribution][source]#

Handle spectral arguments for various Colour definitions that perform spectral computations.

  • If cmfs is not specified, select one according to cmfs_default. The returned colour matching functions adopt the spectral shape specified by shape_default.

  • If illuminant is not specified, select one according to illuminant_default. The returned illuminant adopts the spectral shape of the returned colour matching functions.

  • If illuminant is specified, align the returned illuminant’s spectral shape to that of the returned colour matching functions.

Parameters:
  • cmfs (MultiSpectralDistributions | None) – Standard observer colour matching functions, default to the CIE 1931 2 Degree Standard Observer.

  • illuminant (SpectralDistribution | None) – Illuminant spectral distribution, default to CIE Standard Illuminant D65.

  • cmfs_default (str) – Default colour matching functions to use if cmfs is not specified.

  • illuminant_default (str) – Default illuminant to use if illuminant is not specified.

  • shape_default (SpectralShape) – Default spectral shape to align the final colour matching functions and illuminant.

  • issue_runtime_warnings (bool) – Whether to issue runtime warnings.

Returns:

Colour matching functions and illuminant.

Return type:

tuple

Examples

>>> cmfs, illuminant = handle_spectral_arguments()
>>> cmfs.name, cmfs.shape, illuminant.name, illuminant.shape
('CIE 1931 2 Degree Standard Observer', SpectralShape(360.0, 780.0, 1.0), 'D65', SpectralShape(360.0, 780.0, 1.0))
>>> cmfs, illuminant = handle_spectral_arguments(
...     shape_default=SpectralShape(400, 700, 20)
... )
>>> cmfs.name, cmfs.shape, illuminant.name, illuminant.shape
('CIE 1931 2 Degree Standard Observer', SpectralShape(400.0, 700.0, 20.0), 'D65', SpectralShape(400.0, 700.0, 20.0))