def test_n_dimensional_lightness_Glasser1958(self): """ Tests :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition n-dimensional arrays support. """ Y = 10.08 L = 36.2505626458 np.testing.assert_almost_equal( lightness_Glasser1958(Y), L, decimal=7) Y = np.tile(Y, 6) L = np.tile(L, 6) np.testing.assert_almost_equal( lightness_Glasser1958(Y), L, decimal=7) Y = np.reshape(Y, (2, 3)) L = np.reshape(L, (2, 3)) np.testing.assert_almost_equal( lightness_Glasser1958(Y), L, decimal=7) Y = np.reshape(Y, (2, 3, 1)) L = np.reshape(L, (2, 3, 1)) np.testing.assert_almost_equal( lightness_Glasser1958(Y), L, decimal=7)
def test_nan_lightness_Glasser1958(self): """ Tests :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition nan support. """ lightness_Glasser1958( np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
def test_lightness_Glasser1958(self): """ Tests :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition. """ self.assertAlmostEqual( lightness_Glasser1958(12.19722535), 39.83512646492521, places=7) self.assertAlmostEqual( lightness_Glasser1958(23.04276781), 53.585946877480623, places=7) self.assertAlmostEqual( lightness_Glasser1958(6.15720079), 27.972867038082629, places=7)
def test_lightness_Glasser1958(self): """ Tests :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition. """ self.assertAlmostEqual( lightness_Glasser1958(10.08), 36.25056265, places=7) self.assertAlmostEqual( lightness_Glasser1958(56.76), 78.81179990, places=7) self.assertAlmostEqual( lightness_Glasser1958(98.32), 98.34470526, places=7)
def test_domain_range_scale_lightness_Glasser1958(self): """ Tests :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition domain and range scale support. """ L = lightness_Glasser1958(12.19722535) 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( lightness_Glasser1958(12.19722535 * factor), L * factor, decimal=7)
def test_lightness_Glasser1958(self): """ Tests :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition. """ self.assertAlmostEqual( lightness_Glasser1958(10.08), 36.2505626458, places=7) self.assertAlmostEqual( lightness_Glasser1958(56.76), 78.8117999039, places=7) self.assertAlmostEqual( lightness_Glasser1958(98.32), 98.3447052593, places=7)
def test_n_dimensional_lightness_Glasser1958(self): """ Test :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition n-dimensional arrays support. """ Y = 12.19722535 L = lightness_Glasser1958(Y) Y = np.tile(Y, 6) L = np.tile(L, 6) np.testing.assert_almost_equal(lightness_Glasser1958(Y), L, decimal=7) Y = np.reshape(Y, (2, 3)) L = np.reshape(L, (2, 3)) np.testing.assert_almost_equal(lightness_Glasser1958(Y), L, decimal=7) Y = np.reshape(Y, (2, 3, 1)) L = np.reshape(L, (2, 3, 1)) np.testing.assert_almost_equal(lightness_Glasser1958(Y), L, decimal=7)