Changeset 56b22f9 in sasview for src/sas/qtgui/MainWindow/DataExplorer.py
- Timestamp:
- May 3, 2017 8:42:29 AM (8 years ago)
- Branches:
- 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
- Children:
- 31e4bb8
- Parents:
- 02ddfb4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
rd48cc19 r56b22f9 439 439 # Assure no multiple plots for the same ID 440 440 plot_to_show = data_list[0] 441 for plot in PlotHelper.currentPlots(): 442 if plot == plot_to_show.id: 443 return 444 445 new_plot = Plotter(self) 441 if plot_to_show.id in PlotHelper.currentPlots(): 442 return 443 446 444 # Now query the model item for available plots 447 445 filename = plot_to_show.filename 448 446 model = self.model if plot_to_show.is_data else self.theory_model 449 447 plots = GuiUtils.plotsFromFilename(filename, model) 450 for plot in plots: 451 new_plot.plot(plot) 452 self.plotAdd(new_plot) 448 plots = [(None, plot) for plot in plots] 449 self.plotData(plots) 450 451 def addDataPlot2D(self, plot_set, item): 452 plot2D = Plotter2D(self) 453 plot2D.item = item 454 plot2D.plot(plot_set) 455 self.addPlot(plot2D) 456 #============================================ 457 ## Attach silx 458 #from silx.gui import qt 459 #from silx.gui.plot import StackView 460 #sv = StackView() 461 #sv.setColormap("jet", autoscale=True) 462 #sv.setStack(plot_set.data.reshape(1,100,100)) 463 ##sv.setLabels(["x: -10 to 10 (200 samples)", 464 ## "y: -10 to 5 (150 samples)"]) 465 #sv.show() 466 #============================================ 467 468 def plotData(self, plots): 469 """ 470 Takes 1D/2D data and generates a single plot (1D) or multiple plots (2D) 471 """ 472 # Call show on requested plots 473 # All same-type charts in one plot 474 new_plot = Plotter(self) 475 476 for item, plot_set in plots: 477 if isinstance(plot_set, Data1D): 478 new_plot.plot(plot_set) 479 elif isinstance(plot_set, Data2D): 480 self.addDataPlot2D(plot_set, item) 481 else: 482 msg = "Incorrect data type passed to Plotting" 483 raise AttributeError, msg 484 485 if plots and \ 486 hasattr(new_plot, 'data') and \ 487 isinstance(new_plot.data, Data1D): 488 self.addPlot(new_plot) 453 489 454 490 def newPlot(self): 455 491 """ 456 Create a new matplotlib chart from selected data492 Select checked data and plot it 457 493 """ 458 494 # Check which tab is currently active … … 462 498 plots = GuiUtils.plotsFromCheckedItems(self.theory_model) 463 499 464 # Call show on requested plots 465 # All same-type charts in one plot 466 new_plot = Plotter(self) 467 468 def addDataPlot2D(plot_set, item): 469 plot2D = Plotter2D(self) 470 plot2D.item = item 471 plot2D.plot(plot_set) 472 self.plotAdd(plot2D) 473 #============================================ 474 ## Attach silx 475 #from silx.gui import qt 476 #from silx.gui.plot import StackView 477 #sv = StackView() 478 #sv.setColormap("jet", autoscale=True) 479 #sv.setStack(plot_set.data.reshape(1,100,100)) 480 ##sv.setLabels(["x: -10 to 10 (200 samples)", 481 ## "y: -10 to 5 (150 samples)"]) 482 #sv.show() 483 #============================================ 484 485 for item, plot_set in plots: 486 if isinstance(plot_set, Data1D): 487 new_plot.plot(plot_set) 488 elif isinstance(plot_set, Data2D): 489 addDataPlot2D(plot_set, item) 490 else: 491 msg = "Incorrect data type passed to Plotting" 492 raise AttributeError, msg 493 494 if plots and \ 495 hasattr(new_plot, 'data') and \ 496 isinstance(new_plot.data, Data1D): 497 self.plotAdd(new_plot) 498 499 def plotAdd(self, new_plot): 500 self.plotData(plots) 501 502 def addPlot(self, new_plot): 500 503 """ 501 504 Helper method for plot bookkeeping
Note: See TracChangeset
for help on using the changeset viewer.