def update_graph(self): self.marker.set_xdata(self.cube_dataview.x) self.marker.set_ydata(self.cube_dataview.y) plot_tools.initialize_graph(self.graph_axes, self.cube_data, self.cube_dataview) self.spectrum.clear_peaks() self.load_peaks() self.plot_peaks()
def make_frame(self): """populate screen""" self.main_frame = QtGui.QWidget() self.fig = plt.figure(figsize=(16.0, 6.0)) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self.main_frame) self.img_axes = self.fig.add_subplot(121) self.img = fit_plot_tools.initialize_image(self.img_axes, self.fit_data, self.fit_dataview) self.marker, = self.img_axes.plot(0,0,'wo') self.cbar = plt.colorbar(self.img) self.cbar.ax.set_picker(5) self.graph_axes = self.fig.add_subplot(122) self.img2 = plot_tools.initialize_graph(self.graph_axes, self.cube_data, self.cube_dataview) self.plot_peaks() self.mpl_toolbar = NavigationToolbar(self.canvas, self) self.dropdown_peaks = QtGui.QComboBox() self.dropdown_peaks.addItems(self.peak_list) self.dropdown_peaks.currentIndexChanged.connect(self.peak_changed) self.dropdown_variables = QtGui.QComboBox() self.dropdown_variables.addItems(self.variable_list) self.dropdown_variables.currentIndexChanged.connect(self.variable_changed) self.button_display_residuals = QtGui.QPushButton('Display Integrated\nResiduals') self.button_display_residuals.clicked.connect(self.display_residuals) self.button_display_attributes = QtGui.QPushButton('Display Peak\nAttributes') self.button_display_attributes.clicked.connect(self.display_attributes) self.label_min_filter = QtGui.QLabel('Min Filter') self.textbox_min_filter = QtGui.QLineEdit(str(-1)) self.textbox_min_filter.editingFinished.connect(self.update_filter_settings) self.label_max_filter = QtGui.QLabel('Max Filter') self.textbox_max_filter = QtGui.QLineEdit(str(1)) self.textbox_max_filter.editingFinished.connect(self.update_filter_settings) self.button_filter_from_residuals = QtGui.QPushButton('Filter From Residuals') self.button_filter_from_residuals.clicked.connect(self.filter_from_residuals) #self.button_test = QtGui.QPushButton('test') #self.button_test.clicked.connect(self.test) grid = QtGui.QGridLayout() grid.setSpacing(10) vbox1 = QtGui.QVBoxLayout() vbox1.addWidget(self.mpl_toolbar) vbox1.addWidget(self.canvas) filter_hbox1 = QtGui.QHBoxLayout() filter_hbox1.addWidget(self.label_max_filter) filter_hbox1.addWidget(self.textbox_max_filter) filter_hbox2 = QtGui.QHBoxLayout() filter_hbox2.addWidget(self.label_min_filter) filter_hbox2.addWidget(self.textbox_min_filter) vbox2 = QtGui.QVBoxLayout() vbox2.addWidget(self.dropdown_peaks) vbox2.addWidget(self.dropdown_variables) vbox2.addWidget(self.button_display_residuals) vbox2.addWidget(self.button_display_attributes) vbox2.addLayout(filter_hbox1) vbox2.addLayout(filter_hbox2) vbox2.addWidget(self.button_filter_from_residuals) #vbox2.addWidget(self.button_test) grid.addLayout(vbox1,0,0) grid.addLayout(vbox2,0,1) self.main_frame.setLayout(grid) self.setCentralWidget(self.main_frame) self.connect_events() self.connect_shortcuts() self.show()
def make_frame(self): """populate screen""" self.main_frame = QtGui.QWidget() self.fig = plt.figure(figsize=(16.0, 6.0)) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self.main_frame) self.img_axes = self.fig.add_subplot(121) self.img = fit_plot_tools.initialize_image(self.img_axes, self.fit_data, self.fit_dataview) self.marker, = self.img_axes.plot(0, 0, 'wo') self.cbar = plt.colorbar(self.img) self.cbar.ax.set_picker(5) self.graph_axes = self.fig.add_subplot(122) self.img2 = plot_tools.initialize_graph(self.graph_axes, self.cube_data, self.cube_dataview) self.plot_peaks() self.mpl_toolbar = NavigationToolbar(self.canvas, self) self.dropdown_peaks = QtGui.QComboBox() self.dropdown_peaks.addItems(self.peak_list) self.dropdown_peaks.currentIndexChanged.connect(self.peak_changed) self.dropdown_variables = QtGui.QComboBox() self.dropdown_variables.addItems(self.variable_list) self.dropdown_variables.currentIndexChanged.connect( self.variable_changed) self.button_display_residuals = QtGui.QPushButton( 'Display Integrated\nResiduals') self.button_display_residuals.clicked.connect(self.display_residuals) self.button_display_attributes = QtGui.QPushButton( 'Display Peak\nAttributes') self.button_display_attributes.clicked.connect(self.display_attributes) self.label_min_filter = QtGui.QLabel('Min Filter') self.textbox_min_filter = QtGui.QLineEdit(str(-1)) self.textbox_min_filter.editingFinished.connect( self.update_filter_settings) self.label_max_filter = QtGui.QLabel('Max Filter') self.textbox_max_filter = QtGui.QLineEdit(str(1)) self.textbox_max_filter.editingFinished.connect( self.update_filter_settings) self.button_filter_from_residuals = QtGui.QPushButton( 'Filter From Residuals') self.button_filter_from_residuals.clicked.connect( self.filter_from_residuals) #self.button_test = QtGui.QPushButton('test') #self.button_test.clicked.connect(self.test) grid = QtGui.QGridLayout() grid.setSpacing(10) vbox1 = QtGui.QVBoxLayout() vbox1.addWidget(self.mpl_toolbar) vbox1.addWidget(self.canvas) filter_hbox1 = QtGui.QHBoxLayout() filter_hbox1.addWidget(self.label_max_filter) filter_hbox1.addWidget(self.textbox_max_filter) filter_hbox2 = QtGui.QHBoxLayout() filter_hbox2.addWidget(self.label_min_filter) filter_hbox2.addWidget(self.textbox_min_filter) vbox2 = QtGui.QVBoxLayout() vbox2.addWidget(self.dropdown_peaks) vbox2.addWidget(self.dropdown_variables) vbox2.addWidget(self.button_display_residuals) vbox2.addWidget(self.button_display_attributes) vbox2.addLayout(filter_hbox1) vbox2.addLayout(filter_hbox2) vbox2.addWidget(self.button_filter_from_residuals) #vbox2.addWidget(self.button_test) grid.addLayout(vbox1, 0, 0) grid.addLayout(vbox2, 0, 1) self.main_frame.setLayout(grid) self.setCentralWidget(self.main_frame) self.connect_events() self.connect_shortcuts() self.show()
def create_main_frame(self): self.main_frame = QtGui.QWidget() # Figures self.fig = plt.figure(figsize=(16.0, 6.0)) self.canvas = FigureCanvas(self.fig) self.canvas.setParent(self.main_frame) self.img_axes = self.fig.add_subplot(121) self.img = plot_tools.initialize_image(self.img_axes, self.data, self.dataview) self.marker, = self.img_axes.plot(0, 0, 'wo') self.cbar = plt.colorbar(self.img) self.set_color_bar_settings() self.graph_axes = self.fig.add_subplot(122) self.img2 = plot_tools.initialize_graph(self.graph_axes, self.data, self.dataview) # # Layout with box sizers left_spacer = QtGui.QWidget() left_spacer.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.slider = QtGui.QSlider(QtCore.Qt.Horizontal) self.set_slider_settings() # Create the navigation toolbar, tied to the canvas # self.mpl_toolbar = NavigationToolbar(self.canvas, self.main_frame) # Control self.imageslicelabel = QtGui.QLabel('Image Slice ev:') graphslicelabelx = QtGui.QLabel('Graph Slice X Coordinate:') graphslicelabely = QtGui.QLabel('Graph Slice Y Coordinate:') self.wavelength = QtGui.QRadioButton("wavelength", self) self.ev = QtGui.QRadioButton("ev", self) self.imageslice = QtGui.QLineEdit() self.maxcolor = QtGui.QLineEdit() self.mincolor = QtGui.QLineEdit() self.graphslicex = QtGui.QLineEdit() self.graphslicey = QtGui.QLineEdit() grid = QtGui.QGridLayout() grid.setSpacing(10) grid.addWidget(self.imageslicelabel, 1, 0) grid.addWidget(self.imageslice, 1, 1) grid.addWidget(graphslicelabelx, 1, 2) grid.addWidget(self.graphslicex, 1, 3) grid.addWidget(graphslicelabely, 2, 2) grid.addWidget(self.graphslicey, 2, 3) grid.addWidget(self.wavelength, 1, 4) grid.addWidget(self.ev, 2, 4) # Organization vbox = QtGui.QVBoxLayout() vbox.addWidget(self.canvas) hbox = QtGui.QHBoxLayout() vbox = QtGui.QVBoxLayout() vbox.addWidget(self.mpl_toolbar) vbox.addWidget(self.canvas) hbox.addWidget(left_spacer) hbox.addWidget(self.slider) vbox.addLayout(hbox) vbox.addLayout(grid) self.main_frame.setLayout(vbox) self.setCentralWidget(self.main_frame) self.connect_events() self.connect_shortcuts()