colour.RGB_colourspace_volume_MonteCarlo#
- colour.RGB_colourspace_volume_MonteCarlo(colourspace: RGB_Colourspace, samples: int = 1000000, limits: ArrayLike = ([0, 100], [-150, 150], [-150, 150]), illuminant_Lab: ArrayLike = CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65'], chromatic_adaptation_transform: LiteralChromaticAdaptationTransform | str | None = 'CAT02', random_generator: Callable = random_triplet_generator, random_state: np.random.RandomState | None = None) float[source]#
Compute the specified RGB colourspace volume using the Monte Carlo method with multiprocessing.
- Parameters:
colourspace (RGB_Colourspace) – RGB colourspace to compute the volume of.
samples (int) – Sample count.
limits (ArrayLike) – CIE L*a*b* colourspace volume boundaries.
illuminant_Lab (ArrayLike) – CIE L*a*b* colourspace illuminant chromaticity coordinates.
chromatic_adaptation_transform (LiteralChromaticAdaptationTransform | str | None) – Chromatic adaptation method.
random_generator (Callable) – Random triplet generator providing the random samples within the CIE L*a*b* colourspace volume.
random_state (np.random.RandomState | None) – Mersenne Twister pseudo-random number generator to use in the random number generator.
- Returns:
RGB colourspace volume.
- Return type:
Notes
The doctest is assuming that
np.random.RandomState()definition will return the same sequence no matter which OS or Python version is used. There is however no formal promise about the prng sequence reproducibility of either Python or Numpy implementations: Laurent. (2012). Reproducibility of python pseudo-random numbers across systems and versions? Retrieved January 20, 2015, from http://stackoverflow.com/questions/8786084/reproducibility-of-python-pseudo-random-numbers-across-systems-and-versions
Examples
>>> from colour.models import RGB_COLOURSPACE_sRGB as sRGB >>> from colour.utilities import disable_multiprocessing >>> prng = np.random.RandomState(2) >>> with disable_multiprocessing(): ... RGB_colourspace_volume_MonteCarlo(sRGB, 10e3, random_state=prng) ... ... 8...