Changeset 5116


Ignore:
Timestamp:
Dec 21, 2021 2:46:05 PM (2 years ago)
Author:
vondreele
Message:

fixes to EDX calcs for LeBail?; start on Pawley for EDX.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIlattice.py

    r5112 r5116  
    11741174        pos = Inst['difC'][1]*dsp+Inst['Zero'][1]+Inst['difA'][1]*dsp**2+Inst.get('difB',[0,0,False])[1]/dsp
    11751175    elif 'E' in Inst['Type'][0]:
    1176         return 12.398/(2.0*dsp*sind(Inst['2-theta'][1]/2.0)+Inst['ZE'][1]+Inst['YE'][1]*dsp+Inst['XE'][1]*dsp**2)
     1176        return 12.398/(2.0*dsp*sind(Inst['2-theta'][1]/2.0))+Inst['ZE'][1]+Inst['YE'][1]*dsp+Inst['XE'][1]*dsp**2
    11771177    else:   #'C' or 'B'
    11781178        wave = G2mth.getWave(Inst)
  • trunk/GSASIIphsGUI.py

    r5114 r5116  
    1297212972        '''Set Pawley parameters and optionally recompute
    1297312973        '''
    12974         #GSASIIpath.IPyBreak()
    1297512974       
    1297612975        def DisablePawleyOpts(*args):
     
    1311813117        Inst = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId,'Instrument Parameters'))[0]
    1311913118        Sample = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,PatternId,'Sample Parameters'))
    13120         wave = G2mth.getWave(Inst)
    1312113119        const = 9.e-2/(np.pi*Sample['Gonio. radius'])                  #shifts in microns
    1312213120        gconst = 2.35482 # sqrt(8 ln 2)
     
    1312713125        try:
    1312813126            for ref in Refs:
    13129                 pos = 2.0*asind(wave/(2.0*ref[4+im]))
     13127                pos = G2lat.Dsp2pos(Inst,ref[4+im])
    1313013128                if 'Bragg' in Sample['Type']:
    1313113129                    pos -= const*(4.*Sample['Shift'][0]*cosd(pos/2.0)+ \
    1313213130                        Sample['Transparency'][0]*sind(pos)*100.0)            #trans(=1/mueff) in cm
    13133                 else:               #Debye-Scherrer - simple but maybe not right - +Layer Disp from DData?
     13131                elif 'E' not in Inst['Type'][0]:               #Debye-Scherrer - simple but maybe not right - +Layer Disp from DData?
    1313413132                    pos -= const*(Sample['DisplaceX'][0]*cosd(pos)+Sample['DisplaceY'][0]*sind(pos))
    1313513133                indx = np.searchsorted(xdata[0],pos)
     
    1314113139                    # then divide by Icorr to get F^2.
    1314213140                    ref[6+im] = (xdata[1][indx]-xdata[4][indx])*gconst/(FWHM*np.sqrt(np.pi))  #Area of Gaussian is height * FWHM * sqrt(pi)
    13143                     Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.))           #Lorentz correction
    13144                     pola = 1.0
    13145                     if 'X' in Inst['Type']:
    13146                         pola,dIdPola = G2pwd.Polarization(Inst['Polariz.'][1],xdata[0][indx],Inst['Azimuth'][1])
     13141                    if 'E' not in Inst['Type'][0]:
     13142                        Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.))           #Lorentz correction
     13143                        pola = 1.0
     13144                        if 'X' in Inst['Type']:
     13145                            pola,dIdPola = G2pwd.Polarization(Inst['Polariz.'][1],xdata[0][indx],Inst['Azimuth'][1])
     13146                        else:
     13147                            pola = 1.0
     13148                    # Include histo scale and volume in calculation
     13149                        ref[6+im] /= (Sample['Scale'][0] * Vst * Lorenz * pola * ref[3+im])
    1314713150                    else:
    13148                         pola = 1.0
    13149                     # Include histo scale and volume in calculation
    13150                     ref[6+im] /= (Sample['Scale'][0] * Vst * Lorenz * pola * ref[3+im])
     13151                        ref[6+im] /= (Sample['Scale'][0] * ref[3+im])
    1315113152                except IndexError:
    1315213153                    pass
  • trunk/GSASIIstrMath.py

    r5114 r5116  
    28952895            pos -= const*(parmDict[hfx+'DisplaceX']*cosd(pos)+(parmDict[hfx+'DisplaceY']+parmDict[phfx+'LayerDisp'])*sind(pos))
    28962896    elif 'E' in calcControls[hfx+'histType']:
    2897         pos = G2mth.wavekE(2.0*d*sind(parmDict[hfx+'2-theta']/2.0))+parmDict[hfx+'ZE']+parmDict[hfx+'YE']*d+parmDict[hfx+'XE']*d**2
     2897        pos = 12.397639/(2.0*d*sind(parmDict[hfx+'2-theta']/2.0))+parmDict[hfx+'ZE']+parmDict[hfx+'YE']*d+parmDict[hfx+'XE']*d**2
    28982898    elif 'T' in calcControls[hfx+'histType']:
    28992899        pos = parmDict[hfx+'difC']*d+parmDict[hfx+'difA']*d**2+parmDict[hfx+'difB']/d+parmDict[hfx+'Zero']
     
    29382938        dpdXE = dsp**2
    29392939        dpdA = np.array([h**2,k**2,l**2,h*k,h*l,k*l])*refl[5+im]*dsp**2/2.
    2940         dpdTTh = -12.397639/(2.*tand(tth)*dsp*sind(tth))
     2940        dpdTTh = -12.397639*cosd(tth)/(dsp*sind(tth)**2)
    29412941        return dpdA,dpdTTh,dpdXE,dpdYE,dpdZE
    29422942    elif 'T' in calcControls[hfx+'histType']:
     
    29812981        return -180.*Dij*refl[4+im]**2*tand(refl[5+im]/2.0)/np.pi
    29822982    elif 'E' in calcControls[hfx+'histType']:
    2983         return Dij*(12.397639/(2.*dsp*sind(tth)))
     2983        return Dij*refl[5+im]/refl[4+im]**2
    29842984    else:
    29852985        return -Dij*parmDict[hfx+'difC']*0.5*refl[4+im]**2
     
    30173017    elif 'E' in calcControls[hfx+'histType']:
    30183018        for item in dDijDict:
    3019             dDijDict[item] *= refl[5+im]*refl[4+im]**2/2.
     3019            dDijDict[item] *= refl[5+im]/refl[4+im]**2
    30203020    else:
    30213021        for item in dDijDict:
     
    38003800            elif 'E' in calcControls[hfx+'histType']:
    38013801                dpdA,dpdTTh,dpdXE,dpdYE,dpdZE = GetReflPosDerv(refl,im,0.0,A,pfx,hfx,phfx,calcControls,parmDict)
    3802                 names = {hfx+'Scale':[dIdsh,'int'],
     3802                names = {hfx+'Scale':[dIdsh,'int'],hfx+'2-theta':[dpdTTh,'pos'],
    38033803                    hfx+'A':[refl[5+im]**2,'sig'],hfx+'B':[refl[5+im],'sig'],hfx+'C':[1.0,'sig'],
    38043804                    hfx+'XE':[dpdXE,'pos'],hfx+'YE':[dpdYE,'pos'],hfx+'ZE':[dpdZE,'pos']   }
Note: See TracChangeset for help on using the changeset viewer.