Changeset db709e4 in sasview
- Timestamp:
- Jan 11, 2009 8:12:06 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:
- fb198a9
- Parents:
- d74d751
- Location:
- sansview/perspectives/fitting
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage1D.py
r08b9c6c8 rdb709e4 534 534 and the reset model according to paramaters changes 535 535 """ 536 print "went here",len(self.parameters) ,self.model 536 537 if len(self.parameters) !=0 and self.model !=None: 537 538 for item in self.parameters: … … 546 547 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 547 548 "Drawing Error:wrong value entered : %s"% sys.exc_value)) 548 for item in self.fixed_param: 549 try: 549 550 is_modified = False 551 if self.xmin.IsModified(): 552 is_modified = True 553 if self.xmax.IsModified(): 554 is_modified = True 555 556 try: 550 557 551 name=str(item[0]) 552 value= float(item[1].GetValue()) 553 self.model.setParam(name,value) 558 if item[1].IsModified() or is_modified: 559 print str(item[0].GetLabelText()),item[1].IsModified() 560 item[1].SetModified(False) 561 name=str(item[0].GetLabelText()) 562 value= float(item[1].GetValue()) 563 self.model.setParam(name,value) 564 self.xmin.SetModified(False) 565 self.xmax.SetModified(False) 566 is_modified=False 567 568 self.manager.redraw_model( 569 float(self.xmin.GetValue()), 570 float(self.xmax.GetValue()) ) 571 554 572 except: 555 raise 556 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 557 "Drawing Error:wrong value entered : %s"% sys.exc_value)) 558 self.manager.redraw_model(float(self.xmin.GetValue())\ 559 ,float(self.xmax.GetValue())) 560 573 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 574 "Model Drawing Error:wrong value entered : %s"% sys.exc_value)) 575 576 561 577 def select_all_param(self,event): 562 578 """ -
sansview/perspectives/fitting/fitpage2D.py
rf39511b rdb709e4 498 498 if len(self.parameters) !=0 and self.model !=None: 499 499 for item in self.parameters: 500 try: 501 name=str(item[0].GetLabelText()) 502 value= float(item[1].GetValue()) 503 self.model.setParam(name,value) 500 501 is_modified = False 502 if self.xmin.IsModified(): 503 is_modified = True 504 if self.xmax.IsModified(): 505 is_modified = True 506 507 try: 508 509 if item[1].IsModified() or is_modified: 510 print str(item[0].GetLabelText()),item[1].IsModified() 511 item[1].SetModified(False) 512 name=str(item[0].GetLabelText()) 513 value= float(item[1].GetValue()) 514 self.model.setParam(name,value) 515 self.xmin.SetModified(False) 516 self.xmax.SetModified(False) 517 is_modified=False 518 519 self.manager.redraw_model( 520 float(self.xmin.GetValue()), 521 float(self.xmax.GetValue()) ) 522 504 523 except: 505 524 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 506 "Drawing Error:wrong value entered : %s"% sys.exc_value)) 507 self.manager.redraw_model(float(self.xmin.GetValue())\ 508 ,float(self.xmax.GetValue())) 509 525 "Model Drawing Error:wrong value entered : %s"% sys.exc_value)) 526 527 510 528 def select_all_param(self,event): 511 529 """ -
sansview/perspectives/fitting/fitting.py
rd74d751 rdb709e4 586 586 description=model.description 587 587 #self.fit_panel.add_model_page(model,description,name) 588 589 self.draw_model(model=model,name=name ,enable2D=self.enable_model2D)588 589 self.draw_model(model=model,name=name) 590 590 591 591 def draw_model(self,model,name ,description=None,enable1D=True, enable2D=False,qmin=None, qmax=None,qstep=None): … … 692 692 self.calc_thread.ready(2.5) 693 693 694 695 696 def H_draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None): 697 if qmin==None: 698 qmin= -0.05 699 if qmax==None: 700 qmax= 0.05 701 if qstep ==None: 702 qstep =0.001 703 x = numpy.arange(qmin,qmax, qstep) 704 y = numpy.arange(qmin,qmax,qstep) 705 lx = len(self.x) 706 if enable2D: 707 data=numpy.zeros([len(x),len(y)]) 708 for i in range(len(x)): 709 for j in range(len(x)): 710 try: 711 data[i][j]=model.runXY([j,i]) 712 except: 713 wx.PostEvent(self.parent, StatusEvent(status="\ 714 Model 2D cannot be plot %g %s %s" %(data[i][j],model.name, sys.exc_value))) 715 716 717 def on_draw_model2D(self, event): 718 """ 719 plot view model 2D 720 """ 721 722 if self.enable_model2D== True: 723 self.enable_model2D=False 724 else: 725 self.enable_model2D=True 726 print "self.enable_model2D",self.enable_model2D 694 727 695 if __name__ == "__main__": 728 696 i = Plugin() -
sansview/perspectives/fitting/model_thread.py
rd74d751 rdb709e4 136 136 center_x=0 137 137 center_y=0 138 print "center_x , center_y",center_x , center_y139 print "x ",len(x)140 print "y", y141 print "int(len(self.x)/2)",int(len(self.x)/2)138 #print "center_x , center_y",center_x , center_y 139 #print "x ",len(x) 140 #print "y", y 141 #print "int(len(self.x)/2)",int(len(self.x)/2) 142 142 self.starttime = time.time() 143 143 lx = len(self.x) -
sansview/perspectives/fitting/modelpage.py
rd74d751 rdb709e4 366 366 # Flag to register when a parameter has changed. 367 367 is_modified = False 368 for item in self.parameters:369 try:370 name=str(item[0].GetLabelText())371 value= float(item[1].GetValue())372 # If the value of the parameter has changed,373 # update the model and set the is_modified flag374 if value != self.model.getParam(name):375 self.model.setParam(name,value)376 is_modified = True377 except:378 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\379 "Model Drawing Error:wrong value entered : %s"% sys.exc_value))380 381 # Here we should check whether the boundaries have been modified.382 # If qmin and qmax have been modified, update qmin and qmax and383 # set the is_modified flag to True384 368 if float(self.xmin.GetValue()) != self.qmin: 385 369 self.qmin = float(self.xmin.GetValue()) … … 388 372 self.qmax = float(self.xmax.GetValue()) 389 373 is_modified = True 390 391 if is_modified: 392 self.manager.draw_model(self.model, self.model.name, 374 for item in self.parameters: 375 try: 376 377 if item[1].IsModified() or is_modified: 378 print str(item[0].GetLabelText()),item[1].IsModified() 379 item[1].SetModified(False) 380 name=str(item[0].GetLabelText()) 381 value= float(item[1].GetValue()) 382 self.model.setParam(name,value) 383 384 is_modified=False 385 print "self.enable2d",self.enable2D 386 self.manager.draw_model(self.model, self.model.name, 393 387 qmin=self.qmin, qmax=self.qmax, 394 388 enable2D=self.enable2D) 395 #self.manager.draw_model(self,model,description=None, 389 390 391 except: 392 wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 393 "Model Drawing Error:wrong value entered : %s"% sys.exc_value)) 394 395 # Here we should check whether the boundaries have been modified. 396 # If qmin and qmax have been modified, update qmin and qmax and 397 # set the is_modified flag to True 398 396 399 # enable1D=True,qmin=None,qmax=None, qstep=None) 397 400
Note: See TracChangeset
for help on using the changeset viewer.