Changeset 1282 for trunk/GSASIImath.py
- Timestamp:
- Apr 18, 2014 10:22:29 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r1244 r1282 92 92 """ 93 93 94 ifConverged = False 95 deltaChi2 = -10. 94 96 x0 = np.array(x0, ndmin=1) #might be redundant? 95 97 n = len(x0) … … 141 143 break 142 144 lamMax = max(lamMax,lam) 145 deltaChi2 = (chisq0-chisq1)/chisq0 143 146 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" 146 152 break 147 153 icycle += 1 … … 155 161 try: 156 162 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}] 158 164 except nl.LinAlgError: 159 165 print 'ouch #2 linear algebra error in LS'
Note: See TracChangeset
for help on using the changeset viewer.