def test_sectorphi_full(self): """ Test sector averaging """ r = SectorPhi(r_min=self.qmin, r_max=3*self.qmin, phi_min=0, phi_max=math.pi*2.0) r.nbins_phi = 20 o = r(self.data) for i in range(7): self.assertEqual(o.y[i], 1.0)
def test_sectorphi_full(self): """ Test sector averaging """ r = SectorPhi(r_min=self.qmin, r_max=3 * self.qmin, phi_min=0, phi_max=math.pi * 2.0) r.nbins_phi = 20 o = r(self.data) for i in range(7): self.assertEqual(o.y[i], 1.0)
def test_sectorphi_partial(self): """ """ phi_max = math.pi * 1.5 r = SectorPhi(r_min=self.qmin, r_max=3*self.qmin, phi_min=0, phi_max=phi_max) self.assertEqual(r.phi_max, phi_max) r.nbins_phi = 20 o = r(self.data) self.assertEqual(r.phi_max, phi_max) for i in range(17): self.assertEqual(o.y[i], 1.0)
def test_sectorphi_partial(self): """ """ phi_max = math.pi * 1.5 r = SectorPhi(r_min=self.qmin, r_max=3 * self.qmin, phi_min=0, phi_max=phi_max) self.assertEqual(r.phi_max, phi_max) r.nbins_phi = 20 o = r(self.data) self.assertEqual(r.phi_max, phi_max) for i in range(17): self.assertEqual(o.y[i], 1.0)
def test_sectorphi_quarter(self): """ Test sector averaging I(phi) The test data was not generated by IGOR. """ r = SectorPhi(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi / 2.0) r.nbins_phi = 20 o = r(self.data) filepath = find('test_data' + os.sep + 'sectorphi_testdata.txt') answer = Loader().load(filepath)[0] for i in range(len(o.x)): self.assertAlmostEqual(o.x[i], answer.x[i], 4) self.assertAlmostEqual(o.y[i], answer.y[i], 4) self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
def test_sectorphi_full(self): """ Test sector averaging I(phi) When considering the whole azimuthal range (2pi), the answer should be the same as ring averaging. The test data was not generated by IGOR. """ nbins = 19 phi_min = math.pi / (nbins + 1) phi_max = math.pi * 2 - phi_min r = SectorPhi(r_min=.005, r_max=.01, phi_min=phi_min, phi_max=phi_max, nbins=nbins) o = r(self.data) filepath = find('test_data' + os.sep + 'ring_testdata.txt') answer = Loader().load(filepath)[0] for i in range(len(o.x)): self.assertAlmostEqual(o.x[i], answer.x[i], 4) self.assertAlmostEqual(o.y[i], answer.y[i], 4) self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
def test_sectorphi_full(self): """ Test sector averaging I(phi) When considering the whole azimuthal range (2pi), the answer should be the same as ring averaging. The test data was not generated by IGOR. """ from sas.sascalc.dataloader.manipulations import SectorPhi import math nbins = 19 phi_min = math.pi / (nbins + 1) phi_max = math.pi * 2 - phi_min r = SectorPhi(r_min=.005, r_max=.01, phi_min=phi_min, phi_max=phi_max, nbins=nbins) o = r(self.data) answer = Loader().load('ring_testdata.txt') for i in range(len(o.x)): self.assertAlmostEqual(o.x[i], answer.x[i], 4) self.assertAlmostEqual(o.y[i], answer.y[i], 4) self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
def test_sectorphi_quarter(self): """ Test sector averaging I(phi) The test data was not generated by IGOR. """ from sas.sascalc.dataloader.manipulations import SectorPhi import math r = SectorPhi(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi/2.0) r.nbins_phi = 20 o = r(self.data) answer = Loader().load('sectorphi_testdata.txt') for i in range(len(o.x)): self.assertAlmostEqual(o.x[i], answer.x[i], 4) self.assertAlmostEqual(o.y[i], answer.y[i], 4) self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)
def test_sectorphi_quarter(self): """ Test sector averaging I(phi) The test data was not generated by IGOR. """ from sas.sascalc.dataloader.manipulations import SectorPhi import math r = SectorPhi(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi / 2.0) r.nbins_phi = 20 o = r(self.data) answer = Loader().load('sectorphi_testdata.txt') for i in range(len(o.x)): self.assertAlmostEqual(o.x[i], answer.x[i], 4) self.assertAlmostEqual(o.y[i], answer.y[i], 4) self.assertAlmostEqual(o.dy[i], answer.dy[i], 4)