Changeset 1229


Ignore:
Timestamp:
Feb 25, 2014 9:40:27 AM (8 years ago)
Author:
vondreele
Message:

more fine tuning of image recalibrate
James Hester's fix to Pawley estimate
Fix problems with Pawley penalty fxn.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r1228 r1229  
    528528            continue
    529529        else:                   #no more rings beyond edge of detector
     530            data['ellipses'].append([])
    530531            continue
    531532#            break
  • trunk/GSASIIphsGUI.py

    r1228 r1229  
    48294829       
    48304830    def OnPawleyEstimate(event):
     4831        #Algorithm thanks to James Hester
    48314832        try:
    48324833            Refs = data['Pawley ref']
     
    48354836            G2frame.ErrorDialog('Pawley estimate','No histograms defined for this phase')
    48364837            return
    4837         HistoNames = Histograms.keys()
     4838        Vst = 1.0/data['General']['Cell'][7]     #Get volume
     4839        HistoNames = filter(lambda a:Histograms[a]['Use']==True,Histograms.keys())
    48384840        PatternId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,HistoNames[0])
    48394841        xdata = G2frame.PatternTree.GetItemPyData(PatternId)[1]
     
    48434845        posCorr = Inst['Zero'][1]
    48444846        const = 9.e-2/(np.pi*Sample['Gonio. radius'])                  #shifts in microns
     4847        gconst = 2.35482 # sqrt(8 ln 2)
    48454848       
    48464849        wx.BeginBusyCursor()
     
    48554858                indx = np.searchsorted(xdata[0],pos)
    48564859                try:
    4857                     FWHM = max(0.001,G2pwd.getFWHM(pos,Inst))/2.
    4858                     dx = xdata[0][indx+1]-xdata[0][indx]
    4859                     ref[6] = FWHM*(xdata[1][indx]-xdata[4][indx])*cosd(pos/2.)**3/dx
     4860                    FWHM = max(0.001,G2pwd.getFWHM(pos,Inst))/100.0
     4861                    # We want to estimate Pawley F^2 as a drop-in replacement for F^2 calculated by the structural
     4862                    # routines, which use Icorr * F^2 * peak profile, where peak profile has an area of 1.  So
     4863                    # we multiply the observed peak height by sqrt(8 ln 2)/(FWHM*sqrt(pi)) to determine the value of Icorr*F^2
     4864                    # then divide by Icorr to get F^2.
     4865                    ref[6] = (xdata[1][indx]-xdata[4][indx])*gconst/(FWHM*np.sqrt(np.pi))  #Area of Gaussian is height * FWHM * sqrt(pi)
    48604866                    Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.))           #Lorentz correction
    48614867                    pola = 1.0
    48624868                    if 'X' in Inst['Type']:
    48634869                        pola,dIdPola = G2pwd.Polarization(Inst['Polariz.'][1],xdata[0][indx],Inst['Azimuth'][1])
    4864                     ref[6] /= (Lorenz*pola*ref[3])
     4870                    else:
     4871                        pola = 1.0
     4872                    # Include histo scale and volume in calculation
     4873                    ref[6] /= (Sample['Scale'][0] * Vst * Lorenz * pola * ref[3])
    48654874                except IndexError:
    48664875                    pass
  • trunk/GSASIIstrMath.py

    r1175 r1229  
    393393                                pWsum[name] += wt*((obs-calc)/esd)**2
    394394         
     395    pWsum['PWLref'] = 0.
    395396    for item in varyList:
    396397        if 'PWLref' in item and parmDict[item] < 0.:
     
    400401                pVals.append(-parmDict[item])
    401402                pWt.append(negWt[pId])
    402                 pWsum[name] += negWt[pId]*(-parmDict[item])**2
     403                pWsum['PWLref'] += negWt[pId]*(-parmDict[item])**2
    403404    pVals = np.array(pVals)
    404405    pWt = np.array(pWt)         #should this be np.sqrt?
Note: See TracChangeset for help on using the changeset viewer.