Changeset bdb27e6 in sasview for sansview/perspectives


Ignore:
Timestamp:
Mar 7, 2009 6:56:50 AM (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:
aae8d23
Parents:
fbc3e04
Message:

sansview: fixed problem with switching back to a Gaussian dispersity model after have used an ArrayDispersion? model (the dispersion model were not properly set to Gaussian before filling the form, which left the form blank).

File:
1 edited

Legend:

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

    rfbc3e04 rbdb27e6  
    231231        self.Layout() 
    232232        self.parent.GetSizer().Layout() 
     233         
     234    def _set_dispersion(self, par, disp_model): 
     235        """ 
     236            Utility method to set a dispersion model while making 
     237            sure that the dispersion model object doesn't go out 
     238            of scope. The models should be cleaned up so we don't 
     239            have to do this. 
     240        """ 
     241        # Store the object to make it persist outside the scope of this method 
     242        #TODO: refactor model to clean this up? 
     243        self._disp_obj_dict[par] = disp_model 
     244                     
     245        # Set the new model as the dispersion object for the selected parameter 
     246        self.model.set_dispersion(par, disp_model) 
     247         
    233248    def set_model_description(self, model): 
    234249         
     
    314329            for p in self.model.dispersion.keys(): 
    315330                disp_model = GaussianDispersion() 
    316                  
    317                 # Store the object to make it persist outside the scope of this method 
    318                 #TODO: refactor model to clean this up? 
    319                 self._disp_obj_dict[p] = disp_model 
    320                      
    321                 # Set the new model as the dispersion object for the selected parameter 
    322                 self.model.set_dispersion(p, disp_model) 
     331                self._set_dispersion(p, disp_model) 
    323332                     
    324333            # Redraw the model 
     
    693702                    disp_model = ArrayDispersion() 
    694703                    disp_model.set_weights(values, weights) 
    695                     # Store the object to make it persist outside the scope of this method 
    696                     #TODO: refactor model to clean this up? 
    697                     self._disp_obj_dict[p] = disp_model 
    698                      
    699                     # Set the new model as the dispersion object for the selected parameter 
    700                     self.model.set_dispersion(p, disp_model) 
    701                      
     704                    self._set_dispersion(p, disp_model) 
    702705                     
    703706                    # Redraw the model 
     
    707710                    # The parameter was un-selected. Go back to Gaussian model (with 0 pts) 
    708711                    disp_model = GaussianDispersion() 
    709                     # Store the object to make it persist outside the scope of this method 
    710                     #TODO: refactor model to clean this up? 
    711                     self._disp_obj_dict[p] = disp_model 
    712                      
    713                     # Set the new model as the dispersion object for the selected parameter 
    714                     self.model.set_dispersion(p, disp_model) 
     712                    self._set_dispersion(p, disp_model) 
    715713                     
    716714                    # Redraw the model 
     
    731729        iy=1 
    732730                ### this will become a separate method 
     731        #TODO: don't hard code text values to be shown on the interface 
    733732        if type== "Select customized Model": 
    734733            ix=0 
     
    784783                name3=item+".nsigmas" 
    785784                iy += 1 
     785                 
     786                # Make sure the dispersion model is Gaussian 
     787                if not self.model.dispersion[item]['type'] == 'gaussian':  
     788                    disp_model = GaussianDispersion() 
     789                    self._set_dispersion(item, disp_model) 
     790                 
     791                # Create the interface 
    786792                for p in self.model.dispersion[item].keys(): 
    787793                    #print "name 1 2 3", name1, name2, name3 
Note: See TracChangeset for help on using the changeset viewer.