Changes in src/sas/qtgui/Plotting/Plotter2D.py [133812c7:c30822c] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotting/Plotter2D.py
r133812c7 rc30822c 107 107 zmax=zmax_2D_temp, show_colorbar=show_colorbar, 108 108 update=update) 109 110 self.updateCircularAverage() 109 111 110 112 def calculateDepth(self): … … 240 242 self.slicer_widget.show() 241 243 242 def onCircularAverage(self):243 """ 244 Perform circular averaging on Data2D244 def circularAverage(self): 245 """ 246 Calculate the circular average and create the Data object for it 245 247 """ 246 248 # Find the best number of bins … … 281 283 new_plot.id = "Circ avg " + self.data.name 282 284 new_plot.is_data = True 285 286 return new_plot 287 288 def onCircularAverage(self): 289 """ 290 Perform circular averaging on Data2D 291 """ 292 new_plot = self.circularAverage() 293 283 294 item = self._item 284 295 if self._item.parent() is not None: 285 296 item = self._item.parent() 297 286 298 GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id) 287 299 288 300 self.manager.communicator.plotUpdateSignal.emit([new_plot]) 289 290 301 self.manager.communicator.forcePlotDisplaySignal.emit([item, new_plot]) 291 302 292 # Show the plot 303 def updateCircularAverage(self): 304 """ 305 Update circular averaging plot on Data2D change 306 """ 307 if not hasattr(self,'_item'): return 308 item = self._item 309 if self._item.parent() is not None: 310 item = self._item.parent() 311 312 # Get all plots for current item 313 plots = GuiUtils.plotsFromModel("", item) 314 if plots is None: return 315 ca_caption = '2daverage'+self.data.name 316 # See if current item plots contain 2D average plot 317 has_plot = False 318 for plot in plots: 319 if plot.group_id is None: continue 320 if ca_caption in plot.group_id: has_plot=True 321 # return prematurely if no circular average plot found 322 if not has_plot: return 323 324 # Create a new plot 325 new_plot = self.circularAverage() 326 327 # Overwrite existing plot 328 GuiUtils.updateModelItemWithPlot(item, new_plot, new_plot.id) 329 # Show the new plot, if already visible 330 self.manager.communicator.plotUpdateSignal.emit([new_plot]) 293 331 294 332 def setSlicer(self, slicer): … … 536 574 self.plot(data=new_plot) 537 575 576 def onMplMouseDown(self, event): 577 """ 578 Display x/y/intensity on click 579 """ 580 # Check that the LEFT button was pressed 581 if event.button != 1: 582 return 583 584 if event.inaxes is None: 585 return 586 x_click = 0.0 587 y_click = 0.0 588 try: 589 x_click = float(event.xdata) # / size_x 590 y_click = float(event.ydata) # / size_y 591 except: 592 self.position = None 593 x_str = GuiUtils.formatNumber(x_click) 594 y_str = GuiUtils.formatNumber(y_click) 595 coord_str = "x: {}, y: {}".format(x_str, y_str) 596 self.manager.communicator.statusBarUpdateSignal.emit(coord_str) 538 597 539 598 class Plotter2D(QtWidgets.QDialog, Plotter2DWidget):
Note: See TracChangeset
for help on using the changeset viewer.