示例#1
0
    def test_n_dimensional_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition n-dimensional arrays support.
        """

        Y = 10.08
        W = 37.004114912764535
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)

        Y = np.tile(Y, 6)
        W = np.tile(W, 6)
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)

        Y = np.reshape(Y, (2, 3))
        W = np.reshape(W, (2, 3))
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)

        Y = np.reshape(Y, (2, 3, 1))
        W = np.reshape(W, (2, 3, 1))
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)
示例#2
0
    def test_n_dimensional_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition n-dimensional arrays support.
        """

        Y = 10.08
        W = 37.004114912764535
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)

        Y = np.tile(Y, 6)
        W = np.tile(W, 6)
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)

        Y = np.reshape(Y, (2, 3))
        W = np.reshape(W, (2, 3))
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)

        Y = np.reshape(Y, (2, 3, 1))
        W = np.reshape(W, (2, 3, 1))
        np.testing.assert_almost_equal(
            lightness_Wyszecki1963(Y),
            W,
            decimal=7)
示例#3
0
    def test_nan_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition nan support.
        """

        lightness_Wyszecki1963(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
示例#4
0
    def test_nan_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition nan support.
        """

        lightness_Wyszecki1963(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
示例#5
0
    def test_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition.
        """

        self.assertAlmostEqual(
            lightness_Wyszecki1963(12.19722535), 40.547574599570197, places=7)

        self.assertAlmostEqual(
            lightness_Wyszecki1963(23.04276781), 54.140714588256841, places=7)

        self.assertAlmostEqual(
            lightness_Wyszecki1963(6.15720079), 28.821339499883976, places=7)
示例#6
0
    def test_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition.
        """

        self.assertAlmostEqual(
            lightness_Wyszecki1963(10.08), 37.00411491, places=7)

        self.assertAlmostEqual(
            lightness_Wyszecki1963(56.76), 79.07730319, places=7)

        self.assertAlmostEqual(
            lightness_Wyszecki1963(98.32), 98.38622505, places=7)
示例#7
0
    def test_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition.
        """

        self.assertAlmostEqual(
            lightness_Wyszecki1963(12.19722535), 40.547574599570197, places=7)

        self.assertAlmostEqual(
            lightness_Wyszecki1963(23.04276781), 54.140714588256841, places=7)

        self.assertAlmostEqual(
            lightness_Wyszecki1963(6.15720079), 28.821339499883976, places=7)
示例#8
0
    def test_domain_range_scale_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition domain and range scale support.
        """

        W = lightness_Wyszecki1963(12.19722535)

        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(
                    lightness_Wyszecki1963(12.19722535 * factor),
                    W * factor,
                    decimal=7)
示例#9
0
    def test_domain_range_scale_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition domain and range scale support.
        """

        W = lightness_Wyszecki1963(12.19722535)

        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(
                    lightness_Wyszecki1963(12.19722535 * factor),
                    W * factor,
                    decimal=7)
示例#10
0
    def test_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition.
        """

        self.assertAlmostEqual(
            lightness_Wyszecki1963(10.08),
            37.0041149128,
            places=7)
        self.assertAlmostEqual(
            lightness_Wyszecki1963(56.76),
            79.0773031869,
            places=7)
        self.assertAlmostEqual(
            lightness_Wyszecki1963(98.32),
            98.3862250488,
            places=7)
示例#11
0
    def test_n_dimensional_lightness_Wyszecki1963(self):
        """
        Tests :func:`colour.colorimetry.lightness.lightness_Wyszecki1963`
        definition n-dimensional arrays support.
        """

        Y = 12.19722535
        W = 40.547574599570197
        np.testing.assert_almost_equal(lightness_Wyszecki1963(Y), W, decimal=7)

        Y = np.tile(Y, 6)
        W = np.tile(W, 6)
        np.testing.assert_almost_equal(lightness_Wyszecki1963(Y), W, decimal=7)

        Y = np.reshape(Y, (2, 3))
        W = np.reshape(W, (2, 3))
        np.testing.assert_almost_equal(lightness_Wyszecki1963(Y), W, decimal=7)

        Y = np.reshape(Y, (2, 3, 1))
        W = np.reshape(W, (2, 3, 1))
        np.testing.assert_almost_equal(lightness_Wyszecki1963(Y), W, decimal=7)