Exemplo n.º 1
0
    def test_n_dimensional_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomena.rayleigh.rayleigh_optical_depth`
        definition n-dimensional arrays support.
        """

        wl = 360 * 10e-8
        T_R = 0.599101336848028
        np.testing.assert_almost_equal(rayleigh_optical_depth(wl),
                                       T_R,
                                       decimal=7)

        T_R = np.tile(T_R, 6)
        np.testing.assert_almost_equal(rayleigh_optical_depth(wl),
                                       T_R,
                                       decimal=7)

        T_R = np.reshape(T_R, (2, 3))
        np.testing.assert_almost_equal(rayleigh_optical_depth(wl),
                                       T_R,
                                       decimal=7)

        T_R = np.reshape(T_R, (2, 3, 1))
        np.testing.assert_almost_equal(rayleigh_optical_depth(wl),
                                       T_R,
                                       decimal=7)
Exemplo n.º 2
0
    def test_nan_rayleigh_optical_depth(self):
        """
        Test :func:`colour.phenomena.rayleigh.rayleigh_optical_depth`
        definition nan support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=1))
        for case in cases:
            wavelength = case
            CO2_concentration = case
            temperature = case
            latitude = case
            altitude = case
            rayleigh_optical_depth(wavelength, CO2_concentration, temperature,
                                   latitude, altitude)
Exemplo n.º 3
0
    def test_nan_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomena.rayleigh.rayleigh_optical_depth`
        definition nan support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=1))
        for case in cases:
            wavelength = case
            CO2_concentration = case
            temperature = case
            latitude = case
            altitude = case
            rayleigh_optical_depth(wavelength, CO2_concentration, temperature,
                                   latitude, altitude)
Exemplo n.º 4
0
    def test_n_dimensional_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomena.rayleigh.rayleigh_optical_depth`
        definition n-dimensional arrays support.
        """

        wl = 360 * 10e-8
        T_R = rayleigh_optical_depth(wl)

        T_R = np.tile(T_R, 6)
        np.testing.assert_almost_equal(
            rayleigh_optical_depth(wl), T_R, decimal=7)

        T_R = np.reshape(T_R, (2, 3))
        np.testing.assert_almost_equal(
            rayleigh_optical_depth(wl), T_R, decimal=7)

        T_R = np.reshape(T_R, (2, 3, 1))
        np.testing.assert_almost_equal(
            rayleigh_optical_depth(wl), T_R, decimal=7)
Exemplo n.º 5
0
    def test_rayleigh_optical_depth(self):
        """
        Test :func:`colour.phenomena.rayleigh.rayleigh_optical_depth`
        definition.
        """

        self.assertAlmostEqual(rayleigh_optical_depth(360 * 10e-8),
                               0.599101336848028,
                               places=7)

        self.assertAlmostEqual(rayleigh_optical_depth(555 * 10e-8),
                               0.100407017728965,
                               places=7)

        self.assertAlmostEqual(rayleigh_optical_depth(830 * 10e-8),
                               0.019655847912114,
                               places=7)

        self.assertAlmostEqual(rayleigh_optical_depth(555 * 10e-8, 0),
                               0.093640964348049,
                               places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, 360),
            0.100698605176897,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, 620),
            0.101394382260863,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, temperature=200),
            0.048371194415621,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, temperature=300),
            0.108835187435146,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, temperature=400),
            0.193484777662482,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, pressure=101325),
            0.100407017728965,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, pressure=100325),
            0.099416077509583,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, pressure=99325),
            0.098425137290200,
            places=7,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, latitude=0, altitude=0),
            0.100407017728965,
            places=10,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, latitude=45, altitude=1500),
            0.100190076534634,
            places=10,
        )

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, latitude=48.8567, altitude=35),
            0.100108462705423,
            places=10,
        )
Exemplo n.º 6
0
    def test_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomena.rayleigh.rayleigh_optical_depth`
        definition.
        """

        self.assertAlmostEqual(
            rayleigh_optical_depth(360 * 10e-8), 0.599101336848028, places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8), 0.100407017728965, places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(830 * 10e-8), 0.019655847912114, places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, 0),
            0.093640964348049,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, 360),
            0.100698605176897,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, 620),
            0.101394382260863,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, temperature=200),
            0.048371194415621,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, temperature=300),
            0.108835187435146,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, temperature=400),
            0.193484777662482,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, pressure=101325),
            0.100407017728965,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, pressure=100325),
            0.099416077509583,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, pressure=99325),
            0.098425137290200,
            places=7)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, latitude=0, altitude=0),
            0.100407017728965,
            places=10)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, latitude=45, altitude=1500),
            0.100190076534634,
            places=10)

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, latitude=48.8567, altitude=35),
            0.100108462705423,
            places=10)