Changeset 3136 for trunk/imports/G2img_CBF.py
- Timestamp:
- Oct 23, 2017 11:39:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/imports/G2img_CBF.py
r2817 r3136 13 13 ''' 14 14 15 from __future__ import division, print_function 15 16 import time 16 17 import GSASIIobj as G2obj … … 30 31 ) 31 32 32 def ContentsValidator(self, file pointer):33 def ContentsValidator(self, filename): 33 34 '''no test used at this time 34 35 ''' 35 36 return True 36 37 37 def Reader(self,filename, filepointer,ParentFrame=None, **unused):38 def Reader(self,filename, ParentFrame=None, **unused): 38 39 '''Read using Bob's routine :func:`GetCbfData` 39 40 ''' … … 49 50 import numpy as np 50 51 if GSASIIpath.GetConfigValue('debug'): 51 print 'Read cif binary detector data cbf file: ',filename52 print ('Read cif binary detector data cbf file: '+filename) 52 53 File = open(filename,'rb') 53 54 sizexy = [0,0] … … 58 59 byteOrd = '<' 59 60 stream = File.read() 60 File.close() 61 if 'bytes' in str(type(stream)): 62 stream = stream.decode('latin-1') 61 63 starter = '\x0c\x1a\x04\xd5' 62 64 imageBeg = stream.find(starter)+4 … … 97 99 image = cbf.unpack_cbf(nimg,compImage,nxy,image) 98 100 image = np.reshape(image,(sizexy[1],sizexy[0])) 99 print 'import time:',time.time()-time0101 print ('import time: %.3f'%(time.time()-time0)) 100 102 data = {'pixelSize':pixSize,'wavelength':wave,'distance':dist,'center':cent,'size':sizexy} 101 103 Npix = sizexy[0]*sizexy[1]
Note: See TracChangeset
for help on using the changeset viewer.