コード例 #1
0
    def test_nan_gravity_List1968(self):
        """
        Test :func:`colour.phenomena.rayleigh.gravity_List1968` 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:
            latitude = case
            altitude = case
            gravity_List1968(latitude, altitude)
コード例 #2
0
    def test_nan_gravity_List1968(self):
        """
        Tests :func:`colour.phenomena.rayleigh.gravity_List1968` 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:
            latitude = case
            altitude = case
            gravity_List1968(latitude, altitude)
コード例 #3
0
    def test_gravity_List1968(self):
        """
        Tests :func:`colour.phenomena.rayleigh.gravity_List1968` definition.
        """

        self.assertAlmostEqual(
            gravity_List1968(0.0, 0.0), 978.03560706, places=7)

        self.assertAlmostEqual(
            gravity_List1968(45.0, 1500.0), 980.15334386, places=7)

        self.assertAlmostEqual(
            gravity_List1968(48.8567, 35.0), 980.95241784, places=7)
コード例 #4
0
    def test_gravity_List1968(self):
        """Test :func:`colour.phenomena.rayleigh.gravity_List1968` definition."""

        self.assertAlmostEqual(gravity_List1968(0.0, 0.0),
                               978.03560706,
                               places=7)

        self.assertAlmostEqual(gravity_List1968(45.0, 1500.0),
                               980.15334386,
                               places=7)

        self.assertAlmostEqual(gravity_List1968(48.8567, 35.0),
                               980.95241784,
                               places=7)
コード例 #5
0
    def test_n_dimensional_gravity_List1968(self):
        """
        Test :func:`colour.phenomena.rayleigh.gravity_List1968`
        definition n-dimensional arrays support.
        """

        g = 978.03560706
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)

        g = np.tile(g, 6)
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)

        g = np.reshape(g, (2, 3))
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)

        g = np.reshape(g, (2, 3, 1))
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)
コード例 #6
0
    def test_n_dimensional_gravity_List1968(self):
        """
        Tests :func:`colour.phenomena.rayleigh.gravity_List1968`
        definition n-dimensional arrays support.
        """

        g = 978.03560706
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)

        g = np.tile(g, 6)
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)

        g = np.reshape(g, (2, 3))
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)

        g = np.reshape(g, (2, 3, 1))
        np.testing.assert_almost_equal(gravity_List1968(), g, decimal=7)