Ejemplo n.º 1
0
    def test_nan_molecular_density(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.molecular_density` definition
        nan support.
        """

        molecular_density(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Ejemplo n.º 2
0
    def test_n_dimensional_molecular_density(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.molecular_density` definition
        n-dimensional arrays support.
        """

        temperature = 200
        N_s = 3.669449208173649e+19
        np.testing.assert_almost_equal(
            molecular_density(temperature), N_s, decimal=7)

        temperature = np.tile(temperature, 6)
        N_s = np.tile(N_s, 6)
        np.testing.assert_almost_equal(
            molecular_density(temperature), N_s, decimal=7)

        temperature = np.reshape(temperature, (2, 3))
        N_s = np.reshape(N_s, (2, 3))
        np.testing.assert_almost_equal(
            molecular_density(temperature), N_s, decimal=7)

        temperature = np.reshape(temperature, (2, 3, 1))
        N_s = np.reshape(N_s, (2, 3, 1))
        np.testing.assert_almost_equal(
            molecular_density(temperature), N_s, decimal=7)
Ejemplo n.º 3
0
    def test_n_dimensional_molecular_density(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.molecular_density` definition
        n-dimensional arrays support.
        """

        temperature = 200
        N_s = 3.669449208173649e+19
        np.testing.assert_almost_equal(
            molecular_density(temperature),
            N_s,
            decimal=7)

        temperature = np.tile(temperature, 6)
        N_s = np.tile(N_s, 6)
        np.testing.assert_almost_equal(
            molecular_density(temperature),
            N_s,
            decimal=7)

        temperature = np.reshape(temperature, (2, 3))
        N_s = np.reshape(N_s, (2, 3))
        np.testing.assert_almost_equal(
            molecular_density(temperature),
            N_s,
            decimal=7)

        temperature = np.reshape(temperature, (2, 3, 1))
        N_s = np.reshape(N_s, (2, 3, 1))
        np.testing.assert_almost_equal(
            molecular_density(temperature),
            N_s,
            decimal=7)
Ejemplo n.º 4
0
    def test_nan_molecular_density(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.molecular_density` definition
        nan support.
        """

        molecular_density(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Ejemplo n.º 5
0
    def test_molecular_density(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.molecular_density` definition.
        """

        self.assertAlmostEqual(
            molecular_density(200), 3.669449208173649e+19, delta=10000)

        self.assertAlmostEqual(
            molecular_density(300), 2.4462994721157665e+19, delta=10000)

        self.assertAlmostEqual(
            molecular_density(400), 1.834724604086825e+19, delta=10000)
Ejemplo n.º 6
0
    def test_molecular_density(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.molecular_density` definition.
        """

        self.assertAlmostEqual(
            molecular_density(200),
            3.669449208173649e+19,
            places=24)

        self.assertAlmostEqual(
            molecular_density(300),
            2.4462994721157665e+19,
            places=24)

        self.assertAlmostEqual(
            molecular_density(400),
            1.8347246040868246e+19,
            places=24)