colour.recovery.optimise_gaussian_basis_parameters#
- colour.recovery.optimise_gaussian_basis_parameters(shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, colourspace: RGB_Colourspace | None = None, cmfs: MultiSpectralDistributions | None = None, illuminant: SpectralDistribution | None = None, initial_peak_wavelengths: dict | None = None, initial_fwhm: dict | None = None, initial_exponent: dict | None = None, smoothness_penalty_weight: float = 1.0, optimisation_kwargs: dict | None = None) tuple[dict, dict, dict][source]#
Optimise Gaussian basis parameters for colorimetric accuracy.
This function finds the peak wavelengths, FWHM values, and exponents that minimize the colorimetric error between the basis spectra tristimulus values and the target RGB colourspace primaries, as well as the \(\Delta E^*_{ab}\) error on ColorChecker patches.
The secondary colours are modeled based on their spectral characteristics:
Cyan: Peak in blue-green region (absorbs red), modeled as a Gaussian peak clamped left, similar to blue.
Yellow: Peak in red-green region (absorbs blue), modeled as a Gaussian peak clamped right, similar to red.
Magenta: High at red and blue, low at green (absorbs green), modeled as an inverted Gaussian (valley at green wavelengths).
- Parameters:
shape (SpectralShape) – Spectral shape for the distributions.
colourspace (RGB_Colourspace | None) – RGB colourspace for the optimization. Default is
RGB_COLOURSPACE_GAUSSIANwhich uses sRGB primaries and illuminant E whitepoint.cmfs (MultiSpectralDistributions | None) – Standard observer colour matching functions used for computing the spectral tristimulus values. Default is CIE 1931 2 Degree Standard Observer.
illuminant (SpectralDistribution | None) – Illuminant spectral distribution for XYZ integration. If not provided, defaults to the illuminant matching the colourspace’s whitepoint name, or illuminant E if not found.
initial_peak_wavelengths (dict | None) – Initial peak wavelengths for optimization. Default includes RGB peaks plus cyan, magenta, and yellow peak positions.
initial_fwhm (dict | None) – Initial FWHM values for optimization. Default includes RGB FWHM plus cyan, magenta, and yellow FWHM values.
initial_exponent (dict | None) – Initial exponents for super-Gaussian per basis function. Default 2.0 gives standard Gaussian. Values > 2 give flatter peaks.
smoothness_penalty_weight (float) – Weight for the smoothness penalty that penalizes deviation from standard Gaussian (exponent=2). Higher values produce smoother curves closer to standard Gaussians.
optimisation_kwargs (dict | None) – Parameters for
scipy.optimize.minimize()definition.
- Returns:
Tuple of (peak_wavelengths, fwhm, exponent) with optimized values. All three are dictionaries with entries for red, green, blue, cyan, magenta, and yellow.
- Return type:
References
[Smi99]