Created
August 17, 2018 10:00
-
-
Save astrofrog/485ebaa73ddec7a1774bf3a360a8b442 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qtpy.QtWidgets import QApplication | |
from specutils import Spectrum1D | |
from specviz.app import MainWindow | |
spec = Spectrum1D.read('gbt_1d.fits') | |
app = QApplication(['']) | |
window = MainWindow() | |
# Load data into specviz | |
window.workspace.model.add_data(spec, name='banana') | |
# Get current plot widget | |
plot_widget = window.workspace.current_plot_window.plot_widget | |
# Add data to plot | |
item = window.workspace._model.item(2) | |
source_index = plot_widget.proxy_model.sourceModel().indexFromItem(item) | |
proxy_index = plot_widget.proxy_model.mapFromSource(source_index) | |
plot_widget.add_plot(proxy_index, visible=True, initialize=True) | |
window.show() | |
app.exec_() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment