def test_chromatic_adaptation_reverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ chromatic_adaptation_reverse_CMCCAT2000` definition. """ np.testing.assert_almost_equal(chromatic_adaptation_reverse_CMCCAT2000( np.array([19.52698326, 23.06833960, 24.97175229]), np.array([111.15, 100.00, 35.20]), np.array([94.81, 100.00, 107.30]), 200, 200), np.array([22.48, 22.74, 8.54]), decimal=7) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([17.90511171, 22.75299363, 3.79837384]), np.array([0.95045593, 1.00000000, 1.08905775]) * 100, np.array([1.09846607, 1.00000000, 0.35582280]) * 100, 100, 100), np.array([0.14222010, 0.23042768, 0.10495772]) * 100, decimal=7) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([6.76564344, 5.86585763, 18.40577315]), np.array([0.95045593, 1.00000000, 1.08905775]) * 100, np.array([0.99144661, 1.00000000, 0.67315942]) * 100, 100, 100), np.array([0.07818780, 0.06157201, 0.28099326]) * 100, decimal=7)
def test_chromatic_adaptation_reverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ chromatic_adaptation_reverse_CMCCAT2000` definition. """ np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([19.52698326, 23.06833960, 24.97175229]), np.array([111.15, 100.00, 35.20]), np.array([94.81, 100.00, 107.30]), 200, 200), np.array([22.48, 22.74, 8.54]), decimal=7) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([17.90511171, 22.75299363, 3.79837384]), np.array([0.95045593, 1.00000000, 1.08905775]) * 100, np.array([1.09846607, 1.00000000, 0.35582280]) * 100, 100, 100), np.array([0.14222010, 0.23042768, 0.10495772]) * 100, decimal=7) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([6.76564344, 5.86585763, 18.40577315]), np.array([0.95045593, 1.00000000, 1.08905775]) * 100, np.array([0.99144661, 1.00000000, 0.67315942]) * 100, 100, 100), np.array([0.07818780, 0.06157201, 0.28099326]) * 100, decimal=7)
def test_chromatic_adaptation_reverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ chromatic_adaptation_reverse_CMCCAT2000` definition. """ np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([8.01087299, 10.89423054, 26.89150177]), np.array([1.09846607, 1.00000000, 0.35582280]) * 100, np.array([0.95042855, 1.00000000, 1.08890037]) * 100, 100, 100), np.array([0.07049534, 0.10080000, 0.09558313]) * 100, decimal=7) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([48.97710455, 35.36874611, 9.02878274]), np.array([0.99092745, 1.00000000, 0.85313273]) * 100, np.array([1.01679082, 1.00000000, 0.67610122]) * 100, 100, 100), np.array([0.47097710, 0.34950000, 0.11301649]) * 100, decimal=7) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( np.array([24.68548451, 19.08228483, 7.81570209]), np.array([0.98070597, 1.00000000, 1.18224949]) * 100, np.array([0.92833635, 1.00000000, 1.03664720]) * 100, 100, 100), np.array([0.25506814, 0.19150000, 0.08849752]) * 100, decimal=7)
def test_n_dimensional_chromatic_adaptation_reverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ chromatic_adaptation_reverse_CMCCAT2000` definition n-dimensional arrays support. """ XYZ_c = np.array([19.52698326, 23.06833960, 24.97175229]) XYZ_w = np.array([111.15, 100.00, 35.20]) XYZ_wr = np.array([94.81, 100.00, 107.30]) L_A1 = 200 L_A2 = 200 XYZ = np.array([22.48, 22.74, 8.54]) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) XYZ_c = np.tile(XYZ_c, (6, 1)) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) XYZ_w = np.tile(XYZ_w, (6, 1)) XYZ_wr = np.tile(XYZ_wr, (6, 1)) L_A1 = np.tile(L_A1, 6) L_A2 = np.tile(L_A2, 6) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) XYZ_c = np.reshape(XYZ_c, (2, 3, 3)) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ_wr = np.reshape(XYZ_wr, (2, 3, 3)) L_A1 = np.reshape(L_A1, (2, 3)) L_A2 = np.reshape(L_A2, (2, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7)
def test_n_dimensional_chromatic_adaptation_reverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ chromatic_adaptation_reverse_CMCCAT2000` definition n-dimensional arrays support. """ XYZ_c = np.array([19.52698326, 23.06833960, 24.97175229]) XYZ_w = np.array([111.15, 100.00, 35.20]) XYZ_wr = np.array([94.81, 100.00, 107.30]) L_A1 = 200 L_A2 = 200 XYZ = np.array([22.48, 22.74, 8.54]) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) XYZ_c = np.tile(XYZ_c, (6, 1)) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) XYZ_w = np.tile(XYZ_w, (6, 1)) XYZ_wr = np.tile(XYZ_wr, (6, 1)) L_A1 = np.tile(L_A1, 6) L_A2 = np.tile(L_A2, 6) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7) XYZ_c = np.reshape(XYZ_c, (2, 3, 3)) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ_wr = np.reshape(XYZ_wr, (2, 3, 3)) L_A1 = np.reshape(L_A1, (2, 3)) L_A2 = np.reshape(L_A2, (2, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_almost_equal( chromatic_adaptation_reverse_CMCCAT2000( XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2), XYZ, decimal=7)
def test_nan_chromatic_adaptation_reverse_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ chromatic_adaptation_reverse_CMCCAT2000` 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: XYZ_c = np.array(case) XYZ_w = np.array(case) XYZ_wr = np.array(case) L_A1 = case[0] L_A2 = case[0] chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2)
def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self): """ Tests :func:`colour.adaptation.cmccat2000.\ chromatic_adaptation_reverse_CMCCAT2000` definition domain and range scale support. """ XYZ_c = np.array([19.52698326, 23.06833960, 24.97175229]) XYZ_w = np.array([111.15, 100.00, 35.20]) XYZ_wr = np.array([94.81, 100.00, 107.30]) L_A1 = 200 L_A2 = 200 XYZ = chromatic_adaptation_reverse_CMCCAT2000(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2) 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( chromatic_adaptation_reverse_CMCCAT2000( XYZ_c * factor, XYZ_w * factor, XYZ_wr * factor, L_A1, L_A2), XYZ * factor, decimal=7)