Changeset 5361


Ignore:
Timestamp:
Nov 1, 2022 11:14:03 AM (5 months ago)
Author:
vondreele
Message:

Add FWHM (L+G+Alpha+beta) resolution curves to TOF Instrument parameters plot

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r5320 r5361  
    13451345            QuatA = AVdeg2Q(tor[0],Cart[seq[0]]-Cart[seq[1]])
    13461346            Cart[seq[3]] = prodQVQ(QuatA,(Cart[seq[3]]-Cart[seq[1]]))+Cart[seq[1]]
     1347    elif RBType == 'Spin':
     1348        Cart = [np.zeros(3),]
    13471349    # if symmetry axis is defined, place symmetry axis along quaternion
    13481350    if RBObj.get('symAxis') is None:
  • trunk/GSASIIplot.py

    r5348 r5361  
    64696469        S = 1.17741*np.sqrt(data[8])/T
    64706470        G = data[10]/T
     6471        W = G2pwd.getFWHM(T,Parms,0)/T
    64716472        Plot.plot(Q,A,color='r',label='Alpha')
    64726473        Plot.plot(Q,B,color='g',label='Beta')
    64736474        Plot.plot(Q,S,color='b',label='Gaussian')
    64746475        Plot.plot(Q,G,color='m',label='Lorentzian')
     6476        Plot.plot(Q,W,color='g',label='FWHM (GL+ab)')
    64756477
    64766478        fit = G2mth.setPeakparms(Parms,Parms2,T,Z,useFit=True)
     
    64846486        Sf = 1.17741*np.sqrt(fit[8])/T
    64856487        Gf = fit[10]/T
     6488        Wf = G2pwd.getFWHM(T,Parms)/T
    64866489        Plot.plot(Q,Af,color='r',dashes=(5,5),label='Alpha fit')
    64876490        Plot.plot(Q,Bf,color='g',dashes=(5,5),label='Beta fit')
    64886491        Plot.plot(Q,Sf,color='b',dashes=(5,5),label='Gaussian fit')
    6489         Plot.plot(Q,Gf,color='m',dashes=(5,5),label='Lorentzian fit')
     6492        Plot.plot(Q,Gf,color='m',label='Lorentzian fit')
     6493        Plot.plot(Q,Wf,color='g',dashes=(5,5),label='FWHM fit (GL+ab)')
    64906494       
    64916495        Tp = []
     
    97639767        GL.glShadeModel(GL.GL_SMOOTH)
    97649768               
    9765     def RenderSphere(x,y,z,radius,color):
     9769    def RenderSphere(x,y,z,radius,color,fade=False):
    97669770        GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_DIFFUSE,color)
     9771        if fade:
     9772            Fade = list(color) + [0.5,]
     9773            GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_AMBIENT_AND_DIFFUSE,Fade)           
     9774            GL.glShadeModel(GL.GL_FLAT)
     9775            GL.glEnable(GL.GL_BLEND)
     9776            GL.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA)
    97679777        GL.glPushMatrix()
    97689778        GL.glTranslate(x,y,z)
     
    97719781        GLU.gluSphere(q,radius,20,10)
    97729782        GL.glPopMatrix()
     9783        if fade:
     9784            GL.glDisable(GL.GL_BLEND)
     9785            GL.glShadeModel(GL.GL_SMOOTH)
    97739786       
    97749787    def RenderFadeSphere(x,y,z,radius,color):
     
    1032410337                except:
    1032510338                    name = '  '+aType+str(ind)
     10339                radius = 0.2
     10340                Fade = False
     10341                if testRBObj['rbType'] == 'Spin':
     10342                    radius = testRBObj['AtInfo'][aType][0][0]
     10343                    Fade = True
    1032610344                color = np.array(testRBObj['AtInfo'][aType][1])
    1032710345                if 'RBhighLight' in testRBObj and testRBObj['RBhighLight'] == ind: # highlighted atom is green
    10328                     RenderSphere(x,y,z,0.2,Gr)
     10346                    RenderSphere(x,y,z,radius,Gr,Fade)
    1032910347                else:
    10330                     RenderSphere(x,y,z,0.2,color/255.)
     10348                    RenderSphere(x,y,z,radius,color/255.,Fade)
    1033110349                RenderBonds(x,y,z,rbBonds[ind],0.03,Gr)
    1033210350                RenderLabel(x,y,z,name,0.2,wxOrange,matRot)
     
    1066710685        GL.glDisable(GL.GL_COLOR_MATERIAL)
    1066810686               
    10669     def RenderSphere(x,y,z,radius,color):
     10687    def RenderSphere(x,y,z,radius,color,fade=False):
     10688        if fade:
     10689            Fade = list(color) + [0.5,]
     10690            GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_AMBIENT_AND_DIFFUSE,Fade)
    1067010691        GL.glMaterialfv(GL.GL_FRONT_AND_BACK,GL.GL_DIFFUSE,color)
    1067110692        GL.glPushMatrix()
  • trunk/GSASIIpwd.py

    r5320 r5361  
    845845    return widths,fmin,fmax
    846846   
    847 def getFWHM(pos,Inst):
     847def getFWHM(pos,Inst,N=1):
    848848    '''Compute total FWHM from Thompson, Cox & Hastings (1987) , J. Appl. Cryst. 20, 79-83
    849849    via getgamFW(g,s).
     
    851851    :param pos: float peak position in deg 2-theta or tof in musec
    852852    :param Inst: dict instrument parameters
     853    :param N: int Inst index (0 for input, 1 for fitted)
    853854   
    854855    :returns float: total FWHM of pseudoVoigt in deg or musec
     
    867868        return 3
    868869    elif 'T' in Inst['Type'][0]:
    869         dsp = pos/Inst['difC'][1]
    870         alp = alpTOF(dsp,Inst['alpha'][1])
    871         bet = betTOF(dsp,Inst['beta-0'][1],Inst['beta-1'][1],Inst['beta-q'][1])
    872         s = sigTOF(dsp,Inst['sig-0'][1],Inst['sig-1'][1],Inst['sig-2'][1],Inst['sig-q'][1])
    873         g = gamTOF(dsp,Inst['X'][1],Inst['Y'][1],Inst['Z'][1])
     870        dsp = pos/Inst['difC'][N]
     871        alp = alpTOF(dsp,Inst['alpha'][N])
     872        bet = betTOF(dsp,Inst['beta-0'][1],Inst['beta-1'][N],Inst['beta-q'][N])
     873        s = sigTOF(dsp,Inst['sig-0'][N],Inst['sig-1'][N],Inst['sig-2'][N],Inst['sig-q'][N])
     874        g = gamTOF(dsp,Inst['X'][N],Inst['Y'][N],Inst['Z'][N])
    874875        return getgamFW(g,s)+np.log(2.0)*(alp+bet)/(alp*bet)
    875876    elif 'C' in Inst['Type'][0]:
    876         s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1])
    877         g = gam(pos/2.,Inst['X'][1],Inst['Y'][1],Inst['Z'][1])
     877        s = sig(pos/2.,Inst['U'][N],Inst['V'][N],Inst['W'][N])
     878        g = gam(pos/2.,Inst['X'][N],Inst['Y'][N],Inst['Z'][N])
    878879        return getgamFW(g,s)/100.  #returns FWHM in deg
    879880    elif 'E' in Inst['Type'][0]:
    880         s = sigED(pos,Inst['A'][1],Inst['B'][1],Inst['C'][1])
     881        s = sigED(pos,Inst['A'][N],Inst['B'][N],Inst['C'][N])
    881882        return 2.35482*s
    882883    else:   #'B'
    883         alp = alpPink(pos,Inst['alpha-0'][1],Inst['alpha-1'][1])
    884         bet = betPink(pos,Inst['beta-0'][1],Inst['beta-1'][1])
    885         s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1])
    886         g = gam(pos/2.,Inst['X'][1],Inst['Y'][1],Inst['Z'][1])
     884        alp = alpPink(pos,Inst['alpha-0'][N],Inst['alpha-1'][N])
     885        bet = betPink(pos,Inst['beta-0'][N],Inst['beta-1'][N])
     886        s = sig(pos/2.,Inst['U'][N],Inst['V'][N],Inst['W'][N])
     887        g = gam(pos/2.,Inst['X'][N],Inst['Y'][N],Inst['Z'][N])
    887888        return getgamFW(g,s)/100.+np.log(2.0)*(alp+bet)/(alp*bet)  #returns FWHM in deg
    888889   
Note: See TracChangeset for help on using the changeset viewer.