Exemplo n.º 1
0
    def test_n_dimensional_excitation_purity(self):
        """
        Tests :func:`colour.colorimetry.dominant.excitation_purity` definition
        n-dimensional arrays support.
        """

        xy = np.array([0.26415, 0.37770])
        xy_n = D65
        P_e = 0.157118186993525
        np.testing.assert_almost_equal(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
            P_e,
            decimal=7)

        xy = np.tile(xy, (6, 1))
        xy_n = np.tile(xy_n, (6, 1))
        P_e = np.tile(P_e, 6)
        np.testing.assert_almost_equal(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
            P_e,
            decimal=7)

        xy = np.reshape(xy, (2, 3, 2))
        xy_n = np.reshape(xy_n, (2, 3, 2))
        P_e = np.reshape(P_e, (2, 3))
        np.testing.assert_almost_equal(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
            P_e,
            decimal=7)
Exemplo n.º 2
0
    def test_nan_excitation_purity(self):
        """
        Tests :func:`colour.colorimetry.dominant.excitation_purity` 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:
            try:
                excitation_purity(case, case, CIE_2_1931_CMFS)
            except ValueError:
                pass
Exemplo n.º 3
0
    def test_excitation_purity(self):
        """
        Tests :func:`colour.colorimetry.dominant.excitation_purity` definition.
        """

        xy = np.array([0.54369557, 0.32107944])
        xy_n = D65

        self.assertAlmostEqual(excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
                               0.622885671878446,
                               places=7)

        xy = np.array([0.37605506, 0.24452225])
        self.assertAlmostEqual(excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
                               0.438347859215887,
                               places=7)
Exemplo n.º 4
0
    def test_excitation_purity(self):
        """
        Tests :func:`colour.colorimetry.dominant.excitation_purity` definition.
        """

        xy = np.array([0.26415, 0.37770])
        xy_n = D65

        self.assertAlmostEqual(excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
                               0.157118186993525,
                               places=7)

        xy = np.array([0.35000, 0.25000])
        self.assertAlmostEqual(excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
                               0.370659424135609,
                               places=7)
Exemplo n.º 5
0
    def test_excitation_purity(self):
        """
        Tests :func:`colour.colorimetry.dominant.excitation_purity` definition.
        """

        xy = np.array([0.54369557, 0.32107944])
        xy_n = D65

        self.assertAlmostEqual(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
            0.622885671878446,
            places=7)

        xy = np.array([0.37605506, 0.24452225])
        self.assertAlmostEqual(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
            0.438347859215887,
            places=7)
Exemplo n.º 6
0
    def test_excitation_purity(self):
        """
        Tests :func:`colour.colorimetry.dominant.excitation_purity` definition.
        """

        xy = np.array([0.26415, 0.37770])
        xy_n = D65

        self.assertAlmostEqual(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
            0.157118186993525,
            places=7)

        xy = np.array([0.35000, 0.25000])
        self.assertAlmostEqual(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS),
            0.370659424135609,
            places=7)
Exemplo n.º 7
0
    def test_n_dimensional_excitation_purity(self):
        """
        Tests :func:`colour.colorimetry.dominant.excitation_purity` definition
        n-dimensional arrays support.
        """

        xy = np.array([0.54369557, 0.32107944])
        xy_n = D65
        P_e = excitation_purity(xy, xy_n, CIE_2_1931_CMFS)

        xy = np.tile(xy, (6, 1))
        xy_n = np.tile(xy_n, (6, 1))
        P_e = np.tile(P_e, 6)
        np.testing.assert_almost_equal(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS), P_e, decimal=7)

        xy = np.reshape(xy, (2, 3, 2))
        xy_n = np.reshape(xy_n, (2, 3, 2))
        P_e = np.reshape(P_e, (2, 3))
        np.testing.assert_almost_equal(
            excitation_purity(xy, xy_n, CIE_2_1931_CMFS), P_e, decimal=7)