def test_domain_range_scale_HSL_to_RGB(self): """ Tests :func:`colour.models.rgb.deprecated.HSL_to_RGB` definition domain and range scale support. """ HSL = np.array([0.99603944, 0.87347144, 0.24350795]) RGB = HSL_to_RGB(HSL) d_r = (('reference', 1), (1, 1), (100, 100)) for scale, factor in d_r: with domain_range_scale(scale): np.testing.assert_almost_equal( HSL_to_RGB(HSL * factor), RGB * factor, decimal=7)
def test_n_dimensional_HSL_to_RGB(self): """ Tests :func:`colour.models.rgb.deprecated.HSL_to_RGB` definition n-dimensional arrays support. """ HSL = np.array([0.99603944, 0.87347144, 0.24350795]) RGB = HSL_to_RGB(HSL) HSL = np.tile(HSL, (6, 1)) RGB = np.tile(RGB, (6, 1)) np.testing.assert_almost_equal(HSL_to_RGB(HSL), RGB, decimal=7) HSL = np.reshape(HSL, (2, 3, 3)) RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_almost_equal(HSL_to_RGB(HSL), RGB, decimal=7)
def test_n_dimensional_HSL_to_RGB(self): """ Tests :func:`colour.models.rgb.deprecated.HSL_to_RGB` definition n-dimensional arrays support. """ HSL = np.array([0.27272727, 0.84615385, 0.32500000]) RGB = np.array([0.25000000, 0.60000000, 0.05000000]) np.testing.assert_almost_equal(HSL_to_RGB(HSL), RGB, decimal=7) HSL = np.tile(HSL, (6, 1)) RGB = np.tile(RGB, (6, 1)) np.testing.assert_almost_equal(HSL_to_RGB(HSL), RGB, decimal=7) HSL = np.reshape(HSL, (2, 3, 3)) RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_almost_equal(HSL_to_RGB(HSL), RGB, decimal=7)
def test_HSL_to_RGB(self): """ Tests :func:`colour.models.rgb.deprecated.HSL_to_RGB` definition. """ np.testing.assert_almost_equal( HSL_to_RGB(np.array([0.27272727, 0.84615385, 0.32500000])), np.array([0.25000000, 0.60000000, 0.05000000]), decimal=7) np.testing.assert_almost_equal( HSL_to_RGB(np.array([0.00000000, 0.00000000, 0.00000000])), np.array([0.00000000, 0.00000000, 0.00000000]), decimal=7) np.testing.assert_almost_equal( HSL_to_RGB(np.array([0.00000000, 0.00000000, 1.00000000])), np.array([1.00000000, 1.00000000, 1.00000000]), decimal=7)
def test_HSL_to_RGB(self): """ Tests :func:`colour.models.rgb.deprecated.HSL_to_RGB` definition. """ np.testing.assert_almost_equal( HSL_to_RGB(np.array([0.99603944, 0.87347144, 0.24350795])), np.array([0.45620519, 0.03081071, 0.04091952]), decimal=7) np.testing.assert_almost_equal( HSL_to_RGB(np.array([0.00000000, 0.00000000, 0.00000000])), np.array([0.00000000, 0.00000000, 0.00000000]), decimal=7) np.testing.assert_almost_equal( HSL_to_RGB(np.array([0.00000000, 0.00000000, 1.00000000])), np.array([1.00000000, 1.00000000, 1.00000000]), decimal=7)
def test_nan_HSL_to_RGB(self): """ Tests :func:`colour.models.rgb.deprecated.HSL_to_RGB` 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: HSL = np.array(case) HSL_to_RGB(HSL)