Changeset b2c3225 in sasview
- Timestamp:
- Dec 11, 2008 4:02:55 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:
- 2d107b8
- Parents:
- 768656e
- Location:
- sansview
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpanel.py
rb5847bd8 rb2c3225 104 104 """ 105 105 if page_title !=self.draw_model_name or self.draw_model_name ==None: 106 self.onClose() 106 107 from modelpage import ModelPage 107 108 panel = ModelPage(self.nb,model, -1) -
sansview/perspectives/fitting/fitting.py
rb710eb7 rb2c3225 36 36 ## Fit engine 37 37 self._fit_engine = 'scipy' 38 self.enable_model2D=False 38 39 # Log startup 39 40 logging.info("Fitting plug-in started") … … 57 58 #menu for model 58 59 menu2 = wx.Menu() 60 id4 = wx.NewId() 61 menu2.AppendCheckItem(id4, "model view 2D") 62 wx.EVT_MENU(owner, id4, self.on_draw_model2D) 63 59 64 self.menu_mng.populate_menu(menu2, owner) 60 65 id2 = wx.NewId() … … 570 575 Plot a theory from a model selected from the menu 571 576 """ 577 578 model=evt.model() 572 579 name="Model View" 573 model=evt.model() 574 580 print "mon menu",model.name 575 581 description=model.description 576 self.fit_panel.add_model_page(model,description,name) 577 self.draw_model(model) 578 579 def draw_model(self,model): 582 #self.fit_panel.add_model_page(model,description,model.name) 583 self.fit_panel.add_model_page(model,description,name) 584 self.draw_model(model,self.enable_model2D) 585 586 def draw_model(self,model,enable2D=False): 580 587 """ 581 588 draw model with default data value 582 589 """ 583 x = numpy.arange(0.001, 0.1, 0.001)590 x = numpy.arange(0.001, 1.0, 0.001) 584 591 xlen = len(x) 585 592 y = numpy.zeros(xlen) 586 587 for i in range(xlen): 588 y[i] = model.run(x[i]) 589 590 try: 591 new_plot = Theory1D(x, y) 592 new_plot.name = "Model" 593 new_plot.xaxis("\\rm{Q}", 'A^{-1}') 594 new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 595 596 new_plot.group_id ="Fitness" 597 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="Analytical model")) 598 except: 599 raise 593 if not enable2D: 594 for i in range(xlen): 595 y[i] = model.run(x[i]) 596 597 try: 598 new_plot = Theory1D(x, y) 599 new_plot.name = model.name 600 #new_plot.name = "Model" 601 new_plot.xaxis("\\rm{Q}", 'A^{-1}') 602 new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 603 604 new_plot.group_id ="Fitness" 605 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="Analytical model 1D")) 606 607 except: 608 raise 609 else: 610 for i in range(xlen): 611 y[i] = model.run(x[i]) 612 613 try: 614 new_plot = Theory1D(x, y) 615 new_plot.name = model.name 616 #new_plot.name = "Model" 617 new_plot.xaxis("\\rm{Q}", 'A^{-1}') 618 new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 619 620 new_plot.group_id ="Fitness" 621 wx.PostEvent(self.parent, NewPlotEvent(plot=new_plot, title="Analytical model 1D")) 622 623 except: 624 raise 625 def on_draw_model2D(self, event): 626 """ 627 plot view model 2D 628 """ 629 630 if self.enable_model2D== True: 631 self.enable_model2D=False 632 else: 633 self.enable_model2D=True 634 print "self.enable_model2D",self.enable_model2D 600 635 if __name__ == "__main__": 601 636 i = Plugin() -
sansview/perspectives/fitting/modelpage.py
r04edd0d rb2c3225 171 171 model=items 172 172 print "fitpage: _on_select_model model name",name ,event.GetString() 173 self.model= model 173 174 self.manager.draw_model(model) 174 175 self.set_panel(model)
Note: See TracChangeset
for help on using the changeset viewer.