Changeset 04edd0d in sasview
- Timestamp:
- Oct 27, 2008 1:58:48 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:
- 89fef2c
- Parents:
- d611fb93
- Location:
- sansview/perspectives/fitting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage1D.py
rd171299 r04edd0d 54 54 self.sizer2 = wx.GridBagSizer(5,5) 55 55 self.sizer1 = wx.GridBagSizer(5,5) 56 #self.sizer1 =wx.BoxSizer(wx.HORIZONTAL) 57 #self.DataSource = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) 58 #self.DataSource.SetToolTipString("name of data to fit") 59 #self.DataSource.SetValue(str(data.name)) 60 #self.DataSource.Disable() 56 61 57 self.DataSource =wx.StaticText(self, -1,str(data.name)) 62 58 … … 345 341 @param model: the model selected in combo box for fitting purpose 346 342 """ 347 348 343 self.sizer2.Clear(True) 349 344 self.sizer5.Clear(True) … … 355 350 keys.sort() 356 351 disp_list=self.model.getDispParamList() 352 ip=0 353 iq=1 354 if len(disp_list)>0: 355 disp = wx.StaticText(self, -1, 'Dispersion') 356 self.sizer5.Add(disp,( iq, ip),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 357 ip += 1 358 values = wx.StaticText(self, -1, 'Values') 359 self.sizer5.Add(values,( iq, ip),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 360 357 361 disp_list.sort() 358 362 iy = 1 … … 404 408 ctl2.Hide() 405 409 ix +=1 406 #save data407 self.parameters.append([cb,ctl1,text2,ctl2])408 410 # Units 409 411 try: … … 411 413 except: 412 414 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 413 414 415 self.sizer2.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 416 else: 417 ip = 0 418 iq += 1 419 cb = wx.CheckBox(self, -1, item, (10, 10)) 420 cb.SetValue(False) 421 self.sizer5.Add( cb,( iq, ip),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 422 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 423 424 ip += 1 425 value= self.model.getParam(item) 426 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 427 ctl1.SetValue(str (format_number(value))) 428 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 429 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 430 self.sizer5.Add(ctl1, (iq,ip),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 431 432 #save data 433 self.parameters.append([cb,ctl1,text2,ctl2]) 434 415 435 iy+=1 416 436 self.sizer2.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 417 ix= 0 418 iy=1 419 if len(disp_list)>0: 420 disp = wx.StaticText(self, -1, 'Dispersion') 421 self.sizer5.Add(disp,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 422 ix += 1 423 values = wx.StaticText(self, -1, 'Values') 424 self.sizer5.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 425 #ix += 1 426 #disps = wx.StaticText(self, -1, 'Disp') 427 #self.sizer5.Add(disps,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 428 #ix += 1 429 #npts = wx.StaticText(self, -1, 'npts') 430 #self.sizer5.Add(npts,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 431 iy+=1 432 433 for item in disp_list: 434 ix = 0 435 cb2 = wx.CheckBox(self, -1, item, (10, 10)) 436 cb2.SetValue(False) 437 self.sizer5.Add( cb2,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 438 wx.EVT_CHECKBOX(self, cb2.GetId(), self.select_param) 439 440 ix += 1 441 value= self.model.getParam(item) 442 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 443 ctl2.SetValue(str (format_number(value))) 444 ctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 445 ctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 446 self.sizer5.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 447 iy += 1 437 448 438 #Display units text on panel 449 439 for item in keys: … … 483 473 for item in self.parameters: 484 474 try: 485 475 486 476 name=str(item[0].GetLabelText()) 487 477 value= float(item[1].GetValue()) … … 490 480 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 491 481 "Drawing Error:wrong value entered : %s"% sys.exc_value)) 482 492 483 self.manager.redraw_model(float(self.xmin.GetValue())\ 493 484 ,float(self.xmax.GetValue())) -
sansview/perspectives/fitting/fitpage2D.py
rd171299 r04edd0d 362 362 @param model: the model selected in combo box for fitting purpose 363 363 """ 364 365 364 self.sizer2.Clear(True) 366 365 self.sizer5.Clear(True) … … 369 368 self.model = model 370 369 keys = self.model.getParamList() 370 #print "fitpage1D : dispersion list",self.model.getDispParamList() 371 371 keys.sort() 372 372 disp_list=self.model.getDispParamList() 373 ip=0 374 iq=1 375 if len(disp_list)>0: 376 disp = wx.StaticText(self, -1, 'Dispersion') 377 self.sizer5.Add(disp,( iq, ip),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 378 ip += 1 379 values = wx.StaticText(self, -1, 'Values') 380 self.sizer5.Add(values,( iq, ip),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 381 373 382 disp_list.sort() 374 383 iy = 1 … … 392 401 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 393 402 self.text2_4.Hide() 403 394 404 for item in keys: 395 405 if not item in disp_list: … … 419 429 ctl2.Hide() 420 430 ix +=1 421 #save data422 self.parameters.append([cb,ctl1,text2,ctl2])423 431 # Units 424 432 try: … … 426 434 except: 427 435 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 428 429 436 self.sizer2.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 437 else: 438 ip = 0 439 iq += 1 440 cb = wx.CheckBox(self, -1, item, (10, 10)) 441 cb.SetValue(False) 442 self.sizer5.Add( cb,( iq, ip),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 443 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 444 445 ip += 1 446 value= self.model.getParam(item) 447 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 448 ctl1.SetValue(str (format_number(value))) 449 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 450 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 451 self.sizer5.Add(ctl1, (iq,ip),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 452 453 #save data 454 self.parameters.append([cb,ctl1,text2,ctl2]) 455 430 456 iy+=1 431 457 self.sizer2.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 432 458 433 if len(disp_list)>0:434 ix= 0435 iy=1436 disp = wx.StaticText(self, -1, 'Dispersion')437 self.sizer5.Add(disp,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)438 ix += 1439 values = wx.StaticText(self, -1, 'Values')440 self.sizer5.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)441 #ix += 1442 #disps = wx.StaticText(self, -1, 'Disp')443 #self.sizer5.Add(disps,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)444 #ix += 1445 #npts = wx.StaticText(self, -1, 'npts')446 #self.sizer5.Add(npts,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)447 iy +=1448 449 for item in disp_list:450 ix = 0451 cb2 = wx.CheckBox(self, -1, item, (10, 10))452 cb2.SetValue(False)453 self.sizer5.Add( cb2,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)454 wx.EVT_CHECKBOX(self, cb2.GetId(), self.select_param)455 456 ix += 1457 value= self.model.getParam(item)458 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)459 ctl2.SetValue(str (format_number(value)))460 ctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)461 ctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter)462 self.sizer5.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)463 iy += 1464 459 #Display units text on panel 465 460 for item in keys: -
sansview/perspectives/fitting/fitting.py
r44bbf6a r04edd0d 509 509 theory.x.append(tempx) 510 510 theory.y.append(tempy) 511 511 512 except: 512 513 wx.PostEvent(self.parent, StatusEvent(status="fitting \ … … 520 521 wx.PostEvent(self.parent, StatusEvent(status="fitting \ 521 522 skipping point x %g %s" %(qmax, sys.exc_value))) 523 522 524 else: 523 525 theory=Data2D(data.image, data.err_image) … … 551 553 theory.ymin= ymin 552 554 theory.ymax= ymax 553 555 554 556 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, title="Analytical model")) 555 557 -
sansview/perspectives/fitting/modelpage.py
rd171299 r04edd0d 53 53 self.sizer2 = wx.GridBagSizer(5,5) 54 54 self.sizer4 = wx.GridBagSizer(5,5) 55 self.sizer5 = wx.GridBagSizer(5,5) 56 self.static_line_1 = wx.StaticLine(self, -1) 55 57 self.modelbox = wx.ComboBox(self, -1) 56 58 id = wx.NewId() … … 58 60 self.vbox.Add(self.sizer1) 59 61 self.vbox.Add(self.sizer2) 62 self.vbox.Add(self.static_line_1, 0, wx.EXPAND, 0) 63 self.vbox.Add(self.sizer5) 60 64 self.vbox.Add(self.sizer4) 61 65 … … 208 212 self.sizer2.Clear(True) 209 213 self.sizer1.Clear(True) 214 self.sizer5.Clear(True) 210 215 self.parameters = [] 211 216 self.param_toFit=[] … … 216 221 if hasattr(self.model,'description'): 217 222 description =model.description 218 219 223 disp_list=self.model.getDispParamList() 224 ip=0 225 iq=1 226 if len(disp_list)>0: 227 disp = wx.StaticText(self, -1, 'Dispersion') 228 self.sizer5.Add(disp,( iq, ip),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 229 ip += 1 230 values = wx.StaticText(self, -1, 'Values') 231 self.sizer5.Add(values,( iq, ip),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 232 233 disp_list.sort() 220 234 print "went here",self.model.name,model.description 221 235 iy = 1 … … 247 261 self.text2_4.Hide() 248 262 for item in keys: 249 iy += 1 250 ix = 0 251 cb=wx.StaticText(self, -1, item) 252 self.sizer2.Add( cb,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 253 ix += 1 254 value= self.model.getParam(item) 255 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 256 ctl1.SetValue(str (format_number(value))) 257 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 258 ctl1.Bind(wx.EVT_TEXT_ENTER, self._onparamEnter) 259 self.sizer2.Add(ctl1, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 260 ix +=1 261 # Units 262 try: 263 units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) 264 except: 265 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 266 self.sizer2.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 263 if not item in disp_list: 264 iy += 1 265 ix = 0 266 cb=wx.StaticText(self, -1, item) 267 self.sizer2.Add( cb,( iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 268 ix += 1 269 value= self.model.getParam(item) 270 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 271 ctl1.SetValue(str (format_number(value))) 272 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 273 ctl1.Bind(wx.EVT_TEXT_ENTER, self._onparamEnter) 274 self.sizer2.Add(ctl1, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 275 ix +=1 276 277 # Units 278 try: 279 units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) 280 except: 281 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 282 self.sizer2.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 283 else: 284 ip = 0 285 iq += 1 286 cb = wx.CheckBox(self, -1, item, (10, 10)) 287 cb.SetValue(False) 288 self.sizer5.Add( cb,( iq, ip),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 289 wx.EVT_CHECKBOX(self, cb.GetId(), self._on_select_model) 290 291 ip += 1 292 value= self.model.getParam(item) 293 ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER) 294 ctl1.SetValue(str (format_number(value))) 295 ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) 296 ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) 297 self.sizer5.Add(ctl1, (iq,ip),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 267 298 #save data 268 299 self.parameters.append([cb,ctl1]) 300 iy+=1 301 self.sizer2.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 302 269 303 #Display units text on panel 270 304 for item in keys: … … 276 310 self.vbox.Layout() 277 311 self.GrandParent.GetSizer().Layout() 278 print "out"312 279 313 280 314 def _onparamEnter(self,event):
Note: See TracChangeset
for help on using the changeset viewer.