Changeset 2a52b0e in sasview for test/sasdataloader/test/utest_abs_reader.py
- Timestamp:
- Aug 2, 2017 3: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
- File:
-
- 1 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):
Note: See TracChangeset
for help on using the changeset viewer.