Changeset 54cc36a in sasview
- Timestamp:
- Jan 21, 2009 6:43:48 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:
- fe060f7
- Parents:
- 32673ac
- Location:
- guiframe/local_perspectives/plotting
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/AzimutSlicer.py
ref0c170 r54cc36a 26 26 self.markers = [] 27 27 self.axes = axes 28 self.qmax = self.base. qmax28 self.qmax = self.base.data2D.xmax 29 29 self.connect = self.base.connect 30 30 … … 42 42 self.inner_circle = ArcInteractor(self, self.base.subplot, zorder=zorder, r=self.qmax/2.0,theta1= theta1, 43 43 theta2=theta2) 44 self.inner_circle.qmax = self. base.qmax44 self.inner_circle.qmax = self.qmax 45 45 self.outer_circle = ArcInteractor(self, self.base.subplot, zorder=zorder+1, r=self.qmax/1.8,theta1= theta1, 46 46 theta2=theta2) 47 self.outer_circle.qmax = self. base.qmax*1.247 self.outer_circle.qmax = self.qmax*1.2 48 48 #self.outer_circle.set_cursor(self.base.qmax/1.8, 0) 49 49 from Edge import RadiusInteractor -
guiframe/local_perspectives/plotting/LineSlicer.py
ref0c170 r54cc36a 29 29 self.axes = axes 30 30 self._mouse_x = 0 31 self._mouse_y = self.base. qmax/231 self._mouse_y = self.base.data2D.xmax/2 32 32 self._save_x = 0 33 self._save_y = self.base. qmax/233 self._save_y = self.base.data2D.xmax/2 34 34 self.scale = 10.0 35 35 -
guiframe/local_perspectives/plotting/Plotter2D.py
rffd23b5 r54cc36a 32 32 import pylab 33 33 from Plotter1D import PanelMenu 34 34 #import boxSum 35 from sans.guicomm.events import EVT_SLICER_PARS_UPDATE 35 36 class ModelPanel2D( ModelPanel1D): 36 37 """ … … 71 72 # Beam stop 72 73 self.beamstop_radius = DEFAULT_BEAM 73 # Slicer 74 """ 75 if data2d.xmax==None: 76 data2d.xmax=DEFAULT_QMAX+self.qstep*0.01 77 78 self.qmax = data2d.xmax 79 if data2d.ymax==None: 80 data2d.ymax=DEFAULT_QMAX+self.qstep*0.01 81 self.imax = data2d.ymax 82 """ 83 #self.radius = math.sqrt(data2d.) 84 #self.qstep = DEFAULT_QSTEP 85 #print "panel2D qmax",self.qmax, 86 87 #self.x = pylab.arange(-1*self.qmax, self.qmax+self.qstep*0.01, self.qstep) 88 #self.y = pylab.arange(-1*self.imax, self.imax+self.qstep*0.01, self.qstep) 74 89 75 self.slicer_z = 5 90 76 self.slicer = None … … 92 78 self.axes_frozen = False 93 79 94 80 self.panel_slicer=None 81 #self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 95 82 ## Graph 96 83 self.graph = Graph() … … 98 85 self.graph.yaxis("\\rm{Intensity} ","cm^{-1}") 99 86 self.graph.render(self) 100 87 #self.Bind(boxSum.EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PARS) 88 self.Bind(EVT_SLICER_PARS_UPDATE, self._onEVT_SLICER_PARS) 89 90 91 def _onEVT_SLICER_PARS(self, event): 92 print "box move plotter2D", event.type, event.params 93 self.panel_slicer.set_slicer(event.type, event.params) 94 from sans.guicomm.events import SlicerPanelEvent 95 wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer)) 101 96 def _onEVT_1DREPLOT(self, event): 102 97 """ … … 308 303 event = self._getEmptySlicerEvent() 309 304 event.type = self.slicer.__class__.__name__ 310 print "event.type",event.type305 311 306 event.obj_class = self.slicer.__class__ 312 307 event.params = self.slicer.get_params() 313 try: 314 event.result= self.slicer.get_result() 315 except: 316 event.result= None 317 print "event.result", event.result 308 print "Plotter2D: event.type",event.type,event.params, self.parent 309 318 310 wx.PostEvent(self.parent, event) 319 311 … … 390 382 from boxSum import BoxSum 391 383 self.onClearSlicer(event) 392 wx.PostEvent(self.parent, InternalEvent(slicer= BoxSum)) 384 #wx.PostEvent(self.parent, InternalEvent(slicer= BoxSum)) 385 if not self.slicer == None: 386 self.slicer.clear() 387 self.slicer_z += 1 388 self.slicer = BoxSum(self, self.subplot, zorder=self.slicer_z) 389 print "come here" 390 self.subplot.set_ylim(self.data2D.ymin, self.data2D.ymax) 391 self.subplot.set_xlim(self.data2D.xmin, self.data2D.xmax) 392 393 self.update() 394 self.slicer.update() 395 396 # Post slicer event 397 event = self._getEmptySlicerEvent() 398 event.type = self.slicer.__class__.__name__ 399 400 401 event.obj_class = self.slicer.__class__ 402 event.params = self.slicer.get_params() 403 print "Plotter2D: event.type",event.type,event.params, self.parent 393 404 394 405 from slicerpanel import SlicerPanel 395 new_panel = SlicerPanel(self.parent, -1, style=wx.RAISED_BORDER) 396 397 from sans.guicomm.events import SlicerParameterEvent 398 wx.PostEvent(self.parent, SlicerParameterEvent (panel= new_panel)) 399 406 new_panel = SlicerPanel(parent= self.parent,id= -1,type=event.type, 407 params=event.params, style=wx.RAISED_BORDER) 408 #new_panel.set_slicer(self.slicer.__class__.__name__, 409 new_panel.window_caption=self.slicer.__class__.__name__+" "+ str(self.data2D.name) 410 411 self.panel_slicer= new_panel 412 413 wx.PostEvent(self.panel_slicer, event) 414 from sans.guicomm.events import SlicerPanelEvent 415 wx.PostEvent(self.parent, SlicerPanelEvent (panel= self.panel_slicer)) 416 print "finish box sum" 417 400 418 def onBoxavgX(self,event): 401 419 from boxSlicer import BoxInteractorX … … 406 424 new_panel = SlicerPanel(self.parent, -1, style=wx.RAISED_BORDER) 407 425 408 from sans.guicomm.events import SlicerPa rameterEvent409 wx.PostEvent(self.parent, SlicerPa rameterEvent (panel= new_panel))426 from sans.guicomm.events import SlicerPanelEvent 427 wx.PostEvent(self.parent, SlicerPanelEvent (panel= new_panel)) 410 428 411 429 def onBoxavgY(self,event): -
guiframe/local_perspectives/plotting/SectorSlicer.py
rfbd0bece r54cc36a 152 152 phimin = self.right_line.theta+math.pi 153 153 phimax = self.left_line.theta+math.pi 154 154 print "sector Q", radius 155 155 sect = SectorQ(r_min=0.0, r_max= radius , phi_min=phimin, phi_max=phimax) 156 156 #sect = SectorQ(r_min=-1*radius , r_max= radius , phi_min=phimin, phi_max=phimax) -
guiframe/local_perspectives/plotting/SlicerParameters.py
r0f6d05f8 r54cc36a 53 53 @param event: EVT_SLICER event 54 54 """ 55 print "went here" 55 56 event.Skip() 56 57 if event.obj_class==None: -
guiframe/local_perspectives/plotting/boxSum.py
r2a3a890 r54cc36a 16 16 import SlicerParameters 17 17 import wx 18 18 #(SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE) = wx.lib.newevent.NewEvent() 19 from sans.guicomm.events import SlicerParamUpdateEvent 19 20 class BoxSum(_BaseInteractor): 20 21 """ … … 64 65 65 66 66 self.connect_markers([])67 #self.connect_markers([]) 67 68 68 69 self.update() … … 70 71 71 72 # Bind to slice parameter events 73 print "box sum self.base.parent",self.base.parent 72 74 self.base.parent.Bind(SlicerParameters.EVT_SLICER_PARS, self._onEVT_SLICER_PARS) 73 74 75 75 76 def _onEVT_SLICER_PARS(self, event): 76 77 #printEVT("AnnulusSlicer._onEVT_SLICER_PARS") … … 145 146 # Compute data 146 147 print 147 """148 148 149 data = self.base.data2D 149 150 from DataLoader.manipulations import Boxavg 150 151 radius = math.sqrt(math.pow(self.qmax,2)+math.pow(self.qmax,2)) 151 x_min= self. left_line.x152 x_max= self. right_line.x153 y_min= self. bottom_line.y154 y_max= self. top_line.y152 x_min= self.vertical_lines.x2 153 x_max= self.vertical_lines.x1 154 y_min= self.vertical_lines.y2 155 y_max= self.vertical_lines.y1 155 156 box = Boxavg (x_min=x_min, x_max=x_max, y_min=y_min, y_max=y_max) 156 157 self.count, self.error = box(self.base.data2D) 157 158 print "count, error",self.count, self.error 158 """ 159 159 160 160 def moveend(self, ev): 161 161 self.base.thaw_axes() 162 163 162 # Post paramters 163 self._post_data() 164 """ 164 165 event = SlicerParameters.SlicerParameterEvent() 165 166 event.type = self.__class__.__name__ 166 167 print "event type boxsum: ", event.type 167 168 event.params = self.get_params() 168 169 wx.PostEvent(self.base.parent, event) 170 171 self._post_data() 169 wx.PostEvent(self.base, event) 170 """ 171 self.type= self.__class__.__name__ 172 params= self.get_params() 173 event = SlicerParamUpdateEvent(type=self.type, params=params) 174 wx.PostEvent(self.base, event) 175 172 176 173 177 def restore(self): … … 224 228 width=x_max, 225 229 height=y_max) 226 227 228 230 self.vertical_lines.update(center= self.center, 229 231 width=x_max, … … 289 291 self.connect_markers([self.center_marker]) 290 292 self.update() 291 292 293 293 294 def set_layer(self, n): 294 295 self.layernum = n … … 299 300 try: 300 301 self.center.remove() 302 self.center_marker.remove() 301 303 except: 302 304 # Old version of matplotlib … … 451 453 self.clear_markers() 452 454 try: 455 self.right_marker.remove() 453 456 self.right_line.remove() 454 457 self.left_line.remove() … … 640 643 self.clear_markers() 641 644 try: 645 self.top_marker.remove() 642 646 self.bottom_line.remove() 643 647 self.top_line.remove() -
guiframe/local_perspectives/plotting/plotting.py
rffd23b5 r54cc36a 39 39 ## Plot panels 40 40 self.plot_panels = [] 41 42 41 43 42 def populate_menu(self, id, parent): 44 43 """ … … 61 60 self.parent.Bind(EVT_NEW_PLOT, self._on_plot_event) 62 61 # We have no initial panels for this plug-in 62 63 63 return [] 64 64 65 65 66 def get_perspective(self): -
guiframe/local_perspectives/plotting/slicerpanel.py
raa1b747 r54cc36a 20 20 CENTER_PANE = False 21 21 22 def __init__(self, parent, *args, **kwargs): 23 wx.Panel.__init__(self, parent, *args, **kwargs) 24 self.params = {} 22 def __init__(self, parent,id=-1,type=None, params={}, *args, **kwargs): 23 wx.Panel.__init__(self, parent,id, *args, **kwargs) 24 print "panel created" 25 self.params = params 25 26 self.parent = parent 26 self.type = None27 self.type = type 27 28 self.listeners = [] 28 29 self.parameters = [] 29 30 self.bck = wx.GridBagSizer(5,5) 30 31 self.SetSizer(self.bck) 31 32 title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT) 33 self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 34 32 if type==None and params==None: 33 title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT) 34 self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 35 else: 36 self.set_slicer( type, params) 35 37 # Bindings 38 #self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 36 39 self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 37 40 self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) … … 44 47 @param event: EVT_SLICER event 45 48 """ 49 print "went here panel" 46 50 event.Skip() 47 51 if event.obj_class==None: … … 58 62 self.bck.Clear(True) 59 63 self.type = type 60 64 print "in set slicer", type, params 61 65 if type==None: 62 #title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT)63 #self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15)66 title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT) 67 self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 64 68 65 #else:69 else: 66 70 title = wx.StaticText(self, -1, "Slicer Parameters", style=wx.ALIGN_LEFT) 67 71 self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) … … 91 95 self.bck.Fit(self) 92 96 self.parent.GetSizer().Layout() 97 def onParamChange(self, evt): 98 print "parameters changed" 99 evt.Skip() 100 #if evt.type == "UPDATE": 101 for item in self.parameters: 102 if item[0] in evt.params: 103 item[1].SetValue("%-5.3g" %evt.params[item[0]]) 104 item[1].Refresh() 105 93 106 94 def o nParamChange(self, evt):107 def old_onParamChange(self, evt): 95 108 evt.Skip() 96 109 if evt.type == "UPDATE":
Note: See TracChangeset
for help on using the changeset viewer.