Changeset 6d91073 in sasview for sansview


Ignore:
Timestamp:
Nov 6, 2009 10:32:20 AM (15 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:
f9de20e
Parents:
7a77859
Message:

fixed dipspersion errors displaying wrong values

Location:
sansview/perspectives/fitting
Files:
3 edited

Legend:

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

    rc99a6c5 r6d91073  
    113113        #wx.EVT_MENU(self, id, self.onRedo)        
    114114        #self.popUpMenu.AppendSeparator() 
    115         if sys.platform.count("win32")>0:         
    116             id = wx.NewId() 
    117             self._keep = wx.MenuItem(self.popUpMenu,id,"BookMark"," Keep the panel status to recall it later") 
    118             self.popUpMenu.AppendItem(self._keep) 
    119             self._keep.Enable(True) 
    120             wx.EVT_MENU(self, id, self.onSave) 
    121             self.popUpMenu.AppendSeparator() 
    122          
     115        #if sys.platform.count("win32")>0:         
     116        id = wx.NewId() 
     117        self._keep = wx.MenuItem(self.popUpMenu,id,"BookMark"," Keep the panel status to recall it later") 
     118        self.popUpMenu.AppendItem(self._keep) 
     119        self._keep.Enable(True) 
     120        wx.EVT_MENU(self, id, self.onSave) 
     121        self.popUpMenu.AppendSeparator() 
     122     
    123123        ## Default locations 
    124124        self._default_save_location = os.getcwd()      
     
    15811581        self.sizer4.Layout() 
    15821582        self.Layout() 
    1583         self.Refresh() 
    1584         self.SetScrollbars(20,20,25,65)        
     1583        #self.Refresh() 
     1584        #self.SetScrollbars(20,20,25,65)        
    15851585           
    15861586         
  • sansview/perspectives/fitting/fitpage.py

    rc99a6c5 r6d91073  
    8282        if event.type =="park": 
    8383            self.btFit.SetLabel("Fit") 
    84              
     84 
    8585        for item in self.parameters: 
    8686            if event.type =="scipy" : 
     
    136136                    item[5].Show(True) 
    137137                    item[6].Show(True) 
    138       
    139         self.SetScrollbars(20,20,25,65) 
     138        self.Layout() 
     139 
    140140         
    141141     
     
    835835            raise ValueError,"missing parameter to fit"     
    836836       
    837     def onsetValues(self,chisqr, out,cov): 
     837    def onsetValues(self,chisqr,p_name, out,cov): 
    838838        """ 
    839839            Build the panel from the fit result 
    840840            @param chisqr:Value of the goodness of fit metric 
     841            @p_name: the name of parameters 
    841842            @param out:list of parameter with the best value found during fitting 
    842843            @param cov:Covariance matrix 
     
    859860        #set the panel when fit result are float not list 
    860861        if out.__class__== numpy.float64: 
     862            print "float64" 
    861863            self.param_toFit[0][2].SetValue(format_number(out)) 
    862864            self.param_toFit[0][2].Refresh() 
     
    916918                        pass                    
    917919                    for j in range(len(out)): 
    918                         if out[j]==self.model.getParam(item[1]): 
    919                              
     920                         
     921                        if item[1] == p_name[j]: 
    920922                            break 
    921923                        ## unable to compare cov[j]==numpy.nan so switch to None 
    922924                    #Save errors to model.details[item][3] 
    923                     self.model.details[item[1]][3] = cov[i] 
    924                                         
    925                      
    926                     if cov[i]==None or not numpy.isfinite(cov[i]): 
     925                    self.model.details[item[1]][3] = cov[j] 
     926                                                            
     927                    if cov[j]==None or not numpy.isfinite(cov[j]): 
    927928 
    928929                        if item[3].IsShown: 
     
    930931                        if item[4].IsShown: 
    931932                            item[4].Hide()            
    932                         #k += 1 
    933      
     933                        #k += 1    
    934934 
    935935                    else: 
     
    938938                        item[3].Refresh() 
    939939                        item[4].Show(True) 
    940                         item[4].SetValue(format_number(cov[i])) 
     940                        item[4].SetValue(format_number(cov[j])) 
    941941                        item[4].Refresh() 
    942942                     
  • sansview/perspectives/fitting/fitting.py

    r7a77859 r6d91073  
    357357        if string.find(item,".")!=-1: 
    358358            param_names= re.split("\.",item) 
    359             model_name=param_names[0] 
    360             param_name=param_names[1]   
     359            model_name=param_names[0]            
     360            ##Assume max len is 3; eg., M0.radius.width 
     361            if len(param_names) == 3: 
     362                param_name=param_names[1]+"."+param_names[2] 
     363            else: 
     364                param_name=param_names[1]                     
    361365            return model_name,param_name 
    362366         
     
    755759                    model= value.get_model() 
    756760                    break 
     761            param_name = [] 
    757762            i = 0 
    758763            for name in pars: 
     764                param_name.append(name) 
    759765                if result.pvec.__class__==numpy.float64: 
    760766                    model.setParam(name,result.pvec) 
     
    763769                    i += 1 
    764770            ## Reset values of the current page to fit result 
    765             cpage.onsetValues(result.fitness, result.pvec,result.stderr) 
     771            cpage.onsetValues(result.fitness,param_name, result.pvec,result.stderr) 
    766772            ## plot the current model with new param 
    767773            metadata =  self.page_finder[cpage].get_fit_data() 
     
    804810                    model = value.get_model() 
    805811                    metadata =  value.get_plotted_data() 
     812                    small_param_name = [] 
    806813                    small_out = [] 
    807814                    small_cov = [] 
     
    815822                                small_out.append(p.value ) 
    816823                                model.setParam(param_name,p.value)  
    817                                
     824                                small_param_name.append(param_name) 
    818825                                small_cov.append(p.stderr) 
    819826                            else: 
    820827                                value= model.getParam(param_name) 
    821828                                small_out.append(value ) 
     829                                small_param_name.append(param_name) 
    822830                                small_cov.append(None) 
    823831                    # Display result on each page  
    824                     page.onsetValues(result.fitness, small_out,small_cov) 
     832                    page.onsetValues(result.fitness, small_param_name,small_out,small_cov) 
    825833                    #Replot models 
    826834                    msg= "Simultaneous Fit completed. plotting... %s:"%model.name 
Note: See TracChangeset for help on using the changeset viewer.