Beispiel #1
0
    def test_n_dimensional_air_refraction_index_Bodhaine1999(self):
        """
        Test :func:`colour.phenomena.rayleigh.\
air_refraction_index_Bodhaine1999` definition n-dimensional arrays support.
        """

        wl = 0.360
        n = air_refraction_index_Bodhaine1999(wl)

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

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

        wl = np.reshape(wl, (2, 3, 1))
        n = np.reshape(n, (2, 3, 1))
        np.testing.assert_almost_equal(air_refraction_index_Bodhaine1999(wl),
                                       n,
                                       decimal=7)
Beispiel #2
0
    def test_nan_air_refraction_index_Bodhaine1999(self):
        """
        Test :func:`colour.phenomena.rayleigh.\
air_refraction_index_Bodhaine1999` 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
            air_refraction_index_Bodhaine1999(wavelength, CO2_concentration)
Beispiel #3
0
    def test_nan_air_refraction_index_Bodhaine1999(self):
        """
        Tests :func:`colour.phenomena.rayleigh.\
air_refraction_index_Bodhaine1999` 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
            air_refraction_index_Bodhaine1999(wavelength, CO2_concentration)
Beispiel #4
0
    def test_air_refraction_index_Bodhaine1999(self):
        """
        Tests :func:`colour.phenomena.rayleigh.\
air_refraction_index_Bodhaine1999` definition.
        """

        self.assertAlmostEqual(
            air_refraction_index_Bodhaine1999(0.360),
            1.000285310285056,
            places=10)

        self.assertAlmostEqual(
            air_refraction_index_Bodhaine1999(0.555),
            1.000277726541484,
            places=10)

        self.assertAlmostEqual(
            air_refraction_index_Bodhaine1999(0.830),
            1.000274859144804,
            places=10)

        self.assertAlmostEqual(
            air_refraction_index_Bodhaine1999(0.360, 0),
            1.000285264064789,
            places=10)

        self.assertAlmostEqual(
            air_refraction_index_Bodhaine1999(0.555, 360),
            1.000277735539824,
            places=10)

        self.assertAlmostEqual(
            air_refraction_index_Bodhaine1999(0.830, 620),
            1.000274906640464,
            places=10)
Beispiel #5
0
    def test_air_refraction_index_Bodhaine1999(self):
        """
        Tests :func:`colour.phenomena.rayleigh.\
air_refraction_index_Bodhaine1999` definition.
        """

        self.assertAlmostEqual(air_refraction_index_Bodhaine1999(0.360),
                               1.000285310285056,
                               places=10)

        self.assertAlmostEqual(air_refraction_index_Bodhaine1999(0.555),
                               1.000277726541484,
                               places=10)

        self.assertAlmostEqual(air_refraction_index_Bodhaine1999(0.830),
                               1.000274859144804,
                               places=10)

        self.assertAlmostEqual(air_refraction_index_Bodhaine1999(0.360, 0),
                               1.000285264064789,
                               places=10)

        self.assertAlmostEqual(air_refraction_index_Bodhaine1999(0.555, 360),
                               1.000277735539824,
                               places=10)

        self.assertAlmostEqual(air_refraction_index_Bodhaine1999(0.830, 620),
                               1.000274906640464,
                               places=10)
Beispiel #6
0
    def test_n_dimensional_air_refraction_index_Bodhaine1999(self):
        """
        Tests :func:`colour.phenomena.rayleigh.\
air_refraction_index_Bodhaine1999` definition n-dimensional arrays support.
        """

        wl = 0.360
        n = air_refraction_index_Bodhaine1999(wl)

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

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

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