Changeset 4178 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Oct 16, 2019 6:39:01 AM (2 years ago)
Author:
vondreele
Message:

precalculate polarization for image integration - faster

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r4109 r4178  
    10201020    scalex = pixelSize[0]/1000.
    10211021    scaley = pixelSize[1]/1000.
    1022    
    10231022    tay,tax = np.mgrid[iLim[0]+0.5:iLim[1]+.5,jLim[0]+.5:jLim[1]+.5]         #bin centers not corners
    10241023    tax = np.asfarray(tax*scalex,dtype=np.float32).flatten()
     
    10261025    nI = iLim[1]-iLim[0]
    10271026    nJ = jLim[1]-jLim[0]
    1028     TA = np.array(GetTthAzmG(np.reshape(tax,(nI,nJ)),np.reshape(tay,(nI,nJ)),data))     #includes geom. corr. as dist**2/d0**2 - most expensive step
     1027    TA = np.empty((4,nI,nJ))
     1028    TA[:3] = np.array(GetTthAzmG(np.reshape(tax,(nI,nJ)),np.reshape(tay,(nI,nJ)),data))     #includes geom. corr. as dist**2/d0**2 - most expensive step
    10291029    TA[1] = np.where(TA[1]<0,TA[1]+360,TA[1])
     1030    TA[3] = G2pwd.Polarization(data['PolaVal'][0],TA[0],TA[1]-90.)[0]
    10301031    return TA           #2-theta, azimuth & geom. corr. arrays
    10311032
     
    10711072    rings = masks['Rings']
    10721073    arcs = masks['Arcs']
    1073     TA = np.dstack((ma.getdata(TA[1]),ma.getdata(TA[0]),ma.getdata(TA[2])))    #azimuth, 2-theta, dist
    1074     tax,tay,tad = np.dsplit(TA,3)    #azimuth, 2-theta, dist**2/d0**2
     1074    TA = np.dstack((ma.getdata(TA[1]),ma.getdata(TA[0]),ma.getdata(TA[2]),ma.getdata(TA[3])))    #azimuth, 2-theta, dist, pol
     1075    tax,tay,tad,pol = np.dsplit(TA,4)    #azimuth, 2-theta, dist**2/d0**2
    10751076    for tth,thick in rings:
    10761077        tam = ma.mask_or(tam.flatten(),ma.getmask(ma.masked_inside(tay.flatten(),max(0.01,tth-thick/2.),tth+thick/2.)))
     
    10871088    tad = ma.compressed(ma.array(tad.flatten(),mask=tam))   #dist**2/d0**2
    10881089    tabs = ma.compressed(ma.array(tabs.flatten(),mask=tam)) #ones - later used for absorption corr.
    1089     return tax,tay,taz,tad,tabs
     1090    pol = ma.compressed(ma.array(pol.flatten(),mask=tam))   #polarization
     1091    return tax,tay,taz,tad,tabs,pol
    10901092
    10911093def MakeUseTA(data,blkSize=128):
     
    11821184                tam = MakeMaskMap(data,Masks,(iBeg,iFin),(jBeg,jFin),tamp)
    11831185            Block = image[iBeg:iFin,jBeg:jFin]
    1184             tax,tay,taz,tad,tabs = Fill2ThetaAzimuthMap(Masks,TA,tam,Block)    #and apply masks
    1185             pol = G2pwd.Polarization(data['PolaVal'][0],tay,tax-90.)[0]         #for pixel pola correction
     1186            tax,tay,taz,tad,tabs,pol = Fill2ThetaAzimuthMap(Masks,TA,tam,Block)    #and apply masks
     1187#            pol = TA[3].flatten()     #G2pwd.Polarization(data['PolaVal'][0],tay,tax-90.)[0]         #for pixel pola correction
    11861188            times[0] += time.time()-t0
    11871189            t0 = time.time()
Note: See TracChangeset for help on using the changeset viewer.