- Timestamp:
- Jan 22, 2009 6:44:45 PM (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:
- fcd8a80e
- Parents:
- fd57185
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage1D.py
r89032bf r32d802f 67 67 self.smearer_box.SetValue(str(None)) 68 68 self.smearer_box.Insert(str(None),i) 69 69 70 for k,v in self.smeares.iteritems(): 70 self.smearer_box.Insert(str(v),i) 71 if str(v)=="GaussianModel": 72 self.smearer_box.Insert("Gaussian Resolution",i) 73 else: 74 self.smearer_box.Insert(str(v),i) 71 75 i+=1 72 76 self.modelbox = wx.ComboBox(self, -1) … … 99 103 ix = 0 100 104 iy += 1 101 self.sizer3.Add(wx.StaticText(self,-1,' Averaging (Smearer Type)'),(iy,ix),(1,1)\105 self.sizer3.Add(wx.StaticText(self,-1,'Instrument Smearing'),(iy,ix),(1,1)\ 102 106 , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 103 107 ix += 1 … … 344 348 disp_list=self.model.getDispParamList() 345 349 fixed=self.model.fixed 346 print "fixed"350 #print "fixed" 347 351 ip=0 348 352 iq=1 … … 360 364 iy = 1 361 365 ix = 0 362 self.cb1 = wx.CheckBox(self, -1, 'Parameters', (10, 10))366 self.cb1 = wx.CheckBox(self, -1,"Select all", (10, 10)) 363 367 wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) 364 368 self.sizer2.Add(self.cb1,(iy, ix),(1,1),\ … … 378 382 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 379 383 self.text2_4.Hide() 380 print "keys", keys381 print "disp_list", disp_list382 print "fix_list",fixed384 #print "keys", keys 385 #print "disp_list", disp_list 386 #print "fix_list",fixed 383 387 for item in keys: 384 388 if not item in disp_list: … … 506 510 name=str(item[0]) 507 511 value= float(item[1].GetValue()) 508 print "model para", name,value512 # print "model para", name,value 509 513 # If the value of the parameter has changed, 510 514 # update the model and set the is_modified flag … … 517 521 518 522 for item in self.parameters: 519 print "paramters",str(item[0].GetLabelText())523 # print "paramters",str(item[0].GetLabelText()) 520 524 try: 521 525 name=str(item[0].GetLabelText()) 522 526 value= float(item[1].GetValue()) 523 print "model para", name,value527 # print "model para", name,value 524 528 # If the value of the parameter has changed, 525 529 # update the model and set the is_modified flag … … 653 657 654 658 655 if event.GetString()=="Gaussian Model":659 if event.GetString()=="Gaussian Resolution": 656 660 from DataLoader.qsmearing import smear_selection 657 661 smear =smear_selection( self.data ) 658 662 self.manager.set_smearer(smear) 659 print "on smearing"660 663 # print "on smearing" 664 -
sansview/perspectives/fitting/fitpanel.py
r3dc83be r32d802f 127 127 128 128 # We just created a model page, we are ready to plot the model 129 self.manager.draw_model(model, model.name) 129 #self.manager.draw_model(model, model.name) 130 #FOR PLUGIN for somereason model.name is = BASEcomponent 131 self.manager.draw_model(model, page_title) 130 132 131 133 … … 146 148 self._help_add_model_page(model,description,page_title, qmin=qmin, qmax=qmax, npts=npts) 147 149 elif topmenu==True: 148 self.model_page.select_model(model )150 self.model_page.select_model(model, page_title) 149 151 150 152 def get_notebook(self): -
sansview/perspectives/fitting/fitting.py
r89032bf r32d802f 7 7 from danse.common.plottools.PlotPanel import PlotPanel 8 8 from sans.guicomm.events import NewPlotEvent, StatusEvent 9 from sans.guicomm.events import EVT_SLICER_PANEL 9 from sans.guicomm.events import EVT_SLICER_PANEL,EVT_MODEL2D_PANEL 10 10 11 11 from sans.fit.AbstractFitEngine import Model,Data,FitData1D,FitData2D … … 51 51 # Log startup 52 52 logging.info("Fitting plug-in started") 53 # model 2D view 54 self.model2D_id=None 53 55 54 56 def populate_menu(self, id, owner): … … 59 61 @ return : list of information to populate the main menu 60 62 """ 63 self.parent.Bind(EVT_MODEL2D_PANEL, self._on_model2D_show) 61 64 #Menu for fitting 62 65 self.menu1 = wx.Menu() … … 131 134 self.index_model = 0 132 135 self.parent.Bind(EVT_SLICER_PANEL, self._on_slicer_event) 136 133 137 #create the fitting panel 134 138 #return [self.fit_panel] … … 136 140 self.mypanels.append(self.fit_panel) 137 141 return self.mypanels 142 def _on_model2D_show(self, event ): 143 print "model2D get the id ", event.id 138 144 def _on_slicer_event(self, event): 139 145 print "fitting:slicer event ", event.panel … … 508 514 model = evt.model 509 515 name = evt.name 516 510 517 sim_page=self.fit_panel.get_page(0) 511 518 current_pg = self.fit_panel.get_current_page() … … 599 606 except: 600 607 wx.PostEvent(self.parent, StatusEvent(status="fitting \ 601 skipping point x %g %s" %(qmax, sys.exc_value))) 602 608 skipping point x %g %s" %(qmin, sys.exc_value)) ) 609 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, 610 title=str(data.name))) 603 611 else: 604 612 … … 644 652 theory.ymax= ymax 645 653 646 wx.PostEvent(self.parent, NewPlotEvent(plot=theory,654 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, 647 655 title=self.title +str(data.name))) 648 656 … … 655 663 if hasattr(evt.model, "name"): 656 664 name = evt.model.name 665 print "on model menu", name 657 666 model=evt.model() 658 667 description=model.description … … 693 702 try: 694 703 new_plot = Theory1D(x, y) 704 695 705 new_plot.name = name 696 706 new_plot.xaxis("\\rm{Q}", 'A^{-1}') … … 699 709 new_plot.group_id ="Model" 700 710 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="Analytical model 1D")) 701 702 711 except: 703 raise 712 wx.PostEvent(self.parent, StatusEvent(status="Draw model 1D error: %s" % sys.exc_value)) 713 #raise 704 714 else: 705 715 for i in range(xlen): … … 708 718 try: 709 719 new_plot = Theory1D(x, y) 720 print "draw model 1D", name 710 721 new_plot.name = name 711 722 new_plot.xaxis("\\rm{Q}", 'A^{-1}') … … 720 731 721 732 except: 722 raise 733 #raise 734 wx.PostEvent(self.parent, StatusEvent(status="Draw model 1D error: %s" % sys.exc_value)) 723 735 def update(self, output,time): 724 736 pass … … 757 769 print "model draw comptele xmax",theory.xmax,model.name 758 770 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, 759 title="Analytical model 2D " ))771 title="Analytical model 2D ", reset=True )) 760 772 761 773 … … 790 802 791 803 def show_panel2D(self, id=None ): 792 self.parent.show_panel( 147)804 self.parent.show_panel(self.model2D_id) 793 805 794 806 -
sansview/perspectives/fitting/modelpage.py
r89032bf r32d802f 236 236 return 0 237 237 238 def select_model(self, model ):238 def select_model(self, model, name): 239 239 """ 240 240 Select a new model … … 242 242 """ 243 243 self.model= model 244 print "select_model", model.__class__ 244 245 self.set_panel(model) 245 self._draw_model( )246 self._draw_model(name) 246 247 247 248 # Select the model from the combo box 248 249 items = self.modelbox.GetItems() 249 250 for i in range(len(items)): 250 if items[i]==model.__class__.__name__: 251 print "model name",items[i],model.name, model.__class__.__name__ 252 #if items[i]==model.__class__.__name__: 253 if items[i]==name: 251 254 self.modelbox.SetSelection(i) 252 255 … … 268 271 #self.manager.draw_model(model, name) 269 272 self.enable2D=False 270 self._draw_model( )273 self._draw_model(name) 271 274 272 275 … … 436 439 self._draw_model() 437 440 438 def _draw_model(self ):441 def _draw_model(self, name=None): 439 442 """ 440 443 Method to draw or refresh a plotted model. … … 444 447 [Note to coder: This way future changes will be done in only one place.] 445 448 """ 446 self.manager.draw_model(self.model, self.model.name, 449 if name==None: 450 name= self.model.name 451 self.manager.draw_model(self.model, name, 447 452 qmin=self.qmin, qmax=self.qmax, 448 453 qstep= self.num_points, 449 454 enable2D=self.enable2D) 455 """ 456 self.manager.draw_model(self.model, self.model.name, 457 qmin=self.qmin, qmax=self.qmax, 458 qstep= self.num_points, 459 enable2D=self.enable2D) 460 """ 450 461 451 462
Note: See TracChangeset
for help on using the changeset viewer.