Changeset 920a6e5 in sasview for sansview/perspectives/fitting
- Timestamp:
- Sep 17, 2009 9:49:25 AM (15 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:
- b2f4f83
- Parents:
- f8b79d6
- Location:
- sansview/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
rf5dadd5 r920a6e5 294 294 name = str(key) 295 295 self.disp_box.Append(name,value) 296 297 296 self.disp_box.SetStringSelection("gaussian") 298 297 wx.EVT_COMBOBOX(self.disp_box,-1, self._on_select_Disp) … … 1417 1416 1418 1417 return 1419 1418 #remove previous added details for dispersion parameters. 1419 for item in self.model.details.keys(): 1420 if item in self.model.fixed: 1421 del self.model.details [item] 1422 1420 1423 if self.enable_disp.GetValue(): 1421 1424 self.model_disp.Show(True) … … 1563 1566 if item in self.param_toFit: 1564 1567 self.param_toFit.remove(item) 1565 1568 for item in self.model.details.keys(): 1569 if item in self.model.fixed: 1570 del self.model.details [item] 1566 1571 1567 1572 self.fittable_param=[] -
sansview/perspectives/fitting/fitpage.py
rc5cd3b9 r920a6e5 82 82 if event.type =="park": 83 83 self.btFit.SetLabel("Fit") 84 84 85 for item in self.parameters: 85 if event.type =="scipy" :86 if event.type =="scipy" : 86 87 item[5].SetValue("") 87 88 item[5].Hide() … … 95 96 self.text2_min.Show(True) 96 97 self.text2_max.Show(True) 98 for item in self.fittable_param: 99 if item[5]!=None and item[6]!=None and not item in self.orientation_params_disp: 100 if event.type =="scipy" and not item in self.orientation_params: 101 item[5].SetValue("") 102 item[5].Hide() 103 item[6].SetValue("") 104 item[6].Hide() 105 self.text2_min.Hide() 106 self.text2_max.Hide() 107 self.text_disp_min.Hide() 108 self.text_disp_max.Hide() 109 else: 110 item[5].Show(True) 111 item[6].Show(True) 112 self.text2_min.Show(True) 113 self.text2_max.Show(True) 114 self.text_disp_min.Show(True) 115 self.text_disp_max.Show(True) 116 97 117 for item in self.orientation_params: 98 118 if item[5]!=None and item[6]!=None: … … 102 122 item[6].SetValue("") 103 123 item[6].Hide() 104 self.text2_min.Hide()105 self.text2_max.Hide()106 124 else: 107 125 item[5].Show(True) 108 126 item[6].Show(True) 109 self.text2_min.Show(True) 110 self.text2_max.Show(True) 111 112 for item in self.orientation_params_disp: 127 128 for item in self.orientation_params_disp: 113 129 if item[5]!=None and item[6]!=None: 114 130 if event.type =="scipy" or self.data.__class__.__name__ !="Data2D": 115 print "here21"116 131 item[5].SetValue("") 117 132 item[5].Hide() 118 133 item[6].SetValue("") 119 134 item[6].Hide() 120 self.text2_min.Hide()121 self.text2_max.Hide()122 135 else: 123 print "here22"124 136 item[5].Show(True) 125 137 item[6].Show(True) 126 self.text2_min.Show(True) 127 self.text2_max.Show(True) 128 138 129 139 self.sizer3.Layout() 130 140 self.SetScrollbars(20,20,25,65) … … 257 267 self.fixed_param=[] 258 268 self.orientation_params_disp=[] 259 269 260 270 self.sizer4_4.Clear(True) 261 271 if self.model==None: … … 284 294 self.sizer4_4.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 285 295 ix +=2 286 self.text_disp_1 = wx.StaticText(self, -1, ' Errors')296 self.text_disp_1 = wx.StaticText(self, -1, '') 287 297 self.sizer4_4.Add( self.text_disp_1,(iy, ix),(1,1),\ 288 298 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 289 299 self.text_disp_1.Hide() 300 301 302 ix +=1 303 self.text_disp_min = wx.StaticText(self, -1, 'Min') 304 self.sizer4_4.Add(self.text_disp_min,(iy, ix),(1,1),\ 305 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 306 self.text_disp_min.Hide() 307 ix +=1 308 self.text_disp_max = wx.StaticText(self, -1, 'Max') 309 self.sizer4_4.Add(self.text_disp_max,(iy, ix),(1,1),\ 310 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 311 self.text_disp_max.Hide() 312 313 314 315 316 317 290 318 ix += 1 291 319 npts = wx.StaticText(self, -1, 'Npts') … … 294 322 nsigmas = wx.StaticText(self, -1, 'Nsigmas') 295 323 self.sizer4_4.Add(nsigmas,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 324 325 if self.engine_type=="park": 326 self.text_disp_max.Show(True) 327 self.text_disp_min.Show(True) 296 328 297 329 for item in self.model.dispersion.keys(): … … 327 359 self.sizer4_4.Add(ctl2, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 328 360 ctl2.Hide() 361 362 #Prepare add min and max in model.details.(Maybe Not correct way) 363 if not self.model.details.has_key(name1): 364 self.model.details [name1] = ["",None, None] 365 param_min, param_max= self.model.details[name1][1:] 366 ix = 4 367 ctl3 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER, 368 kill_focus_callback = self._on_paramRangeEnter, 369 set_focus_callback = self._on_paramRangeEnter) 370 if param_min ==None: 371 ctl3.SetValue("") 372 else: 373 ctl3.SetValue(str(param_min)) 374 self.sizer4_4.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 375 ctl3.Hide() 376 377 ix = 5 378 ctl4 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER, 379 kill_focus_callback = self._on_paramRangeEnter, 380 set_focus_callback = self._on_paramRangeEnter) 381 self.sizer4_4.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 382 if param_max==None: 383 ctl4.SetValue("") 384 else: 385 ctl4.SetValue(str(param_max)) 386 ctl4.Hide() 387 388 if self.engine_type=="park": 389 ctl3.Show(True) 390 ctl4.Show(True) 391 329 392 self.fittable_param.append([cb,name1,ctl1,text2, 330 ctl2, None, None,None]) 393 ctl2, ctl3, ctl4,None]) 394 #self.parameters.append([cb,name1, ctl1,text2,ctl2, ctl3, ctl4,None]) 395 #self.orientation_params.append([cb,name1, ctl1,text2,ctl2, ctl3, ctl4,None]) 396 397 331 398 elif p=="npts": 332 ix = 4399 ix = 6 333 400 value= self.model.getParam(name2) 334 401 Tctl = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), … … 341 408 None, None,None]) 342 409 elif p=="nsigmas": 343 ix = 5410 ix = 7 344 411 value= self.model.getParam(name3) 345 412 Tctl = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), … … 353 420 354 421 self.fixed_param.append([None,name3, Tctl 355 ,None,None, None, None,None]) 422 ,None,None,None, None,None]) 423 356 424 ix =0 357 425 iy +=1 … … 401 469 else: 402 470 ctl2.Disable() 471 472 473 if not self.model.details.has_key(name1): 474 self.model.details [name1] = ["",None, None] 475 476 param_min, param_max= self.model.details[name1][1:] 477 ix = 4 478 ctl3 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER, 479 kill_focus_callback = self._onparamRangeEnter, 480 set_focus_callback = self._onparamRangeEnter) 481 if param_min ==None: 482 ctl3.SetValue("") 483 else: 484 ctl3.SetValue(str(param_min)) 485 self.sizer4_4.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 486 ctl3.Hide() 487 if self.data.__class__.__name__ =="Data2D": 488 ctl3.Enable() 489 else: 490 ctl3.Disable() 491 492 ix = 5 493 ctl4 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER, 494 kill_focus_callback = self._onparamRangeEnter, 495 set_focus_callback = self._onparamRangeEnter) 496 self.sizer4_4.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 497 if param_max==None: 498 ctl4.SetValue("") 499 else: 500 ctl4.SetValue(str(param_max)) 501 ctl4.Hide() 502 if self.data.__class__.__name__ =="Data2D": 503 ctl4.Enable() 504 else: 505 ctl4.Disable() 506 507 if self.engine_type=="park" and self.data.__class__.__name__ =="Data2D": 508 ctl3.Show(True) 509 ctl4.Show(True) 510 511 512 513 403 514 self.fittable_param.append([cb,name1,ctl1,text2, 404 ctl2, None, None,None]) 515 ctl2, ctl3, ctl4,None]) 516 #self.parameters.append([cb,name1, ctl1,text2,ctl2, ctl3, ctl4,None]) 517 #self.orientation_params.append([cb,name1,ctl1,text2, ctl2, ctl3, ctl4,None]) 405 518 self.orientation_params_disp.append([cb,name1,ctl1,text2, 406 ctl2, None, None,None])519 ctl2, ctl3, ctl4,None]) 407 520 elif p=="npts": 408 ix = 4521 ix = 6 409 522 value= self.model.getParam(name2) 410 523 Tctl = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), … … 423 536 None, None,None]) 424 537 elif p=="nsigmas": 425 ix = 5538 ix = 7 426 539 value= self.model.getParam(name3) 427 540 Tctl = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), … … 439 552 self.fixed_param.append([None,name3, Tctl 440 553 ,None,None, None, None,None]) 554 441 555 self.orientation_params_disp.append([None,name3, Tctl 442 556 ,None,None, None, None,None]) … … 445 559 self.state.model = self.model.clone() 446 560 ## save state into 561 562 self._copy_parameters_state(self.parameters, self.state.parameters) 447 563 self._copy_parameters_state(self.orientation_params_disp, 448 564 self.state.orientation_params_disp) 449 565 self._copy_parameters_state(self.fittable_param, self.state.fittable_param) 450 566 self._copy_parameters_state(self.fixed_param, self.state.fixed_param) 567 451 568 452 569 wx.PostEvent(self.parent, StatusEvent(status=\ … … 611 728 return 612 729 730 ### Same as _onparamRangeEnter but smear and chi^2 calculations are removed 731 ### and _onparamEnter_helper is not used, which causing mess sizer display 732 def _on_paramRangeEnter(self, event): 733 """ 734 Check validity of value enter in the parameters range field 735 """ 736 tcrtl= event.GetEventObject() 737 if tcrtl.GetValue().lstrip().rstrip()!="": 738 try: 739 value = float(tcrtl.GetValue()) 740 tcrtl.SetBackgroundColour(wx.WHITE) 741 tcrtl.Refresh() 742 except: 743 tcrtl.SetBackgroundColour("pink") 744 tcrtl.Refresh() 745 return 746 else: 747 tcrtl.SetBackgroundColour(wx.WHITE) 748 tcrtl.Refresh() 749 #self._onparamEnter_helper() 750 751 ## new state posted 752 if self.state_change: 753 self._undo.Enable(True) 754 event = PageInfoEvent(page = self) 755 wx.PostEvent(self.parent, event) 756 self.state_change= False 757 758 613 759 614 760 def set_data(self, data ): … … 1093 1239 ix += 1 1094 1240 ctl3 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER, 1095 kill_focus_callback = self._on paramRangeEnter,1096 set_focus_callback = self._on paramRangeEnter)1241 kill_focus_callback = self._on_paramRangeEnter, 1242 set_focus_callback = self._on_paramRangeEnter) 1097 1243 if param_min ==None: 1098 1244 ctl3.SetValue("") … … 1104 1250 ix += 1 1105 1251 ctl4 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER, 1106 kill_focus_callback = self._on paramRangeEnter,1107 set_focus_callback = self._on paramRangeEnter)1252 kill_focus_callback = self._on_paramRangeEnter, 1253 set_focus_callback = self._on_paramRangeEnter) 1108 1254 sizer.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1109 1255 if param_max==None: … … 1233 1379 ctl4.Hide() 1234 1380 #ctl4.Disable() 1235 if self.engine_type !="park" :1381 if self.engine_type !="park" or self.data.__class__.__name__ !="Data2D": 1236 1382 ctl3.Hide() 1237 1383 ctl4.Hide()
Note: See TracChangeset
for help on using the changeset viewer.