Changeset 3413
- Timestamp:
- May 29, 2018 3:10:32 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIconstrGUI.py
r3411 r3413 743 743 FrstVarb = varList[sel] 744 744 VarObj = G2obj.G2VarObj(FrstVarb) 745 moreVarb = G2obj.SortVariables( 746 FindEquivVarb(FrstVarb,[i for i in varList if i not in omitVars])) 745 moreVarb = G2obj.SortVariables(FindEquivVarb(FrstVarb,[i for i in varList if i not in omitVars])) 747 746 newcons = SelectVarbs(page,VarObj,moreVarb,title2+FrstVarb,constType) 748 747 if len(newcons) > 0: -
trunk/GSASIIstrMain.py
r3378 r3413 48 48 49 49 def RefineCore(Controls,Histograms,Phases,restraintDict,rigidbodyDict,parmDict,varyList, 50 calcControls,pawleyLookup,if Print,printFile,dlg):50 calcControls,pawleyLookup,ifSeq,printFile,dlg): 51 51 '''Core optimization routines, shared between SeqRefine and Refine 52 52 … … 56 56 # for item in parmDict: print item,parmDict[item] ######### show dict just before refinement 57 57 G2mv.Map2Dict(parmDict,varyList) 58 ifPrint = True 59 if ifSeq: 60 ifPrint = False 58 61 Rvals = {} 59 62 while True: … … 113 116 printFile.write(' wR = %7.2f%%, chi**2 = %12.6g, GOF = %6.2f\n'%(Rvals['Rwp'],Rvals['chisq'],Rvals['GOF'])) 114 117 sig = len(varyList)*[None,] 115 if 'None' in str(type(result[1])) :118 if 'None' in str(type(result[1])) and ifSeq: #this bails out of a sequential refinement on singular matrix 116 119 IfOK = False 117 120 covMatrix = [] 121 print ('**** Refinement failed - singular matrix ****') 122 if 'Hessian' in Controls['deriv type']: 123 num = len(varyList)-1 124 for i,val in enumerate(np.flipud(result[2]['psing'])): 125 if val: 126 print ('Bad parameter: '+varyList[num-i]) 127 else: 128 Ipvt = result[2]['ipvt'] 129 for i,ipvt in enumerate(Ipvt): 130 if not np.sum(result[2]['fjac'],axis=1)[i]: 131 print ('Bad parameter: '+varyList[ipvt-1]) 118 132 break 119 133 IfOK = True … … 216 230 # print G2mv.VarRemapShow(varyList) 217 231 218 if Print = True232 ifSeq = False 219 233 printFile.write('\n Refinement results:\n') 220 234 printFile.write(135*'-'+'\n') … … 223 237 covData = {} 224 238 IfOK,Rvals,result,covMatrix,sig = RefineCore(Controls,Histograms,Phases,restraintDict, 225 rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,if Print,printFile,dlg)239 rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,ifSeq,printFile,dlg) 226 240 if IfOK: 227 241 sigDict = dict(zip(varyList,sig)) … … 441 455 firstVaryList = newVaryList 442 456 443 if Print = False457 ifSeq = True 444 458 printFile.write('\n Refinement results for histogram: %s\n'%histogram) 445 459 printFile.write(135*'-'+'\n') … … 447 461 # try: 448 462 IfOK,Rvals,result,covMatrix,sig = RefineCore(Controls,Histo,Phases,restraintDict, 449 rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,if Print,printFile,dlg)463 rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,ifSeq,printFile,dlg) 450 464 if PlotFunction: 451 465 PlotFunction(G2frame,Histo[histogram]['Data'],histogram)
Note: See TracChangeset
for help on using the changeset viewer.