コード例 #1
0
ファイル: tests_delta_e.py プロジェクト: brehm/colour
    def test_n_dimensional_delta_E_CMC(self):
        """
        Tests :func:`colour.difference.delta_e.delta_E_CMC` definition
        n-dimensional arrays support.
        """

        Lab1 = np.array([100.00000000, 21.57210357, 272.22819350])
        Lab2 = np.array([100.00000000, 426.67945353, 72.39590835])
        delta_E = 172.70477128656015
        np.testing.assert_almost_equal(
            delta_E_CMC(Lab1, Lab2),
            delta_E,
            decimal=7)

        Lab1 = np.tile(Lab1, (6, 1))
        Lab2 = np.tile(Lab2, (6, 1))
        delta_E = np.tile(delta_E, 6)
        np.testing.assert_almost_equal(
            delta_E_CMC(Lab1, Lab2),
            delta_E,
            decimal=7)

        Lab1 = np.reshape(Lab1, (2, 3, 3))
        Lab2 = np.reshape(Lab2, (2, 3, 3))
        delta_E = np.reshape(delta_E, (2, 3))
        np.testing.assert_almost_equal(
            delta_E_CMC(Lab1, Lab2),
            delta_E,
            decimal=7)
コード例 #2
0
    def test_n_dimensional_delta_E_CMC(self):
        """
        Tests :func:`colour.difference.delta_e.delta_E_CMC` definition
        n-dimensional arrays support.
        """

        Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
        Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
        delta_E = 172.70477129
        np.testing.assert_almost_equal(delta_E_CMC(Lab_1, Lab_2),
                                       delta_E,
                                       decimal=7)

        Lab_1 = np.tile(Lab_1, (6, 1))
        Lab_2 = np.tile(Lab_2, (6, 1))
        delta_E = np.tile(delta_E, 6)
        np.testing.assert_almost_equal(delta_E_CMC(Lab_1, Lab_2),
                                       delta_E,
                                       decimal=7)

        Lab_1 = np.reshape(Lab_1, (2, 3, 3))
        Lab_2 = np.reshape(Lab_2, (2, 3, 3))
        delta_E = np.reshape(delta_E, (2, 3))
        np.testing.assert_almost_equal(delta_E_CMC(Lab_1, Lab_2),
                                       delta_E,
                                       decimal=7)
コード例 #3
0
    def test_nan_delta_E_CMC(self):
        """
        Tests :func:`colour.difference.delta_e.delta_E_CMC` definition nan
        support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=3))
        for case in cases:
            Lab_1 = np.array(case)
            Lab_2 = np.array(case)
            delta_E_CMC(Lab_1, Lab_2)
コード例 #4
0
ファイル: tests_delta_e.py プロジェクト: brehm/colour
    def test_nan_delta_E_CMC(self):
        """
        Tests :func:`colour.difference.delta_e.delta_E_CMC` definition nan
        support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=3))
        for case in cases:
            Lab1 = np.array(case)
            Lab2 = np.array(case)
            delta_E_CMC(Lab1, Lab2)
コード例 #5
0
    def test_domain_range_scale_delta_E_CMC(self):
        """
        Tests :func:`colour.difference.delta_e.delta_E_CMC` definition
        domain and range scale support.
        """

        Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
        Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
        delta_E = delta_E_CMC(Lab_1, Lab_2)

        d_r = (('reference', 1), (1, 0.01), (100, 1))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    delta_E_CMC(Lab_1 * factor, Lab_2 * factor),
                    delta_E,
                    decimal=7)
コード例 #6
0
ファイル: test_delta_e.py プロジェクト: colour-science/colour
    def test_domain_range_scale_delta_E_CMC(self):
        """
        Tests :func:`colour.difference.delta_e.delta_E_CMC` definition
        domain and range scale support.
        """

        Lab_1 = np.array([100.00000000, 21.57210357, 272.22819350])
        Lab_2 = np.array([100.00000000, 426.67945353, 72.39590835])
        delta_E = delta_E_CMC(Lab_1, Lab_2)

        d_r = (('reference', 1), (1, 0.01), (100, 1))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    delta_E_CMC(Lab_1 * factor, Lab_2 * factor),
                    delta_E,
                    decimal=7)
コード例 #7
0
ファイル: test_delta_e.py プロジェクト: colour-science/colour
    def test_delta_E_CMC(self):
        """Test :func:`colour.difference.delta_e.delta_E_CMC` definition."""

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 426.67945353, 72.39590835]),
            ),
            172.70477129,
            places=7,
        )

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 74.05216981, 276.45318193]),
            ),
            20.59732717,
            places=7,
        )

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 8.32281957, -73.58297716]),
            ),
            121.71841479,
            places=7,
        )

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 426.67945353, 72.39590835]),
                l=1,
            ),  # noqa
            172.70477129,
            places=7,
        )

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 74.05216981, 276.45318193]),
                l=1,
            ),  # noqa
            20.59732717,
            places=7,
        )

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 8.32281957, -73.58297716]),
                l=1,
            ),  # noqa
            121.71841479,
            places=7,
        )
コード例 #8
0
ファイル: tests_delta_e.py プロジェクト: brehm/colour
    def test_delta_E_CMC(self):
        """
        Tests :func:`colour.difference.delta_e.delta_E_CMC` definition.
        """

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 426.67945353, 72.39590835])),
            172.704771287,
            places=7)

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 74.05216981, 276.45318193])),
            20.5973271674,
            places=7)

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 8.32281957, -73.58297716])),
            121.718414791,
            places=7)

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 426.67945353, 72.39590835]),
                l=1),
            172.704771287,
            places=7)

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 74.05216981, 276.45318193]),
                l=1),
            20.5973271674,
            places=7)

        self.assertAlmostEqual(
            delta_E_CMC(
                np.array([100.00000000, 21.57210357, 272.22819350]),
                np.array([100.00000000, 8.32281957, -73.58297716]),
                l=1),
            121.718414791,
            places=7)