Changeset 53fc5ad9 in sasview


Ignore:
Timestamp:
Oct 13, 2011 4:00:42 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:
3576dd0
Parents:
7124300
Message:

fixed simul fit page constraint sizer bug and raise error in park_fit

Files:
2 edited

Legend:

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

    r1aa6145 r53fc5ad9  
    6969        ## number of constraint 
    7070        self.nb_constraint= 0 
     71        self.model_cbox_left = None 
     72        self.model_cbox_right = None 
    7173        self.uid = wx.NewId() 
    7274        ## draw page 
     
    187189            self._store_model() 
    188190            ## display constraint fields 
    189             if self.show_constraint.GetValue(): 
     191            if self.show_constraint.GetValue() and\ 
     192                             len(self.constraints_list)==0: 
    190193                self._show_all_constraint()  
    191194                self._show_constraint() 
    192                 return 
    193195        else: 
    194196            for item in self.model_list: 
     
    198200            ##constraint info 
    199201            self._hide_constraint() 
     202             
     203        self._update_easy_setup_cb() 
    200204         
    201205    def check_model_name(self,event): 
     
    204208        """ 
    205209        self.model_toFit=[] 
     210        cbox = event.GetEventObject() 
    206211        for item in self.model_list: 
    207212            if item[0].GetValue()==True: 
     
    213218         
    214219        ## display constraint fields 
    215         if len(self.model_toFit)==1: 
     220        if len(self.model_toFit)>=1: 
    216221            self._store_model() 
    217222            if self.show_constraint.GetValue() and\ 
     
    219224                self._show_all_constraint()  
    220225                self._show_constraint() 
     226 
    221227        elif len(self.model_toFit)< 1: 
    222228            ##constraint info 
    223             self._hide_constraint()               
    224         
     229            self._hide_constraint()   
     230                         
     231        self._update_easy_setup_cb() 
    225232        ## set the value of the main check button           
    226233        if len(self.model_list)==len(self.model_toFit): 
     
    229236        else: 
    230237            self.cb1.SetValue(False) 
     238             
     239    def _update_easy_setup_cb(self):    
     240        """ 
     241        Update easy setup combobox on selecting a model 
     242        """ 
     243        if self.model_cbox_left != None and self.model_cbox_right != None: 
     244            self.model_cbox_left.Clear() 
     245            self.model_cbox_right.Clear() 
     246            #for id, model in self.constraint_dict.iteritems(): 
     247            for item in self.model_toFit: 
     248                model = item[3] 
     249                ## check if all parameters have been selected for constraint 
     250                ## then do not allow add constraint on parameters 
     251                if str(model.name) not in self.model_cbox_left.GetItems(): 
     252                    self.model_cbox_left.Append(str(model.name), model) 
     253                if str(model.name) not in self.model_cbox_right.GetItems(): 
     254                    self.model_cbox_right.Append(str(model.name), model) 
     255            self.model_cbox_left.SetSelection(0) 
     256            self.sizer2.Layout() 
     257            self.sizer3.Layout() 
    231258         
    232259    def draw_page(self):       
     
    522549            self.btAdd.Hide() 
    523550        self._store_model() 
     551        if self.model_cbox_left != None: 
     552            self.model_cbox_left.Clear() 
     553            self.model_cbox_left = None 
     554        if self.model_cbox_right != None: 
     555            self.model_cbox_right.Clear() 
     556            self.model_cbox_right = None 
    524557        self.constraints_list = []    
    525558        self.sizer_all_constraints.Clear(True)  
     
    535568        fill combox box with list of parameters 
    536569        """ 
     570        param_list = [] 
    537571        ##This way PC/MAC both work, instead of using event.GetClientData(). 
    538572        n = self.model_cbox.GetCurrentSelection() 
     
    541575            if model == dic_model: 
    542576                param_list = self.page_finder[id].get_param2fit() 
    543                 break 
     577                #break 
    544578        #param_list= get_fittableParam(model) 
    545579        length = len(self.constraints_list) 
     
    551585        for param in param_list: 
    552586            param_cbox.Append( str(param), model) 
    553              
     587 
    554588        param_cbox.Show(True) 
    555589        self.btRemove.Show(True) 
     
    770804                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
    771805        for id, value in self.page_finder.iteritems(): 
     806            if id not in self.parent.opened_pages: 
     807                continue 
    772808            try: 
    773809                ix = 0 
  • park_integration/src/sans/fit/ParkFitting.py

    r5d0a786 r53fc5ad9  
    121121        This procedure maps a local optimizer across a set of initial points. 
    122122        """ 
    123         park.fitmc.fitmc(objective, x0, bounds, self.localfit, 
    124               self.start_points, self.handler) 
    125  
     123        try: 
     124            park.fitmc.fitmc(objective, x0, bounds, self.localfit, 
     125                             self.start_points, self.handler) 
     126        except: 
     127            raise ValueError, "Fit did not converge.\n" 
    126128         
    127129class SansPart(Part): 
Note: See TracChangeset for help on using the changeset viewer.