Changeset 1282 for trunk/GSASIImath.py


Ignore:
Timestamp:
Apr 18, 2014 10:22:29 AM (8 years ago)
Author:
toby
Message:

sequential refinement updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r1244 r1282  
    9292    """
    9393               
     94    ifConverged = False
     95    deltaChi2 = -10.
    9496    x0 = np.array(x0, ndmin=1)      #might be redundant?
    9597    n = len(x0)
     
    141143                break
    142144        lamMax = max(lamMax,lam)
     145        deltaChi2 = (chisq0-chisq1)/chisq0
    143146        if Print:
    144             print ' Cycle: %d, Time: %.2fs, Chi**2: %.3g, Lambda: %.3g'%(icycle,time.time()-time0,chisq1,lam)
    145         if (chisq0-chisq1)/chisq0 < ftol:
     147            print ' Cycle: %d, Time: %.2fs, Chi**2: %.3g, Lambda: %.3g,  Delta: %.3g'%(
     148                icycle,time.time()-time0,chisq1,lam,deltaChi2)
     149        if deltaChi2 < ftol:
     150            ifConverged = True
     151            if Print: print "converged"
    146152            break
    147153        icycle += 1
     
    155161    try:
    156162        Bmat = nl.inv(Amatlam)*(One+Lam)/Anorm      #rescale Bmat to Marquardt array
    157         return [x0,Bmat,{'num cyc':icycle,'fvec':M,'nfev':nfev,'lamMax':lamMax,'psing':[]}]
     163        return [x0,Bmat,{'num cyc':icycle,'fvec':M,'nfev':nfev,'lamMax':lamMax,'psing':[], 'Converged': ifConverged, 'DelChi2':deltaChi2}]
    158164    except nl.LinAlgError:
    159165        print 'ouch #2 linear algebra error in LS'
Note: See TracChangeset for help on using the changeset viewer.