- Timestamp:
- Dec 15, 2008 7:06:42 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:
- e8c96f5
- Parents:
- e5a9e32
- Location:
- sansview/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitting.py
re5a9e32 rd250f7d 14 14 import fitpage1D,fitpage2D 15 15 import park 16 16 DEFAULT_BEAM = 0.005 17 17 class Plugin: 18 18 """ … … 581 581 self.draw_model(model,self.enable_model2D) 582 582 583 def draw_model(self,model,description=None, enable2D=False,qmin=None, qmax=None):583 def draw_model(self,model,description=None,enable1D=True, enable2D=False,qmin=None, qmax=None,qstep=None): 584 584 """ 585 585 draw model with default data value 586 586 """ 587 587 self.fit_panel.add_model_page(model,model.description,model.name) 588 #x = numpy.arange(0.001, 1.0, 0.001) 589 #y = numpy.arange(0.001, 1.0, 0.001) 590 x = numpy.arange(-0.05, 0.05, 0.001) 591 y = numpy.arange(-0.05, 0.05, 0.001) 592 593 print "went here ",len(x) 594 if enable2D: 595 data=numpy.zeros([len(x),len(y)]) 596 for i in range(len(y)): 597 for j in range(len(x)): 598 if i >=0 and i<=0.005 or j >=0 and j<=0.005: 599 data[i][j]=0 600 else: 601 data[i][j]=model.runXY([j,i]) 602 theory = Theory2D(data) 603 theory.group_id =str(model.name)+" 2D" 604 theory.xmin=-0.05 605 theory.xmax= 0.05 606 theory.ymin= -0.05 607 theory.ymax= 0.05 608 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, title="Analytical model 2D")) 609 else: 610 x = numpy.arange(0.001, 1.0, 0.001) 588 self._draw_model2D(model,model.description, enable2D,qmin,qmax,qstep) 589 self._draw_model1D(model,model.description, enable1D,qmin,qmax, qstep) 590 591 def _draw_model1D(self,model,description=None, enable1D=True,qmin=None,qmax=None, qstep=None): 592 593 if enable1D: 594 if qmin==None: 595 qmin= 0.001 596 if qmax==None: 597 qmax= 1.0 598 if qstep ==None: 599 qstep =0.001 600 601 602 x = numpy.arange(qmin, qmax, qstep) 611 603 xlen= len(x) 612 604 y = numpy.zeros(xlen) 613 if not enable 2D:605 if not enable1D: 614 606 for i in range(xlen): 615 607 y[i] = model.run(x[i]) … … 643 635 except: 644 636 raise 637 638 639 640 def _draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None): 641 if qmin==None: 642 qmin= -0.05 643 if qmax==None: 644 qmax= 0.05 645 if qstep ==None: 646 qstep =0.001 647 x = numpy.arange(qmin,qmax, qstep) 648 y = numpy.arange(qmin,qmax,qstep) 649 650 if enable2D: 651 data=numpy.zeros([len(x),len(y)]) 652 for i in range(len(x)): 653 for j in range(len(x)): 654 try: 655 data[i][j]=model.runXY([j,i]) 656 except: 657 wx.PostEvent(self.parent, StatusEvent(status="\ 658 Model 2D cannot be plot %g %s %s" %(data[i][j],model.name, sys.exc_value))) 659 theory = Theory2D(data) 660 theory.group_id =str(model.name)+" 2D" 661 theory.xmin= qmin 662 theory.xmax= qmax 663 theory.ymin= qmin 664 theory.ymax= qmax 665 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, title="Analytical model 2D")) 645 666 def on_draw_model2D(self, event): 646 667 """ -
sansview/perspectives/fitting/modelpage.py
rf39511b rd250f7d 344 344 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 345 345 "Model Drawing Error:wrong value entered : %s"% sys.exc_value)) 346 self.manager.draw_model(self.model )346 self.manager.draw_model(self.model,enable2D=self.model_view.GetValue()) 347 347
Note: See TracChangeset
for help on using the changeset viewer.