Changeset a8d79fd in sasview for test/sasdataloader
- Timestamp:
- Apr 4, 2017 11:41:31 AM (8 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:
- 571bf4b
- Parents:
- 063dd44 (diff), 5156918 (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. - git-author:
- Andrew Jackson <andrew.jackson@…> (04/04/17 11:41:31)
- git-committer:
- GitHub <noreply@…> (04/04/17 11:41:31)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sasdataloader/test/utest_abs_reader.py
r5f26aa4 r36d69e1 4 4 5 5 import unittest 6 import numpy, math 7 from sas.sascalc.dataloader.loader import Loader 6 import math 7 import numpy as np 8 from sas.sascalc.dataloader.loader import Loader 9 from sas.sascalc.dataloader.readers.IgorReader import Reader as IgorReader 8 10 from sas.sascalc.dataloader.data_info import Data1D 9 11 … … 86 88 87 89 def setUp(self): 88 self.data = Loader().load("MAR07232_rest.ASC") 89 90 # the IgorReader should be able to read this filetype 91 # if it can't, stop here. 92 reader = IgorReader() 93 self.data = reader.read("MAR07232_rest.ASC") 94 90 95 def test_igor_checkdata(self): 91 96 """ … … 108 113 109 114 self.assertEqual(self.data.detector[0].beam_center_unit, 'mm') 110 center_x = (68.76 -1)*5.0111 center_y = (62.47 -1)*5.0115 center_x = (68.76 - 1)*5.0 116 center_y = (62.47 - 1)*5.0 112 117 self.assertEqual(self.data.detector[0].beam_center.x, center_x) 113 118 self.assertEqual(self.data.detector[0].beam_center.y, center_y) 114 119 115 120 self.assertEqual(self.data.I_unit, '1/cm') 116 self.assertEqual(self.data.data[0], 0.279783) 117 self.assertEqual(self.data.data[1], 0.28951) 118 self.assertEqual(self.data.data[2], 0.167634) 119 121 # 3 points should be suffcient to check that the data is in column 122 # major order. 123 np.testing.assert_almost_equal(self.data.data[0:3], 124 [0.279783, 0.28951, 0.167634]) 125 np.testing.assert_almost_equal(self.data.qx_data[0:3], 126 [-0.01849072, -0.01821785, -0.01794498]) 127 np.testing.assert_almost_equal(self.data.qy_data[0:3], 128 [-0.01677435, -0.01677435, -0.01677435]) 129 130 def test_generic_loader(self): 131 # the generic loader should direct the file to IgorReader as well 132 data = Loader().load("MAR07232_rest.ASC") 133 self.assertEqual(data.meta_data['loader'], "IGOR 2D") 134 135 120 136 class danse_reader(unittest.TestCase): 121 137 … … 313 329 from sas.sascalc.dataloader.readers.cansas_reader import Reader 314 330 r = Reader() 315 x = n umpy.ones(5)316 y = n umpy.ones(5)317 dy = n umpy.ones(5)331 x = np.ones(5) 332 y = np.ones(5) 333 dy = np.ones(5) 318 334 319 335 filename = "write_test.xml"
Note: See TracChangeset
for help on using the changeset viewer.