colour.RGB_colourspace_volume_coverage_MonteCarlo#

colour.RGB_colourspace_volume_coverage_MonteCarlo(colourspace: RGB_Colourspace, coverage_sampler: Callable, samples: int = 1000000, random_generator: Callable = random_triplet_generator, random_state: Optional[RandomState] = None) float[source]#

Return given RGB colourspace percentage coverage of an arbitrary volume.

Parameters:
  • colourspace (RGB_Colourspace) – RGB colourspace to compute the volume coverage percentage.

  • coverage_sampler (Callable) – Python object responsible for checking the volume coverage.

  • samples (int) – Samples count.

  • random_generator (Callable) – Random triplet generator providing the random samples.

  • random_state (Optional[RandomState]) – Mersenne Twister pseudo-random number generator to use in the random number generator.

Returns:

Percentage coverage of volume.

Return type:

numpy.floating

Examples

>>> from colour.models import RGB_COLOURSPACE_sRGB as sRGB
>>> prng = np.random.RandomState(2)
>>> RGB_colourspace_volume_coverage_MonteCarlo(
...     sRGB, is_within_pointer_gamut, 10e3, random_state=prng
... )
... 
81...