Changeset 2686


Ignore:
Timestamp:
Feb 2, 2017 10:34:07 AM (5 years ago)
Author:
vondreele
Message:

for image calibration constants, redefine DetDepth? to be old DetDepth/Distance?; this is now independent of sample-detector distance. Patches applied to do conversion if old DetDepth? > 0.1. Display & calibration output format changed to accommodate. PeneCorr? routine changed for new function.
For Recalibrate all, the resulting sequential table includes distance even if not refined.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r2685 r2686  
    6666    return Inside
    6767   
    68 def peneCorr(tth,dep,tilt=0.,azm=0.):
     68def peneCorr(tth,dep,dist,tilt=0.,azm=0.):
    6969    'Needs a doc string'
    7070#    return dep*(1.-npcosd(abs(tilt*npsind(azm))-tth*npcosd(azm)))  #something wrong here
    71     return dep*(1.-npcosd(tth))         #best one
     71    return dep*(1.-npcosd(tth))*dist         #best one
    7272#    return dep*npsind(tth)             #not as good as 1-cos2Q
    7373       
     
    166166        tth = 2.0*npasind(parms['wave']/(2.*dsp))
    167167        phi0 = npatan2d(y-parms['det-Y'],x-parms['det-X'])
    168         dxy = peneCorr(tth,parms['dep'],parms['tilt'],phi0)
     168        dxy = peneCorr(tth,parms['dep'],parms['dist'],parms['tilt'],phi0)
    169169        stth = npsind(tth)
    170170        cosb = npcosd(parms['tilt'])
     
    191191       
    192192    names = ['dist','det-X','det-Y','tilt','phi','dep','wave']
    193     fmt = ['%12.3f','%12.3f','%12.3f','%12.3f','%12.3f','%12.2f','%12.6f']
     193    fmt = ['%12.3f','%12.3f','%12.3f','%12.3f','%12.3f','%12.4f','%12.6f']
    194194    Fmt = dict(zip(names,fmt))
    195195    p0 = [parmDict[key] for key in varyList]
     
    312312    dep = data.get('DetDepth',0.0)
    313313    tth = 2.0*asind(data['wavelength']/(2.*dsp))
    314     dxy = peneCorr(tth,dep,tilt)
    315314    dist = data['distance']
     315    dxy = peneCorr(tth,dep,dist,tilt)
    316316    return GetEllipse2(tth,dxy,dist,cent,tilt,phi)
    317317       
     
    387387    Z = np.dot(X,makeMat(tilt,0)).T[2]
    388388    tth = npatand(np.sqrt(dx**2+dy**2-Z**2)/(dist-Z))
    389     dxy = peneCorr(tth,dep,tilt,npatan2d(dy,dx))
     389    dxy = peneCorr(tth,dep,dist,tilt,npatan2d(dy,dx))
    390390    DX = dist-Z+dxy
    391391    DY = np.sqrt(dx**2+dy**2-Z**2)
     
    421421    xyZ = dx**2+dy**2-Z**2   
    422422    tth = npatand(np.sqrt(xyZ)/(dist-Z))
    423     dxy = peneCorr(tth,data['DetDepth'],tilt,npatan2d(dy,dx))
     423    dxy = peneCorr(tth,data['DetDepth'],dist,tilt,npatan2d(dy,dx))
    424424    tth = npatan2d(np.sqrt(xyZ),dist-Z+dxy)
    425425    azm = (npatan2d(dy,dx)+data['azmthOff']+720.)%360.
     
    525525    data['rings'] = []
    526526    data['ellipses'] = []
     527    if data['DetDepth'] > 0.1:          #patch - redefine DetDepth
     528        data['DetDepth'] /= data['distance']
    527529    if not data['calibrant']:
    528530        print 'no calibration material selected'
     
    749751        data['rings'].append(np.array(Ringm))
    750752        G2plt.PlotImage(G2frame,newImage=True)
     753    if data['DetDepth'] > 0.1:          #patch - redefine DetDepth
     754        data['DetDepth'] /= data['distance']
    751755    parmDict = {'dist':data['distance'],'det-X':data['center'][0],'det-Y':data['center'][1],
    752756        'tilt':data['tilt'],'phi':data['rotation'],'wave':data['wavelength'],'dep':data['DetDepth']}
     
    884888    dtth = (lutth[1]-lutth[0])/numChans
    885889    muT = data.get('SampleAbs',[0.0,''])[0]
     890    if data['DetDepth'] > 0.1:          #patch - redefine DetDepth
     891        data['DetDepth'] /= data['distance']
    886892    if 'SASD' in data['type']:
    887893        muT = -np.log(muT)/2.       #Transmission to 1/2 thickness muT
  • trunk/GSASIIimgGUI.py

    r2685 r2686  
    163163    if 'varyList' not in data:
    164164        data['varyList'] = {'dist':True,'det-X':True,'det-Y':True,'tilt':True,'phi':True,'dep':False,'wave':False}
     165    if data['DetDepth'] > 0.1:
     166        data['DetDepth'] /= data['distance']
    165167#end patch
    166168
     
    196198                    Masks = G2frame.PatternTree.GetItemPyData(Mid)
    197199                    vals,varyList,sigList,parmDict = G2img.ImageRecalibrate(G2frame,Data,Masks)
     200                    if 'distance' not in varyList:
     201                        vals.append(parmDict['dist'])
     202                        varyList.append('dist')
     203                        list(sigList).append(0.0)
    198204                    SeqResult[name] = {'variables':vals,'varyList':varyList,'sig':sigList,'Rvals':[],
    199205                        'covMatrix':np.eye(len(varyList)),'title':name,'parmDict':parmDict}
     
    745751        Parms = {'dist':['Distance',(10,3),data,'distance'],'det-X':['Beam center X',(10,3),data['center'],0],
    746752            'det-Y':['Beam center Y',(10,3),data['center'],1],'tilt':['Tilt angle',(10,3),data,'tilt'],
    747             'phi':['Tilt rotation',(10,2),data,'rotation'],'dep':['Penetration',(10,2),data,'DetDepth'],
     753            'phi':['Tilt rotation',(10,2),data,'rotation'],'dep':['Penetration',(10,4),data,'DetDepth'],
    748754            'wave':['Wavelength',(10,6),data,'wavelength']}
    749755        for name in Names:
     
    756762                calVal = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,Parms[name][2],
    757763                    Parms[name][3],min=0.01,max=10.,nDig=Parms[name][1],typeHint=float)
     764            elif name == 'dep':
     765                calVal = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,Parms[name][2],
     766                    Parms[name][3],min=0.0,max=0.1,nDig=Parms[name][1],typeHint=float)
    758767            else:
    759768                calVal = G2G.ValidatedTxtCtrl(G2frame.dataDisplay,Parms[name][2],
Note: See TracChangeset for help on using the changeset viewer.