Пример #1
0
    def test_n_dimensional_scattering_cross_section(self):
        """
        Tests :func:`colour.phenomena.rayleigh.scattering_cross_section`
        definition n-dimensional arrays support.
        """

        wl = 360 * 10e-8
        sigma = 2.781289234802031e-26
        np.testing.assert_almost_equal(scattering_cross_section(wl),
                                       sigma,
                                       decimal=32)

        sigma = np.tile(sigma, 6)
        np.testing.assert_almost_equal(scattering_cross_section(wl),
                                       sigma,
                                       decimal=32)

        sigma = np.reshape(sigma, (2, 3))
        np.testing.assert_almost_equal(scattering_cross_section(wl),
                                       sigma,
                                       decimal=32)

        sigma = np.reshape(sigma, (2, 3, 1))
        np.testing.assert_almost_equal(scattering_cross_section(wl),
                                       sigma,
                                       decimal=32)
Пример #2
0
    def test_scattering_cross_section(self):
        """
        Test :func:`colour.phenomena.rayleigh.scattering_cross_section`
        definition.
        """

        self.assertAlmostEqual(
            scattering_cross_section(360 * 10e-8),
            2.781289234802031e-26,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8),
            4.661330902337604e-27,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(830 * 10e-8),
            9.125100352218880e-28,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, 0),
            4.346543336839102e-27,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, 360),
            4.675013461928133e-27,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, 620),
            4.707951639592975e-27,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, temperature=200),
            2.245601437154005e-27,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, temperature=300),
            5.052603233596510e-27,
            places=32,
        )

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, temperature=400),
            8.982405748616020e-27,
            places=32,
        )
Пример #3
0
    def test_nan_scattering_cross_section(self):
        """
        Test :func:`colour.phenomena.rayleigh.scattering_cross_section`
        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
            scattering_cross_section(wavelength, CO2_concentration,
                                     temperature)
Пример #4
0
    def test_nan_scattering_cross_section(self):
        """
        Tests :func:`colour.phenomena.rayleigh.scattering_cross_section`
        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
            scattering_cross_section(wavelength, CO2_concentration,
                                     temperature)
Пример #5
0
    def test_scattering_cross_section(self):
        """
        Tests :func:`colour.phenomena.rayleigh.scattering_cross_section`
        definition.
        """

        self.assertAlmostEqual(
            scattering_cross_section(360 * 10e-8),
            2.781289234802031e-26,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8),
            4.661330902337604e-27,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(830 * 10e-8),
            9.125100352218880e-28,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, 0),
            4.346543336839102e-27,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, 360),
            4.675013461928133e-27,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, 620),
            4.707951639592975e-27,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, temperature=200),
            2.245601437154005e-27,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, temperature=300),
            5.052603233596510e-27,
            places=32)

        self.assertAlmostEqual(
            scattering_cross_section(555 * 10e-8, temperature=400),
            8.982405748616020e-27,
            places=32)
Пример #6
0
    def test_n_dimensional_scattering_cross_section(self):
        """
        Tests :func:`colour.phenomena.rayleigh.scattering_cross_section`
        definition n-dimensional arrays support.
        """

        wl = 360 * 10e-8
        sigma = scattering_cross_section(wl)

        sigma = np.tile(sigma, 6)
        np.testing.assert_almost_equal(
            scattering_cross_section(wl), sigma, decimal=32)

        sigma = np.reshape(sigma, (2, 3))
        np.testing.assert_almost_equal(
            scattering_cross_section(wl), sigma, decimal=32)

        sigma = np.reshape(sigma, (2, 3, 1))
        np.testing.assert_almost_equal(
            scattering_cross_section(wl), sigma, decimal=32)