Changeset 635 for trunk


Ignore:
Timestamp:
May 26, 2012 12:56:38 PM (13 years ago)
Author:
vondreele
Message:

HKLF refinement "numeric" now OK; revamp output a bit for more generalized R-values.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/GSASII.py

    r630 r635  
    20082008            return
    20092009        #works - but it'd be better if it could restore plots
    2010         dlg = wx.ProgressDialog('Residual','Powder profile Rwp =',101.0,
     2010        dlg = wx.ProgressDialog('Residual','All data Rw =',101.0,
    20112011            style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT)
    20122012        screenSize = wx.ClientDisplayRect()
     
    20152015        dlg.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5))
    20162016        dlg.SetSize(Size)
    2017         Rwp = 100.00
     2017        Rw = 100.00
    20182018        try:
    2019             Rwp = G2str.Refine(self.GSASprojectfile,dlg)
     2019            Rw = G2str.Refine(self.GSASprojectfile,dlg)
    20202020        finally:
    20212021            dlg.Destroy()       
    2022         dlg = wx.MessageDialog(self,'Load new result?','Refinement results, Rwp =%.3f'%(Rwp),wx.OK|wx.CANCEL)
     2022        dlg = wx.MessageDialog(self,'Load new result?','Refinement results, Rw =%.3f'%(Rw),wx.OK|wx.CANCEL)
    20232023        try:
    20242024            if dlg.ShowModal() == wx.ID_OK:
  • TabularUnified trunk/GSASIIgrid.py

    r633 r635  
    863863                value = 1.0
    864864            data['minF/sig'] = value
    865             Factr.SetValue('%.2f'%(value))
     865            minSig.SetValue('%.2f'%(value))
    866866
    867867        LSSizer = wx.FlexGridSizer(cols=4,vgap=5,hgap=5)
  • TabularUnified trunk/GSASIIstruct.py

    r633 r635  
    14651465            elif 'HKLF' in histogram:
    14661466                pfx = str(pId)+':'+str(hId)+':'
     1467                print ' Final refinement RF, RF^2 = %.2f%%, %.2f%% on %d reflections'   \
     1468                    %(Histogram[pfx+'Rf'],Histogram[pfx+'Rf^2'],Histogram[pfx+'Nref'])
    14671469                ScalExtSig = {}
    14681470                for item in ['Scale','Ep','Eg','Es']:
     
    18181820            print '\n Histogram: ',histogram,' histogram Id: ',hId
    18191821            print 135*'-'
    1820             print ' Final refinement wRp = %.2f%% on %d observations in this histogram'%(Histogram['wRp'],Histogram['Nobs'])
     1822            print ' Final refinement wR = %.2f%% on %d observations in this histogram'%(Histogram['wR'],Histogram['Nobs'])
    18211823            if Print:
    18221824                print ' Instrument type: ',Sample['Type']
     
    28832885                varylist,Histogram,Phases,calcControls,pawleyLookup)
    28842886            if dlg:
    2885                 dlg.Update(Histogram['wRp'],newmsg='Hessian for histogram %d Rwp=%8.3f%s'%(hId,Histogram['wRp'],'%'))[0]
     2887                dlg.Update(Histogram['wR'],newmsg='Hessian for histogram %d Rw=%8.3f%s'%(hId,Histogram['wR'],'%'))[0]
    28862888            if len(Hess):
    28872889                Vec += np.sum(dMdvh*np.sqrt(w[xB:xF])*dy[xB:xF],axis=1)
     
    29042906            Histogram['Nobs'] = len(refList)
    29052907            dFdvDict = StructureFactorDerv(refList,G,hfx,pfx,SGData,calcControls,parmdict)
    2906             df = np.empty(len(refList))
     2908            df = np.zeros(len(refList))
    29072909            for i,ref in enumerate(refList):
    29082910                if ref[6] > 0:
     
    29112913                    ref[8] = ref[5]/parmdict[phfx+'Scale']
    29122914                    df[i] = (ref[5]-ref[7])/ref[6]
    2913                     sumwYo += ref[5]/ref[6]**2
     2915                    sumwYo += (ref[5]/ref[6])**2
    29142916            M = np.concatenate((M,df))
    29152917
     
    29252927    Histograms,Phases = HistoPhases
    29262928    M = np.empty(0)
    2927     sumwYo = 0
     2929    SumwYo = 0
    29282930    Nobs = 0
    29292931    histoList = Histograms.keys()
     
    29442946            Nobs += Histogram['Nobs']
    29452947            Histogram['sumwYo'] = np.sum(w[xB:xF]*y[xB:xF]**2)
    2946             sumwYo += Histogram['sumwYo']
     2948            SumwYo += Histogram['sumwYo']
    29472949            yc[xB:xF],yb[xB:xF] = getPowderProfile(parmdict,x[xB:xF],
    29482950                varylist,Histogram,Phases,calcControls,pawleyLookup)
     
    29512953            Histogram['sumwYd'] = np.sum(np.sqrt(w[xB:xF])*(yd[xB:xF]))
    29522954            wdy = -np.sqrt(w[xB:xF])*(yd[xB:xF])
    2953             Histogram['wRp'] = min(100.,np.sqrt(np.sum(wdy**2)/Histogram['sumwYo'])*100.)
     2955            Histogram['wR'] = min(100.,np.sqrt(np.sum(wdy**2)/Histogram['sumwYo'])*100.)
    29542956            if dlg:
    2955                 dlg.Update(Histogram['wRp'],newmsg='For histogram %d Rwp=%8.3f%s'%(hId,Histogram['wRp'],'%'))[0]
     2957                dlg.Update(Histogram['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['wR'],'%'))[0]
    29562958            M = np.concatenate((M,wdy))
    29572959        elif 'HKLF' in histogram[:4]:
     
    29692971            Histogram['Nobs'] = len(refList)
    29702972            refList = StructureFactor(refList,G,hfx,pfx,SGData,calcControls,parmdict)
    2971             df = np.empty(len(refList))
     2973            df = np.zeros(len(refList))
     2974            sumwYo = 0
     2975            sumFo = 0
     2976            sumFo2 = 0
     2977            sumdF = 0
     2978            sumdF2 = 0
    29722979            for i,ref in enumerate(refList):
    29732980                if ref[6] > 0 and ref[5] > 0:
     
    29762983                    if calcControls['F**2']:
    29772984                        if ref[5]/ref[6] >= calcControls['minF/sig']:
     2985                            sumFo2 += ref[5]
     2986                            Fo = np.sqrt(ref[5])
     2987                            sumFo += Fo
     2988                            sumFo2 += ref[5]
     2989                            sumdF += abs(Fo-np.sqrt(ref[7]))
     2990                            sumdF2 += abs(ref[5]-ref[7])
    29782991                            Nobs += 1
    29792992                            df[i] = -(ref[5]-ref[7])/ref[6]
    2980                             sumwYo += ref[5]/ref[6]**2
     2993                            sumwYo += (ref[5]/ref[6])**2
    29812994                    else:
    29822995                        Fo = np.sqrt(ref[5])
     
    29842997                        sig = ref[6]/(2.0*Fo)
    29852998                        if Fo/sig >= calcControls['minF/sig']:
     2999                            sumFo += Fo
     3000                            sumFo2 += ref[5]
     3001                            sumdF += abs(Fo-Fc)
     3002                            sumdF2 += abs(ref[5]-ref[7])
    29863003                            Nobs += 1
    29873004                            df[i] = (Fo-Fc)/sig
    2988                             sumwYo += Fo/sig**2
     3005                            sumwYo += (Fo/sig)**2
     3006            Histogram['sumwYo'] = sumwYo
     3007            SumwYo += sumwYo
     3008            Histogram['wR'] = min(100.,np.sqrt(np.sum(df**2)/Histogram['sumwYo'])*100.)
     3009            Histogram[phfx+'Rf'] = 100.*sumdF/sumFo
     3010            Histogram[phfx+'Rf^2'] = 100.*sumdF2/sumFo2
     3011            Histogram[phfx+'Nref'] = Nobs
     3012            if dlg:
     3013                dlg.Update(Histogram['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['wR'],'%'))[0]
    29893014            M = np.concatenate((M,df))
    2990 
    2991 
    2992     Histograms['sumwYo'] = sumwYo
     3015    Histograms['sumwYo'] = SumwYo
    29933016    Histograms['Nobs'] = Nobs
    2994     Rwp = min(100.,np.sqrt(np.sum(M**2)/sumwYo)*100.)
    2995     print 'Rwp',sumwYo,np.sum(M**2),np.sqrt(np.sum(M**2)),Rwp,Nobs
     3017    Rw = min(100.,np.sqrt(np.sum(M**2)/SumwYo)*100.)
    29963018    if dlg:
    2997         GoOn = dlg.Update(Rwp,newmsg='%s%8.3f%s'%('Powder profile Rwp =',Rwp,'%'))[0]
     3019        GoOn = dlg.Update(Rw,newmsg='%s%8.3f%s'%('All data Rw =',Rw,'%'))[0]
    29983020        if not GoOn:
    29993021            parmDict['saved values'] = values
     
    30933115        print ' Number of function calls:',result[2]['nfev'],' Number of observations: ',Histograms['Nobs'],' Number of parameters: ',len(varyList)
    30943116        print ' Refinement time = %8.3fs, %8.3fs/cycle, for %d cycles'%(runtime,runtime/ncyc,ncyc)
    3095         print ' wRp = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
     3117        print ' wR = %7.2f%%, chi**2 = %12.6g, reduced chi**2 = %6.2f'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])
    30963118        try:
    30973119            covMatrix = result[1]*Rvals['GOF']
Note: See TracChangeset for help on using the changeset viewer.