Changeset 16d8e5f in sasview for DataLoader/test
- Timestamp:
- Jul 10, 2008 4:41:18 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:
- 83ca047
- Parents:
- 93f0a586
- Location:
- DataLoader/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/test/testLoad.py
rd3619421 r16d8e5f 19 19 from DataLoader.readers import TXT3_Reader,TXT2_Reader 20 20 from DataLoader.readers import IgorReader,danse_reader,tiff_reader 21 21 22 import os.path 22 23 class testLoader(unittest.TestCase): … … 56 57 57 58 #Testing loading a txt file of 2 columns, the only reader should be read1 58 xload,yload,dyload=self.L.load('test_2_columns.txt')59 output=self.L.load('test_2_columns.txt') 59 60 x=[2.83954,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449,1.42857,1.63265] 60 61 y=[0.6,3.44938, 5.82026,5.27591,5.2781,5.22531,7.47487,7.85852,10.2278] 61 62 dx=[] 62 63 dy=[] 63 self.assertEqual(len( xload),len(x))64 self.assertEqual(len( yload),len(y))65 self.assertEqual(len(dyload),0)64 self.assertEqual(len(output.x),len(x)) 65 self.assertEqual(len(output.y),len(y)) 66 66 67 for i in range(len(x)): 67 self.assertEqual( xload[i],x[i])68 self.assertEqual( yload[i],y[i])68 self.assertEqual(output.x[i],x[i]) 69 self.assertEqual(output.y[i],y[i]) 69 70 70 71 71 72 def testLoad2(self): 72 73 """Testing loading a txt file of 3 columns""" 73 xload,yload,dyload= self.L.load('test_3_columns.txt')74 output= self.L.load('test_3_columns.txt') 74 75 x=[0,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449] 75 76 y=[2.83954,3.44938,5.82026,5.27591,5.2781,5.22531,7.47487] 76 77 dx=[] 77 78 dy=[0.6,0.676531,0.753061,0.829592,0.906122,0.982653,1.05918] 78 self.assertEqual(len( xload),len(x))79 self.assertEqual(len( yload),len(y))80 self.assertEqual(len( dyload),len(dy))79 self.assertEqual(len(output.x),len(x)) 80 self.assertEqual(len(output.y),len(y)) 81 self.assertEqual(len(output.dy),len(dy)) 81 82 for i in range(len(x)): 82 self.assertEqual( xload[i],x[i])83 self.assertEqual( yload[i],y[i])84 self.assertEqual( dyload[i],dy[i])83 self.assertEqual(output.x[i],x[i]) 84 self.assertEqual(output.y[i],y[i]) 85 self.assertEqual(output.dy[i],dy[i]) 85 86 86 87 … … 88 89 """ Testing loading Igor data""" 89 90 #tested good file.asc 90 Z,xmin, xmax, ymin, ymax= self.L.load('MAR07232_rest.ASC')91 self.assertEqual( xmin,-0.018558945804750416)92 self.assertEqual( xmax, 0.016234058202440633,)93 self.assertEqual( ymin,-0.01684257151702391)94 self.assertEqual( ymax,0.017950440578015116)91 output= self.L.load('MAR07232_rest.ASC') 92 self.assertEqual(output.xmin,-0.018558945804750416) 93 self.assertEqual(output.xmax, 0.016234058202440633,) 94 self.assertEqual(output.ymin,-0.01684257151702391) 95 self.assertEqual(output.ymax,0.017950440578015116) 95 96 96 97 #tested corrupted file.asc … … 102 103 """ Testing loading danse file""" 103 104 #tested good file.sans 104 data=self.L.load('MP_New.sans')105 output=self.L.load('MP_New.sans') 105 106 106 self.assertEqual( data.wavelength,7.5)107 self.assertEqual(output.wavelength,7.5) 107 108 108 109 #tested corrupted file.sans … … 115 116 def testload5(self): 116 117 """ Testing loading image file""" 117 data=self.L.load('angles_flat.png')118 self.assertEqual( data.xbins ,200)118 output=self.L.load('angles_flat.png') 119 self.assertEqual(output.xbins ,200) 119 120 120 121 def testload6(self): -
DataLoader/test/testplugings.py
rd3619421 r16d8e5f 39 39 self.assertEqual(self.L.__contains__('.ASC'),True) 40 40 #Testing loading a txt file of 2 columns, the only reader should be read1 41 xload,yload,dyload=self.L.load('test_2_columns.txt')41 output=self.L.load('test_2_columns.txt') 42 42 x=[2.83954,0.204082,0.408163,0.612245,0.816327,1.02041,1.22449,1.42857,1.63265] 43 43 y=[0.6,3.44938, 5.82026,5.27591,5.2781,5.22531,7.47487,7.85852,10.2278] 44 44 dx=[] 45 45 dy=[] 46 self.assertEqual(len( xload),len(x))47 self.assertEqual(len( yload),len(y))48 self.assertEqual(len(dyload),0)46 self.assertEqual(len(output.x),len(x)) 47 self.assertEqual(len(output.y),len(y)) 48 49 49 for i in range(len(x)): 50 self.assertEqual( xload[i],x[i])51 self.assertEqual( yload[i],y[i])50 self.assertEqual(output.x[i],x[i]) 51 self.assertEqual(output.y[i],y[i])
Note: See TracChangeset
for help on using the changeset viewer.