Changeset 8d6440f in sasview
- Timestamp:
- Jul 9, 2008 6:05:49 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:
- c45976b
- Parents:
- 8dac49d
- Location:
- DataLoader
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/loader.py
r94daf8a r8d6440f 94 94 dir='readers' 95 95 96 if reader==None and ext==None:#1st load96 if (reader==None and ext==None) or dir:#1st load 97 97 plugReader=None 98 98 if os.path.isdir(dir): -
DataLoader/plugins/TXT2_Reader.py
r1b0b3ca r8d6440f 2 2 import wx 3 3 import string,numpy 4 import logging 4 5 class Reader: 5 6 """ … … 27 28 return None 28 29 else: 29 input_f = open(path,'r') 30 try: 31 input_f = open(path,'r') 32 except : 33 raise RuntimeError,"TXT2_Reader cannot open %s"%(path) 30 34 buff = input_f.read() 31 35 lines = buff.split('\n') … … 63 67 #msg="R1 reading: \n"+"this x :"+ str(self.x) +"\n"+"this y:"+str(self.y)+"\n"+"this dy :"+str(self.dy)+"\n" 64 68 #return msg 65 print "TXT2_Reader reading %s\n" %path69 logging.info("TXT2_Reader reading %s\n" %path) 66 70 return self.x,self.y,self.dy 67 71 return None -
DataLoader/plugins/TXT3_Reader.py
r1b0b3ca r8d6440f 2 2 import wx 3 3 import string,numpy 4 import logging 4 5 class Reader: 5 6 """ … … 31 32 return None 32 33 else: 33 input_f = open(path,'r') 34 try: 35 input_f = open(path,'r') 36 except : 37 raise RuntimeError,"TXT3_Reader cannot open %s"%(path) 34 38 buff = input_f.read() 35 39 lines = buff.split('\n') … … 65 69 #msg="txtReader Reading:\n"+"this x :"+ str(self.x) +"\n"+"this y:"+str(self.y)+"\n"+"this dy :"+str(self.dy)+"\n" 66 70 #return msg 67 print "TXT3_Reader reading %s \n" %path71 logging.info ("TXT3_Reader reading %s \n" %(path)) 68 72 return self.x,self.y,self.dy 69 73 -
DataLoader/readers/IgorReader.py
r2fd516b r8d6440f 2 2 import pylab 3 3 from copy import deepcopy 4 import math 4 import math,logging 5 5 class Reader: 6 6 """ Simple data reader for Igor data files """ … … 165 165 self.center_x = center_x 166 166 self.center_y = center_y 167 print "IgorReader reading %s"%self.file167 logging.info("IgorReader reading %s"%self.file) 168 168 return Z, xmin-xstep/2.0, xmax+xstep/2.0, ymin-ystep/2.0, ymax+ystep/2.0 169 169 -
DataLoader/readers/TXT2_Reader.py
r8dac49d r8d6440f 1 1 # class Loader to load any king of file 2 2 import wx 3 import string,numpy 3 import string,numpy,logging 4 4 class Reader: 5 5 """ … … 27 27 return None 28 28 else: 29 input_f = open(path,'r') 29 try: 30 input_f = open(path,'r') 31 except : 32 raise RuntimeError,"TXT2_Reader cannot open %s"%(path) 30 33 buff = input_f.read() 31 34 lines = buff.split('\n') … … 63 66 #msg="R1 reading: \n"+"this x :"+ str(self.x) +"\n"+"this y:"+str(self.y)+"\n"+"this dy :"+str(self.dy)+"\n" 64 67 #return msg 65 print "TXT2_Reader reading %s\n" %path68 logging.info("TXT2_Reader reading %s\n" %path) 66 69 return self.x,self.y,self.dy 67 70 return None -
DataLoader/readers/TXT3_Reader.py
r1b0b3ca r8d6440f 1 1 # class Loader to load any king of file 2 2 import wx 3 import string,numpy 3 import string,numpy,logging 4 4 class Reader: 5 5 """ … … 31 31 return None 32 32 else: 33 input_f = open(path,'r') 33 try: 34 input_f = open(path,'r') 35 except : 36 raise RuntimeError,"TXT3_Reader cannot open %s"%(path) 34 37 buff = input_f.read() 35 38 lines = buff.split('\n') … … 65 68 #msg="txtReader Reading:\n"+"this x :"+ str(self.x) +"\n"+"this y:"+str(self.y)+"\n"+"this dy :"+str(self.dy)+"\n" 66 69 #return msg 67 print "TXT3_Reader reading %s \n" %path70 logging.info("TXT3_Reader reading %s \n" %path) 68 71 return self.x,self.y,self.dy 69 72 -
DataLoader/readers/danse_reader.py
rc125e0c r8d6440f 7 7 import copy 8 8 import numpy 9 import logging 9 10 class ReaderInfo: 10 11 """ … … 61 62 62 63 if read_it: 63 64 datafile = open(filename, 'r') 64 try: 65 datafile = open(filename, 'r') 66 except : 67 raise RuntimeError,"danse_reader cannot open %s"%(filename) 68 65 69 66 70 # defaults … … 126 130 error.append(err) 127 131 except: 128 print "Skipping line:%s" % data_str 129 print sys.exc_value 132 logging.info("Skipping line:%s,%s" %( data_str,sys.exc_value)) 133 #print "Skipping line:%s" % data_str 134 #print sys.exc_value 130 135 131 136 # Initialize … … 209 214 raise ValueError,"Danse_reader can't read this file %s"%filename 210 215 else: 211 print "Danse_reader Reading %s \n"%filename216 logging.info("Danse_reader Reading %s \n"%filename) 212 217 return output 213 218 -
DataLoader/readers/tiff_reader.py
r3dd7cce r8d6440f 1 1 2 2 import Image 3 import math 3 import math,logging 4 4 class ReaderInfo: 5 5 """ … … 46 46 47 47 def read(self, filename=None): 48 print "in tiff" 48 49 """ 49 50 Open and read the data in a file … … 144 145 output.image = Z 145 146 output.pixel_size = pixel 146 147 logging.info("tiff_reader reading %s"%(filename)) 148 147 149 return output 148 150 -
DataLoader/test/testLoad.py
r94daf8a r8d6440f 104 104 data=self.L.load('MP_New.sans') 105 105 106 self.assertEqual(data. __class__,danse_reader.ReaderInfo)106 self.assertEqual(data.wavelength,7.5) 107 107 108 108 #tested corrupted file.sans … … 112 112 logging.error(str(msg)) 113 113 #else: raise ValueError,"No error raised for missing extension" 114 114 115 def testload5(self): 115 116 """ Testing loading image file""" 116 117 data=self.L.load('angles_flat.png') 117 self.assertEqual(data. __class__,tiff_reader.ReaderInfo)118 self.assertEqual(data.xbins ,200) 118 119 119 120 def testload6(self): 120 121 """test file with unknown extension""" 121 122 try:self.L.load('hello.missing') 122 except ValueError,msg:123 except RuntimeError,msg: 123 124 self.assertEqual( str(msg),"Unknown file type '.missing'") 124 125 else: raise ValueError,"No error raised for missing extension" … … 126 127 #self.L.lookup('hello.missing') 127 128 try: self.L.lookup('hello.missing') 128 except ValueError,msg:129 except RuntimeError,msg: 129 130 self.assertEqual( str(msg),"Unknown file type '.missing'") 130 131 else: raise ValueError,"No error raised for missing extension"
Note: See TracChangeset
for help on using the changeset viewer.