Changeset 2e83ff3 in sasview for DataLoader/test
- Timestamp:
- Sep 22, 2008 3:53:09 PM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 1374174f
- Parents:
- 55fd102
- Location:
- DataLoader/test
- Files:
-
- 4 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/test/utest_averaging.py
rf8d0ee7 r2e83ff3 61 61 self.assertAlmostEqual(ds, 0.011979881083557541, 4) 62 62 63 def test_slabX(self): 64 """ 65 Test slab in X 66 The test data was not generated by IGOR. 67 """ 68 from DataLoader.manipulations import SlabX 69 70 r = SlabX(x_min=-.01, x_max=.01, y_min=-0.0002, y_max=0.0002, bin_width=0.0004) 71 r.fold = False 72 o = r(self.data) 73 74 answer = Loader().load('slabx_testdata.txt') 75 for i in range(len(o.x)): 76 self.assertAlmostEqual(o.x[i], answer.x[i], 4) 77 self.assertAlmostEqual(o.y[i], answer.y[i], 4) 78 self.assertAlmostEqual(o.dy[i], answer.dy[i], 4) 79 80 def test_slabY(self): 81 """ 82 Test slab in Y 83 The test data was not generated by IGOR. 84 """ 85 from DataLoader.manipulations import SlabY 86 87 r = SlabY(x_min=.005, x_max=.01, y_min=-0.01, y_max=0.01, bin_width=0.0004) 88 r.fold = False 89 o = r(self.data) 90 91 answer = Loader().load('slaby_testdata.txt') 92 for i in range(len(o.x)): 93 self.assertAlmostEqual(o.x[i], answer.x[i], 4) 94 self.assertAlmostEqual(o.y[i], answer.y[i], 4) 95 self.assertAlmostEqual(o.dy[i], answer.dy[i], 4) 96 97 def test_sectorphi_full(self): 98 """ 99 Test sector averaging I(phi) 100 When considering the whole azimuthal range (2pi), 101 the answer should be the same as ring averaging. 102 The test data was not generated by IGOR. 103 """ 104 from DataLoader.manipulations import SectorPhi 105 import math 106 107 r = SectorPhi(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi*2.0) 108 r.nbins_phi = 20 109 o = r(self.data) 110 111 answer = Loader().load('ring_testdata.txt') 112 for i in range(len(o.x)): 113 self.assertAlmostEqual(o.x[i], answer.x[i], 4) 114 self.assertAlmostEqual(o.y[i], answer.y[i], 4) 115 self.assertAlmostEqual(o.dy[i], answer.dy[i], 4) 116 117 def test_sectorphi_quarter(self): 118 """ 119 Test sector averaging I(phi) 120 The test data was not generated by IGOR. 121 """ 122 from DataLoader.manipulations import SectorPhi 123 import math 124 125 r = SectorPhi(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi/2.0) 126 r.nbins_phi = 20 127 o = r(self.data) 128 129 answer = Loader().load('sectorphi_testdata.txt') 130 for i in range(len(o.x)): 131 self.assertAlmostEqual(o.x[i], answer.x[i], 4) 132 self.assertAlmostEqual(o.y[i], answer.y[i], 4) 133 self.assertAlmostEqual(o.dy[i], answer.dy[i], 4) 134 135 def test_sectorq_full(self): 136 """ 137 Test sector averaging I(q) 138 The test data was not generated by IGOR. 139 """ 140 from DataLoader.manipulations import SectorQ 141 import math 142 143 r = SectorQ(r_min=.005, r_max=.01, phi_min=0, phi_max=math.pi/2.0) 144 r.nbins_phi = 20 145 o = r(self.data) 146 147 answer = Loader().load('sectorq_testdata.txt') 148 for i in range(len(o.x)): 149 self.assertAlmostEqual(o.x[i], answer.x[i], 4) 150 self.assertAlmostEqual(o.y[i], answer.y[i], 4) 151 self.assertAlmostEqual(o.dy[i], answer.dy[i], 4) 152 63 153 64 154 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.