Changeset 2a52b0e in sasview
- Timestamp:
- Aug 2, 2017 5:37:27 AM (7 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 3eb7bf2
- Parents:
- be43448
- Location:
- test/sasdataloader/test
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sasdataloader/test/utest_abs_reader.py
r5a8cdbb r2a52b0e 101 101 data = Loader().load("S2-30dq.d1d") 102 102 self.assertEqual(data.meta_data['loader'], "HFIR 1D") 103 104 105 class igor_reader(unittest.TestCase):106 107 def setUp(self):108 # the IgorReader should be able to read this filetype109 # if it can't, stop here.110 reader = IgorReader()111 self.data = reader.read("MAR07232_rest.ASC")112 113 def test_igor_checkdata(self):114 """115 Check the data content to see whether116 it matches the specific file we loaded.117 Check the units too to see whether the118 Data1D defaults changed. Otherwise the119 tests won't pass120 """121 self.assertEqual(self.data.filename, "MAR07232_rest.ASC")122 self.assertEqual(self.data.meta_data['loader'], "IGOR 2D")123 124 self.assertEqual(self.data.source.wavelength_unit, 'A')125 self.assertEqual(self.data.source.wavelength, 8.4)126 127 self.assertEqual(self.data.detector[0].distance_unit, 'mm')128 self.assertEqual(self.data.detector[0].distance, 13705)129 130 self.assertEqual(self.data.sample.transmission, 0.84357)131 132 self.assertEqual(self.data.detector[0].beam_center_unit, 'mm')133 center_x = (68.76 - 1)*5.0134 center_y = (62.47 - 1)*5.0135 self.assertEqual(self.data.detector[0].beam_center.x, center_x)136 self.assertEqual(self.data.detector[0].beam_center.y, center_y)137 138 self.assertEqual(self.data.I_unit, '1/cm')139 # 3 points should be suffcient to check that the data is in column140 # major order.141 np.testing.assert_almost_equal(self.data.data[0:3],142 [0.279783, 0.28951, 0.167634])143 np.testing.assert_almost_equal(self.data.qx_data[0:3],144 [-0.01849072, -0.01821785, -0.01794498])145 np.testing.assert_almost_equal(self.data.qy_data[0:3],146 [-0.01677435, -0.01677435, -0.01677435])147 148 def test_generic_loader(self):149 # the generic loader should direct the file to IgorReader as well150 data = Loader().load("MAR07232_rest.ASC")151 self.assertEqual(data.meta_data['loader'], "IGOR 2D")152 153 103 154 104 class DanseReaderTests(unittest.TestCase): -
test/sasdataloader/test/utest_averaging.py
r5a8cdbb r2a52b0e 103 103 def setUp(self): 104 104 filepath = os.path.join(os.path.dirname( 105 os.path.realpath(__file__)), 'MAR07232_rest. ASC')106 self.data = Loader().load(filepath) 105 os.path.realpath(__file__)), 'MAR07232_rest.h5') 106 self.data = Loader().load(filepath)[0] 107 107 108 108 def test_ring(self): … … 119 119 filepath = os.path.join(os.path.dirname( 120 120 os.path.realpath(__file__)), 'ring_testdata.txt') 121 answer = Loader().load(filepath) 121 answer = Loader().load(filepath)[0] 122 122 123 123 for i in range(r.nbins_phi - 1): … … 139 139 filepath = os.path.join(os.path.dirname( 140 140 os.path.realpath(__file__)), 'avg_testdata.txt') 141 answer = Loader().load(filepath) 141 answer = Loader().load(filepath)[0] 142 142 for i in range(r.nbins_phi): 143 143 self.assertAlmostEqual(o.x[i], answer.x[i], 4) … … 175 175 filepath = os.path.join(os.path.dirname( 176 176 os.path.realpath(__file__)), 'slabx_testdata.txt') 177 answer = Loader().load(filepath) 177 answer = Loader().load(filepath)[0] 178 178 for i in range(len(o.x)): 179 179 self.assertAlmostEqual(o.x[i], answer.x[i], 4) … … 194 194 filepath = os.path.join(os.path.dirname( 195 195 os.path.realpath(__file__)), 'slaby_testdata.txt') 196 answer = Loader().load(filepath) 196 answer = Loader().load(filepath)[0] 197 197 for i in range(len(o.x)): 198 198 self.assertAlmostEqual(o.x[i], answer.x[i], 4) … … 221 221 filepath = os.path.join(os.path.dirname( 222 222 os.path.realpath(__file__)), 'ring_testdata.txt') 223 answer = Loader().load(filepath) 223 answer = Loader().load(filepath)[0] 224 224 for i in range(len(o.x)): 225 225 self.assertAlmostEqual(o.x[i], answer.x[i], 4) … … 239 239 filepath = os.path.join(os.path.dirname( 240 240 os.path.realpath(__file__)), 'sectorphi_testdata.txt') 241 answer = Loader().load(filepath) 241 answer = Loader().load(filepath)[0] 242 242 for i in range(len(o.x)): 243 243 self.assertAlmostEqual(o.x[i], answer.x[i], 4) … … 257 257 filepath = os.path.join(os.path.dirname( 258 258 os.path.realpath(__file__)), 'sectorq_testdata.txt') 259 answer = Loader().load(filepath) 259 answer = Loader().load(filepath)[0] 260 260 for i in range(len(o.x)): 261 261 self.assertAlmostEqual(o.x[i], answer.x[i], 4)
Note: See TracChangeset
for help on using the changeset viewer.