Changeset dc317d1 in sasview for sansview/perspectives/fitting
- Timestamp:
- Dec 17, 2008 4:29:39 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:
- 169460a
- Parents:
- cd84dca
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage1D.py
rf39511b rdc317d1 482 482 self.compute_chisqr() 483 483 self.vbox.Layout() 484 self.Layout() 484 485 self.GrandParent.GetSizer().Layout() 485 486 -
sansview/perspectives/fitting/fitting.py
rd250f7d rdc317d1 4 4 5 5 from copy import deepcopy 6 from danse.common.plottools.plottables import Data1D, Theory1D,Data2D ,Theory2D6 from danse.common.plottools.plottables import Data1D, Theory1D,Data2D 7 7 from danse.common.plottools.PlotPanel import PlotPanel 8 8 from sans.guicomm.events import NewPlotEvent, StatusEvent … … 94 94 return [["Select data for Fitting",\ 95 95 "Dialog with fitting parameters ", self._onSelect]] 96 #elif item.__class__.__name__ is "Theory2D":97 # return [["Line Slicer [Q-view]","Sector Averaging as a function of Q",98 # self.onLineSlicer],99 # ["Annulus Slicer [Phi-view]","Sector Averaging as a function of Phi",100 # self.onLineSlicer]]101 96 else: 102 97 if item.name==graph.selected_plottable and\ … … 532 527 533 528 else: 534 theory= Theory2D(data.data, data.err_data)535 #theory=Theory2D(data.image, data.err_image)529 theory=Data2D(data.data, data.err_data) 530 536 531 theory.x_bins= data.x_bins 537 532 theory.y_bins= data.y_bins … … 635 630 except: 636 631 raise 637 638 639 640 632 def _draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None): 641 633 if qmin==None: … … 647 639 x = numpy.arange(qmin,qmax, qstep) 648 640 y = numpy.arange(qmin,qmax,qstep) 649 641 lx = len(x) 642 data=numpy.zeros([len(x),len(y)]) 643 if enable2D: 644 """ 645 for i_x in range(int(len(x)/2)): 646 if i_x%2==1: 647 continue 648 for i_y in range(len(y)): 649 try: 650 value = model.runXY([x[i_x], y[i_y]]) 651 #output[i_x][i_y] = value 652 #output[lx-i_x-1][lx-i_y-1] = value 653 data[i_y][i_x] = value 654 data[lx-i_y-1][lx-i_x-1] = value 655 except: 656 wx.PostEvent(self.parent, StatusEvent(status="\ 657 Error computing %s at [%g,%g] :%s" %(model.name,x[i_x],y[i_y], sys.exc_value))) 658 659 if lx%2==1: 660 i_x = int(len(x)/2) 661 for i_y in range(len(y)): 662 try: 663 value = model.runXY([x[i_x],y[i_y]]) 664 #output[i_x][i_y] = value 665 data[i_y][i_x] = value 666 except: 667 wx.PostEvent(self.parent, StatusEvent(status="\ 668 Error computing %s at [%g,%g] :%s" %(model.name,x[i_x],y[i_y], sys.exc_value))) 669 670 """ 671 for i_x in range(int(len(x)/2)): 672 """ 673 if not i_x%2==1: 674 continue 675 """ 676 for i_y in range(len(y)): 677 try: 678 value = model.runXY([x[i_x],y[i_y]]) 679 #output[i_x][i_y] = value 680 #output[lx-i_x-1][lx-i_y-1] = value 681 data[i_y][i_x] = value 682 data[lx-i_y-1][lx-i_x-1] = value 683 except: 684 wx.PostEvent(self.parent, StatusEvent(status="\ 685 Error computing %s at [%g,%g] :%s" %(model.name,x[i_x],y[i_y], sys.exc_value))) 686 687 688 689 theory = (data) 690 theory.group_id =str(model.name)+" 2D" 691 theory.xmin= qmin 692 theory.xmax= qmax 693 theory.ymin= qmin 694 theory.ymax= qmax 695 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, title="Analytical model 2D")) 696 697 698 699 def H_draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None): 700 if qmin==None: 701 qmin= -0.05 702 if qmax==None: 703 qmax= 0.05 704 if qstep ==None: 705 qstep =0.001 706 x = numpy.arange(qmin,qmax, qstep) 707 y = numpy.arange(qmin,qmax,qstep) 708 lx = len(self.x) 650 709 if enable2D: 651 710 data=numpy.zeros([len(x),len(y)]) … … 657 716 wx.PostEvent(self.parent, StatusEvent(status="\ 658 717 Model 2D cannot be plot %g %s %s" %(data[i][j],model.name, sys.exc_value))) 659 theory = Theory2D(data)718 theory = Data2D(data) 660 719 theory.group_id =str(model.name)+" 2D" 661 720 theory.xmin= qmin … … 664 723 theory.ymax= qmax 665 724 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, title="Analytical model 2D")) 725 726 666 727 def on_draw_model2D(self, event): 667 728 """ -
sansview/perspectives/fitting/modelpage.py
rd250f7d rdc317d1 69 69 self.btClose.Bind(wx.EVT_BUTTON, self.onClose,id=id) 70 70 self.btClose.SetToolTipString("Close page.") 71 72 ix = 12 73 iy = 1 71 ix = 0 72 iy = 1 73 self.sizer4.Add(wx.StaticText(self, -1, 'Min'),(iy, ix),(1,1),\ 74 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 75 ix += 2 76 self.sizer4.Add(wx.StaticText(self, -1, 'Max'),(iy, ix),(1,1),\ 77 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 78 ix = 0 79 iy += 1 80 self.sizer4.Add(wx.StaticText(self, -1, 'x range'),(iy, ix),(1,1),\ 81 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 82 try: 83 if hasattr(model,'x'): 84 qmin= numpy.min(model.x) 85 86 except: 87 qmin= numpy.min(model.xmin) 88 ix += 1 89 self.xmin = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 90 #self.xmin.SetValue(format_number(numpy.min(model.x))) 91 self.xmin.SetToolTipString("Minimun value of x in linear scale.") 92 self.xmin.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 93 self.xmin.Bind(wx.EVT_TEXT_ENTER, self._onparamEnter) 94 self.sizer4.Add(self.xmin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 95 96 97 ix += 2 98 self.xmax = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 99 #self.xmax.SetValue(format_number(numpy.max(data.x))) 100 self.xmax.SetToolTipString("Maximum value of x in linear scale.") 101 self.xmax.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 102 self.xmax.Bind(wx.EVT_TEXT_ENTER, self._onparamEnter) 103 104 self.sizer4.Add(self.xmax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 105 ix = 0 106 iy += 1 107 self.sizer4.Add((20,20),(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 108 ix +=3 74 109 self.sizer4.Add( self.btClose,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 75 110 ix = 0 … … 131 166 """ 132 167 self.manager = manager 168 133 169 def onModel2D(self, event): 134 170 … … 345 381 "Model Drawing Error:wrong value entered : %s"% sys.exc_value)) 346 382 self.manager.draw_model(self.model,enable2D=self.model_view.GetValue()) 347 383 #self.manager.draw_model(self,model,description=None, enable1D=True,qmin=None,qmax=None, qstep=None)
Note: See TracChangeset
for help on using the changeset viewer.