Changeset bbec827 in sasview
- Timestamp:
- May 1, 2008 5:04:40 PM (17 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:
- ddff053
- Parents:
- 34ae302
- Location:
- guitools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guitools/PlotPanel.py
r34ae302 rbbec827 12 12 from matplotlib.widgets import RectangleSelector 13 13 from pylab import gca, gcf 14 14 from plottables import Theory1D 15 #from plottables import Data1D 15 16 #TODO: make the plottables interactive 16 17 … … 103 104 self.canvas.mpl_connect('scroll_event',self.onWheel) 104 105 self.axes = [self.subplot] 106 # new data for the fit 107 self.fit_result = Theory1D(x=[], y=[], dy=None) 108 #self.fit_result = Data1D(x=[], y=[],dx=None, dy=None) 109 self.fit_result.name = "Fit" 110 self.fit_result.ID = "isFit" 105 111 106 112 def onWheel(self, event): … … 130 136 if insidex: 131 137 xdata,_ = ax.transAxes.inverse_xy_tup((x,y)) 132 print "xaxis",x,"->",xdata138 #print "xaxis",x,"->",xdata 133 139 insidey,_ = ax.yaxis.contains(event) 134 140 if insidey: 135 141 _,ydata = ax.transAxes.inverse_xy_tup((x,y)) 136 print "yaxis",y,"->",ydata142 #print "yaxis",y,"->",ydata 137 143 if xdata is not None: 138 144 lo,hi = ax.get_xlim() … … 420 426 list =[] 421 427 list = self.graph.returnPlottable() 428 self.fit_result.x =[] 429 self.fit_result.y =[] 430 self.fit_result.dx=None 431 self.fit_result.dy=None 422 432 423 433 for item in list: … … 507 517 name, units = item.get_yaxis() 508 518 self.graph.yaxis("$Log %s$" % name, "%s^{-1}" % units) 509 519 item.transformView() 510 520 #item.name = self.yscales+" vs " +self.xscales 511 521 self.prevXtrans = self.xscales 512 522 self.prevYtrans = self.yscales 513 item.transformView()514 523 self.graph.render(self) 515 524 self.subplot.figure.canvas.draw_idle() 516 525 517 def onFitDisplay(self, plottable,xmin,xmax):526 def onFitDisplay(self, tempx,tempy,xmin,xmax): 518 527 """ 519 528 Add a new plottable into the graph .In this case this plottable will be used … … 521 530 @param plottable: the plottable to plot 522 531 """ 532 533 523 534 list =[] 524 535 list = self.graph.returnPlottable() 525 536 for item in list: 526 537 item.onFitRange(xmin,xmax) 527 #Add the data to fit 528 self.graph.add(plottable) 538 # Create new data plottable with result 539 self.fit_result.x =[] 540 self.fit_result.y =[] 541 self.fit_result.x =tempx 542 self.fit_result.y =tempy 543 self.fit_result.dx=None 544 self.fit_result.dy=None 545 #Load the view with the new values 546 self.fit_result.reset_view() 547 self.graph.add(self.fit_result) 548 529 549 self.graph.render(self) 530 531 550 self.subplot.figure.canvas.draw_idle() 532 self.graph.delete(plottable)551 #self.graph.delete(plottable) 533 552 534 553 def onResetGraph(self,event): -
guitools/fitDialog.py
r34ae302 rbbec827 138 138 139 139 # new data for the fit 140 self.file_data1 = Theory1D(x=[], y=[], dy=None) 141 self.file_data1.name = "Fit" 140 #self.file_data1 = Theory1D(x=[], y=[], dy=None) 141 #self.file_data1.name = "Fit" 142 #self.file_data1.ID = "isFit" 142 143 # Receive transformations of x and y 143 144 self.xtrans,self.ytrans= self.transform() … … 252 253 253 254 # Create new data plottable with result 254 self.file_data1.x =[]255 self.file_data1.y =[]256 self.file_data1.x =tempx257 self.file_data1.y =tempy258 self.file_data1.dx=None259 self.file_data1.dy=None255 #self.file_data1.x =[] 256 #self.file_data1.y =[] 257 #self.file_data1.x =tempx 258 #self.file_data1.y =tempy 259 #self.file_data1.dx=None 260 #self.file_data1.dy=None 260 261 #Load the view with the new values 261 self.file_data1.reset_view()262 #self.file_data1.reset_view() 262 263 263 264 #Send the data to display to the PlotPanel 264 self.push_data(self.file_data1,xminView,xmaxView) 265 #self.push_data(self.file_data1,xminView,xmaxView) 266 self.push_data(tempx,tempy,xminView,xmaxView) 265 267 266 268 # Display the fitting value on the Fit Dialog -
guitools/plottables.py
r34ae302 rbbec827 204 204 "title":""} 205 205 self.plottables = {} 206 206 def setGraph(self,listofplottable): 207 self.plottables = listofplottable 207 208 def _make_labels(self): 208 209 # Find groups of related plottables … … 386 387 self._yunit = "" 387 388 389 388 390 def set_View(self,x,y): 389 391 """ Load View """ … … 445 447 dx = None 446 448 dy = None 447 449 ID = "" 448 450 449 451 def __init__(self, x=None, y=None, dx=None, dy=None): … … 611 613 tempy=[] 612 614 tempdy=[] 615 if self.dx==None: 616 self.dx=numpy.zeros(len(self.x)) 617 if self.dy==None: 618 self.dy=numpy.zeros(len(self.y)) 613 619 for i in range(len(self.x)): 614 620 if ( self.x[i] >= xmin ) and ( self.x[i] <= xmax ): … … 635 641 """ 636 642 self.name = "data" 643 self.ID= "" 637 644 self.x = x 638 645 self.y = y … … 673 680 self.y = y 674 681 self.dy = dy 675 682 self.ID= "" 683 self.xaxis( 'q', 'A') 684 self.yaxis( 'intensity', 'cm') 676 685 self.view = self.View(self.x, self.y, None, self.dy) 677 686 def render(self,plot,**kw):
Note: See TracChangeset
for help on using the changeset viewer.