示例#1
0
    def test_n_dimensional_xy_to_CCT_McCamy1992(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition
        n-dimensional arrays support.
        """

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

        xy = np.tile(xy, (6, 1))
        CCT = np.tile(CCT, 6)
        np.testing.assert_almost_equal(
            xy_to_CCT_McCamy1992(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_McCamy1992(xy),
            CCT,
            decimal=7)
示例#2
0
    def test_nan_xy_to_CCT_McCamy1992(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` 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_McCamy1992(case)
示例#3
0
    def test_xy_to_CCT_McCamy1992(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition.
        """

        self.assertAlmostEqual(
            xy_to_CCT_McCamy1992((0.31271, 0.32902)),
            6504.38938305,
            places=7)
        self.assertAlmostEqual(
            xy_to_CCT_McCamy1992((0.44757, 0.40745)),
            2857.28961266,
            places=7)
        self.assertAlmostEqual(
            xy_to_CCT_McCamy1992(
                (0.25252093937408293, 0.252220883926284)),
            19501.6195313,
            places=7)
示例#4
0
    def test_xy_to_CCT_McCamy1992(self):
        """
        Tests :func:`colour.temperature.cct.xy_to_CCT_McCamy1992` definition.
        """

        self.assertAlmostEqual(
            xy_to_CCT_McCamy1992(np.array([0.31270, 0.32900])),
            6505.08059131,
            places=7)

        self.assertAlmostEqual(
            xy_to_CCT_McCamy1992(np.array([0.44757, 0.40745])),
            2857.28961266,
            places=7)

        self.assertAlmostEqual(
            xy_to_CCT_McCamy1992(
                np.array([0.252520939374083, 0.252220883926284])),
            19501.61953130,
            places=7)
示例#5
0
    def test_xy_to_CCT_McCamy1992(self):
        """
        Tests :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992`
        definition.
        """

        self.assertAlmostEqual(xy_to_CCT_McCamy1992(
            np.array([0.31270, 0.32900])),
                               6505.08059131,
                               places=7)

        self.assertAlmostEqual(xy_to_CCT_McCamy1992(
            np.array([0.44757, 0.40745])),
                               2857.28961266,
                               places=7)

        self.assertAlmostEqual(xy_to_CCT_McCamy1992(
            np.array([0.252520939374083, 0.252220883926284])),
                               19501.61953130,
                               places=7)
示例#6
0
    def test_n_dimensional_xy_to_CCT_McCamy1992(self):
        """
        Test :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992`
        definition n-dimensional arrays support.
        """

        xy = np.array([0.31270, 0.32900])
        CCT = xy_to_CCT_McCamy1992(xy)

        xy = np.tile(xy, (6, 1))
        CCT = np.tile(CCT, 6)
        np.testing.assert_almost_equal(xy_to_CCT_McCamy1992(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_McCamy1992(xy),
                                       CCT,
                                       decimal=7)