Changeset 356aea78 in sasview for guiframe/local_perspectives/plotting
- Timestamp:
- Dec 12, 2008 6:39:35 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:
- b98db8c
- Parents:
- 3aae6b6
- Location:
- guiframe/local_perspectives/plotting
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/Arc.py
r2d107b8 r356aea78 72 72 while self.theta2 < self.theta1: self.theta2 += 2*math.pi 73 73 npts = int((self.theta2 - self.theta1)/(math.pi/120)) 74 75 76 77 74 78 for i in range(self.npts): 75 79 … … 89 93 self.inner_circle.set_data(x, y) 90 94 91 92 if self._inner_mouse_x <0: 93 self._inner_mouse_x= 0 94 self._inner_mouse_y= 0 95 """ 95 96 r= math.sqrt(math.pow(self._inner_mouse_x, 2)+math.pow(self._inner_mouse_y, 2)) 96 97 x1= r*math.cos(self.theta1) 97 98 y1= r*math.sin(self.theta1) 99 """ 98 100 #x1= self._inner_mouse_x*math.cos(self.theta1) 99 101 #y1= self._inner_mouse_x*math.sin(self.theta1) … … 101 103 #y2= r2*math.sin(self.theta1) 102 104 103 104 105 105 106 def save(self, ev): 106 107 """ … … 110 111 #self._inner_save_x = self._inner_mouse_x 111 112 #self._inner_save_y = self._inner_mouse_y 112 self._inner_save_x = self._inner_mouse_x 113 self._inner_save_y = self._inner_mouse_y 113 self._inner_save_x = ev.xdata 114 self._inner_save_y = ev.ydata 115 print "save value",self._inner_save_x ,self._inner_save_y 114 116 self.base.freeze_axes() 115 117 … … 129 131 Process move to a new position, making sure that the move is allowed. 130 132 """ 131 #print "ring move x, y", x,y133 print "ring move x, y", x,y 132 134 self._inner_mouse_x = x 133 135 self._inner_mouse_y = y -
guiframe/local_perspectives/plotting/DataPanel.py
r2d107b8 r356aea78 104 104 105 105 is_new = True 106 print "model panel name",event.plot.name106 #print "model panel name",event.plot.name 107 107 if event.plot.name in self.plots.keys(): 108 108 # Check whether the class of plottable changed 109 print "model panel",event.plot.name,event.plot.__class__109 #print "model panel",event.plot.name,event.plot.__class__ 110 110 if not event.plot.__class__==self.plots[event.plot.name].__class__: 111 111 self.graph.delete(self.plots[event.plot.name]) … … 346 346 group_id = None 347 347 348 348 349 def __init__(self, parent, id = -1,data2d=None, color = None,\ 349 350 dpi = None, style = wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs): … … 369 370 self.beamstop_radius = DEFAULT_BEAM 370 371 # Slicer 372 if data2d.xmax==None: 373 data2d.xmax=DEFAULT_QMAX 371 374 372 375 self.qmax = data2d.xmax 373 self.imax= data2d.ymax 376 if data2d.ymax==None: 377 data2d.ymax=DEFAULT_QMAX 378 self.imax = data2d.ymax 379 374 380 self.qstep = DEFAULT_QSTEP 375 self.x = pylab.arange(-self.qmax, self.qmax+self.qstep*0.01, self.qstep) 376 self.y = pylab.arange(-self.imax, self.imax+self.qstep*0.01, self.qstep) 381 print "panel2D qmax",self.qmax, 382 self.x = pylab.arange(-1*self.qmax, self.qmax+self.qstep*0.01, self.qstep) 383 self.y = pylab.arange(-1*self.imax, self.imax+self.qstep*0.01, self.qstep) 377 384 378 385 self.slicer_z = 5 … … 380 387 self.parent.Bind(EVT_INTERNAL, self._onEVT_INTERNAL) 381 388 self.axes_frozen = False 389 390 382 391 ## Graph 383 392 self.graph = Graph() … … 604 613 Perform sector averaging on Q 605 614 """ 615 606 616 from SectorSlicer import SectorInteractorQ 607 608 self.slicer_z += 1 609 self.slicer = SectorInteractorQ(self, self.subplot, zorder=self.slicer_z) 610 self.subplot.set_ylim(-self.qmax, self.qmax) 611 self.subplot.set_xlim(-self.qmax, self.qmax) 612 self.update() 613 self.slicer.update() 614 617 self.onClearSlicer(event) 618 wx.PostEvent(self.parent, InternalEvent(slicer= SectorInteractorQ)) 615 619 616 620 def onSectorPhi(self, event): … … 618 622 Perform sector averaging on Phi 619 623 """ 620 from SectorSlicer import SectorInteractor 621 622 self.slicer_z += 1 623 self.slicer = SectorInteractor(self, self.subplot, zorder=self.slicer_z) 624 self.subplot.set_ylim(-self.qmax, self.qmax) 625 self.subplot.set_xlim(-self.qmax, self.qmax) 626 self.update() 627 self.slicer.update() 624 from SectorSlicer import SectorInteractorPhi 625 self.onClearSlicer(event) 626 wx.PostEvent(self.parent, InternalEvent(slicer= SectorInteractorPhi)) 628 627 629 628 … … 700 699 self.graph.yaxis("\\rm{Intensity} ","cm^{-1}") 701 700 self.graph.render(self) 701 702 702 703 def onContextMenu(self, event): 703 704 # Slicer plot popup menu -
guiframe/local_perspectives/plotting/Edge.py
r2d107b8 r356aea78 27 27 self.save_theta= theta 28 28 #self.scale = 10.0 29 29 self.move_stop=False 30 self.theta_left=None 31 self.theta_right=None 30 32 self.arc1= arc1 31 33 self.arc2=arc2 … … 39 41 color=self.color, 40 42 visible=True)[0] 41 43 self.phi= theta 42 44 self.npts = 20 43 45 self.has_move= False … … 65 67 return self.theta 66 68 67 def update(self,r1=None, r2=None ):69 def update(self,r1=None, r2=None, theta_right=None, theta_left=None): 68 70 """ 69 71 Draw the new roughness on the graph. 70 72 """ 71 # Plot inner circle 73 self.theta_left=theta_left 74 self.theta_right=theta_right 72 75 if r1 !=None: 73 76 self.r1=r1 74 77 if r2!=None: 75 78 self.r2=r2 76 #print "update line ",self.r1,self.r2 77 #if self.theta <0: 78 # self.theta= 2*math.pi + self.theta 79 if theta_right!=None: 80 if theta_right < self.theta: 81 self.move_stop=True 82 else: 83 self.move_stop=False 84 if theta_left !=None: 85 if theta_left > self.theta: 86 self.move_stop=True 87 else: 88 self.move_stop=False 89 if theta_left ==None and theta_right==None: 90 self.move_stop=True 91 print "in the edge theta_right theta_left",theta_right,theta_left,self.theta 79 92 x1= self.r1*math.cos(self.theta) 80 93 y1= self.r1*math.sin(self.theta) … … 83 96 84 97 self.line.set(xdata=[x1,x2], ydata=[y1,y2]) 85 return 198 86 99 87 100 def save(self, ev): … … 107 120 Process move to a new position, making sure that the move is allowed. 108 121 """ 109 self.theta= math.atan2(y,x) 110 111 self.has_move= True 122 #print "on move theta left , theta right",self.theta_left,self.theta_right 123 theta= math.atan2(y,x) 124 print "on move theta left , theta right",self.theta_left,self.theta_right,theta 125 if self.theta_left !=None: 126 if self.theta_left >= theta: 127 print "went hier" 128 self.move_stop= True 129 if self.theta_right !=None: 130 if self.theta_right <= theta: 131 self.move_stop= True 132 133 if self.move_stop: 134 self.theta= math.atan2(y,x) 135 self.has_move= True 136 112 137 self.base.base.update() 113 138 -
guiframe/local_perspectives/plotting/SectorSlicer.py
r2d107b8 r356aea78 117 117 if self.inner_radius.has_move: 118 118 print "inner radius has moved" 119 self.inner_radius.update( )119 self.inner_radius.update(theta_left=self.outer_radius.get_radius()) 120 120 self.inner_circle.update(theta1=self.inner_radius.get_radius(), theta2=None) 121 121 self.outer_circle.update(theta1=self.inner_radius.get_radius(), theta2=None) 122 122 if self.outer_radius.has_move: 123 123 print "outer radius has moved" 124 self.outer_radius.update( )124 self.outer_radius.update(theta_right=self.inner_radius.get_radius()) 125 125 self.inner_circle.update(theta1=None, theta2=self.outer_radius.get_radius()) 126 126 self.outer_circle.update(theta1=None, theta2=self.outer_radius.get_radius()) … … 139 139 def post_data(self,new_sector ): 140 140 """ post data averaging in Q""" 141 rmin=self.inner_circle.get_radius() 142 rmax=self.outer_circle.get_radius() 143 phimin=self.inner_radius.get_radius() 144 phimax=self.outer_radius.get_radius() 141 if self.inner_circle.get_radius() < self.outer_circle.get_radius(): 142 rmin=self.inner_circle.get_radius() 143 rmax=self.outer_circle.get_radius() 144 else: 145 rmin=self.outer_circle.get_radius() 146 rmax=self.inner_circle.get_radius() 147 if self.inner_radius.get_radius() < self.outer_radius.get_radius(): 148 phimin=self.inner_radius.get_radius() 149 phimax=self.outer_radius.get_radius() 150 else: 151 phimin=self.outer_radius.get_radius() 152 phimax=self.inner_radius.get_radius() 153 154 print "phimin, phimax, rmin ,rmax",math.degrees(phimin), math.degrees(phimax), rmin ,rmax 145 155 #from DataLoader.manipulations import SectorQ 156 146 157 sect = new_sector(r_min=rmin, r_max=rmax, phi_min=phimin, phi_max=phimax) 147 158 sector = sect(self.base.data2D) … … 156 167 else: 157 168 dxw= None 158 169 159 170 new_plot = Data1D(x=sector.x,y=sector.y,dy=sector.dy,dxl=dxl,dxw=dxw) 160 171 new_plot.name = str(new_sector.__name__) +"("+ self.base.data2D.name+")" … … 168 179 new_plot.detector =self.base.data2D.detector 169 180 # If the data file does not tell us what the axes are, just assume... 170 new_plot.xaxis( self.base.data2D._xaxis,self.base.data2D._xunit)171 new_plot.yaxis( self.base.data2D._yaxis,self.base.data2D._yunit)172 new_plot.group_id = "sector"+self.base.data2D.name181 new_plot.xaxis("\\rm{Q}", 'rad') 182 new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 183 new_plot.group_id = str(new_sector.__name__)+self.base.data2D.name 173 184 wx.PostEvent(self.base.parent, NewPlotEvent(plot=new_plot, 174 185 title=str(new_sector.__name__) )) … … 243 254 from DataLoader.manipulations import SectorQ 244 255 self.post_data(SectorQ ) 256 257 258 class SectorInteractorPhi(SectorInteractor): 259 def __init__(self,base,axes,color='black', zorder=3): 260 SectorInteractor.__init__(self, base, axes, color=color) 261 self.base=base 262 self._post_data() 263 def _post_data(self): 264 from DataLoader.manipulations import SectorPhi 265 self.post_data(SectorPhi ) 266 267
Note: See TracChangeset
for help on using the changeset viewer.