예제 #1
0
    def test_nan_luminance_ASTMD1535(self):
        """
        Test :func:`colour.colorimetry.luminance.luminance_ASTMD1535`
        definition nan support.
        """

        luminance_ASTMD1535(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf,
                                      np.nan]))
예제 #2
0
    def test_luminance_ASTMD1535(self):
        """
        Tests :func:`colour.colorimetry.luminance.luminance_ASTMD1535`
        definition.
        """

        self.assertAlmostEqual(
            luminance_ASTMD1535(4.08244375), 12.236342675366036, places=7)

        self.assertAlmostEqual(
            luminance_ASTMD1535(5.39132685), 22.893999867280378, places=7)

        self.assertAlmostEqual(
            luminance_ASTMD1535(2.97619312), 6.2902253509053132, places=7)
예제 #3
0
    def test_domain_range_scale_luminance_ASTMD1535(self):
        """
        Tests :func:`colour.colorimetry.luminance.luminance_ASTMD1535`
        definition domain and range scale support.
        """

        Y = luminance_ASTMD1535(4.08244375)

        d_r = (('reference', 1, 1), (1, 0.1, 0.01), (100, 10, 1))
        for scale, factor_a, factor_b in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(luminance_ASTMD1535(4.08244375 *
                                                                   factor_a),
                                               Y * factor_b,
                                               decimal=7)
예제 #4
0
    def test_n_dimensional_luminance_ASTMD1535(self):
        """
        Test :func:`colour.colorimetry.luminance.luminance_ASTMD1535`
        definition n-dimensional arrays support.
        """

        V = 4.08244375
        Y = luminance_ASTMD1535(V)

        V = np.tile(V, 6)
        Y = np.tile(Y, 6)
        np.testing.assert_almost_equal(luminance_ASTMD1535(V), Y, decimal=7)

        V = np.reshape(V, (2, 3))
        Y = np.reshape(Y, (2, 3))
        np.testing.assert_almost_equal(luminance_ASTMD1535(V), Y, decimal=7)

        V = np.reshape(V, (2, 3, 1))
        Y = np.reshape(Y, (2, 3, 1))
        np.testing.assert_almost_equal(luminance_ASTMD1535(V), Y, decimal=7)