Example #1
0
    def test_n_dimensional_luminance_CIE1976(self):
        """
        Tests :func:`colour.colorimetry.lightness.luminance_CIE1976`
        definition n-dimensional arrays support.
        """

        Lstar = 37.98562910
        Y = 10.080000000026304
        np.testing.assert_almost_equal(
            luminance_CIE1976(Lstar),
            Y,
            decimal=7)

        Lstar = np.tile(Lstar, 6)
        Y = np.tile(Y, 6)
        np.testing.assert_almost_equal(
            luminance_CIE1976(Lstar),
            Y,
            decimal=7)

        Lstar = np.reshape(Lstar, (2, 3))
        Y = np.reshape(Y, (2, 3))
        np.testing.assert_almost_equal(
            luminance_CIE1976(Lstar),
            Y,
            decimal=7)

        Lstar = np.reshape(Lstar, (2, 3, 1))
        Y = np.reshape(Y, (2, 3, 1))
        np.testing.assert_almost_equal(
            luminance_CIE1976(Lstar),
            Y,
            decimal=7)
Example #2
0
    def test_nan_luminance_CIE1976(self):
        """
        Tests :func:`colour.colorimetry.luminance.luminance_CIE1976`
        definition nan support.
        """

        luminance_CIE1976(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Example #3
0
    def test_luminance_CIE1976(self):
        """
        Tests :func:`colour.colorimetry.luminance.luminance_CIE1976`
        definition.
        """

        self.assertAlmostEqual(
            luminance_CIE1976(37.98562910),
            10.08000000,
            places=7)

        self.assertAlmostEqual(
            luminance_CIE1976(80.04441556),
            56.76000000,
            places=7)

        self.assertAlmostEqual(
            luminance_CIE1976(99.34672790),
            98.32000000,
            places=7)

        self.assertAlmostEqual(
            luminance_CIE1976(37.98562910, 50),
            5.04000000,
            places=7)

        self.assertAlmostEqual(
            luminance_CIE1976(37.98562910, 75),
            7.56000000,
            places=7)

        self.assertAlmostEqual(
            luminance_CIE1976(37.98562910, 95),
            9.57600000,
            places=7)