Changeset 7db52f1 in sasview for fittingview


Ignore:
Timestamp:
Oct 12, 2011 1:40:24 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
7643ba2
Parents:
18253cd
Message:

now able to reset the model init param values in batch model

Location:
fittingview/src/sans/perspectives/fitting
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fittingview/src/sans/perspectives/fitting/fit_thread.py

    r6a4002d r7db52f1  
    2727                 yieldtime  = 0.01, 
    2828                 worktime   = 0.01, 
    29                  ftol       = None): 
     29                 ftol       = None, 
     30                 reset_flag = False): 
    3031        CalcThread.__init__(self,completefn, 
    3132                 updatefn, 
     
    4243        #Relative error desired in the sum of squares. 
    4344        self.ftol = ftol 
     45        self.reset_flag = reset_flag 
    4446    
    4547    def isquit(self): 
     
    6365            list_curr_thread = []  
    6466            list_ftol = [] 
     67            list_reset_flag = [] 
    6568            list_map_get_attr = [] 
    6669            list_fit_function = [] 
     
    7174                list_curr_thread.append(None) 
    7275                list_ftol.append(self.ftol) 
     76                list_reset_flag.append(self.reset_flag) 
    7377                list_fit_function.append('fit') 
    7478                list_map_get_attr.append(map_getattr) 
    7579            #from multiprocessing import Pool 
    7680            inputs = zip(list_map_get_attr,self.fitter, list_fit_function, 
    77                          list_handler, list_q, list_curr_thread,list_ftol) 
     81                         list_handler, list_q, list_curr_thread,list_ftol, 
     82                         list_reset_flag) 
    7883            result =  map(map_apply, inputs) 
    7984            self.complete(result=result, 
  • fittingview/src/sans/perspectives/fitting/fitproblem.py

    ra3c8e8f r7db52f1  
    595595        self.fit_data = None 
    596596        # original data: should not be modified 
    597         self.original_data = copy.deepcopy(data) 
     597        self.original_data = data 
    598598        # fit data: used for fit and can be modified for convenience 
    599599        self.fit_data = copy.deepcopy(data) 
     
    609609        return self.fit_data 
    610610     
     611    def get_origin_data(self): 
     612        """ 
     613        """ 
     614        return self.original_data 
     615     
    611616    def set_weight(self, is2d, flag=None): 
    612617        """ 
  • fittingview/src/sans/perspectives/fitting/fitting.py

    r47d9be79 r7db52f1  
    8686        ## Fit engine 
    8787        self._fit_engine = 'scipy' 
     88        self._gui_engine = None 
    8889        ## Relative error desired in the sum of squares (float); scipy only 
    8990        self.ftol = SANS_F_TOL 
     91        self.batch_reset_flag = True 
    9092        #List of selected data 
    9193        self.selected_data_list = [] 
     
    705707            if value.get_scheduled() == 1: 
    706708                fitproblem_count += 1 
    707                  
     709        self._gui_engine = self._return_engine_type()        
    708710        self.fitproblem_count = fitproblem_count   
    709711        if self._fit_engine == "park": 
     
    721723            fitter_list.append(sim_fitter)  
    722724            is_single_fit = False 
     725             
    723726 
    724727        self.fitproblem_count = fitproblem_count   
     
    818821                                    page_id=list_page_id, 
    819822                                    completefn=self._batch_fit_complete, 
    820                                     ftol=self.ftol) 
     823                                    ftol=self.ftol, 
     824                                    reset_flag=self.batch_reset_flag) 
    821825        else: 
    822826            # single fit: not batch and not simul fit  
     
    10961100                        msg += "Data %s and Model %s did not fit.\n" % (data_name,  
    10971101                                                                        model_name) 
    1098                         #print msg 
     1102                        print msg 
    10991103                        wx.PostEvent(self.parent, StatusEvent(status=msg, 
    11001104                                                              error="error", 
     
    11561160                    flag = issubclass(data.__class__, Data2D) 
    11571161                    if not flag: 
    1158                         #print "Batch complete", len(res.theory), len(res.index) 
    11591162                        self._complete1D(x=data.x, y=res.theory, page_id=pid,  
    11601163                                         elapsed=None,  
     
    11631166                                         toggle_mode_on=False, state=None,  
    11641167                                         data=data, update_chisqr=False,  
    1165                                          source='model') 
     1168                                         source='fit') 
    11661169                    else: 
    11671170                        self._complete2D(image=data.data, data=data, 
     
    11731176                                          toggle_mode_on=False, state=None,  
    11741177                                         update_chisqr=False,  
    1175                                          source='model') 
     1178                                         source='fit') 
    11761179                         
    11771180                    self.on_set_batch_result(page_id=pid,  
     
    12041207        cell.label = data.name 
    12051208        cell.value = index 
    1206         theory_data.id = wx.NewId() 
    1207         theory_data.name = data.name + "[%s]" % str(model.__class__.__name__) 
     1209        theory_data.id = str(page_id) + "model" 
     1210        theory_data.name =  model.name + "[%s]" % str(model.__class__.__name__) 
    12081211        cell.object = [data, theory_data] 
    12091212        batch_outputs["Data"].append(cell) 
     
    12331236        :param elapsed: time spent at the fitting level 
    12341237        """ 
     1238       # reset fit_engine if changed by simul_fit 
     1239        self._on_change_engine(self._gui_engine) 
    12351240        result = result[0] 
    12361241        self.fit_thread_list = {} 
     
    14501455            caption = current_pg.window_caption 
    14511456            self.page_finder[page_id].set_fit_tab_caption(caption=caption) 
    1452             
     1457            new_plot.id =  str(page_id) + "model" 
    14531458            self.page_finder[page_id].set_theory_data(data=new_plot,  
    14541459                                                      fid=data.id) 
  • fittingview/src/sans/perspectives/fitting/simfitpage.py

    r1153d0e r7db52f1  
    622622        self.btFit.SetToolTipString("Perform fit.") 
    623623         
    624         text= "Hint: Park fitting engine will be selected automatically. \n" 
     624        text= "Hint: Park fitting engine will be used automatically. \n" 
    625625        #text+= "automatically for more than 2 combinations checked" 
    626626        text_hint = wx.StaticText(self,-1,text) 
Note: See TracChangeset for help on using the changeset viewer.