Exemplo n.º 1
0
    def test_n_dimensional_xy_to_CCT_Hernandez1999(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_Hernandez1999` definition
        n-dimensional arrays support.
        """

        xy = np.array([0.31271, 0.32902])
        CCT = 6500.04215334
        np.testing.assert_almost_equal(
            xy_to_CCT_Hernandez1999(xy),
            CCT,
            decimal=7)

        xy = np.tile(xy, (6, 1))
        CCT = np.tile(CCT, 6)
        np.testing.assert_almost_equal(
            xy_to_CCT_Hernandez1999(xy),
            CCT,
            decimal=7)

        xy = np.reshape(xy, (2, 3, 2))
        CCT = np.reshape(CCT, (2, 3))
        np.testing.assert_almost_equal(
            xy_to_CCT_Hernandez1999(xy),
            CCT,
            decimal=7)
Exemplo n.º 2
0
    def test_n_dimensional_xy_to_CCT_Hernandez1999(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_Hernandez1999` definition
        n-dimensional arrays support.
        """

        xy = np.array([0.31270, 0.32900])
        CCT = 6500.74204318
        np.testing.assert_almost_equal(
            xy_to_CCT_Hernandez1999(xy),
            CCT,
            decimal=7)

        xy = np.tile(xy, (6, 1))
        CCT = np.tile(CCT, 6)
        np.testing.assert_almost_equal(
            xy_to_CCT_Hernandez1999(xy),
            CCT,
            decimal=7)

        xy = np.reshape(xy, (2, 3, 2))
        CCT = np.reshape(CCT, (2, 3))
        np.testing.assert_almost_equal(
            xy_to_CCT_Hernandez1999(xy),
            CCT,
            decimal=7)
Exemplo n.º 3
0
    def test_nan_xy_to_CCT_Hernandez1999(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_Hernandez1999` definition
        nan support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=2))
        for case in cases:
            xy_to_CCT_Hernandez1999(case)
Exemplo n.º 4
0
    def test_xy_to_CCT_Hernandez1999(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition.
        """

        self.assertAlmostEqual(
            xy_to_CCT_Hernandez1999((0.31271, 0.32902)),
            6500.04215334,
            places=7)
        self.assertAlmostEqual(
            xy_to_CCT_Hernandez1999((0.44757, 0.40745)),
            2790.64222533,
            places=7)
        self.assertAlmostEqual(
            xy_to_CCT_Hernandez1999(
                (0.24416224821391358, 0.24033367475831827)),
            64448.110925653324,
            places=7)
Exemplo n.º 5
0
    def test_xy_to_CCT_Hernandez1999(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition.
        """

        self.assertAlmostEqual(xy_to_CCT_Hernandez1999(
            np.array([0.31270, 0.32900])),
                               6500.74204318,
                               places=7)

        self.assertAlmostEqual(xy_to_CCT_Hernandez1999(
            np.array([0.44757, 0.40745])),
                               2790.64222533,
                               places=7)

        self.assertAlmostEqual(xy_to_CCT_Hernandez1999(
            np.array([0.244162248213914, 0.240333674758318])),
                               64448.11092565,
                               places=7)
Exemplo n.º 6
0
    def test_xy_to_CCT_Hernandez1999(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition.
        """

        self.assertAlmostEqual(
            xy_to_CCT_Hernandez1999(np.array([0.31270, 0.32900])),
            6500.74204318,
            places=7)

        self.assertAlmostEqual(
            xy_to_CCT_Hernandez1999(np.array([0.44757, 0.40745])),
            2790.64222533,
            places=7)

        self.assertAlmostEqual(
            xy_to_CCT_Hernandez1999(
                np.array([0.244162248213914, 0.240333674758318])),
            64448.11092565,
            places=7)