Ignore:
Timestamp:
Jun 3, 2017 12:23:04 PM (5 years ago)
Author:
vondreele
Message:

implement Hessian SVD refinement option (no Levenberg-Marquardt). Works for final refinements but not good for initial refinements (far from minimum). Warning in Controls status bar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMain.py

    r2847 r2854  
    6666                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
    6767            ncyc = int(result[2]['nfev']/2)
    68         elif 'Hessian' in Controls['deriv type']:
     68        elif 'analytic Hessian' in Controls['deriv type']:
    6969            Lamda = Controls.get('Marquardt',-3)
    7070            maxCyc = Controls['max cyc']
     
    7474            Rvals['lamMax'] = result[2]['lamMax']
    7575            Controls['Marquardt'] = -3  #reset to default
     76        elif 'Hessian SVD' in Controls['deriv type']:
     77            maxCyc = Controls['max cyc']
     78            result = G2mth.HessianSVD(G2stMth.errRefine,values,Hess=G2stMth.HessRefine,ftol=Ftol,xtol=Xtol,maxcyc=maxCyc,Print=ifPrint,
     79                args=([Histograms,Phases,restraintDict,rigidbodyDict],parmDict,varyList,calcControls,pawleyLookup,dlg))
     80            ncyc = result[2]['num cyc']+1
    7681        else:           #'numeric'
    7782            result = so.leastsq(G2stMth.errRefine,values,full_output=True,ftol=Ftol,epsfcn=1.e-8,factor=Factor,
     
    8388#        for item in table: print item,table[item]               #useful debug - are things shifting?
    8489        runtime = time.time()-begin
     90        Rvals['SVD0'] = result[2].get('SVD0',0)
    8591        Rvals['converged'] = result[2].get('Converged')
    8692        Rvals['DelChi2'] = result[2].get('DelChi2',-1.)
     
    105111#            for item in table: print item,table[item]               #useful debug - are things shifting?
    106112            break                   #refinement succeeded - finish up!
    107         except TypeError:          #result[1] is None on singular matrix
     113        except TypeError:          #result[1] is None on singular matrix or LinAlgError
    108114            IfOK = False
    109115            if not len(varyList):
Note: See TracChangeset for help on using the changeset viewer.