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 the spectral arguments of various Colour definitions performing spectral computations.

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

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

  • If illuminant is given, the returned illuminant spectral shape is aligned 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) – The default colour matching functions to use if cmfs is not given.

  • illuminant_default (str) – The default illuminant to use if illuminant is not given.

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

  • issue_runtime_warnings (bool) – Whether to issue the 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))