예제 #1
0
    def test_n_dimensional_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.rayleigh_optical_depth`
        definition n-dimensional arrays support.
        """

        wl = 360 * 10e-8
        T_R = 0.5991013368480278
        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)
예제 #2
0
    def test_n_dimensional_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.rayleigh_optical_depth`
        definition n-dimensional arrays support.
        """

        wl = 360 * 10e-8
        T_R = 0.5991013368480278
        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)
예제 #3
0
    def test_nan_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomenons.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)
예제 #4
0
    def test_nan_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomenons.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)
예제 #5
0
    def test_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomenons.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)
예제 #6
0
    def test_rayleigh_optical_depth(self):
        """
        Tests :func:`colour.phenomenons.rayleigh.rayleigh_optical_depth`
        definition.
        """

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.assertAlmostEqual(
            rayleigh_optical_depth(555 * 10e-8, latitude=48.8567, altitude=35),
            0.10010846270542267,
            places=10)
예제 #7
0
"""

import colour
from colour.phenomenons import (rayleigh_optical_depth,
                                rayleigh_scattering_spd,
                                scattering_cross_section)
from colour.utilities.verbose import message_box

message_box('Rayleigh Optical Depth Computations')

wavelength = 555 * 10e-8
message_box(('Computing the scattering cross section per molecule at given '
             'wavelength in cm:\n'
             '\n\tWavelength: {0} cm'.format(wavelength)))
print(scattering_cross_section(wavelength))

print('\n')

message_box(('Computing the "Rayleigh Optical depth" as function of '
             'wavelength in cm:\n'
             '\n\tWavelength: {0} cm'.format(wavelength)))
print(rayleigh_optical_depth(wavelength))

print('\n')

message_box(('Creating a "Rayleigh" spectral power distribution with default '
             'spectral shape:\n'
             '\n\t{0}'.format(colour.DEFAULT_SPECTRAL_SHAPE)))
spd = rayleigh_scattering_spd()
print(spd[555])
예제 #8
0
import colour
from colour.phenomenons import (
    rayleigh_optical_depth,
    rayleigh_scattering_spd,
    scattering_cross_section)
from colour.utilities.verbose import message_box

message_box('Rayleigh Optical Depth Computations')

wavelength = 555 * 10e-8
message_box(('Computing the scattering cross section per molecule at given '
             'wavelength in cm:\n'
             '\n\tWavelength: {0} cm'.format(wavelength)))
print(scattering_cross_section(wavelength))

print('\n')

message_box(('Computing the "Rayleigh Optical depth" as function of '
             'wavelength in cm:\n'
             '\n\tWavelength: {0} cm'.format(wavelength)))
print(rayleigh_optical_depth(wavelength))

print('\n')

message_box(('Creating a "Rayleigh" spectral power distribution with default '
             'spectral shape:\n'
             '\n\t{0}'.format(colour.DEFAULT_SPECTRAL_SHAPE)))
spd = rayleigh_scattering_spd()
print(spd[555])