- Timestamp:
- Apr 24, 2009 4:40:05 PM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- da26c1a
- Parents:
- 4bd557d
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fit_thread.py
r1c1436d rad6dd4c 139 139 handler= ConsoleUpdate(parent= self.parent,improvement_delta=0.1) 140 140 #Result from the fit 141 result = self.fitter.fit(handler= handler )141 result = self.fitter.fit(handler= handler, curr_thread=self) 142 142 143 143 elapsed = time.time()-self.starttime … … 150 150 # Thread was interrupted, just proceed and re-raise. 151 151 # Real code should not print, but this is an example... 152 #print "keyboard exception" 152 153 raise 153 154 155 except : 156 #print "uncaught exception" 157 raise 154 158 -
sansview/perspectives/fitting/fitpage.py
r813334e rad6dd4c 68 68 if len(self.parameters)==0: 69 69 return 70 if event.type =="park": 71 self.btFit.SetLabel("Fit") 70 72 for item in self.parameters: 71 73 if event.type =="scipy": … … 454 456 Allow to fit 455 457 """ 456 #self.btFit.SetLabel("Stop")457 458 from sans.guiframe.utils import check_value 458 459 flag = check_value( self.qmin, self.qmax) … … 469 470 470 471 # Remove or do not allow fitting on the Q=0 point, especially when y(q=0)=None at x[0]. 471 #ToDo: Fix this. 472 #if float(self.qmin.GetValue())==0.0 and self.data.x[0]==0 and not numpy.isfinite(self.data.y[0]): 473 # self.qmin_x = min(self.data.x[self.data.x!=0]) 474 #else: 472 #ToDo: Fix this. 475 473 self.qmin_x = float(self.qmin.GetValue()) 476 477 474 self.qmax_x =float( self.qmax.GetValue()) 478 475 self.manager._reset_schedule_problem( value=0) 479 476 self.manager.schedule_for_fit( value=1,page=self,fitproblem =None) 480 477 self.manager.set_fit_range(page= self,qmin= self.qmin_x, qmax= self.qmax_x) 478 481 479 #single fit 482 480 self.manager.onFit() 481 ## allow stopping the fit 482 if self.engine_type=="scipy": 483 self.btFit.SetLabel("Stop") 484 self.btFit.Unbind(event=wx.EVT_BUTTON, id= self.btFit.GetId()) 485 self.btFit.Bind(event= wx.EVT_BUTTON, handler=self._StopFit, id=self.btFit.GetId()) 486 else: 487 self.btFit.SetLabel("Fit") 488 self.btFit.Bind(event= wx.EVT_BUTTON, handler=self._onFit, id=self.btFit.GetId()) 483 489 self.btFit.SetFocus() 484 490 self.sizer5.Layout() 485 491 self.SetScrollbars(20,20,55,40) 486 492 487 493 def _StopFit(self, event): 494 """ 495 Stop fit 496 """ 497 self.btFit.SetLabel("Fit") 498 if self.engine_type=="scipy": 499 self.manager.stop_fit() 500 self.btFit.Unbind(event=wx.EVT_BUTTON, id=self.btFit.GetId()) 501 self.btFit.Bind(event=wx.EVT_BUTTON, handler=self._onFit,id=self.btFit.GetId()) 502 else: 503 self.btFit.Unbind(event=wx.EVT_BUTTON, id=self.btFit.GetId()) 504 self.btFit.Bind(event= wx.EVT_BUTTON, handler=self._onFit, id=self.btFit.GetId()) 505 self.btFit.SetFocus() 506 self.sizer5.Layout() 507 self.SetScrollbars(20,20,55,40) 508 488 509 def _on_select_model(self, event): 489 510 """ … … 619 640 except: 620 641 pass 621 if cov[0]==None :642 if cov[0]==None or not numpy.isfinite(cov[0]): 622 643 self.param_toFit[0][3].Hide() 623 644 self.param_toFit[0][4].Clear() … … 658 679 break 659 680 ## unable to compare cov[j]==numpy.nan so switch to None 660 if cov[j]==None :681 if cov[j]==None or not numpy.isfinite(cov[j]): 661 682 item[3].Hide() 662 683 item[4].Refresh() -
sansview/perspectives/fitting/fitting.py
r813334e rad6dd4c 354 354 Stop the fit engine 355 355 """ 356 if self.calc_fit!= None and self.calc_ thread.isrunning():357 self.calc_ thread.stop()356 if self.calc_fit!= None and self.calc_fit.isrunning(): 357 self.calc_fit.stop() 358 358 wx.PostEvent(self.parent, StatusEvent(status="Fitting \ 359 359 is cancelled" , type="stop")) … … 681 681 682 682 try: 683 if result ==None: 684 msg= "Simple Fitting Stop !!!" 685 wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 686 return 683 687 if numpy.any(result.pvec ==None )or not numpy.all(numpy.isfinite(result.pvec) ): 684 msg= " Fitting did not converge!!!"688 msg= "Single Fitting did not converge!!!" 685 689 wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 686 690 return … … 727 731 ## fit more than 1 model at the same time 728 732 try: 733 if result ==None: 734 msg= "Complex Fitting Stop !!!" 735 wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 736 return 737 if numpy.any(result.pvec ==None )or not numpy.all(numpy.isfinite(result.pvec) ): 738 msg= "Single Fitting did not converge!!!" 739 wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 740 return 729 741 for page, value in self.page_finder.iteritems(): 730 742 if value.get_scheduled()==1:
Note: See TracChangeset
for help on using the changeset viewer.