def test_O2_depolarisation(self): """Test :func:`colour.phenomena.rayleigh.O2_depolarisation` definition.""" self.assertAlmostEqual(O2_depolarisation(0.360), 1.115307746532541, places=7) self.assertAlmostEqual(O2_depolarisation(0.555), 1.102022536201071, places=7) self.assertAlmostEqual(O2_depolarisation(0.830), 1.098315561269013, places=7)
def test_nan_O2_depolarisation(self): """ Test :func:`colour.phenomena.rayleigh.O2_depolarisation` definition nan support. """ O2_depolarisation(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
def test_n_dimensional_O2_depolarisation(self): """ Test :func:`colour.phenomena.rayleigh.O2_depolarisation` definition n-dimensional arrays support. """ wl = 0.360 n = O2_depolarisation(wl) wl = np.tile(wl, 6) n = np.tile(n, 6) np.testing.assert_almost_equal(O2_depolarisation(wl), n, decimal=7) wl = np.reshape(wl, (2, 3)) n = np.reshape(n, (2, 3)) np.testing.assert_almost_equal(O2_depolarisation(wl), n, decimal=7) wl = np.reshape(wl, (2, 3, 1)) n = np.reshape(n, (2, 3, 1)) np.testing.assert_almost_equal(O2_depolarisation(wl), n, decimal=7)