Exemplo n.º 1
0
    def test_n_dimensional_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition
        n-dimensional arrays support.
        """

        LCHuv = np.array([37.98562910, 28.83419279, 182.69946404])
        Luv = np.array([37.98562910, -28.80219593, -1.35800706])
        np.testing.assert_almost_equal(
            LCHuv_to_Luv(LCHuv),
            Luv,
            decimal=7)

        Luv = np.tile(Luv, (6, 1))
        LCHuv = np.tile(LCHuv, (6, 1))
        np.testing.assert_almost_equal(
            LCHuv_to_Luv(LCHuv),
            Luv,
            decimal=7)

        Luv = np.reshape(Luv, (2, 3, 3))
        LCHuv = np.reshape(LCHuv, (2, 3, 3))
        np.testing.assert_almost_equal(
            LCHuv_to_Luv(LCHuv),
            Luv,
            decimal=7)
Exemplo n.º 2
0
    def test_n_dimensional_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition
        n-dimensional arrays support.
        """

        LCHuv = np.array([37.98562910, 28.82419933, 182.69604747])
        Luv = np.array([37.98562910, -28.79229446, -1.35581950])
        np.testing.assert_almost_equal(
            LCHuv_to_Luv(LCHuv),
            Luv,
            decimal=7)

        Luv = np.tile(Luv, (6, 1))
        LCHuv = np.tile(LCHuv, (6, 1))
        np.testing.assert_almost_equal(
            LCHuv_to_Luv(LCHuv),
            Luv,
            decimal=7)

        Luv = np.reshape(Luv, (2, 3, 3))
        LCHuv = np.reshape(LCHuv, (2, 3, 3))
        np.testing.assert_almost_equal(
            LCHuv_to_Luv(LCHuv),
            Luv,
            decimal=7)
Exemplo n.º 3
0
    def test_domain_range_scale_LCHuv_to_Lab(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition domain and
        range scale support.
        """

        LCHuv = np.array([41.52787529, 98.44997950, 10.38816348])
        Luv = LCHuv_to_Luv(LCHuv)

        d_r = (('reference', 1, 1), (1, np.array([0.01, 0.01, 1 / 360]), 0.01),
               (100, np.array([1, 1, 1 / 3.6]), 1))
        for scale, factor_a, factor_b in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(LCHuv_to_Luv(LCHuv * factor_a),
                                               Luv * factor_b,
                                               decimal=7)
Exemplo n.º 4
0
    def test_n_dimensional_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition
        n-dimensional arrays support.
        """

        LCHuv = np.array([41.52787529, 98.44997950, 10.38816348])
        Luv = LCHuv_to_Luv(LCHuv)

        Luv = np.tile(Luv, (6, 1))
        LCHuv = np.tile(LCHuv, (6, 1))
        np.testing.assert_almost_equal(LCHuv_to_Luv(LCHuv), Luv, decimal=7)

        Luv = np.reshape(Luv, (2, 3, 3))
        LCHuv = np.reshape(LCHuv, (2, 3, 3))
        np.testing.assert_almost_equal(LCHuv_to_Luv(LCHuv), Luv, decimal=7)
Exemplo n.º 5
0
    def test_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition.
        """

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([41.52787529, 98.44997950, 10.38816348])),
            np.array([41.52787529, 96.83626054, 17.75210149]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([55.11636304, 57.97736624, 130.42180076])),
            np.array([55.11636304, -37.59308176, 44.13768458]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([29.80565520, 65.98464238, 260.43611196])),
            np.array([29.80565520, -10.96316802, -65.06751860]),
            decimal=7)
Exemplo n.º 6
0
    def test_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition.
        """

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([100, 31.45086945, 248.99237865])),
            np.array([100., -11.27488915, -29.36041662]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([100, 339.2969064, 12.34702048])),
            np.array([100., 331.44911128, 72.55258319]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([100, 116.74777618, 251.94795555])),
            np.array([100., -36.17788915, -111.00091702]),
            decimal=7)
Exemplo n.º 7
0
    def test_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition.
        """

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([37.98562910, 28.83419279, 182.69946404])),
            np.array([37.98562910, -28.80219593, -1.35800706]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([65.70971880, 91.28765027, 17.21092723])),
            np.array([65.70971880, 87.19996716, 27.01112399]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([50.86223896, 61.92004176, 12.24936515])),
            np.array([50.86223896, 60.51033649, 13.13737985]),
            decimal=7)
Exemplo n.º 8
0
    def test_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` definition.
        """

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([37.98562910, 28.82419933, 182.69604747])),
            np.array([37.98562910, -28.79229446, -1.35581950]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([65.70971880, 91.30513117, 17.21001524])),
            np.array([65.70971880, 87.21709531, 27.01490816]),
            decimal=7)

        np.testing.assert_almost_equal(
            LCHuv_to_Luv(np.array([50.86223896, 61.93361932, 12.24941097])),
            np.array([50.86223896, 60.52359443, 13.14030896]),
            decimal=7)
Exemplo n.º 9
0
    def test_nan_LCHuv_to_Luv(self):
        """
        Tests :func:`colour.models.cie_luv.LCHuv_to_Luv` 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:
            LCHuv = np.array(case)
            LCHuv_to_Luv(LCHuv)