Changeset 6b44403 in sasview for sansview/perspectives/fitting/fitpage2D.py
- Timestamp:
- Feb 3, 2009 11:47:46 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:
- 94999eb
- Parents:
- ca88b2e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage2D.py
r26bf293 r6b44403 10 10 11 11 from modelpage import format_number 12 from fitpage1D import FitPage1D12 from old_fitpage1D import FitPage1D 13 13 14 14 class FitPage2D(FitPage1D): … … 27 27 28 28 def __init__(self, parent,data, *args, **kwargs): 29 FitPage1D.__init__(self, parent, *args, **kwargs)29 wx.ScrolledWindow.__init__(self, parent, *args, **kwargs) 30 30 """ 31 31 Initialization of the Panel 32 32 """ 33 33 self.manager = None 34 self.parent = parent 35 self.event_owner=None 36 #panel interface 37 self.vbox = wx.BoxSizer(wx.VERTICAL) 38 self.sizer6 = wx.GridBagSizer(5,5) 39 self.sizer5 = wx.GridBagSizer(5,5) 40 self.sizer4 = wx.GridBagSizer(5,5) 41 self.sizer3 = wx.GridBagSizer(5,5) 42 self.sizer2 = wx.GridBagSizer(5,5) 43 self.sizer1 = wx.GridBagSizer(5,5) 44 45 #self.DataSource = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 46 #self.DataSource.SetToolTipString("name of data to fit") 47 #self.DataSource.SetValue(str(data.name)) 48 #self.DataSource.Disable() 49 self.DataSource =wx.StaticText(self, -1,str(data.name)) 50 self.modelbox = wx.ComboBox(self, -1) 51 id = wx.NewId() 52 self.btFit =wx.Button(self,id,'Fit') 53 self.btFit.Bind(wx.EVT_BUTTON, self.onFit,id=id) 54 self.btFit.SetToolTipString("Perform fit.") 55 self.static_line_1 = wx.StaticLine(self, -1) 56 57 self.vbox.Add(self.sizer3) 58 self.vbox.Add(self.sizer2) 59 self.vbox.Add(self.static_line_1, 0, wx.EXPAND, 0) 60 self.vbox.Add(self.sizer5) 61 self.vbox.Add(self.sizer6) 62 self.vbox.Add(self.sizer4) 63 self.vbox.Add(self.sizer1) 64 ## Q range 65 self.qmin= 0.001 66 self.qmax= 0.1 67 68 id = wx.NewId() 69 self.btClose =wx.Button(self,id,'Close') 70 self.btClose.Bind(wx.EVT_BUTTON, self.onClose,id=id) 71 self.btClose.SetToolTipString("Close page.") 72 ix = 0 73 iy = 1 74 self.sizer3.Add(wx.StaticText(self, -1, 'Data Source'),(iy,ix),\ 75 (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 76 ix += 1 77 self.sizer3.Add(self.DataSource,(iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 78 ix += 1 79 self.sizer3.Add((20,20),(iy,ix),(1,1),wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE,0) 80 ix = 0 81 iy += 1 82 self.sizer3.Add(wx.StaticText(self,-1,'Model'),(iy,ix),(1,1)\ 83 , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 84 ix += 1 85 self.sizer3.Add(self.modelbox,(iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 86 87 ix = 0 88 iy = 1 89 #set maximum range for x in linear scale 90 self.text4_3 = wx.StaticText(self, -1, 'Maximum Data\n Range (Linear)', style=wx.ALIGN_LEFT) 91 self.sizer4.Add(self.text4_3,(iy,ix),(1,1),\ 92 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 93 ix += 1 94 self.text4_1 = wx.StaticText(self, -1, 'Min') 95 self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\ 96 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 97 #self.text4_1.Hide() 98 ix += 2 99 self.text4_2 = wx.StaticText(self, -1, 'Max') 100 self.sizer4.Add(self.text4_2,(iy, ix),(1,1),\ 101 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 102 #self.text4_2.Hide() 103 104 #self.text4_3.Hide() 105 ix = 0 106 iy += 1 107 self.text4_4 = wx.StaticText(self, -1, 'x range') 108 self.sizer4.Add(self.text4_4,(iy, ix),(1,1),\ 109 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 110 ix += 1 111 self.xmin = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 112 self.xmin.SetValue(format_number(data.xmin)) 113 self.xmin.SetToolTipString("Minimun value of x in linear scale.") 114 self.sizer4.Add(self.xmin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 115 self.xmin.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter) 116 self.xmin.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter) 117 118 ix += 2 119 self.xmax = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 120 self.xmax.SetValue(format_number(data.xmax)) 121 self.xmax.SetToolTipString("Maximum value of x in linear scale.") 122 self.sizer4.Add(self.xmax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 123 self.xmax.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter) 124 self.xmax.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter) 125 126 iy +=1 127 ix = 0 128 self.text4_5 = wx.StaticText(self, -1, 'y range') 129 self.sizer4.Add(self.text4_5,(iy, ix),(1,1),\ 130 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 131 ix += 1 132 self.ymin = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 133 self.ymin.SetValue(format_number(data.ymin)) 134 self.ymin.SetToolTipString("Minimun value of y in linear scale.") 135 self.sizer4.Add(self.ymin,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 136 self.ymin.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter) 137 self.ymin.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter) 138 139 ix += 2 140 self.ymax = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 141 self.ymax.SetValue(format_number(data.ymax)) 142 self.ymax.SetToolTipString("Maximum value of y in linear scale.") 143 self.sizer4.Add(self.ymax,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 144 self.ymax.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter) 145 self.ymax.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter) 146 147 #Set chisqr result into TextCtrl 148 ix = 0 149 iy = 1 150 self.text1_1 = wx.StaticText(self, -1, 'Chi2/dof', style=wx.ALIGN_LEFT) 151 self.sizer1.Add(self.text1_1,(iy,ix),(1,1),\ 152 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 153 ix += 1 154 self.tcChi = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 155 self.tcChi.SetToolTipString("Chi^2 over degrees of freedom.") 156 self.sizer1.Add(self.tcChi,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 157 ix +=2 158 self.sizer1.Add(self.btFit,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 159 ix+= 1 160 self.sizer1.Add( self.btClose,(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 161 ix= 1 162 iy+=1 163 self.sizer1.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 164 # contains link between model ,all its parameters, and panel organization 165 self.parameters=[] 166 self.fixed_param=[] 167 #contains link between a model and selected parameters to fit 168 self.param_toFit=[] 169 # model on which the fit would be performed 170 self.model=None 171 # preview selected model name 172 173 174 #dictionary of model name and model class 175 self.model_list_box={} 176 177 self.data = data 178 self.vbox.Layout() 179 self.vbox.Fit(self) 180 self.SetSizer(self.vbox) 181 self.SetScrollbars(20,20,55,40) 182 self.Centre() 183 184 34 185 35 186 def compute_chisqr(self):
Note: See TracChangeset
for help on using the changeset viewer.