Changeset 3144 for trunk/imports/G2img_CBF.py
- Timestamp:
- Oct 30, 2017 3:39:15 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/imports/G2img_CBF.py
r3141 r3144 17 17 import GSASIIobj as G2obj 18 18 import GSASIIpath 19 import struct as st 20 import numpy as np 19 21 import unpack_cbf as cbf 20 22 GSASIIpath.SetVersionNumber("$Revision: 2133 $") … … 48 50 'Read cif binarydetector data cbf file' 49 51 50 import numpy as np51 52 if GSASIIpath.GetConfigValue('debug'): 52 53 print ('Read cif binary detector data cbf file: '+filename) … … 95 96 img = File.read()[imageBeg:imageBeg+compImageSize] 96 97 nimg = len(img) 97 if 'bytes' in str(type(img)):98 img = np.array(img,dtype='a')99 98 image = np.zeros(nxy,dtype=np.int32) 100 99 time0 = time.time() 101 # GSASIIpath.IPyBreak() 102 image = cbf.unpack_cbf(nimg,img,nxy,image) 100 if 'bytes' in str(type(img)): 101 img = np.frombuffer(img,dtype=np.uint8) 102 image = cbf.unpack_cbf3(nimg,img,nxy,image) 103 else: 104 image = cbf.unpack_cbf(nimg,img,nxy,image) 103 105 image = np.reshape(image,(sizexy[1],sizexy[0])) 104 106 print ('import time: %.3f'%(time.time()-time0))
Note: See TracChangeset
for help on using the changeset viewer.