Changeset 07a93a1 in sasview for sansview/perspectives


Ignore:
Timestamp:
Mar 5, 2009 10:10:36 PM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
1fbb343
Parents:
12aa9b5
Message:

sansview: fixed problem with switching back and forth between dispersity and no dispersity

Location:
sansview/perspectives/fitting
Files:
2 edited

Legend:

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

    rc77f72c r07a93a1  
    1313 
    1414 
    15  
     15#TODO: FitPage1D inherits from ModelPage but doesn't call its __init__ method! 
     16#TODO: refactor this class to have an __init__ that deals with data only, then calls a UI builder method. 
    1617class FitPage1D(ModelPage): 
    1718    """ 
     
    4041        #fit page manager  
    4142        self.manager = None 
     43         
     44         
     45        # Should not have to write the following line if the inheritance 
     46        # was coded properly... 
     47        #TODO: get rid of this line once the class is refactored 
     48        self._disp_obj_dict = {} 
     49         
     50         
    4251        #Store the parent of this panel parent 
    4352        # For this application fitpanel is the parent 
  • sansview/perspectives/fitting/modelpage.py

    r047ed70 r07a93a1  
    3737        # Data member to store the dispersion object created 
    3838        self._disp_obj_dict = {} 
    39         self.back_up_model= model.clone() 
    4039        #list of dispersion paramaters 
    4140        self.disp_list=[] 
     
    279278 
    280279    def Set_DipersParam(self, event): 
     280        """ 
     281            This method is called when the user changes the state  
     282            of the "dispersity" radio buttons. 
     283             
     284            #TODO: correct the spelling mistake in the name of this method, start name with lowercase. 
     285        """ 
    281286        if self.enable_disp.GetValue(): 
     287            # The user selected to use dispersion/averaging 
    282288            if len(self.disp_list)==0: 
     289                # This model contains no parameter to which we can apply dispersion/averaging 
    283290                ix=0 
    284291                iy=1 
     
    294301                return  
    295302            else: 
    296                 if self.data !=None and self.model !=None: # allow to recognize data panel from model panel 
    297                      
    298                  
    299                     self.cb1.SetValue(False) 
    300                     self.select_all_param_helper() 
    301                  
     303                # Show the default dispersion/averaging sub-panel 
    302304                self.populate_disp_box() 
    303305                self.set_panel_dispers(self.disp_list) 
    304306                 
    305307        else: 
    306             if self.data !=None and self.model!=None: 
    307                 if self.cb1.GetValue(): 
    308                     self.select_all_param_helper() 
    309              
    310             if self.back_up_model!=None: 
    311                 keys = self.back_up_model.getDispParamList() 
    312                 keys.sort() 
    313                 #disperse param into the initial state 
    314                 for item in keys: 
    315                     value= self.back_up_model.getParam(item) 
    316                     self.model.setParam(item, value) 
    317                 self._draw_model()  
    318              
     308            # The user selected not to use dispersion/averaging             
     309            # Make sure all parameters have the default Gaussian 
     310            # dispersion object with only a single point (no dispersion). 
     311            for p in self.model.dispersion.keys(): 
     312                disp_model = GaussianDispersion() 
     313                 
     314                # Store the object to make it persist outside the scope of this method 
     315                #TODO: refactor model to clean this up? 
     316                self._disp_obj_dict[p] = disp_model 
     317                     
     318                # Set the new model as the dispersion object for the selected parameter 
     319                self.model.set_dispersion(p, disp_model) 
     320                     
     321            # Redraw the model 
     322            self._draw_model() 
    319323                 
    320324            self.fittable_param=[]         
Note: See TracChangeset for help on using the changeset viewer.