def test_n_dimensional_delta_E_CIE1994(self): """ Tests :func:`colour.difference.delta_e.delta_E_CIE1994` 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 = 83.779225500887094 np.testing.assert_almost_equal(delta_E_CIE1994(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_CIE1994(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_CIE1994(Lab_1, Lab_2), delta_E, decimal=7)
def test_n_dimensional_delta_E_CIE1994(self): """ Tests :func:`colour.difference.delta_e.delta_E_CIE1994` 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 = 88.335553057506502 np.testing.assert_almost_equal( delta_E_CIE1994(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_CIE1994(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_CIE1994(Lab1, Lab2), delta_E, decimal=7)
def test_nan_delta_E_CIE1994(self): """ Tests :func:`colour.difference.delta_e.delta_E_CIE1994` 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_CIE1994(Lab_1, Lab_2)
def test_nan_delta_E_CIE1994(self): """ Tests :func:`colour.difference.delta_e.delta_E_CIE1994` 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_CIE1994(Lab1, Lab2)
def test_domain_range_scale_delta_E_CIE1994(self): """ Tests :func:`colour.difference.delta_e.delta_E_CIE1994` 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_CIE1994(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_CIE1994(Lab_1 * factor, Lab_2 * factor), delta_E, decimal=7)
def test_delta_E_CIE1994(self): """Test :func:`colour.difference.delta_e.delta_E_CIE1994` definition.""" self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 426.67945353, 72.39590835]), ), 83.779225500887094, places=7, ) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 74.05216981, 276.45318193]), ), 10.053931954553839, places=7, ) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 8.32281957, -73.58297716]), ), 57.535453706667425, places=7, ) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 426.67945353, 72.39590835]), textiles=True, ), 88.335553057506502, places=7, ) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 74.05216981, 276.45318193]), textiles=True, ), 10.612657890048272, places=7, ) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 8.32281957, -73.58297716]), textiles=True, ), 60.368687261063329, places=7, )
def test_delta_E_CIE1994(self): """ Tests :func:`colour.difference.delta_e.delta_E_CIE1994` definition. """ self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 426.67945353, 72.39590835])), 88.3355530575, places=7) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 74.05216981, 276.45318193])), 10.61265789, places=7) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 8.32281957, -73.58297716])), 60.3686872611, places=7) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 426.67945353, 72.39590835]), textiles=False), 83.7792255009, places=7) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 74.05216981, 276.45318193]), textiles=False), 10.0539319546, places=7) self.assertAlmostEqual( delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 8.32281957, -73.58297716]), textiles=False), 57.5354537067, places=7)
def test_delta_E_CIE1994(self): """ Tests :func:`colour.difference.delta_e.delta_E_CIE1994` definition. """ self.assertAlmostEqual(delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 426.67945353, 72.39590835])), 88.3355530575, places=7) self.assertAlmostEqual(delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 74.05216981, 276.45318193])), 10.61265789, places=7) self.assertAlmostEqual(delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 8.32281957, -73.58297716])), 60.3686872611, places=7) self.assertAlmostEqual(delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 426.67945353, 72.39590835]), textiles=False), 83.7792255009, places=7) self.assertAlmostEqual(delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 74.05216981, 276.45318193]), textiles=False), 10.0539319546, places=7) self.assertAlmostEqual(delta_E_CIE1994( np.array([100.00000000, 21.57210357, 272.22819350]), np.array([100.00000000, 8.32281957, -73.58297716]), textiles=False), 57.5354537067, places=7)