Changeset 6b44403 in sasview
- Timestamp:
- Feb 3, 2009 9: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
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage1D.py
r26bf293 r6b44403 264 264 self.parameters=[] 265 265 self.fixed_param=[] 266 self.fittable_param=[] 266 267 #list of dispersion paramaters 267 268 self.disp_list=None … … 589 590 list= [item[0],item[1],item[2],item[3]] 590 591 self.param_toFit.append(list ) 592 if len(self.fittable_param)>0: 593 for item in self.fittable_param: 594 item[0].SetValue(True) 595 list= [item[0],item[1],item[2],item[3]] 596 self.param_toFit.append(list ) 591 597 592 598 if not (len(self.param_toFit ) >0): 593 self. xmin.Disable()594 self. xmax.Disable()599 self.qmin.Disable() 600 self.qmax.Disable() 595 601 else: 596 self. xmin.Enable()597 self. xmax.Enable()602 self.qmin.Enable() 603 self.qmax.Enable() 598 604 else: 599 605 for item in self.parameters: 600 606 item[0].SetValue(False) 607 for item in self.fittable_param: 608 item[0].SetValue(False) 601 609 self.param_toFit=[] 602 610 603 self. xmin.Disable()604 self. xmax.Disable()611 self.qmin.Disable() 612 self.qmax.Disable() 605 613 606 614 … … 619 627 if item in self.param_toFit: 620 628 self.param_toFit.remove(item) 621 if len(self.parameters)==len(self.param_toFit): 629 630 for item in self.fittable_param: 631 if item[0].GetValue()==True: 632 list= [item[0],item[1],item[2],item[3]] 633 if not (list in self.param_toFit): 634 self.param_toFit.append(list ) 635 else: 636 if item in self.param_toFit: 637 self.param_toFit.remove(item) 638 639 640 if len(self.parameters)+len(self.fittable_param) ==len(self.param_toFit): 622 641 self.cb1.SetValue(True) 623 642 else: -
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): -
sansview/perspectives/fitting/fitpanel.py
r26bf293 r6b44403 98 98 self.count +=1 99 99 100 """ 100 101 if data.__class__.__name__=='Data2D': 101 102 from fitpage2D import FitPage2D … … 103 104 104 105 else: 105 106 107 106 """ 107 from fitpage1D import FitPage1D 108 panel = FitPage1D(self,data, -1) 108 109 m_name= "M"+str(self.count) 109 110 panel.set_manager(self.manager) -
sansview/perspectives/fitting/modelpage.py
r26bf293 r6b44403 190 190 self.parameters=[] 191 191 self.fixed_param=[] 192 self.fittable_param=[] 192 193 #contains link between a model and selected parameters to fit 193 194 self.param_toFit=[] … … 252 253 ix=0 253 254 iy=1 255 self.fittable_param=[] 256 self.fixed_param=[] 254 257 self.sizer8.Clear(True) 255 258 model_disp = wx.StaticText(self, -1, 'No PolyDispersity for this model') … … 261 264 return 262 265 else: 266 self.fittable_param=[] 267 self.fixed_param=[] 263 268 self.sizer8.Clear(True) 264 269 self.populate_disp_box() … … 269 274 self.parent.GetSizer().Layout() 270 275 else: 276 self.fittable_param=[] 277 self.fixed_param=[] 271 278 self.sizer7.Clear(True) 272 279 self.sizer8.Clear(True) … … 608 615 self.sizer8.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 609 616 ctl2.Hide() 617 self.fittable_param=[cb,ctl1,text2,ctl2] 610 618 611 self.parameters.append([cb,ctl1,text2,ctl2])612 619 613 620 elif p=="npts":
Note: See TracChangeset
for help on using the changeset viewer.