def test_n_dimensional_RGB_to_ICTCP(self): """ Tests :func:`colour.models.rgb.ictpt.RGB_to_ICTCP` definition n-dimensions support. """ RGB = np.array([0.35181454, 0.26934757, 0.21288023]) ICTCP = np.array([0.09554079, -0.00890639, 0.01389286]) np.testing.assert_almost_equal( RGB_to_ICTCP(RGB), ICTCP, decimal=7) RGB = np.tile(RGB, (6, 1)) ICTCP = np.tile(ICTCP, (6, 1)) np.testing.assert_almost_equal( RGB_to_ICTCP(RGB), ICTCP, decimal=7) RGB = np.reshape(RGB, (2, 3, 3)) ICTCP = np.reshape(ICTCP, (2, 3, 3)) np.testing.assert_almost_equal( RGB_to_ICTCP(RGB), ICTCP, decimal=7)
def test_domain_range_scale_RGB_to_ICTCP(self): """ Tests :func:`colour.models.rgb.ictpt.RGB_to_ICTCP` definition domain and range scale support. """ RGB = np.array([0.45620519, 0.03081071, 0.04091952]) ICTCP = RGB_to_ICTCP(RGB) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal(RGB_to_ICTCP(RGB * factor), ICTCP * factor, decimal=7)
def test_n_dimensional_RGB_to_ICTCP(self): """ Tests :func:`colour.models.rgb.ictpt.RGB_to_ICTCP` definition n-dimensional support. """ RGB = np.array([0.45620519, 0.03081071, 0.04091952]) ICTCP = RGB_to_ICTCP(RGB) RGB = np.tile(RGB, (6, 1)) ICTCP = np.tile(ICTCP, (6, 1)) np.testing.assert_almost_equal(RGB_to_ICTCP(RGB), ICTCP, decimal=7) RGB = np.reshape(RGB, (2, 3, 3)) ICTCP = np.reshape(ICTCP, (2, 3, 3)) np.testing.assert_almost_equal(RGB_to_ICTCP(RGB), ICTCP, decimal=7)
def test_RGB_to_ICTCP(self): """ Tests :func:`colour.models.rgb.ictpt.RGB_to_ICTCP` definition. """ np.testing.assert_almost_equal( RGB_to_ICTCP(np.array([0.35181454, 0.26934757, 0.21288023])), np.array([0.09554079, -0.00890639, 0.01389286]), decimal=7) np.testing.assert_almost_equal( RGB_to_ICTCP(np.array([0.35181454, 0.26934757, 0.21288023]), 4000), np.array([0.13385341, -0.01151831, 0.01780776]), decimal=7) np.testing.assert_almost_equal( RGB_to_ICTCP(np.array([0.35181454, 0.26934757, 0.21288023]), 1000), np.array([0.21071460, -0.01586417, 0.02421400]), decimal=7)
def test_RGB_to_ICTCP(self): """ Tests :func:`colour.models.rgb.ictpt.RGB_to_ICTCP` definition. """ np.testing.assert_almost_equal( RGB_to_ICTCP(np.array([0.45620519, 0.03081071, 0.04091952])), np.array([0.07351364, 0.00475253, 0.09351596]), decimal=7) np.testing.assert_almost_equal( RGB_to_ICTCP(np.array([0.45620519, 0.03081071, 0.04091952]), 4000), np.array([0.10516931, 0.00514031, 0.12318730]), decimal=7) np.testing.assert_almost_equal( RGB_to_ICTCP(np.array([0.45620519, 0.03081071, 0.04091952]), 1000), np.array([0.17079612, 0.00485580, 0.17431356]), decimal=7)
def test_nan_RGB_to_ICTCP(self): """ Tests :func:`colour.models.rgb.ictpt.RGB_to_ICTCP` 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: RGB = np.array(case) RGB_to_ICTCP(RGB)