示例#1
0
    def test_n_dimensional_ICTCP_to_RGB(self):
        """
        Tests :func:`colour.models.rgb.ictpt.ICTCP_to_RGB` definition
        n-dimensions support.
        """

        ICTCP = np.array([0.09554079, -0.00890639, 0.01389286])
        RGB = np.array([0.35181454, 0.26934757, 0.21288023])
        np.testing.assert_almost_equal(
            ICTCP_to_RGB(ICTCP),
            RGB,
            decimal=7)

        ICTCP = np.tile(ICTCP, (6, 1))
        RGB = np.tile(RGB, (6, 1))
        np.testing.assert_almost_equal(
            ICTCP_to_RGB(ICTCP),
            RGB,
            decimal=7)

        ICTCP = np.reshape(ICTCP, (2, 3, 3))
        RGB = np.reshape(RGB, (2, 3, 3))
        np.testing.assert_almost_equal(
            ICTCP_to_RGB(ICTCP),
            RGB,
            decimal=7)
示例#2
0
    def test_domain_range_scale_ICTCP_to_RGB(self):
        """
        Tests :func:`colour.models.rgb.ictpt.ICTCP_to_RGB` definition domain
        and range scale support.
        """

        ICTCP = np.array([0.07351364, 0.00475253, 0.09351596])
        RGB = ICTCP_to_RGB(ICTCP)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(ICTCP_to_RGB(ICTCP * factor),
                                               RGB * factor,
                                               decimal=7)
示例#3
0
    def test_n_dimensional_ICTCP_to_RGB(self):
        """
        Tests :func:`colour.models.rgb.ictpt.ICTCP_to_RGB` definition
        n-dimensional support.
        """

        ICTCP = np.array([0.07351364, 0.00475253, 0.09351596])
        RGB = ICTCP_to_RGB(ICTCP)

        ICTCP = np.tile(ICTCP, (6, 1))
        RGB = np.tile(RGB, (6, 1))
        np.testing.assert_almost_equal(ICTCP_to_RGB(ICTCP), RGB, decimal=7)

        ICTCP = np.reshape(ICTCP, (2, 3, 3))
        RGB = np.reshape(RGB, (2, 3, 3))
        np.testing.assert_almost_equal(ICTCP_to_RGB(ICTCP), RGB, decimal=7)
示例#4
0
    def test_ICTCP_to_RGB(self):
        """
        Tests :func:`colour.models.rgb.ictpt.ICTCP_to_RGB` definition.
        """

        np.testing.assert_almost_equal(
            ICTCP_to_RGB(np.array([0.07351364, 0.00475253, 0.09351596])),
            np.array([0.45620519, 0.03081071, 0.04091952]),
            decimal=7)

        np.testing.assert_almost_equal(
            ICTCP_to_RGB(np.array([0.10516931, 0.00514031, 0.12318730]), 4000),
            np.array([0.45620519, 0.03081071, 0.04091952]),
            decimal=7)

        np.testing.assert_almost_equal(
            ICTCP_to_RGB(np.array([0.17079612, 0.00485580, 0.17431356]), 1000),
            np.array([0.45620519, 0.03081071, 0.04091952]),
            decimal=7)
示例#5
0
    def test_nan_ICTCP_to_RGB(self):
        """
        Tests :func:`colour.models.rgb.ictpt.ICTCP_to_RGB` 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:
            ICTCP = np.array(case)
            ICTCP_to_RGB(ICTCP)
示例#6
0
    def test_ICTCP_to_RGB(self):
        """
        Tests :func:`colour.models.rgb.ictpt.ICTCP_to_RGB` definition.
        """

        np.testing.assert_almost_equal(
            ICTCP_to_RGB(np.array([0.09554079, -0.00890639, 0.01389286])),
            np.array([0.35181454, 0.26934757, 0.21288023]),
            decimal=7)

        np.testing.assert_almost_equal(
            ICTCP_to_RGB(np.array([0.13385341, -0.01151831, 0.01780776]),
                         4000),
            np.array([0.35181454, 0.26934757, 0.21288023]),
            decimal=7)

        np.testing.assert_almost_equal(
            ICTCP_to_RGB(np.array([0.21071460, -0.01586417, 0.02421400]),
                         1000),
            np.array([0.35181454, 0.26934757, 0.21288023]),
            decimal=7)