Changeset 2438


Ignore:
Timestamp:
Aug 19, 2016 12:29:28 PM (5 years ago)
Author:
vondreele
Message:

new CBF importer with fortran routine to decode image - much, much faster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/imports/G2img_CBF.py

    r2432 r2438  
    1818import GSASIIIO as G2IO
    1919import GSASIIpath
     20import unpack_cbf as cbf
    2021GSASIIpath.SetVersionNumber("$Revision: 2133 $")
    2122class CBF_ReaderClass(G2IO.ImportImage):
     
    2728            extensionlist=('.cbf',),
    2829            strictExtension=True,
    29             formatName = 'CBF image (Slow!)',
     30            formatName = 'CBF image',
    3031            longFormatName = 'CIF Binary Data Format image file (NB: Slow!)'
    3132            )
     
    137138#    GSASIIpath.IPyBreak()
    138139    time0 = time.time()
    139     image = np.hstack(analyse(compImage)).cumsum()
     140    nxy = sizexy[0]*sizexy[1]
     141    nimg = len(compImage)
     142    image = np.zeros(nxy)
     143    image = cbf.unpack_cbf(nimg,compImage,nxy,image)
    140144    image = np.reshape(image,(sizexy[1],sizexy[0]))
    141     print 'import time:',time.time()-time0
    142145    data = {'pixelSize':pixSize,'wavelength':wave,'distance':dist,'center':cent,'size':sizexy}
    143146    Npix = sizexy[0]*sizexy[1]
    144147   
    145     filename = os.path.splitext(filename)[0]+'.G2img'
    146     File = open(filename,'wb')
    147     cPickle.dump([head,data,Npix,image],File,1)
    148     File.close()
    149     self.sumfile = filename
    150     self.formatName = 'GSAS-II image'
    151148    return head,data,Npix,image
    152149       
Note: See TracChangeset for help on using the changeset viewer.