- Timestamp:
- Oct 21, 2008 4:51:19 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:
- 7691125
- Parents:
- 109e60ab
- Location:
- sansview/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage1D.py
r2dbb681 r5cab7d3 49 49 #panel interface 50 50 self.vbox = wx.BoxSizer(wx.VERTICAL) 51 self.sizer5 = wx.GridBagSizer(5,5) 51 52 self.sizer4 = wx.GridBagSizer(5,5) 52 53 self.sizer3 = wx.GridBagSizer(5,5) … … 61 62 self.btFit.Bind(wx.EVT_BUTTON, self.onFit,id=id) 62 63 self.btFit.SetToolTipString("Perform fit.") 64 self.static_line_1 = wx.StaticLine(self, -1) 65 66 67 63 68 self.vbox.Add(self.sizer3) 64 69 self.vbox.Add(self.sizer2) 70 self.vbox.Add(self.static_line_1, 0, wx.EXPAND, 0) 71 self.vbox.Add(self.sizer5) 72 65 73 self.vbox.Add(self.sizer4) 66 74 self.vbox.Add(self.sizer1) 75 76 67 77 68 78 id = wx.NewId() … … 84 94 ix += 1 85 95 self.sizer3.Add(self.modelbox,(iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 86 87 96 ix = 0 88 iy += 197 iy = 1 89 98 #set maximum range for x in linear scale 90 99 self.text4_3 = wx.StaticText(self, -1, 'Maximum Data\n Range (Linear)', style=wx.ALIGN_LEFT) 91 100 self.sizer4.Add(self.text4_3,(iy,ix),(1,1),\ 92 101 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 93 94 102 ix += 1 95 103 self.text4_1 = wx.StaticText(self, -1, 'Min') 96 104 self.sizer4.Add(self.text4_1,(iy, ix),(1,1),\ 97 105 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 98 99 106 ix += 2 100 107 self.text4_2 = wx.StaticText(self, -1, 'Max') … … 107 114 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 108 115 ix += 1 109 110 116 self.xmin = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 111 117 self.xmin.SetValue(format_number(numpy.min(data.x))) … … 114 120 self.xmin.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter) 115 121 self.xmin.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter) 116 117 122 ix += 2 118 123 self.xmax = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) … … 122 127 self.xmax.Bind(wx.EVT_KILL_FOCUS, self._onTextEnter) 123 128 self.xmax.Bind(wx.EVT_TEXT_ENTER, self._onTextEnter) 124 125 129 #Set chisqr result into TextCtrl 126 130 ix = 0 … … 146 150 # model on which the fit would be performed 147 151 self.model=None 148 149 150 152 #dictionary of model name and model class 151 153 self.model_list_box={} 152 153 self.data=data 154 self.data = data 154 155 self.vbox.Layout() 155 156 self.GrandParent.GetSizer().Layout() … … 336 337 337 338 self.sizer2.Clear(True) 339 self.sizer5.Clear(True) 338 340 self.parameters = [] 339 341 self.param_toFit=[] … … 342 344 print "fitpage1D : dispersion list",self.model.getDispParamList() 343 345 keys.sort() 346 disp_list=self.model.getDispParamList() 347 disp_list.sort() 344 348 iy = 1 345 349 ix = 0 … … 362 366 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 363 367 self.text2_4.Hide() 368 364 369 for item in keys: 365 iy += 1 370 if not item in disp_list: 371 iy += 1 372 ix = 0 373 374 cb = wx.CheckBox(self, -1, item, (10, 10)) 375 cb.SetValue(False) 376 self.sizer2.Add( cb,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 377 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 378 379 ix += 1 380 value= self.model.getParam(item) 381 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 382 ctl1.SetValue(str (format_number(value))) 383 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 384 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 385 self.sizer2.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) 386 ix += 1 387 text2=wx.StaticText(self, -1, '+/-') 388 self.sizer2.Add(text2,(iy, ix),(1,1),\ 389 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 390 text2.Hide() 391 ix += 1 392 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 393 self.sizer2.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 394 ctl2.Hide() 395 ix +=1 396 #save data 397 self.parameters.append([cb,ctl1,text2,ctl2]) 398 # Units 399 try: 400 units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) 401 except: 402 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 403 404 self.sizer2.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 405 iy+=1 406 self.sizer2.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 407 ix= 0 408 iy=1 409 self.disp = wx.StaticText(self, -1, 'Dispersion') 410 self.sizer5.Add(self.disp,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 411 iy+=1 412 for item in disp_list: 366 413 ix = 0 367 368 cb = wx.CheckBox(self, -1, item, (10, 10)) 369 cb.SetValue(False) 370 self.sizer2.Add( cb,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 371 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 414 cb2 = wx.CheckBox(self, -1, item, (10, 10)) 415 cb2.SetValue(False) 416 self.sizer5.Add( cb2,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 417 wx.EVT_CHECKBOX(self, cb2.GetId(), self.select_param) 372 418 373 419 ix += 1 374 420 value= self.model.getParam(item) 375 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)376 ctl1.SetValue(str (format_number(value)))377 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)378 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter)379 self.sizer2.Add(ctl1, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)380 ix += 1381 text2=wx.StaticText(self, -1, '+/-')382 self.sizer2.Add(text2,(iy, ix),(1,1),\383 wx.EXPAND|wx.ADJUST_MINSIZE, 0)384 text2.Hide()385 ix += 1386 421 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 387 self.sizer2.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 388 ctl2.Hide() 389 ix +=1 390 391 # Units 392 393 try: 394 units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) 395 except: 396 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 397 398 self.sizer2.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 399 #save data 400 self.parameters.append([cb,ctl1,text2,ctl2]) 422 ctl2.SetValue(str (format_number(value))) 423 ctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 424 ctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 425 self.sizer5.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 426 iy += 1 401 427 #Display units text on panel 402 428 for item in keys: -
sansview/perspectives/fitting/modelpage.py
r2dbb681 r5cab7d3 213 213 keys = self.model.getParamList() 214 214 keys.sort() 215 description=None 216 if hasattr(self.model,'description'): 217 description =model.description 215 218 print "went here",self.model.name,model.description 216 219 iy = 1 … … 220 223 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 221 224 ix += 1 222 self.cb01 = wx.StaticText(self, -1,str( model.description))225 self.cb01 = wx.StaticText(self, -1,str(description)) 223 226 self.sizer1.Add(self.cb01,(iy, ix),(1,1),\ 224 227 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
Note: See TracChangeset
for help on using the changeset viewer.