Changeset 6d91073 in sasview for sansview/perspectives
- Timestamp:
- Nov 6, 2009 10:32:20 AM (15 years ago)
- 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
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
rc99a6c5 r6d91073 113 113 #wx.EVT_MENU(self, id, self.onRedo) 114 114 #self.popUpMenu.AppendSeparator() 115 if sys.platform.count("win32")>0:116 117 118 119 120 121 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 123 123 ## Default locations 124 124 self._default_save_location = os.getcwd() … … 1581 1581 self.sizer4.Layout() 1582 1582 self.Layout() 1583 self.Refresh()1584 self.SetScrollbars(20,20,25,65)1583 #self.Refresh() 1584 #self.SetScrollbars(20,20,25,65) 1585 1585 1586 1586 -
sansview/perspectives/fitting/fitpage.py
rc99a6c5 r6d91073 82 82 if event.type =="park": 83 83 self.btFit.SetLabel("Fit") 84 84 85 85 for item in self.parameters: 86 86 if event.type =="scipy" : … … 136 136 item[5].Show(True) 137 137 item[6].Show(True) 138 139 self.SetScrollbars(20,20,25,65) 138 self.Layout() 139 140 140 141 141 … … 835 835 raise ValueError,"missing parameter to fit" 836 836 837 def onsetValues(self,chisqr, out,cov):837 def onsetValues(self,chisqr,p_name, out,cov): 838 838 """ 839 839 Build the panel from the fit result 840 840 @param chisqr:Value of the goodness of fit metric 841 @p_name: the name of parameters 841 842 @param out:list of parameter with the best value found during fitting 842 843 @param cov:Covariance matrix … … 859 860 #set the panel when fit result are float not list 860 861 if out.__class__== numpy.float64: 862 print "float64" 861 863 self.param_toFit[0][2].SetValue(format_number(out)) 862 864 self.param_toFit[0][2].Refresh() … … 916 918 pass 917 919 for j in range(len(out)): 918 if out[j]==self.model.getParam(item[1]):919 920 921 if item[1] == p_name[j]: 920 922 break 921 923 ## unable to compare cov[j]==numpy.nan so switch to None 922 924 #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]): 927 928 928 929 if item[3].IsShown: … … 930 931 if item[4].IsShown: 931 932 item[4].Hide() 932 #k += 1 933 933 #k += 1 934 934 935 935 else: … … 938 938 item[3].Refresh() 939 939 item[4].Show(True) 940 item[4].SetValue(format_number(cov[ i]))940 item[4].SetValue(format_number(cov[j])) 941 941 item[4].Refresh() 942 942 -
sansview/perspectives/fitting/fitting.py
r7a77859 r6d91073 357 357 if string.find(item,".")!=-1: 358 358 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] 361 365 return model_name,param_name 362 366 … … 755 759 model= value.get_model() 756 760 break 761 param_name = [] 757 762 i = 0 758 763 for name in pars: 764 param_name.append(name) 759 765 if result.pvec.__class__==numpy.float64: 760 766 model.setParam(name,result.pvec) … … 763 769 i += 1 764 770 ## 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) 766 772 ## plot the current model with new param 767 773 metadata = self.page_finder[cpage].get_fit_data() … … 804 810 model = value.get_model() 805 811 metadata = value.get_plotted_data() 812 small_param_name = [] 806 813 small_out = [] 807 814 small_cov = [] … … 815 822 small_out.append(p.value ) 816 823 model.setParam(param_name,p.value) 817 824 small_param_name.append(param_name) 818 825 small_cov.append(p.stderr) 819 826 else: 820 827 value= model.getParam(param_name) 821 828 small_out.append(value ) 829 small_param_name.append(param_name) 822 830 small_cov.append(None) 823 831 # 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) 825 833 #Replot models 826 834 msg= "Simultaneous Fit completed. plotting... %s:"%model.name
Note: See TracChangeset
for help on using the changeset viewer.