def test_yellowness_ASTMD1925(self): """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition. """ self.assertAlmostEqual( yellowness_ASTMD1925( np.array([95.00000000, 100.00000000, 105.00000000])), 10.299999999999997, places=7, ) self.assertAlmostEqual( yellowness_ASTMD1925( np.array([105.00000000, 100.00000000, 95.00000000])), 33.700000000000003, places=7, ) self.assertAlmostEqual( yellowness_ASTMD1925( np.array([100.00000000, 100.00000000, 100.00000000])), 22.0, places=7, )
def test_nan_yellowness_ASTMD1925(self): """ Tests :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` 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 = np.array(case) yellowness_ASTMD1925(XYZ)
def test_n_dimensional_yellowness_ASTMD1925(self): """ Tests :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition n_dimensional arrays support. """ XYZ = np.array([95.00000000, 100.00000000, 105.00000000]) YI = yellowness_ASTMD1925(XYZ) XYZ = np.tile(XYZ, (6, 1)) YI = np.tile(YI, 6) np.testing.assert_almost_equal( yellowness_ASTMD1925(XYZ), YI, decimal=7) XYZ = np.reshape(XYZ, (2, 3, 3)) YI = np.reshape(YI, (2, 3)) np.testing.assert_almost_equal( yellowness_ASTMD1925(XYZ), YI, decimal=7)
def test_domain_range_scale_yellowness_ASTMD1925(self): """ Tests :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition domain and range scale support. """ XYZ = np.array([95.00000000, 100.00000000, 105.00000000]) YI = 10.299999999999997 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( yellowness_ASTMD1925(XYZ * factor), YI * factor, decimal=7)
def test_yellowness_ASTMD1925(self): """ Tests :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition. """ self.assertAlmostEqual( yellowness_ASTMD1925( np.array([95.00000000, 100.00000000, 105.00000000])), 10.299999999999997, places=7) self.assertAlmostEqual( yellowness_ASTMD1925( np.array([105.00000000, 100.00000000, 95.00000000])), 33.700000000000003, places=7) self.assertAlmostEqual( yellowness_ASTMD1925( np.array([100.00000000, 100.00000000, 100.00000000])), 22.0, places=7)