Changeset 9853ad0 in sasview for sansview/perspectives
- Timestamp:
- Mar 31, 2009 9:50:18 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:
- 59a7f2d
- Parents:
- a68efd1
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r00c3aac r9853ad0 653 653 self._populate_box( self.formfactorbox, 654 654 self.model_list_box["Added models"]) 655 656 657 if self.multip_cb.GetValue(): 655 if not self.multip_cb.GetValue(): 656 model = self.formfactorbox.GetClientData(0) 657 self.model = model() 658 659 else: 658 660 ## multplication not available for structure factor 659 661 if self.struct_rbutton.GetValue(): … … 664 666 self.structurebox.Show(True) 665 667 self.text2.Show(True) 666 ## draw empty model 667 from sans.models.NullModel import NullModel 668 self.model = NullModel() 669 self.model.name = "Select P(Q) and S(Q)" 670 self.set_model_param_sizer(self.model) 671 self.sizer4_4.Clear() 672 self.sizer4.Layout() 673 self._draw_model() 674 668 ## draw multplication model 669 form_factor = self.formfactorbox.GetClientData(0) 670 struct_factor = self.structurebox.GetClientData(0) 671 672 from sans.models.MultiplicationModel import MultiplicationModel 673 self.model= MultiplicationModel(form_factor(),struct_factor()) 674 675 self.set_model_param_sizer(self.model) 676 self.sizer4_4.Clear() 677 self.sizer4.Layout() 678 679 self._draw_model() 675 680 self.set_scroll() 676 681 … … 691 696 name = model.name 692 697 combobox.Append(name,models) 693 698 try: 699 combobox.SetSelection(0) 700 except: 701 pass 694 702 wx.EVT_COMBOBOX(combobox,-1, self._on_select_model) 695 703 return 0 … … 706 714 707 715 if self.multip_cb.GetValue(): 708 if struct_factor != None and form_factor != None: 709 from sans.models.MultiplicationModel import MultiplicationModel 710 self.model= MultiplicationModel(form_factor(),struct_factor()) 711 else: 712 from sans.models.NullModel import NullModel 713 self.model = NullModel() 714 self.model.name = "Select P(Q) and S(Q)" 715 msg= "select one P(Q) and one S(Q) to plot" 716 wx.PostEvent(self.parent.parent, StatusEvent(status= msg)) 716 from sans.models.MultiplicationModel import MultiplicationModel 717 self.model= MultiplicationModel(form_factor(),struct_factor()) 718 717 719 else: 718 if form_factor != None: 719 self.model= form_factor() 720 self.model= form_factor() 720 721 721 722 … … 753 754 is_modified = True 754 755 except: 755 msg= "Model Drawing Error:wrong value entered : %s"% sys.exc_value 756 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 757 return 756 raise 757 #msg= "Model Drawing Error:wrong value entered : %s"% sys.exc_value 758 #wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 759 #return 758 760 759 761 return is_modified -
sansview/perspectives/fitting/fitpanel.py
rc9a4377 r9853ad0 61 61 close page and remove all references to the closed page 62 62 """ 63 page_info=self.get_current_page().page_info.clone() 64 page_info.page_name= self.get_current_page().page_info.page_name 65 66 self.manager._add_page_onmenu(page_info.page_name, page_info) 63 page_info = self.get_current_page().page_info.clone() 64 page_info.page_name = self.get_current_page().page_info.page_name 65 page_finder = self.manager.get_page_finder() 66 fitproblem = None 67 68 if self.get_current_page() in page_finder: 69 fitproblem= page_finder[self.get_current_page()] 70 71 self.manager._add_page_onmenu(page_info.page_name, page_info, fitproblem) 67 72 68 73 selected_page = self.GetPage(self.GetSelection()) 69 74 page_number = self.GetSelection() 75 70 76 if self.sim_page != selected_page and selected_page!=self.about_page: 71 #remove that page from page_finder of fitting module72 page_finder=self.manager.get_page_finder()73 for page, value in page_finder.iteritems():74 if page==selected_page:75 del page_finder[page]76 break77 77 # remove the check box link to the model name of this page (selected_page) 78 78 if self.sim_page !=None : … … 86 86 self.draw_model_name=None 87 87 self.model_page=None 88 88 89 if page_number == 1: 89 90 self.model_page=None … … 170 171 return None 171 172 172 def _help_add_model_page(self,model,page_title, qmin=0, qmax=0.1, npts=50): 173 """ 174 #TODO: fill in description 175 173 174 def add_model_page(self,model,page_title, qmin=0, qmax=0.1, npts=50, topmenu=False): 175 """ 176 Add a model page only one to display any model selected from the menu or the page combo box. 177 when this page is closed than the user will be able to open a new one 178 179 @param model: the model for which paramters will be changed 180 @param page_title: the name of the page 181 @param page_title: [Coder: fill your description!] 176 182 @param qmin: mimimum Q 177 183 @param qmax: maximum Q 178 184 @param npts: number of Q points 179 185 """ 186 if topmenu==True: 187 if self.draw_model_name ==None: 188 self._help_add_model_page(model,page_title, qmin=qmin, qmax=qmax, npts=npts) 189 else: 190 self.model_page.select_model(model, page_title) 191 else: 192 self._create_model_page(model,page_title, qmin=qmin, qmax=qmax, npts=npts) 193 194 def _help_add_model_page(self,model,page_title, qmin=0, qmax=0.1, npts=50): 195 """ 196 #TODO: fill in description 197 198 @param qmin: mimimum Q 199 @param qmax: maximum Q 200 @param npts: number of Q points 201 """ 202 self._create_model_page(model,page_title,qmin=qmin, qmax=qmax, npts=npts) 203 # We just created a model page, we are ready to plot the model 204 #self.manager.draw_model(model, model.name) 205 #FOR PLUGIN for some reason model.name is = BASEcomponent 206 self.manager.draw_model(model) 207 208 def _create_model_page(self,model,page_title, qmin, qmax, npts): 209 """ 210 adding model page occurs here 211 """ 212 180 213 ## storing page info 181 214 from pageInfo import PageInfo … … 201 234 self.model_page.set_range(qmin, qmax, npts) 202 235 203 # We just created a model page, we are ready to plot the model 204 #self.manager.draw_model(model, model.name) 205 #FOR PLUGIN for some reason model.name is = BASEcomponent 206 self.manager.draw_model(model) 207 208 209 210 def add_model_page(self,model,page_title, qmin=0, qmax=0.1, npts=50, topmenu=False): 211 """ 212 Add a model page only one to display any model selected from the menu or the page combo box. 213 when this page is closed than the user will be able to open a new one 214 215 @param model: the model for which paramters will be changed 216 @param page_title: the name of the page 217 @param page_title: [Coder: fill your description!] 218 @param qmin: mimimum Q 219 @param qmax: maximum Q 220 @param npts: number of Q points 221 """ 222 if topmenu==True: 223 if self.draw_model_name ==None: 224 self._help_add_model_page(model,page_title, qmin=qmin, qmax=qmax, npts=npts) 225 else: 226 self.model_page.select_model(model, page_title) 227 228 236 229 237 230 238 -
sansview/perspectives/fitting/fitproblem.py
r2140e68 r9853ad0 29 29 self.qmin = None 30 30 self.qmax = None 31 32 def clone(self): 33 """ 34 copy fitproblem 35 """ 36 import copy 37 obj = FitProblem( self.parent,model= model ) 38 obj.fit_data = copy.deepcopy(self.fit_data) 39 obj.model = copy.deepcopy(self.model) 40 obj.schedule = copy.deepcopy(self.schedule) 41 obj.list_param = copy.deepcopy(self.list_param) 42 obj.smearer = copy.deepcopy(self.smearer) 43 obj.plotted_data = copy.deepcopy(self.plotted_data) 44 obj.qmin = copy.deepcopy(self.qmin) 45 obj.qmax = copy.deepcopy(self.qmax) 46 47 return obj 31 48 32 49 -
sansview/perspectives/fitting/fitting.py
rc9a4377 r9853ad0 446 446 447 447 448 def _add_page_onmenu(self, name, page_info ):448 def _add_page_onmenu(self, name, page_info,fitproblem=None): 449 449 """ 450 450 Add name of a closed page of fitpanel in a menu … … 454 454 self.menu1.Append(event_id, name, 455 455 "Show %s fit panel" % name) 456 self.closed_page_dict[event_id ]= page_info456 self.closed_page_dict[event_id ]= [page_info, fitproblem] 457 457 wx.EVT_MENU(self.parent,event_id, self._open_closed_page) 458 458 … … 463 463 """ 464 464 if event.GetId() in self.closed_page_dict.keys(): 465 page_info = self.closed_page_dict[ event.GetId() ]465 page_info,fitproblem = self.closed_page_dict[ event.GetId() ] 466 466 if page_info.page_name !="Model Page": 467 467 page = self.fit_panel.add_fit_page(page_info.data) 468 if fitproblem != None: 469 self.page_finder[page]=fitproblem 468 470 else: 469 471 model= page_info.model 470 self.fit_panel.add_model_page(model,model.name,topmenu= True)472 self.fit_panel.add_model_page(model,model.name,topmenu=False) 471 473 472 474 def _reset_schedule_problem(self, value=0):
Note: See TracChangeset
for help on using the changeset viewer.