Changeset 2773
- Timestamp:
- Apr 5, 2017 8:21:48 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIimage.py
r2760 r2773 380 380 x0 = dist*tand(tilt) 381 381 phi = data['rotation'] 382 dep = data ['DetDepth']382 dep = data.get('DetDepth',0.) 383 383 azmthoff = data['azmthOff'] 384 384 dx = np.array(x-cent[0],dtype=np.float32) -
trunk/imports/G2img_1TIF.py
r2772 r2773 208 208 File.seek(8) 209 209 print 'Read GE-detector tiff file: ',filename 210 image = np.fromfile(File,dtype=np.int16,count=2*Npix)[:Npix] 210 image = np.array(np.frombuffer(File.read(2*Npix),dtype=np.int16),dtype=np.int32) 211 # image = np.fromfile(File,dtype=np.int16,count=2*Npix)[:Npix] 211 212 # image = np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32) 212 213 elif IFD[258][2][0] == 32: … … 251 252 print 'Read APS PE-detector tiff file: ',filename 252 253 if dataType == 5: 253 image = np.fromfile(File,dtype=np.float32,count=4*Npix)[:Npix] 254 image = np.array(np.frombuffer(File.read(4*Npix),dtype=np.float32),dtype=np.int32) #fastest 255 # image = np.fromfile(File,dtype=np.float32,count=4*Npix)[:Npix] 254 256 # image = np.array(ar.array('f',File.read(4*Npix)),dtype=np.int32) 255 257 else: … … 272 274 File.seek(4096) 273 275 print 'Read MAR CCD tiff file: ',filename 274 image = np.fromfile(File,dtype=np.int16,count=2*Npix)[:Npix] 276 image = np.array(np.frombuffer(File.read(2*Npix),dtype=np.uint16),dtype=np.int32) 277 # image = np.fromfile(File,dtype=np.int16,count=2*Npix)[:Npix] 275 278 # image = np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32) 276 279 elif IFD[273][2][0] == 512: -
trunk/imports/G2img_GE.py
r2539 r2773 117 117 import struct as st 118 118 import cPickle 119 import time 119 120 more = False 121 time0 = time.time() 120 122 File = open(filename,'rb') 121 123 if filename.split('.')[-1] in ['sum',]: … … 124 126 Npix = sizexy[0]*sizexy[1] 125 127 image = np.array(np.frombuffer(File.read(4*Npix),dtype=np.float32),dtype=np.int32) 126 # image = np.array(ar.array('f',File.read(4*Npix)),dtype=np.int32)127 128 elif filename.split('.')[-1] in ['avg','cor']: 128 129 File.seek(0,2) … … 134 135 Npix = sizexy[0]*sizexy[1] 135 136 image = np.array(np.frombuffer(File.read(2*Npix),dtype=np.int16),dtype=np.int32) 136 # image = np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32)137 137 else: 138 138 head = ['GE detector raw data',] … … 154 154 File.seek(pos) 155 155 image = np.array(np.frombuffer(File.read(2*Npix),dtype=np.int16),dtype=np.int32) 156 # image = np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32)157 156 if len(image) != sizexy[1]*sizexy[0]: 158 157 print('not enough images while reading GE file: '+filename+'image #'+str(imagenum)) … … 164 163 try: 165 164 image += np.array(np.frombuffer(File.read(2*Npix),dtype=np.int16),dtype=np.int32) 166 # image += np.array(ar.array('H',File.read(2*Npix)),dtype=np.int32)167 165 except ValueError: 168 166 break … … 183 181 data = {'pixelSize':[200,200],'wavelength':0.15,'distance':250.0,'center':[204.8,204.8],'size':sizexy} 184 182 File.close() 183 print 'Image read time %.2fs'%(time.time()-time0) 185 184 if GSASIIpath.GetConfigValue('debug'): 186 185 print 'Read GE file: '+filename+' image #'+'%04d'%(imagenum)
Note: See TracChangeset
for help on using the changeset viewer.