Changeset 662da312 in sasview for sansview


Ignore:
Timestamp:
Jan 20, 2010 3:55:37 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
97603c0
Parents:
6d20b46
Message:

working on thread fit issues [incomplete]

Location:
sansview/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/fit_thread.py

    r785c8233 r662da312  
    155155        except : 
    156156            #Stop on exception during fitting. Todo: need to put some mssg and reset progress bar. 
    157             msg= " Fit Error occurred... %s"%sys.exc_value 
    158             wx.PostEvent(self.parent, StatusEvent(status= msg,type="stop")) 
    159             #raise 
     157            #msg= " Fit Error occurred... %s"%sys.exc_value 
     158            #wx.PostEvent(self.parent, StatusEvent(status= msg,type="stop")) 
     159            raise 
    160160     
  • sansview/perspectives/fitting/fitting.py

    r2db1d66 r662da312  
    453453                    self.current_pg= page 
    454454            except: 
    455                 msg= "%s error: %s" % (engineType,sys.exc_value) 
    456                 wx.PostEvent(self.parent, StatusEvent(status= msg )) 
    457                 return  
     455                raise 
     456                #msg= "%s error: %s" % (engineType,sys.exc_value) 
     457                #wx.PostEvent(self.parent, StatusEvent(status= msg )) 
     458                #return  
    458459             
    459460        #Do the simultaneous fit 
    460461        try: 
    461462            ## If a thread is already started, stop it 
    462             if self.calc_fit!= None and self.calc_fit.isrunning(): 
    463                 return 
    464                 self.calc_fit.stop() 
     463            #if self.calc_fit!= None and self.calc_fit.isrunning(): 
     464            #    self.calc_fit.stop() 
    465465             
    466466            wx.PostEvent(self.parent, StatusEvent(status="Start the computation", 
     
    471471            time.sleep(0.5) 
    472472            ## perform single fit 
    473             if self._fit_engine=="scipy": 
     473            if fitproblem_count == 1: 
    474474                #qmin, qmax= self.current_pg.get_range() 
    475                 self.calc_fit=FitThread(parent =self.parent, 
     475                print "went here fitproblem_count == 1",fitproblem_count == 1 
     476                calc_fit=FitThread(parent =self.parent, 
    476477                                        fn= self.fitter, 
    477478                                       cpage=self.current_pg, 
     
    479480                                       completefn= self._single_fit_completed, 
    480481                                       updatefn=self._updateFit) 
     482                 
    481483                       
    482484            else: 
    483485                ## Perform more than 1 fit at the time 
    484                 self.calc_fit=FitThread(parent =self.parent, 
     486                calc_fit=FitThread(parent =self.parent, 
    485487                                        fn= self.fitter, 
    486488                                       completefn= self._simul_fit_completed, 
    487489                                       updatefn=self._updateFit) 
    488490             
    489             self.calc_fit.queue() 
    490             self.ready_fit() 
     491            calc_fit.queue() 
     492            self.ready_fit(calc_fit=calc_fit) 
    491493             
    492494        except FitAbort: 
    493495            print "in pluging" 
    494496        except: 
    495             msg= "%s error: %s" % (engineType,sys.exc_value) 
    496             wx.PostEvent(self.parent, StatusEvent(status= msg ,type="stop")) 
    497             return  
    498          
    499     def ready_fit(self): 
     497            raise 
     498        #    msg= "%s error: %s" % (engineType,sys.exc_value) 
     499        #    wx.PostEvent(self.parent, StatusEvent(status= msg ,type="stop")) 
     500        #    return  
     501         
     502    def ready_fit(self, calc_fit): 
    500503        """ 
    501504        Ready for another fit 
    502505        """ 
    503506        if self.fitproblem_count != None and self.fitproblem_count > 1: 
    504             self.calc_fit.ready(2.5) 
     507            calc_fit.ready(2.5) 
    505508             
    506509        else: 
     
    626629            self.fitter.set_data(data=metadata,Uid=self.fit_id, 
    627630                                 smearer=smearer,qmin= qmin,qmax=qmax ) 
    628             
     631            print "self.fitter.set_data" 
    629632            self.fitter.select_problem_for_fit(Uid= self.fit_id, 
    630633                                               value= value.get_scheduled()) 
    631634            value.clear_model_param() 
    632635        except: 
    633             msg= title +" error: %s" % sys.exc_value 
    634             wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
    635             return 
     636            raise 
     637            #msg= title +" error: %s" % sys.exc_value 
     638            #wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
     639            #return 
    636640        
    637641    def _onSelect(self,event): 
     
    775779            """ 
    776780        except: 
    777             msg= "Single Fit completed but Following error occurred:%s"% sys.exc_value 
    778             wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 
    779             return 
     781            raise 
     782            #msg= "Single Fit completed but Following error occurred:%s"% sys.exc_value 
     783            #wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 
     784            #return 
    780785        
    781786        
     
    827832                    page.onsetValues(result.fitness, small_param_name,small_out,small_cov) 
    828833        except: 
    829              msg= "Simultaneous Fit completed" 
    830              msg +=" but Following error occurred:%s"%sys.exc_value 
    831              wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 
    832              return  
     834            raise 
     835             #msg= "Simultaneous Fit completed" 
     836             #msg +=" but Following error occurred:%s"%sys.exc_value 
     837             #wx.PostEvent(self.parent, StatusEvent(status=msg,type="stop")) 
     838             #return  
    833839              
    834840                            
Note: See TracChangeset for help on using the changeset viewer.