- Timestamp:
- Sep 13, 2018 2:31:36 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
- Children:
- 43313e72
- Parents:
- feec1cb (diff), 356af60e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- test/sasdataloader/test
- Files:
-
- 3 added
- 3 deleted
- 4 edited
- 7 moved
Legend:
- Unmodified
- Added
- Removed
-
test/sasdataloader/test/test_data/avg_testdata.txt
r8c9ffde r7fd5e2a 1 1 0.00019987186878 -0.01196215 0.148605728355 2 0.000453772721237 0.02091606 0. 06802830293343 0.000750492390439 -0.01337855 0. 04449029107574 0.00103996394336 0.03062 0. 05803128945285 0.0013420198959 0.0811008333333 0. 05404692891086 0.001652061869 0.167022288372 0. 06518913200317 0.00196086470492 27.5554711176 0.7350533 009572 0.000453772721237 0.02091606 0.23372601 3 0.000750492390439 -0.01337855 0.17169562 4 0.00103996394336 0.03062 0.13136407 5 0.0013420198959 0.0811008333333 0.10681163 6 0.001652061869 0.167022288372 0.10098903 7 0.00196086470492 27.5554711176 0.7350533 8 8 0.00226262401224 105.031578947 1.35744586624 9 9 0.00256734439716 82.1791776119 1.10749938588 -
test/sasdataloader/test/test_data/ring_testdata.txt
r400155b r7fd5e2a 4 4 0.628318530718 0.964040908176 0.0790933208542 5 5 0.942477796077 0.922142905769 0.0781616076625 6 1.25663706144 1.02710537736 0.08 08758975386 1.25663706144 1.02710537736 0.08136351514804 7 7 1.57079632679 1.01448978075 0.0808313893873 8 8 1.88495559215 1.04677136013 0.0828850195035 -
test/sasdataloader/test/test_data/sectorphi_testdata.txt
r8c9ffde r7fd5e2a 13 13 0.981747704247 0.893411561538 0.151685984204 14 14 1.06028752059 0.86231787 0.152618707077 15 1.13882733693 1.0607364925 0.16 427615031615 1.13882733693 1.0607364925 0.166167546658 16 16 1.21736715327 1.0684421475 0.163649496829 17 1.29590696961 1.09330437436 0.16 787164526317 1.29590696961 1.09330437436 0.16981858402 18 18 1.37444678595 0.88759347 0.150974201439 19 19 1.45298660229 1.1352002 0.172191803977 -
test/sasdataloader/test/test_data/sectorq_testdata.txt
r8c9ffde r7fd5e2a 17 17 0.00913119845523 0.405669568421 0.0705339106673 18 18 0.00938052380065 0.331241946 0.061307573431 19 0.00962825731078 0.237315993939 0.05 7865476989319 0.00962825731078 0.237315993939 0.059602636160850493 20 20 0.00987552050718 0.296916590385 0.0592796733987 -
test/sasdataloader/test/test_data/slabx_testdata.txt
r8c9ffde r7fd5e2a 21 21 -0.00184475260646 2.40154 1.09579651396 22 22 -0.00143541414791 0.065281 0.198049867458 23 -0.00102607559383 -0.04767235 0. 15438968553624 -0.000616736954402 -0.0090503 0. 096010546295723 -0.00102607559383 -0.04767235 0.52329358394690839 24 -0.000616736954402 -0.0090503 0.36635778277525377 25 25 -0.000207398273925 0.03109325 0.246629023029 26 0.000201940423805 -0.027508775 0. 08292884751426 0.000201940423805 -0.027508775 0.36314899662535211 27 27 0.000611279108096 0.03251315 0.246951260373 28 0.00102061774154 -0.00987975 0. 14423353458929 0.00142995630705 0.075937 0. 1948550743528 0.00102061774154 -0.00987975 0.38184199939241886 29 0.00142995630705 0.075937 0.53662696540520582 30 30 0.00183929475361 10.60918375 1.62858709853 31 31 0.00224863307777 106.2485 7.2886384188 -
test/sasdataloader/test/test_data/slaby_testdata.txt
r8c9ffde r7fd5e2a 1 -0.00981587154747 0.197046827778 0.0 8722263092611 -0.00981587154747 0.197046827778 0.09153902 2 2 -0.00940654133769 0.2466434 0.124972263589 3 3 -0.0089972103454 0.218745969444 0.0838510368061 4 4 -0.00858787875434 0.126093522222 0.107482002513 5 -0.00817854644886 0.310427366667 0.10 09452898525 -0.00817854644886 0.310427366667 0.10469745 6 6 -0.0077692135991 0.0843802722222 0.103942898914 7 7 -0.00735988010303 0.246036369444 0.0916479235889 -
test/sasdataloader/test/utest_abs_reader.py
rbd5c3b1 r35ac8df 118 118 self.assertEqual(self.data.detector[0].beam_center.y, center_y) 119 119 120 self.assertEqual(self.data.I_unit, ' 1/cm')120 self.assertEqual(self.data.I_unit, 'cm^{-1}') 121 121 self.assertEqual(self.data.data[0], 1.57831) 122 122 self.assertEqual(self.data.data[1], 2.70983) -
test/sasdataloader/test/utest_averaging.py
rf53d684 r7fd5e2a 106 106 107 107 def setUp(self): 108 filepath = find(' MAR07232_rest.h5')108 filepath = find('test_data//MAR07232_rest.h5') 109 109 self.data_list = Loader().load(filepath) 110 110 self.data = self.data_list[0] … … 121 121 122 122 o = r(self.data) 123 filepath = find(' ring_testdata.txt')123 filepath = find('test_data//ring_testdata.txt') 124 124 answer_list = Loader().load(filepath) 125 125 answer = answer_list[0] … … 142 142 o = r(self.data) 143 143 144 filepath = find(' avg_testdata.txt')144 filepath = find('test_data//avg_testdata.txt') 145 145 answer = Loader().load(filepath)[0] 146 146 for i in range(r.nbins_phi): … … 158 158 s, ds, npoints = r(self.data) 159 159 self.assertAlmostEqual(s, 34.278990899999997, 4) 160 self.assertAlmostEqual(ds, 7.8007981835194293, 4)160 self.assertAlmostEqual(ds, 8.237259999538685, 4) 161 161 self.assertAlmostEqual(npoints, 324.0000, 4) 162 162 … … 164 164 s, ds = r(self.data) 165 165 self.assertAlmostEqual(s, 0.10579935462962962, 4) 166 self.assertAlmostEqual(ds, 0.02 4076537603455028, 4)166 self.assertAlmostEqual(ds, 0.02542364197388483, 4) 167 167 168 168 def test_slabX(self): … … 177 177 o = r(self.data) 178 178 179 filepath = find(' slabx_testdata.txt')179 filepath = find('test_data//slabx_testdata.txt') 180 180 answer = Loader().load(filepath)[0] 181 181 for i in range(len(o.x)): … … 195 195 o = r(self.data) 196 196 197 filepath = find(' slaby_testdata.txt')197 filepath = find('test_data//slaby_testdata.txt') 198 198 answer = Loader().load(filepath)[0] 199 199 for i in range(len(o.x)): … … 221 221 o = r(self.data) 222 222 223 filepath = find(' ring_testdata.txt')223 filepath = find('test_data//ring_testdata.txt') 224 224 answer = Loader().load(filepath)[0] 225 225 for i in range(len(o.x)): … … 238 238 o = r(self.data) 239 239 240 filepath = find(' sectorphi_testdata.txt')240 filepath = find('test_data//sectorphi_testdata.txt') 241 241 answer = Loader().load(filepath)[0] 242 242 for i in range(len(o.x)): … … 255 255 o = r(self.data) 256 256 257 filepath = find(' sectorq_testdata.txt')257 filepath = find('test_data//sectorq_testdata.txt') 258 258 answer = Loader().load(filepath)[0] 259 259 for i in range(len(o.x)): -
test/sasdataloader/test/utest_cansas.py
rf53d684 r2ca5d57b 91 91 reader = XMLreader(self.xml_valid, self.schema_1_0) 92 92 valid = reader.validate_xml() 93 if valid: 94 self.assertTrue(valid) 95 else: 96 self.assertFalse(valid) 93 self.assertTrue(valid) 97 94 98 95 def _check_data(self, data): … … 193 190 def test_save_cansas_v1_0(self): 194 191 xmlreader = XMLreader(self.isis_1_0, self.schema_1_0) 195 valid = xmlreader.validate_xml() 196 self.assertTrue(valid) 192 self.assertTrue(xmlreader.validate_xml()) 197 193 reader_generic = Loader() 198 194 dataloader = reader_generic.load(self.isis_1_0) … … 207 203 return_data = reader2.read(self.write_1_0_filename) 208 204 written_data = return_data[0] 209 XMLreader(self.write_1_0_filename, self.schema_1_0) 210 valid = xmlreader.validate_xml() 211 self.assertTrue(valid) 205 xmlreader = XMLreader(self.write_1_0_filename, self.schema_1_0) 206 self.assertTrue(xmlreader.validate_xml()) 212 207 self._check_data(written_data) 213 208 if os.path.isfile(self.write_1_0_filename): … … 260 255 self.loader = Loader() 261 256 self.datafile_basic = find("simpleexamplefile.h5") 262 self.datafile_multiplesasentry = find("cansas_1Dand2D_samedatafile.h5") 263 self.datafile_multiplesasdata = find("cansas_1Dand2D_samesasentry.h5") 264 self.datafile_multiplesasdata_multiplesasentry = find("cansas_1Dand2D_multiplesasentry_multiplesasdata.h5") 257 self.datafile_multiplesasentry = find( 258 "test_data//nxcansas_1Dand2D_multisasentry.h5") 259 self.datafile_multiplesasdata = find( 260 "test_data//nxcansas_1Dand2D_multisasdata.h5") 261 self.datafile_multiplesasdata_multiplesasentry = find( 262 "test_data//nxcansas_1Dand2D_multisasentry_multisasdata.h5") 265 263 266 264 def test_real_data(self): … … 273 271 self._check_multiple_data(self.data[0]) 274 272 self._check_multiple_data(self.data[1]) 275 self._check_1d_data(self.data[0]) 273 if isinstance(self.data[0], Data1D): 274 self._check_1d_data(self.data[0]) 275 self._check_2d_data(self.data[1]) 276 else: 277 self._check_1d_data(self.data[1]) 278 self._check_2d_data(self.data[0]) 279 280 def test_multiple_sasdatas(self): 281 self.data = self.loader.load(self.datafile_multiplesasdata) 282 self.assertTrue(len(self.data) == 2) 283 self._check_multiple_data(self.data[0]) 284 self._check_multiple_data(self.data[1]) 285 if isinstance(self.data[0], Data1D): 286 self._check_1d_data(self.data[0]) 287 self._check_2d_data(self.data[1]) 288 else: 289 self._check_1d_data(self.data[1]) 290 self._check_2d_data(self.data[0]) 291 292 def test_multiple_sasentries_multiplesasdatas(self): 293 self.data = self.loader.load( 294 self.datafile_multiplesasdata_multiplesasentry) 295 self.assertTrue(len(self.data) == 4) 296 self._check_multiple_data(self.data[0]) 297 self._check_multiple_data(self.data[1]) 298 self._check_multiple_data(self.data[2]) 299 self._check_multiple_data(self.data[3]) 300 for data in self.data: 301 if isinstance(data, Data1D): 302 self._check_1d_data(data) 303 else: 304 self._check_2d_data(data) 276 305 277 306 def _check_multiple_data(self, data): … … 281 310 self.assertTrue(data.instrument == "SANS2D") 282 311 self.assertTrue(data.source.radiation == "Spallation Neutron Source") 283 self.assertTrue(len(data.detector) == 1) 284 self.assertTrue(data.detector[0].name == "rear-detector") 285 self.assertTrue(data.detector[0].distance == 4.385281) 286 self.assertTrue(data.detector[0].distance_unit == 'm') 312 self.assertTrue(len(data.detector) == 2) 313 self.assertTrue(data.detector[0].name == "rear-detector" 314 or data.detector[1].name == "rear-detector") 315 self.assertTrue(data.detector[0].name == "front-detector" 316 or data.detector[1].name == "front-detector") 317 self.assertAlmostEqual(data.detector[0].distance + 318 data.detector[1].distance, 7230.54, 2) 319 self.assertTrue(data.detector[0].distance_unit == 'mm') 287 320 self.assertTrue(len(data.trans_spectrum) == 1) 288 321 289 322 def _check_1d_data(self, data): 290 self.assertTrue(isinstance(data, Data1D))291 323 self.assertTrue(len(data.x) == 66) 292 324 self.assertTrue(len(data.x) == len(data.y)) 293 self.assertTrue(data.dy[10] == 0.20721 350111248701)294 self.assertTrue(data.y[10] == 24.193 889608153476)295 self.assertTrue(data.x[10] == 0.0089811 27988654792)325 self.assertTrue(data.dy[10] == 0.207214) 326 self.assertTrue(data.y[10] == 24.1939) 327 self.assertTrue(data.x[10] == 0.00898113) 296 328 297 329 def _check_2d_data(self, data): 298 330 self.assertTrue(isinstance(data, Data2D)) 299 self.assertTrue(len(data.x) == 66) 300 self.assertTrue(len(data.x) == len(data.y)) 301 self.assertTrue(data.dy[10] == 0.20721350111248701) 302 self.assertTrue(data.y[10] == 24.193889608153476) 303 self.assertTrue(data.x[10] == 0.008981127988654792) 331 self.assertTrue(len(data.q_data) == 150*150) 332 self.assertTrue(len(data.q_data) == len(data.data)) 333 self.assertAlmostEqual(data.err_data[10], 0.186723989418) 334 self.assertAlmostEqual(data.data[10], 0.465181) 335 self.assertAlmostEqual(data.qx_data[10], -0.129) 336 self.assertAlmostEqual(data.qy_data[10], -0.149) 304 337 305 338 def _check_example_data(self, data): -
test/sasdataloader/test/utest_red2d_reader.py
rf53d684 rfc51d06 31 31 self.assertEqual(f.qx_data[0],-0.03573497) 32 32 self.assertEqual(f.qx_data[36863],0.2908819) 33 self.assertEqual(f.Q_unit, ' 1/A')34 self.assertEqual(f.I_unit, ' 1/cm')33 self.assertEqual(f.Q_unit, 'A^{-1}') 34 self.assertEqual(f.I_unit, 'cm^{-1}') 35 35 36 36 self.assertEqual(f.meta_data['loader'],"IGOR/DAT 2D Q_map")
Note: See TracChangeset
for help on using the changeset viewer.