示例#1
0
    def test_n_dimensional_N2_depolarisation(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.N2_depolarisation`
        definition n-dimensional arrays support.
        """

        wl = 0.360
        n = 1.036445987654321
        np.testing.assert_almost_equal(
            N2_depolarisation(wl),
            n,
            decimal=7)

        wl = np.tile(wl, 6)
        n = np.tile(n, 6)
        np.testing.assert_almost_equal(
            N2_depolarisation(wl),
            n,
            decimal=7)

        wl = np.reshape(wl, (2, 3))
        n = np.reshape(n, (2, 3))
        np.testing.assert_almost_equal(
            N2_depolarisation(wl),
            n,
            decimal=7)

        wl = np.reshape(wl, (2, 3, 1))
        n = np.reshape(n, (2, 3, 1))
        np.testing.assert_almost_equal(
            N2_depolarisation(wl),
            n,
            decimal=7)
示例#2
0
    def test_N2_depolarisation(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.N2_depolarisation` definition.
        """

        self.assertAlmostEqual(
            N2_depolarisation(0.360), 1.036445987654321, places=7)

        self.assertAlmostEqual(
            N2_depolarisation(0.555), 1.035029137245354, places=7)

        self.assertAlmostEqual(
            N2_depolarisation(0.830), 1.034460153868486, places=7)
示例#3
0
    def test_nan_N2_depolarisation(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.N2_depolarisation` definition
        nan support.
        """

        N2_depolarisation(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))