Changeset 101


Ignore:
Timestamp:
Jul 1, 2010 2:50:32 PM (11 years ago)
Author:
vondreel
Message:

new fortran histogram2d routine

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r98 r101  
    473473    polygons = masks['Polygons']
    474474    tam = ma.make_mask_none((imageN,imageN))
     475    if polygons:
     476        print 'Generate polygon mask'
    475477    for polygon in polygons:
    476478        tamp = ma.make_mask_none((imageN*imageN))
    477479        tam = ma.mask_or(tam.flatten(),ma.make_mask(pm.polymask(imageN*imageN,
    478480            tax.flatten(),tay.flatten(),len(polygon),polygon,tamp)))
     481    if spots:
     482        print 'Generate spot mask'
    479483    tam = np.reshape(tam,(imageN,imageN))
    480484    for X,Y,diam in spots:
     
    491495    TA = np.dstack((ma.getdata(TA[1]),ma.getdata(TA[0])))    #azimuth, 2-theta
    492496    tax,tay = np.dsplit(TA,2)    #azimuth, 2-theta
     497    if rings:
     498        print 'Generate ring mask'
    493499    for tth,thick in rings:
    494500        tam = ma.mask_or(tam.flatten(),ma.getmask(ma.masked_inside(tay.flatten(),max(0.01,tth-thick/2.),tth+thick/2.)))
     501    if arcs:
     502        print 'Generate arc mask'
    495503    for tth,azm,thick in arcs:
    496504        tam = ma.mask_or(tam.flatten(),ma.getmask(ma.masked_inside(tay.flatten(),max(0.01,tth-thick/2.),tth+thick/2.))* \
     
    506514def Bin2ThetaAzimuthMap(data,tax,tay,taz):
    507515    import numpy.ma as ma
     516    import histogram2d as h2d
    508517    LUtth = data['IOtth']
    509518    if data['fullIntegrate']:
     
    513522    numAzms = data['outAzimuths']
    514523    numChans = data['outChannels']
    515     NST = np.histogram2d(tax,tay,normed=False,bins=(numAzms,numChans),range=[LRazm,LUtth])
    516     HST = np.histogram2d(tax,tay,normed=False,bins=(numAzms,numChans),range=[LRazm,LUtth],weights=taz)
     524    NST = np.zeros(shape=(numAzms,numChans),dtype=int,order='F')
     525    H0 = np.zeros(shape=(numAzms,numChans),order='F')
     526    H1 = np.zeros(shape=(numAzms+1,))
     527    H2 = np.zeros(shape=(numChans+1,))   
     528    NST,H0,H1,H2 = h2d.histogram2d(len(tax),tax,tay,taz,numAzms,numChans,LRazm,LUtth,NST,H0,H1,H2)
     529    HST = [H0,H1,H2]
    517530    return NST,HST
    518531
Note: See TracChangeset for help on using the changeset viewer.