diff --git a/colour/volume/tests/test_macadam_limits.py b/colour/volume/tests/test_macadam_limits.py deleted file mode 100644 index eb4fbefcf..000000000 --- a/colour/volume/tests/test_macadam_limits.py +++ /dev/null @@ -1,68 +0,0 @@ -"""Define the unit tests for the :mod:`colour.volume.macadam_limits` module.""" - -from itertools import product - -import numpy as np - -from colour.utilities import ignore_numpy_errors -from colour.volume import is_within_macadam_limits - -__author__ = "Colour Developers" -__copyright__ = "Copyright 2013 Colour Developers" -__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" -__maintainer__ = "Colour Developers" -__email__ = "colour-developers@colour-science.org" -__status__ = "Production" - -__all__ = [ - "TestIsWithinMacadamLimits", -] - - -class TestIsWithinMacadamLimits: - """ - Define :func:`colour.volume.macadam_limits.is_within_macadam_limits` - definition unit tests methods. - """ - - def test_is_within_macadam_limits(self): - """ - Test :func:`colour.volume.macadam_limits.is_within_macadam_limits` - definition. - """ - - assert is_within_macadam_limits(np.array([0.3205, 0.4131, 0.5100]), "A") - - assert not is_within_macadam_limits(np.array([0.0005, 0.0031, 0.0010]), "A") - - assert is_within_macadam_limits(np.array([0.4325, 0.3788, 0.1034]), "C") - - assert not is_within_macadam_limits(np.array([0.0025, 0.0088, 0.0340]), "C") - - def test_n_dimensional_is_within_macadam_limits(self): - """ - Test :func:`colour.volume.macadam_limits.is_within_macadam_limits` - definition n-dimensional arrays support. - """ - - a = np.array([0.3205, 0.4131, 0.5100]) - b = is_within_macadam_limits(a, "A") - - a = np.tile(a, (6, 1)) - b = np.tile(b, 6) - np.testing.assert_allclose(is_within_macadam_limits(a, "A"), b) - - a = np.reshape(a, (2, 3, 3)) - b = np.reshape(b, (2, 3)) - np.testing.assert_allclose(is_within_macadam_limits(a, "A"), b) - - @ignore_numpy_errors - def test_nan_is_within_macadam_limits(self): - """ - Test :func:`colour.volume.macadam_limits.is_within_macadam_limits` - definition nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = np.array(list(set(product(cases, repeat=3)))) - is_within_macadam_limits(cases, "A") diff --git a/colour/volume/tests/test_pointer_gamut.py b/colour/volume/tests/test_pointer_gamut.py deleted file mode 100644 index f9e4be108..000000000 --- a/colour/volume/tests/test_pointer_gamut.py +++ /dev/null @@ -1,68 +0,0 @@ -"""Define the unit tests for the :mod:`colour.volume.pointer_gamut` module.""" - -from itertools import product - -import numpy as np - -from colour.utilities import ignore_numpy_errors -from colour.volume import is_within_pointer_gamut - -__author__ = "Colour Developers" -__copyright__ = "Copyright 2013 Colour Developers" -__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" -__maintainer__ = "Colour Developers" -__email__ = "colour-developers@colour-science.org" -__status__ = "Production" - -__all__ = [ - "TestIsWithinPointerGamut", -] - - -class TestIsWithinPointerGamut: - """ - Define :func:`colour.volume.pointer_gamut.is_within_pointer_gamut` - definition unit tests methods. - """ - - def test_is_within_pointer_gamut(self): - """ - Test :func:`colour.volume.pointer_gamut.is_within_pointer_gamut` - definition. - """ - - assert is_within_pointer_gamut(np.array([0.3205, 0.4131, 0.5100])) - - assert not is_within_pointer_gamut(np.array([0.0005, 0.0031, 0.0010])) - - assert is_within_pointer_gamut(np.array([0.4325, 0.3788, 0.1034])) - - assert not is_within_pointer_gamut(np.array([0.0025, 0.0088, 0.0340])) - - def test_n_dimensional_is_within_pointer_gamut(self): - """ - Test :func:`colour.volume.pointer_gamut.is_within_pointer_gamut` - definition n-dimensional arrays support. - """ - - a = np.array([0.3205, 0.4131, 0.5100]) - b = is_within_pointer_gamut(a) - - a = np.tile(a, (6, 1)) - b = np.tile(b, 6) - np.testing.assert_allclose(is_within_pointer_gamut(a), b) - - a = np.reshape(a, (2, 3, 3)) - b = np.reshape(b, (2, 3)) - np.testing.assert_allclose(is_within_pointer_gamut(a), b) - - @ignore_numpy_errors - def test_nan_is_within_pointer_gamut(self): - """ - Test :func:`colour.volume.pointer_gamut.is_within_pointer_gamut` - definition nan support. - """ - - cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] - cases = np.array(list(set(product(cases, repeat=3)))) - is_within_pointer_gamut(cases) diff --git a/colour/volume/tests/test_rgb.py b/colour/volume/tests/test_rgb.py deleted file mode 100644 index d92949b54..000000000 --- a/colour/volume/tests/test_rgb.py +++ /dev/null @@ -1,212 +0,0 @@ -""" -Define the unit tests for the :mod:`colour.volume.rgb` module. - -Notes ------ -The MonteCarlo sampling based unit tests are assuming that -:func:`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: - -References ----------- -- :cite:`Laurent2012a` : 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 -""" - - -import numpy as np - -from colour.constants import TOLERANCE_ABSOLUTE_TESTS -from colour.models import ( - RGB_COLOURSPACE_ACES2065_1, - RGB_COLOURSPACE_BT709, - RGB_COLOURSPACE_BT2020, -) -from colour.utilities import disable_multiprocessing -from colour.volume import ( - RGB_colourspace_limits, - RGB_colourspace_pointer_gamut_coverage_MonteCarlo, - RGB_colourspace_visible_spectrum_coverage_MonteCarlo, - RGB_colourspace_volume_coverage_MonteCarlo, - RGB_colourspace_volume_MonteCarlo, - is_within_pointer_gamut, -) - -__author__ = "Colour Developers" -__copyright__ = "Copyright 2013 Colour Developers" -__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" -__maintainer__ = "Colour Developers" -__email__ = "colour-developers@colour-science.org" -__status__ = "Production" - -__all__ = [ - "TestRGB_colourspaceLimits", - "TestRGB_colourspaceVolumeMonteCarlo", - "TestRGB_colourspace_volume_coverage_MonteCarlo", - "TestRGB_colourspacePointerGamutCoverageMonteCarlo", - "TestRGB_colourspaceVisibleSpectrumCoverageMonteCarlo", -] - - -class TestRGB_colourspaceLimits: - """ - Define :func:`colour.volume.rgb.RGB_colourspace_limits` definition unit - tests methods. - """ - - def test_RGB_colourspace_limits(self): - """Test :func:`colour.volume.rgb.RGB_colourspace_limits` definition.""" - - np.testing.assert_allclose( - RGB_colourspace_limits(RGB_COLOURSPACE_BT709), - np.array( - [ - [0.00000000, 100.00000000], - [-86.18159689, 98.23744381], - [-107.85546554, 94.48384002], - ] - ), - atol=TOLERANCE_ABSOLUTE_TESTS, - ) - - np.testing.assert_allclose( - RGB_colourspace_limits(RGB_COLOURSPACE_BT2020), - np.array( - [ - [0.00000000, 100.00000000], - [-172.32005590, 130.52657313], - [-120.27412558, 136.88564561], - ] - ), - atol=TOLERANCE_ABSOLUTE_TESTS, - ) - - np.testing.assert_allclose( - RGB_colourspace_limits(RGB_COLOURSPACE_ACES2065_1), - np.array( - [ - [-65.15706201, 102.72462756], - [-380.86283223, 281.23227495], - [-284.75355519, 177.11142683], - ] - ), - atol=TOLERANCE_ABSOLUTE_TESTS, - ) - - -class TestRGB_colourspaceVolumeMonteCarlo: - """ - Define :func:`colour.volume.rgb.RGB_colourspace_volume_MonteCarlo` - definition unit tests methods. - - References - ---------- - :cite:`Laurent2012a` - """ - - @disable_multiprocessing() - def test_RGB_colourspace_volume_MonteCarlo(self): - """ - Test :func:`colour.volume.rgb.RGB_colourspace_volume_MonteCarlo` - definition. - """ - - np.testing.assert_allclose( - RGB_colourspace_volume_MonteCarlo( - RGB_COLOURSPACE_BT709, - 10e3, - random_state=np.random.RandomState(2), - ) - * 1e-6, - 821700.0 * 1e-6, - atol=1, - ) - - -class TestRGB_colourspace_volume_coverage_MonteCarlo: - """ - Define :func:`colour.volume.rgb.\ -RGB_colourspace_volume_coverage_MonteCarlo` definition unit tests methods. - - References - ---------- - :cite:`Laurent2012a` - """ - - def test_RGB_colourspace_volume_coverage_MonteCarlo(self): - """ - Test :func:`colour.volume.rgb.\ -RGB_colourspace_volume_coverage_MonteCarlo` definition. - """ - - np.testing.assert_allclose( - RGB_colourspace_volume_coverage_MonteCarlo( - RGB_COLOURSPACE_BT709, - is_within_pointer_gamut, - 10e3, - random_state=np.random.RandomState(2), - ), - 81.044349070100140, - atol=TOLERANCE_ABSOLUTE_TESTS, - ) - - -class TestRGB_colourspacePointerGamutCoverageMonteCarlo: - """ - Define :func:`colour.volume.rgb.\ -RGB_colourspace_pointer_gamut_coverage_MonteCarlo` definition unit tests - methods. - - References - ---------- - :cite:`Laurent2012a` - """ - - def test_RGB_colourspace_pointer_gamut_coverage_MonteCarlo(self): - """ - Test :func:`colour.volume.rgb.\ -RGB_colourspace_pointer_gamut_coverage_MonteCarlo` definition. - """ - - np.testing.assert_allclose( - RGB_colourspace_pointer_gamut_coverage_MonteCarlo( - RGB_COLOURSPACE_BT709, - 10e3, - random_state=np.random.RandomState(2), - ), - 81.044349070100140, - atol=TOLERANCE_ABSOLUTE_TESTS, - ) - - -class TestRGB_colourspaceVisibleSpectrumCoverageMonteCarlo: - """ - Define :func:`colour.volume.rgb.\ -RGB_colourspace_visible_spectrum_coverage_MonteCarlo` definition unit tests - methods. - - References - ---------- - :cite:`Laurent2012a` - """ - - def test_RGB_colourspace_visible_spectrum_coverage_MonteCarlo(self): - """ - Test :func:`colour.volume.rgb.\ -RGB_colourspace_visible_spectrum_coverage_MonteCarlo` definition. - """ - - np.testing.assert_allclose( - RGB_colourspace_visible_spectrum_coverage_MonteCarlo( - RGB_COLOURSPACE_BT709, - 10e3, - random_state=np.random.RandomState(2), - ), - 46.931407942238266, - atol=TOLERANCE_ABSOLUTE_TESTS, - )