Changeset 5117


Ignore:
Timestamp:
Dec 23, 2021 9:01:03 AM (21 months ago)
Author:
vondreele
Message:

complete implementation of EDX data in GSAS-II; will do LeBail? or Pawley refinement
Will not do sample broadening (not even shown at present)
Add column selection for Pawley refinement flag (like similar in Peak List refinement)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIphsGUI.py

    r5116 r5117  
    1291212912##### Pawley routines ################################################################################
    1291312913    def FillPawleyReflectionsGrid():
     12914       
     12915        def onRefineDClick(event):
     12916            '''Called after a double-click on a cell label'''
     12917            c =  event.GetCol()
     12918            if c == 5:     #refine column label: just select it (& redisplay)
     12919                G2frame.PawleyRefl.ClearSelection()
     12920                G2frame.PawleyRefl.SelectCol(c,True)
     12921                choice = ['Y - vary all','N - vary none',]
     12922                dlg = wx.SingleChoiceDialog(G2frame,'Select refinement option',
     12923                    'Refinement controls',choice)
     12924                dlg.CenterOnParent()
     12925                if dlg.ShowModal() == wx.ID_OK:
     12926                    sel = dlg.GetSelection()
     12927                    if sel == 0:
     12928                        for row in range(G2frame.PawleyRefl.GetNumberRows()): PawleyPeaks[row][c]=True
     12929                    else:
     12930                        for row in range(G2frame.PawleyRefl.GetNumberRows()): PawleyPeaks[row][c]=False
     12931                FillPawleyReflectionsGrid()
     12932               
    1291412933        def KeyEditPawleyGrid(event):
    1291512934            colList = G2frame.PawleyRefl.GetSelectedCols()
     
    1295912978            G2frame.PawleyRefl.SetTable(PawleyTable, True)
    1296012979            G2frame.PawleyRefl.Bind(wx.EVT_KEY_DOWN, KeyEditPawleyGrid)                 
     12980            G2frame.PawleyRefl.Bind(wg.EVT_GRID_LABEL_LEFT_DCLICK, onRefineDClick)
    1296112981            for r in range(G2frame.PawleyRefl.GetNumberRows()):
    1296212982                for c in range(G2frame.PawleyRefl.GetNumberCols()):
     
    1312013140        gconst = 2.35482 # sqrt(8 ln 2)
    1312113141        dx = (xdata[0][1]-xdata[0][0])*20.              #this ian approximation - not correct, but CW seems to be needed
     13142        cw = np.diff(xdata[0])
     13143        cw = np.append(cw,cw[-1])
    1312213144        gconst *= dx
    1312313145       
     
    1313813160                    # we multiply the observed peak height by sqrt(8 ln 2)/(FWHM*sqrt(pi)) to determine the value of Icorr*F^2
    1313913161                    # then divide by Icorr to get F^2.
    13140                     ref[6+im] = (xdata[1][indx]-xdata[4][indx])*gconst/(FWHM*np.sqrt(np.pi))  #Area of Gaussian is height * FWHM * sqrt(pi)
     13162                    ref[6+im] = (xdata[1][indx]-xdata[4][indx])*FWHM*np.sqrt(np.pi)  #Area of Gaussian is height * FWHM * sqrt(pi)
    1314113163                    if 'E' not in Inst['Type'][0]:
    13142                         Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.))           #Lorentz correction
     13164                        if 'C' in Inst['Type'][0]:
     13165                            Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.))           #Lorentz correction
     13166                        else:
     13167                            Lorenz = ref[4+im]**4
    1314313168                        pola = 1.0
    1314413169                        if 'X' in Inst['Type']:
     
    1314913174                        ref[6+im] /= (Sample['Scale'][0] * Vst * Lorenz * pola * ref[3+im])
    1315013175                    else:
    13151                         ref[6+im] /= (Sample['Scale'][0] * ref[3+im])
     13176                        ref[6+im] /= (0.02*Sample['Scale'][0] * ref[3+im]*cw[indx])     #why 0.02*cw?
    1315213177                except IndexError:
    1315313178                    pass
  • trunk/GSASIIstrMain.py

    r5106 r5117  
    298298        if CheckLeBail(Phases):   # only needed for LeBail extraction
    299299            G2stMth.errRefine([],[Histograms,Phases,restraintDict,rigidbodyDict],
    300                                 parmDict,[],calcControls,pawleyLookup,dlg)
     300                parmDict,[],calcControls,pawleyLookup,dlg)
    301301        G2stMth.GetFobsSq(Histograms,Phases,parmDict,calcControls)
    302302    if chisq0 is not None:
  • trunk/GSASIIstrMath.py

    r5116 r5117  
    34583458                        refl[9+im] = parmDict[pInd]
    34593459                    except KeyError:
    3460 #                        print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l)
    34613460                        continue
    34623461                Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.)
     
    35013500                        refl[9+im] = parmDict[pInd]
    35023501                    except KeyError:
    3503 #                        print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l)
    35043502                        continue
    35053503                Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im])
     
    36973695                Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.)
    36983696            elif 'E' in calcControls[hfx+'histType']:
    3699                 Wd,fmin,fmax = G2pwd.getWidthsED(refl[5+im],refl[6+im]*1.e4)
     3697                Wd,fmin,fmax = G2pwd.getWidthsED(refl[5+im],refl[6+im])
    37003698            iBeg = np.searchsorted(x,refl[5+im]-fmin)
    37013699            iFin = np.searchsorted(x,refl[5+im]+fmax)
     
    38733871            if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']:
    38743872                sigDict,gamDict = GetSampleSigGamDerv(refl,im,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict)
    3875             else:   #'T'OF
     3873            elif 'T' in calcControls[hfx+'histType']:   #'T'OF
    38763874                sigDict,gamDict = GetSampleSigGamDerv(refl,im,0.0,G,GB,SGData,hfx,phfx,calcControls,parmDict)
     3875            else: #'E'
     3876                sigDict = {}
     3877                gamDict = {}
    38773878            for name in gamDict:
    38783879                if name in varylist:
Note: See TracChangeset for help on using the changeset viewer.