- Timestamp:
- Jan 11, 2009 4:55:55 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:
- d74d751
- Parents:
- 24ea33c
- Location:
- sansview/perspectives/fitting
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitting.py
r86c1832 r20be946 643 643 except: 644 644 raise 645 def _draw_model2D(self,model,name,description=None, enable2D=False,qmin=None,qmax=None, qstep=None): 645 def update(self, output): 646 print "Got an update" 647 648 def complete(self, output, elapsed, model, qmin, qmax): 649 #printEVT("Calc complete in %g sec" % elapsed) 650 wx.PostEvent(self.parent, StatusEvent(status="Calc \ 651 complete in %g sec" % elapsed)) 652 653 print "complete",output, model,qmin, qmax 654 data = output 655 theory= Data2D(data) 656 theory.name= model.name 657 theory.group_id ="Model" 658 theory.id ="Model" 659 theory.xmin= qmin 660 theory.xmax= qmax 661 theory.ymin= qmin 662 theory.ymax= qmax 663 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, 664 title="Analytical model 2D %s" %str(model.name))) 665 666 667 668 def _draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None): 646 669 if qmin==None: 647 670 qmin= -0.05 … … 655 678 #print x 656 679 data=numpy.zeros([len(x),len(y)]) 680 self.model= model 657 681 if enable2D: 658 #print "drawing model 2D params",qmin, qmax,model.getParamList() 659 for i_x in range(int(len(x))): 660 for i_y in range(len(y)): 682 from model_thread import Calc2D 683 self.calc_thread = Calc2D(parent =self.parent,x=x, y=y,model= self.model, qmin=qmin,qmax=qmax, 684 completefn=self.complete, 685 updatefn=self.update) 686 self.calc_thread.queue() 687 self.calc_thread.ready(2.5) 688 689 690 691 def H_draw_model2D(self,model,description=None, enable2D=False,qmin=None,qmax=None, qstep=None): 692 if qmin==None: 693 qmin= -0.05 694 if qmax==None: 695 qmax= 0.05 696 if qstep ==None: 697 qstep =0.001 698 x = numpy.arange(qmin,qmax, qstep) 699 y = numpy.arange(qmin,qmax,qstep) 700 lx = len(self.x) 701 if enable2D: 702 data=numpy.zeros([len(x),len(y)]) 703 for i in range(len(x)): 704 for j in range(len(x)): 661 705 try: 662 value = model.runXY([x[i_x],y[i_y]]) 663 data[i_y][i_x] = value 706 data[i][j]=model.runXY([j,i]) 664 707 except: 665 708 wx.PostEvent(self.parent, StatusEvent(status="\ 666 Error computing %s at [%g,%g] :%s" %(model.name,x[i_x],y[i_y], sys.exc_value))) 667 #print "data2 draw" ,data 668 theory= Data2D(data) 669 theory.name= name 670 theory.group_id ="Model" 671 theory.id ="Model" 672 theory.xmin= qmin 673 theory.xmax= qmax 674 theory.ymin= qmin 675 theory.ymax= qmax 676 wx.PostEvent(self.parent, NewPlotEvent(plot=theory, 677 title="Analytical model 2D %s" %str(name))) 678 679 709 Model 2D cannot be plot %g %s %s" %(data[i][j],model.name, sys.exc_value))) 710 711 712 def on_draw_model2D(self, event): 713 """ 714 plot view model 2D 715 """ 716 717 if self.enable_model2D== True: 718 self.enable_model2D=False 719 else: 720 self.enable_model2D=True 721 print "self.enable_model2D",self.enable_model2D 680 722 if __name__ == "__main__": 681 723 i = Plugin() -
sansview/perspectives/fitting/modelpage.py
r24ea33c r20be946 134 134 # preview selected model name 135 135 self.prevmodel_name=name 136 print "model view prev_model",name 136 137 self.modelbox.SetValue(self.prevmodel_name) 137 138 # flag to check if the user has selected a new model in the combox box … … 179 180 if self.enable2D==False: 180 181 self.enable2D=True 181 self.manager.draw_model(model=self.model, name=self.prevmodel_name,182 self.manager.draw_model(model=self.model, 182 183 description=None, 183 184 enable2D=self.enable2D,
Note: See TracChangeset
for help on using the changeset viewer.