Exemple #1
0
    def test_mesopic_weighting_function(self):
        """
        Tests :func:`colour.colorimetry.lefs.mesopic_weighting_function`
        definition.
        """

        self.assertAlmostEqual(
            mesopic_weighting_function(500, 0.2),
            0.70522000,
            places=7)

        self.assertAlmostEqual(
            mesopic_weighting_function(500,
                                       0.2,
                                       source='Red Heavy',
                                       method='LRC'),
            0.90951000,
            places=7)

        self.assertAlmostEqual(
            mesopic_weighting_function(700,
                                       10,
                                       source='Red Heavy',
                                       method='LRC'),
            0.00410200,
            places=7)
Exemple #2
0
    def test_n_dimensional_planck_law(self):
        """
        Tests :func:`colour.colorimetry.lefs.mesopic_weighting_function`
        definition n-dimensional arrays support.
        """

        wl = 500
        Vm = 0.70522000
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)

        wl = np.tile(wl, 6)
        Vm = np.tile(Vm, 6)
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)

        wl = np.reshape(wl, (2, 3))
        Vm = np.reshape(Vm, (2, 3))
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)

        wl = np.reshape(wl, (2, 3, 1))
        Vm = np.reshape(Vm, (2, 3, 1))
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)
Exemple #3
0
    def test_mesopic_weighting_function(self):
        """
        Test :func:`colour.colorimetry.lefs.mesopic_weighting_function`
        definition.
        """

        self.assertAlmostEqual(mesopic_weighting_function(500, 0.2),
                               0.70522000,
                               places=7)

        self.assertAlmostEqual(
            mesopic_weighting_function(500,
                                       0.2,
                                       source="Red Heavy",
                                       method="LRC"),
            0.90951000,
            places=7,
        )

        self.assertAlmostEqual(
            mesopic_weighting_function(700,
                                       10,
                                       source="Red Heavy",
                                       method="LRC"),
            0.00410200,
            places=7,
        )
Exemple #4
0
    def test_nan_mesopic_weighting_function(self):
        """
        Tests :func:`colour.colorimetry.lefs.mesopic_weighting_function`
        definition nan support.
        """

        mesopic_weighting_function(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]), 0.2),
Exemple #5
0
    def test_n_dimensional_planck_law(self):
        """
        Tests :func:`colour.colorimetry.lefs.mesopic_weighting_function`
        definition n-dimensional arrays support.
        """

        wl = 500
        Vm = 0.70522000
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)

        wl = np.tile(wl, 6)
        Vm = np.tile(Vm, 6)
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)

        wl = np.reshape(wl, (2, 3))
        Vm = np.reshape(Vm, (2, 3))
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)

        wl = np.reshape(wl, (2, 3, 1))
        Vm = np.reshape(Vm, (2, 3, 1))
        np.testing.assert_almost_equal(
            mesopic_weighting_function(wl, 0.2),
            Vm)
Exemple #6
0
    def test_nan_mesopic_weighting_function(self):
        """
        Tests :func:`colour.colorimetry.lefs.mesopic_weighting_function`
        definition nan support.
        """

        mesopic_weighting_function(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]), 0.2),
Exemple #7
0
    def test_mesopic_weighting_function(self):
        """
        Tests :func:`colour.colorimetry.lefs.mesopic_weighting_function`
        definition.
        """

        self.assertAlmostEqual(mesopic_weighting_function(500, 0.2),
                               0.7052200000000001,
                               places=7)
        self.assertAlmostEqual(mesopic_weighting_function(500,
                                                          0.2,
                                                          source='Red Heavy',
                                                          method='LRC'),
                               0.9095099999999999,
                               places=7)
        self.assertAlmostEqual(mesopic_weighting_function(700,
                                                          10,
                                                          source='Red Heavy',
                                                          method='LRC'),
                               0.004102,
                               places=7)