Changeset a5ca7ef in sasview for guiframe/local_perspectives
- Timestamp:
- Apr 17, 2010 4:35:05 PM (15 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:
- 7f66617
- Parents:
- 7068cc7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/masking.py
rb40439d9 ra5ca7ef 12 12 copyright 2008, University of Tennessee 13 13 """ 14 ##Todo: cleaning up, improving the maskplotpanel initialization, and testing. 14 15 import wx 15 16 import sys … … 17 18 import copy,numpy 18 19 from danse.common.plottools.PlotPanel import PlotPanel 20 from danse.common.plottools.plottables import Graph 19 21 from binder import BindArtist 20 22 from sans.guiframe.dataFitting import Data2D … … 79 81 80 82 # Panel for 2D plot 81 self.plotpanel = SANSplotpanel(self, -1, style=wx.TRANSPARENT_WINDOW)83 self.plotpanel = Maskplotpanel(self, -1, style=wx.TRANSPARENT_WINDOW) 82 84 self.cmap = DEFAULT_CMAP 83 85 ## Create Artist and bind it … … 208 210 self.update() 209 211 self.slicer_mask = self.slicer.update() 210 211 #wx.PostEvent(self, InternalEvent(slicer= BoxMask))212 212 213 213 … … 228 228 self.update() 229 229 self.slicer_mask = self.slicer.update() 230 #wx.PostEvent(self, InternalEvent(slicer= BoxMask))231 230 232 231 … … 245 244 self.subplot.set_xlim(self.data.xmin, self.data.xmax) 246 245 247 #mask = self.slicer.update()248 246 self.update() 249 247 self.slicer_mask = self.slicer.update() 250 #wx.PostEvent(self, InternalEvent(slicer= SectorMask)) 248 251 249 252 250 def onOuterSectorMask(self,event=None): … … 266 264 self.update() 267 265 self.slicer_mask = self.slicer.update() 268 #wx.PostEvent(self, InternalEvent(slicer= SectorMask)) 266 269 267 270 268 def onInnerRingMask(self, event=None): … … 281 279 self.subplot.set_ylim(self.data.ymin, self.data.ymax) 282 280 self.subplot.set_xlim(self.data.xmin, self.data.xmax) 283 #mask = self.slicer.update() 281 284 282 self.update() 285 283 self.slicer_mask = self.slicer.update() 286 287 #wx.PostEvent(self, InternalEvent(slicer= AnnulusInteractor)) 284 288 285 289 286 def onOuterRingMask(self, event=None): … … 314 311 315 312 self._check_display_mask(data.mask, event) 316 # Post slicer None event317 #event = self._getEmptySlicerEvent()318 #wx.PostEvent(self, event)319 313 320 314 def _check_display_mask(self, mask, event): … … 335 329 mask[self.slicer_mask==False] = True 336 330 337 #event = self._getEmptySlicerEvent()338 #wx.PostEvent(self, event)339 331 self._check_display_mask(mask, event) 340 332 … … 352 344 self.data.mask = mask 353 345 354 # Post slicer None event355 #event = self._getEmptySlicerEvent()356 #wx.PostEvent(self, event)357 346 # update mask plot 358 347 self._check_display_mask(mask, event) … … 370 359 mask = numpy.ones(len(self.data.mask), dtype=bool) 371 360 self.data.mask = mask 372 373 # Post slicer None event 374 #event = self._getEmptySlicerEvent() 375 #wx.PostEvent(self, event) 361 376 362 # update mask plot 377 363 self._check_display_mask(mask, event) … … 385 371 self.subplot.figure.canvas.draw() 386 372 self.slicer = None 387 388 # Post slicer None event389 #event = self._getEmptySlicerEvent()390 #wx.PostEvent(self, event)391 373 392 374 … … 464 446 465 447 #replot 466 448 ##This method not alway updating the plot(?): use manual plot 449 #self.newplot=Data2D(image=temp_data.data) 450 #self.newplot.setValues(temp_data) 451 #self.plotpanel.add_image(self.newplot) 452 #use this method 467 453 plot = self.plotpanel.image(data= temp_mask, 468 454 qx_data=self.data.qx_data, … … 515 501 pass 516 502 517 class SANSplotpanel(PlotPanel):503 class Maskplotpanel(PlotPanel): 518 504 519 505 def __init__(self, parent, id = -1, color = None,\ … … 527 513 # doesn't have a dictionary of handles for the plottables) 528 514 self.plots = {} 515 self.graph = Graph() 529 516 530 517 def add_toolbar(self): … … 544 531 def add_image(self, plot): 545 532 self.plots[plot.name] = plot 546 533 #init graph 534 self.gaph = Graph() 535 #add plot 547 536 self.graph.add(plot) 537 #add axes 548 538 self.graph.xaxis('\\rm{Q}_{x} ', 'A^{-1}') 549 539 self.graph.yaxis('\\rm{Q}_{y} ', 'A^{-1}') 540 #draw 550 541 self.graph.render(self) 551 542 self.subplot.figure.canvas.draw_idle() 552 #self.onResetGraph(None)543 553 544 def onMouseMotion(self, event): 554 545 """ … … 576 567 577 568 578 579 580 from DataLoader.readers.IgorReader import Reader581 582 class ViewApp(wx.App):583 def OnInit(self):584 frame = MaskPanel(None, -1, 'Mask Editor')585 data = Data2D()586 data = Reader().read('/test/MAR07232_rest.ASC')587 panel = frame(self, data=data)588 panel.Show(True)589 self.SetTopWindow(panel)590 591 return True592 593 594 569 if __name__ == "__main__": 595 570 app = ViewApp(0)
Note: See TracChangeset
for help on using the changeset viewer.