Changeset 5112 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Dec 15, 2021 4:56:41 PM (12 months ago)
Author:
vondreele
Message:

implement energy dispersive x-ray data as a new type 'PXE'; assume Gaussian peak shape only; no sample broadening considered. Peak resolution is only ~0.5% not good enough to see sample broadening
import, plotting, peak fitting, indexing & cell refinement from peak positions "complete"
data is old (from ~20 yrs ago) so no idea about modern ED data.
Start on use in Pawley/LeBail? refinement - Rietveld excluded; currently not working
Some work on ISODISTORT implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r5109 r5112  
    23212321                if 'T' in Parms['Type'][0]: # TOF
    23222322                    dT = Parms['difC'][1] * 2 * np.pi * tolerance / q**2
     2323                elif 'E' in Parms['Type'][0]: # energy dispersive x-rays
     2324                    pass    #for now
    23232325                else: # 'C' or  'B' in Parms['Type'][0] or 'PKS' in Parms['Type'][0]:
    23242326                    wave = G2mth.getWave(Parms)
     
    23602362                    else:
    23612363                        G2frame.G2plotNB.status.SetStatusText('TOF =%9.3f d=%9.5f Q=%9.5f Intensity =%9.2f'%(xpos,dsp,q,ypos),1)
     2364                elif 'E' in Parms['Type'][0]:
     2365                    G2frame.G2plotNB.status.SetStatusText('Energy =%9.3f d=%9.5f Q=%9.5f sqrt(Intensity) =%9.2f'%(xpos,dsp,q,ypos),1)
    23622366                else:
    23632367                    if 'PWDR' in plottype:
     
    33263330            else:
    33273331                xLabel = r'$TOF, \mathsf{\mu}$s'
     3332        elif 'E' in ParmList[0]['Type'][0]:
     3333            xLabel = 'E, keV'
    33283334        else:
    33293335            xLabel = r'$\mathsf{2\theta}$'
     
    34083414            if ('C' in ParmList[0]['Type'][0] and Page.plotStyle['dPlot']) or \
    34093415                ('B' in ParmList[0]['Type'][0] and Page.plotStyle['dPlot']) or \
     3416                ('E' in ParmList[0]['Type'][0] and Page.plotStyle['dPlot']) or \
    34103417                ('T' in ParmList[0]['Type'][0] and Page.plotStyle['qPlot']): # reversed regions relative to data order
    34113418                tcorner = 1
     
    53505357       
    53515358    for N,Pattern in enumerate(PlotList):
    5352         xye = Pattern[1]
     5359        xye = np.array(Pattern[1])
    53535360        X = xye[0]
    53545361        if not lenX:
     
    63156322        return
    63166323    elif 'T' in Parms['Type'][0]:
    6317         difC = Parms['difC'][0]
     6324        difC = Parms['difC'][1]
     6325    elif 'E' in Parms['Type'][0]:
     6326        tth = Parms['2-theta'][1]
    63186327    else:
    63196328        lam = G2mth.getWave(Parms)
     
    63696378        Plot.plot(Q,G,color='m',label='Lorentzian')
    63706379
    6371         fit = G2mth.setPeakparms(Parms,Parms2,T,Z)
     6380        fit = G2mth.setPeakparms(Parms,Parms2,T,Z,useFit=True)
    63726381        ds = T/difC
    63736382        Q = 2.*np.pi/ds
     
    64026411            Plot.plot(Qp,Gp,'+',color='m',label='Lorentzian peak')
    64036412        Plot.legend(loc='best')
     6413    elif 'E' in Parms['Type'][0]:
     6414        isig = 4
     6415        Plot.set_title('Instrument and sample peak widths')
     6416        Plot.set_xlabel(r'$Q, \AA^{-1}$',fontsize=14)
     6417        Plot.set_ylabel(r'$\Delta Q/Q, \Delta d/d$',fontsize=14)
     6418        Xmin,Xmax = limits[1]
     6419        X = np.linspace(Xmin,Xmax,num=101,endpoint=True)
     6420        Q = 2.*np.pi*X*npsind(tth/2.)/12.3986
     6421        Z = np.ones_like(X)
     6422        data = G2mth.setPeakparms(Parms,Parms2,X,Z)
     6423        s = np.sqrt(data[isig])   #var -> sig(radians)
     6424        Y = sq8ln2*s/X
     6425        Plot.plot(Q,Y,color='r',label='Gaussian')
     6426       
     6427        fit = G2mth.setPeakparms(Parms,Parms2,X,Z,useFit=True)
     6428        sf = np.sqrt(fit[isig])
     6429        Yf = sq8ln2*sf/X
     6430        Plot.plot(Q,Yf,color='r',dashes=(5,5),label='Gaussian fit')
     6431       
     6432        Xp = []
     6433        Yp = []
     6434        for peak in peaks:
     6435            Xp.append(2.*np.pi*peak[0]*npsind(tth/2.)/12.3986)
     6436            try:
     6437                s = math.sqrt(peak[isig])
     6438            except ValueError:
     6439                s = 0.01
     6440            Yp.append(sq8ln2*s/peak[0])
     6441        if len(peaks):
     6442            Plot.plot(Xp,Yp,'+',color='r',label='G peak')
     6443        legend = Plot.legend(loc='best')
     6444        SetupLegendPick(legend,new)
     6445        Page.canvas.draw()
     6446       
    64046447    else:       #'C' & 'B'
    64056448        isig = 4
Note: See TracChangeset for help on using the changeset viewer.