Esempio n. 1
0
    def test_nan_molecular_density(self):
        """
        Test :func:`colour.phenomena.rayleigh.molecular_density` definition
        nan support.
        """

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

        temperature = 200
        N_s = molecular_density(temperature)

        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)
Esempio n. 3
0
    def test_nan_molecular_density(self):
        """
        Tests :func:`colour.phenomena.rayleigh.molecular_density` definition
        nan support.
        """

        molecular_density(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Esempio n. 4
0
    def test_molecular_density(self):
        """
        Tests :func:`colour.phenomena.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)
Esempio n. 5
0
    def test_molecular_density(self):
        """Test :func:`colour.phenomena.rayleigh.molecular_density` definition."""

        self.assertAlmostEqual(molecular_density(200),
                               3.669449208173649e19,
                               delta=10000)

        self.assertAlmostEqual(molecular_density(300),
                               2.4462994721157665e19,
                               delta=10000)

        self.assertAlmostEqual(molecular_density(400),
                               1.834724604086825e19,
                               delta=10000)
Esempio n. 6
0
    def test_n_dimensional_molecular_density(self):
        """
        Tests :func:`colour.phenomena.rayleigh.molecular_density` definition
        n-dimensional arrays support.
        """

        temperature = 200
        N_s = molecular_density(temperature)

        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)