def test_gauss_symmetric(self): x = np.linspace(0., 5., 1000) s12 = 10.0 # sample length/2. sigma = 0.5 # beam width sigma G1 = instrument.GaussIntensity(x, s12, s12, sigma) G2 = instrument_numba.GaussIntensity(x, s12, s12, sigma) np.testing.assert_array_almost_equal(G1, G2)
def test_fp_gauss(self): ai = np.linspace(0., 10., 100) slen = 10.0 bw = np.sin( 5.0 * np.pi / 180. ) * slen / 2.0 # beam with to have +/-1 sigma illumination at 5 deg one_sigma = erf(1.0 / np.sqrt(2.0)) # area of Gaussian between + and - sigma IFP = instrument.GaussIntensity(ai, slen / 2., slen / 2., bw) self.assertTrue((IFP >= 0.0).all()) self.assertTrue((IFP < 1.0).all()) np.testing.assert_array_less(one_sigma, IFP[ai >= 5.0]) np.testing.assert_array_less(IFP[ai < 5.0], one_sigma)