Beispiel #1
0
    def test_n_dimensional_whiteness_Ganz1979(self):
        """
        Tests :func:`colour.colorimetry.whiteness.whiteness_Ganz1979`
        definition n_dimensional arrays support.
        """

        xy = np.array([0.3167, 0.3334])
        Y = 100
        WT = np.array([85.60037660, 0.67890030])
        np.testing.assert_almost_equal(whiteness_Ganz1979(xy, Y),
                                       WT,
                                       decimal=7)

        xy = np.tile(xy, (6, 1))
        WT = np.tile(WT, (6, 1))
        np.testing.assert_almost_equal(whiteness_Ganz1979(xy, Y),
                                       WT,
                                       decimal=7)

        Y = np.tile(Y, 6)
        np.testing.assert_almost_equal(whiteness_Ganz1979(xy, Y),
                                       WT,
                                       decimal=7)

        xy = np.reshape(xy, (2, 3, 2))
        Y = np.reshape(Y, (2, 3))
        WT = np.reshape(WT, (2, 3, 2))
        np.testing.assert_almost_equal(whiteness_Ganz1979(xy, Y),
                                       WT,
                                       decimal=7)
Beispiel #2
0
    def test_n_dimensional_whiteness_Ganz1979(self):
        """
        Tests :func:`colour.colorimetry.whiteness.whiteness_Ganz1979`
        definition n_dimensional arrays support.
        """

        xy = np.array([0.3167, 0.3334])
        Y = 100
        WT = np.array([85.60037660, 0.67890030])
        np.testing.assert_almost_equal(
            whiteness_Ganz1979(xy, Y),
            WT,
            decimal=7)

        xy = np.tile(xy, (6, 1))
        WT = np.tile(WT, (6, 1))
        np.testing.assert_almost_equal(
            whiteness_Ganz1979(xy, Y),
            WT,
            decimal=7)

        Y = np.tile(Y, 6)
        np.testing.assert_almost_equal(
            whiteness_Ganz1979(xy, Y),
            WT,
            decimal=7)

        xy = np.reshape(xy, (2, 3, 2))
        Y = np.reshape(Y, (2, 3))
        WT = np.reshape(WT, (2, 3, 2))
        np.testing.assert_almost_equal(
            whiteness_Ganz1979(xy, Y),
            WT,
            decimal=7)
Beispiel #3
0
    def test_nan_whiteness_Ganz1979(self):
        """
        Tests :func:`colour.colorimetry.whiteness.whiteness_Ganz1979`
        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:
            xy = np.array(case[0:2])
            Y = np.array(case[0])
            whiteness_Ganz1979(xy, Y)
Beispiel #4
0
    def test_nan_whiteness_Ganz1979(self):
        """
        Tests :func:`colour.colorimetry.whiteness.whiteness_Ganz1979`
        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:
            xy = np.array(case[0:2])
            Y = np.array(case[0])
            whiteness_Ganz1979(xy, Y)
Beispiel #5
0
    def test_domain_range_scale_whiteness_Ganz1979(self):
        """
        Tests :func:`colour.colorimetry.whiteness.whiteness_Ganz1979`
        definition domain and range scale support.
        """

        xy = np.array([0.3167, 0.3334])
        Y = 100
        WT = whiteness_Ganz1979(xy, Y)

        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(
                    whiteness_Ganz1979(xy, Y * factor), WT * factor, decimal=7)
Beispiel #6
0
    def test_whiteness_Ganz1979(self):
        """
        Tests :func:`colour.colorimetry.whiteness.whiteness_Ganz1979`
        definition.
        """

        np.testing.assert_almost_equal(
            whiteness_Ganz1979((0.3139, 0.3311), 100),
            np.array([99.3317652, 1.7610829]),
            decimal=7)
        np.testing.assert_almost_equal(
            whiteness_Ganz1979((0.3500, 0.3334), 100),
            np.array([23.385254, -32.6618256]),
            decimal=7)
        np.testing.assert_almost_equal(
            whiteness_Ganz1979((0.3334, 0.3334), 100),
            np.array([54.3993992, -16.0415238]),
            decimal=7)
Beispiel #7
0
    def test_whiteness_Ganz1979(self):
        """
        Tests :func:`colour.colorimetry.whiteness.whiteness_Ganz1979`
        definition.
        """

        np.testing.assert_almost_equal(whiteness_Ganz1979(
            np.array([0.3139, 0.3311]), 100),
                                       np.array([99.33176520, 1.76108290]),
                                       decimal=7)

        np.testing.assert_almost_equal(whiteness_Ganz1979(
            np.array([0.3500, 0.3334]), 100),
                                       np.array([23.38525400, -32.66182560]),
                                       decimal=7)

        np.testing.assert_almost_equal(whiteness_Ganz1979(
            np.array([0.3334, 0.3334]), 100),
                                       np.array([54.39939920, -16.04152380]),
                                       decimal=7)