Changeset 060b857 in sasview
- Timestamp:
- Sep 8, 2008 10:14:08 AM (16 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:
- bee885e
- Parents:
- c8c5b9a
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpanel.py
r1b07935d r060b857 50 50 # save the title of the last page tab added 51 51 self.fit_page_name=None 52 self.draw_model_name=[] 52 self.draw_model_name=None 53 self.page_name="Model View" 53 54 self.nb.Update() 54 55 self.SetSizer(self.sizer) … … 90 91 return panel 91 92 def add_model_page(self,model,page_title): 92 if not page_title in self.draw_model_name: 93 print "fitpanel: self.draw_model_name",self.draw_model_name 94 if page_title !=self.draw_model_name or self.draw_model_name ==None: 95 print "went here" 93 96 from modelpage import ModelPage 94 97 panel = ModelPage(self.nb,model, -1) … … 97 100 self.nb.AddPage(page=panel,text=page_title,select=True) 98 101 panel.populate_box( self.model_list_box) 99 self.draw_model_name.append(page_title) 102 self.draw_model_name=page_title 103 else: 104 print "fitpanel: a page was added already " 105 for i in range(self.nb.GetPageCount()): 106 if self.nb.GetPageText(i)==self.page_name: 107 page=self.nb.GetPage(i) 108 page.set_page(model) 109 break 110 100 111 101 112 … … 147 158 del page_finder[page] 148 159 break 149 #delete the page from notebook 160 #Delete the page from notebook 161 page_number = self.nb.GetSelection() 162 if self.nb.GetPageText(page_number)== self.page_name: 163 self.draw_model_name=None 164 150 165 selected_page.Destroy() 151 self.nb.RemovePage( self.nb.GetSelection())166 self.nb.RemovePage(page_number) 152 167 self.name=None 153 168 -
sansview/perspectives/fitting/fitting.py
r1b07935d r060b857 234 234 self.plot_helper(currpage=current_pg,qmin=qmin,qmax=qmax) 235 235 except: 236 wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value)) 236 raise 237 wx.PostEvent(self.parent, StatusEvent(status="Fitting error: %s" % sys.exc_value)) 237 238 238 239 … … 352 353 #print "fitting: pars",pars 353 354 pars.sort() 354 355 self.fitter.set_model( model,model.name, self.id, pars)355 print "fitting: model ",model.__class__.__name__ 356 self.fitter.set_model(Model(model),model.name, self.id, pars) 356 357 self.fitter.set_data(data,self.id,qmin,qmax) 357 358 #Do the fit SCIPY … … 543 544 Plot a theory from a model selected from the menu 544 545 """ 546 print "_on_model_menu done" 545 547 #name = evt.model.__class__.__name__ 546 548 name="Model View" -
sansview/perspectives/fitting/modelpage.py
r1b07935d r060b857 49 49 #panel interface 50 50 self.vbox = wx.BoxSizer(wx.VERTICAL) 51 52 51 self.sizer3 = wx.GridBagSizer(5,5) 53 52 self.sizer2 = wx.GridBagSizer(5,5) 54 55 53 self.modelbox = wx.ComboBox(self, -1) 56 54 id = wx.NewId() 57 58 55 self.vbox.Add(self.sizer3) 59 56 self.vbox.Add(self.sizer2) 60 61 57 ix = 0 62 58 iy = 1 63 64 59 self.sizer3.Add(wx.StaticText(self,-1,'Model'),(iy,ix),(1,1)\ 65 60 , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 66 61 ix += 1 67 62 self.sizer3.Add(self.modelbox,(iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 68 69 63 # contains link between model ,all its parameters, and panel organization 70 64 self.parameters=[] … … 79 73 # flag to check if the user has selected a new model in the combox box 80 74 self.model_hasChanged=False 81 82 75 #dictionary of model name and model class 83 76 self.model_list_box={} 84 77 # Data1D to make a deep comparison between 2 Data1D for checking data 85 78 #change 86 87 79 self.vbox.Layout() 88 80 self.vbox.Fit(self) … … 124 116 wx.EVT_COMBOBOX(self.modelbox,-1, self._on_select_model) 125 117 return 0 126 127 118 119 def set_page(self, model): 120 print " modelpage: set_page was called",model 121 self.model=model 122 if hasattr(self.model, "name"): 123 name = self.model.name 124 else: 125 name = self.model.__class__.__name__ 126 self.modelbox.SetValue(name) 127 self.set_panel(self.model) 128 self.manager.draw_model(self.model) 128 129 def _on_select_model(self,event): 129 130 """ … … 191 192 iy = 1 192 193 ix = 0 194 193 195 self.cb1 = wx.StaticText(self, -1,'Parameters') 194 196 self.sizer2.Add(self.cb1,(iy, ix),(1,1),\ … … 246 248 for item in self.parameters: 247 249 try: 248 name=str(item[0] )250 name=str(item[0].GetLabelText()) 249 251 value= float(item[1].GetValue()) 250 252 print "modelpage: name. value",name , value 251 253 self.model.setParam(name,value) 252 254 self.manager.draw_model(self.model) -
sansview/perspectives/fitting/models.py
rd89f09b r060b857 4 4 5 5 (ModelEvent, EVT_MODEL) = wx.lib.newevent.NewEvent() 6 6 7 7 8
Note: See TracChangeset
for help on using the changeset viewer.