Changeset 4136
- Timestamp:
- Sep 4, 2019 5:06:31 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r4118 r4136 4832 4832 dlg.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x 4833 4833 dlg.CenterOnParent() 4834 dlg.Show() 4834 4835 # find 1st histogram to be refined 4835 4836 if 'Seq Data' in Controls: -
trunk/GSASIIobj.py
r4073 r4136 2764 2764 2765 2765 class G2Exception(Exception): 2766 'A generic GSAS-II exception class' 2766 2767 def __init__(self,msg): 2767 2768 self.msg = msg … … 2769 2770 return repr(self.msg) 2770 2771 2772 class G2RefineCancel(Exception): 2773 'Raised when Cancel is pressed in a refinement dialog' 2774 def __init__(self,msg): 2775 self.msg = msg 2776 def __str__(self): 2777 return repr(self.msg) 2778 2771 2779 def HowDidIgetHere(wherecalledonly=False): 2772 2780 '''Show a traceback with calls that brought us to the current location. -
trunk/GSASIIstrMain.py
r4133 r4136 251 251 printFile.write('\n Refinement results:\n') 252 252 printFile.write(135*'-'+'\n') 253 if True: 254 # try: 253 try: 255 254 covData = {} 256 255 IfOK,Rvals,result,covMatrix,sig = RefineCore(Controls,Histograms,Phases,restraintDict, … … 280 279 G2fil.G2Print ('****ERROR - Refinement failed') 281 280 raise G2obj.G2Exception('****ERROR - Refinement failed') 282 # except G2obj.G2Exception(Msg): 283 # printFile.close() 284 # return False,Msg.msg 281 except G2obj.G2RefineCancel as Msg: 282 printFile.close() 283 G2fil.G2Print (' ***** Refinement stopped *****') 284 return False,Msg.msg 285 except G2obj.G2Exception as Msg: # cell metric error, others? 286 printFile.close() 287 G2fil.G2Print (' ***** Refinement error *****') 288 return False,Msg.msg 285 289 286 290 #for testing purposes, create a file for testderiv … … 497 501 printFile.write('\n Refinement results for histogram: %s\n'%histogram) 498 502 printFile.write(135*'-'+'\n') 499 if True: 500 # try: 503 try: 501 504 IfOK,Rvals,result,covMatrix,sig = RefineCore(Controls,Histo,Phases,restraintDict, 502 505 rigidbodyDict,parmDict,varyList,calcControls,pawleyLookup,ifSeq,printFile,dlg, … … 547 550 NewparmDict[parm] = parmDict[parm] 548 551 549 # except G2obj.G2Exception(Msg): 550 # printFile.close() 551 # G2fil.G2Print (' ***** Refinement aborted *****') 552 # return False,Msg.msg 552 except G2obj.G2RefineCancel as Msg: 553 printFile.close() 554 G2fil.G2Print (' ***** Refinement stopped *****') 555 return False,Msg.msg 556 except G2obj.G2Exception as Msg: # cell metric error, others? 557 printFile.close() 558 G2fil.G2Print (' ***** Refinement error *****') 559 return False,Msg.msg 553 560 if GSASIIpath.GetConfigValue('Show_timing'): 554 561 t2 = time.time() -
trunk/GSASIIstrMath.py
r4135 r4136 3897 3897 dMdvh *= Wt 3898 3898 if dlg: 3899 dlg.Update(Histogram['Residuals']['wR'],newmsg='Hessian for histogram %d\nAll data Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%')) 3899 GoOn = dlg.Update(Histogram['Residuals']['wR'],newmsg='Hessian for histogram %d\nAll data Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%')) 3900 if type(GoOn) is tuple: 3901 if not GoOn[0]: 3902 raise G2obj.G2RefineCancel('Cancel pressed') 3903 elif not GoOn: 3904 raise G2obj.G2RefineCancel('Cancel pressed') 3900 3905 dlg.Raise() 3901 3906 if len(Hess): … … 3920 3925 3921 3926 if dlg: 3922 dlg.Update(Histogram['Residuals']['wR'],newmsg='Hessian for histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%'))[0] 3927 GoOn = dlg.Update(Histogram['Residuals']['wR'],newmsg='Hessian for histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%')) 3928 if type(GoOn) is tuple: 3929 if not GoOn[0]: 3930 raise G2obj.G2RefineCancel('Cancel pressed') 3931 elif not GoOn: 3932 raise G2obj.G2RefineCancel('Cancel pressed') 3923 3933 dlg.Raise() 3924 3934 if len(Hess): … … 4001 4011 Histogram['Residuals']['wRmin'] = min(100.,100.*ma.sqrt(Histogram['Residuals']['Nobs']/Histogram['Residuals']['sumwYo'])) 4002 4012 if dlg: 4003 dlg.Update(Histogram['Residuals']['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%'))[0] 4013 GoOn = dlg.Update(Histogram['Residuals']['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%')) 4014 if type(GoOn) is tuple: 4015 if not GoOn[0]: 4016 raise G2obj.G2RefineCancel('Cancel pressed') 4017 elif not GoOn: 4018 raise G2obj.G2RefineCancel('Cancel pressed') 4004 4019 dlg.Raise() 4005 4020 M = np.concatenate((M,wdy)) … … 4145 4160 Next += next 4146 4161 if dlg: 4147 dlg.Update(Histogram['Residuals']['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%'))[0] 4162 GoOn = dlg.Update(Histogram['Residuals']['wR'],newmsg='For histogram %d Rw=%8.3f%s'%(hId,Histogram['Residuals']['wR'],'%')) 4163 if type(GoOn) is tuple: 4164 if not GoOn[0]: 4165 raise G2obj.G2RefineCancel('Cancel pressed') 4166 elif not GoOn: 4167 raise G2obj.G2RefineCancel('Cancel pressed') 4148 4168 dlg.Raise() 4149 4169 M = np.concatenate((M,wtFactor*df)) … … 4156 4176 Rw = min(100.,np.sqrt(np.sum(M**2)/SumwYo)*100.) 4157 4177 if dlg: 4158 GoOn = dlg.Update(Rw,newmsg='%s%8.3f%s'%('All data Rw =',Rw,'%'))[0] 4159 if not GoOn: 4178 GoOn = dlg.Update(Rw,newmsg='%s%8.3f%s'%('All data Rw =',Rw,'%')) 4179 if type(GoOn) is tuple: 4180 if not GoOn[0]: 4181 parmDict['saved values'] = values 4182 raise G2obj.G2RefineCancel('Cancel pressed') 4183 elif not GoOn: 4160 4184 parmDict['saved values'] = values 4161 dlg.Destroy()4162 raise G2obj.G2Exception('User abort') #Abort!!4185 raise G2obj.G2RefineCancel('Cancel pressed') 4186 dlg.Raise() 4163 4187 pDict,pVals,pWt,pWsum,pWnum = penaltyFxn(HistoPhases,calcControls,parmDict,varylist) 4164 4188 if len(pVals):
Note: See TracChangeset
for help on using the changeset viewer.