Changeset 2432


Ignore:
Timestamp:
Aug 18, 2016 4:36:19 PM (5 years ago)
Author:
vondreele
Message:

allow cbf file imports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/imports/G2img_CBF.py

    r2309 r2432  
    1515import sys
    1616import os
     17import time
    1718import GSASIIIO as G2IO
    1819import GSASIIpath
     
    5051    import cPickle
    5152   
    52 #    def analyze(stream):
    53 #        listnpa = []
    54 #        key16 = "\x80"
    55 #        key32 = "\x00\x80"
    56 #        key64 = "\x00\x00\x00\x80"
    57 #        iBeg = True
    58 #        st64 = stream.split(key64)
    59 #        for iA,stA in enumerate(st64):
    60 #            st32 = stA.split(key32)
    61 #            for iB,stB in enumerate(st32):
    62 #                st16 = stB.split(key16)
    63 #                if not iB:
    64 #                    listnpa.append(np.fromstring(st16[0], dtype="int32"))
    65 #                else:
    66 #                    for iC,stC in enumerate(st16):
    67 #                        if not iC:
    68 #                            listnpa.append(np.fromstring(stC, dtype="int8"))
    69 #                        else:
    70 #                            listnpa.append(np.fromstring(stC, dtype="int16"))
    71                    
    72                
    73            
    74 
    7553    def analyse(stream):
    7654        """
     
    157135    cent = [cent[0]*pixSize[0]/1000.,cent[1]*pixSize[1]/1000.]
    158136    compImage = stream[imageBeg:imageBeg+compImageSize]
    159     GSASIIpath.IPyBreak()
     137#    GSASIIpath.IPyBreak()
     138    time0 = time.time()
    160139    image = np.hstack(analyse(compImage)).cumsum()
    161140    image = np.reshape(image,(sizexy[1],sizexy[0]))
     141    print 'import time:',time.time()-time0
    162142    data = {'pixelSize':pixSize,'wavelength':wave,'distance':dist,'center':cent,'size':sizexy}
    163143    Npix = sizexy[0]*sizexy[1]
Note: See TracChangeset for help on using the changeset viewer.