Changeset 1170 for trunk/GSASIIimage.py


Ignore:
Timestamp:
Dec 17, 2013 12:06:10 PM (9 years ago)
Author:
vondreele
Message:

remove Rigid bodies from delete data list
revise geometric correction for tilted detectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r1169 r1170  
    373373    tilt = data['tilt']
    374374    dist = data['distance']/cosd(tilt)
     375    x0 = data['distance']*tand(tilt)
    375376    phi = data['rotation']
    376377    dep = data['DetDepth']
     
    379380    dx = np.array(x-cent[0],dtype=np.float32)
    380381    dy = np.array(y-cent[1],dtype=np.float32)
     382    D = ((dx-x0)**2+dy**2+data['distance']**2)      #sample to pixel distance
    381383    X = np.array(([dx,dy,np.zeros_like(dx)]),dtype=np.float32).T
    382384    X = np.dot(X,makeMat(phi,2))
    383385    Z = np.dot(X,makeMat(tilt,0)).T[2]
    384386    tth = npatand(np.sqrt(dx**2+dy**2-Z**2)/(dist-Z))
    385     dxy = peneCorr(tth,dep)
     387    dxy = peneCorr(tth,dep)     #depth corr not correct for tilted detector
    386388    DX = dist-Z+dxy
    387389    DY = np.sqrt(dx**2+dy**2-Z**2)
    388     D = (DX**2+DY**2)/data['distance']**2       #for geometric correction = 1/cos(2theta)^2 if tilt=0.
    389     tth = npatan2d(DY,DX) #depth corr not correct for tilted detector
     390    tth = npatan2d(DY,DX)
    390391    dsp = wave/(2.*npsind(tth/2.))
    391392    azm = (npatan2d(dy,dx)+azmthoff+720.)%360.
    392     return tth,azm,D,dsp
     393    G = D/data['distance']**2       #for geometric correction = 1/cos(2theta)^2 if tilt=0.
     394    return tth,azm,G,dsp
    393395   
    394396def GetTth(x,y,data):
     
    754756        tamp = ma.getmask(ma.masked_less((tax-X)**2+(tay-Y)**2,(diam/2.)**2))
    755757        tam = ma.mask_or(tam,tamp)
    756     TA = np.array(GetTthAzmD(tax,tay,data))     #includes geom. corr.
     758    TA = np.array(GetTthAzmD(tax,tay,data))     #includes geom. corr. as dist**2/d0**2
    757759    TA[1] = np.where(TA[1]<0,TA[1]+360,TA[1])
    758760    return np.array(TA),tam           #2-theta, azimuth & geom. corr. arrays & position mask
     
    764766    arcs = masks['Arcs']
    765767    TA = np.dstack((ma.getdata(TA[1]),ma.getdata(TA[0]),ma.getdata(TA[2])))    #azimuth, 2-theta, dist
    766     tax,tay,tad = np.dsplit(TA,3)    #azimuth, 2-theta, dist
     768    tax,tay,tad = np.dsplit(TA,3)    #azimuth, 2-theta, dist**2/d0**2
    767769    for tth,thick in rings:
    768770        tam = ma.mask_or(tam.flatten(),ma.getmask(ma.masked_inside(tay.flatten(),max(0.01,tth-thick/2.),tth+thick/2.)))
     
    777779    taz = ma.compressed(ma.array(taz.flatten(),mask=tam))
    778780    tad = ma.compressed(ma.array(tad.flatten(),mask=tam))
    779     return tax,tay,taz      #*tad**2 wrong - why?
     781    return tax,tay,taz*tad
    780782   
    781783def ImageIntegrate(image,data,masks,blkSize=128,dlg=None):
Note: See TracChangeset for help on using the changeset viewer.