def __init__(self, x_scale_factor=1.0, y_scale_factor=1.0): super(SRWPlot.Detailed2DWidget, self).__init__() self.x_scale_factor = x_scale_factor self.y_scale_factor = y_scale_factor self.plot_canvas = ImageView(parent=self) self.plot_canvas.setColormap({ "name": "gray", "normalization": "linear", "autoscale": True, "vmin": 0, "vmax": 0, "colors": 256 }) self.plot_canvas.setMinimumWidth(590 * x_scale_factor) self.plot_canvas.setMaximumWidth(590 * y_scale_factor) self.info_box = SRWPlot.InfoBoxWidget(x_scale_factor, y_scale_factor) layout = QGridLayout() layout.addWidget(self.info_box, 0, 1, 1, 1) layout.addWidget(self.plot_canvas, 0, 0, 1, 1) layout.setColumnMinimumWidth(0, 600 * x_scale_factor) layout.setColumnMinimumWidth(1, 230 * x_scale_factor) self.setLayout(layout)
def plot_xy_hybrid(self, progressBarValue, scaled_matrix, plot_canvas_index, title, xtitle, ytitle, var1, var2): if self.plot_canvas[plot_canvas_index] is None: self.plot_canvas[plot_canvas_index] = ImageView() self.plot_canvas[plot_canvas_index].setColormap({"name":"temperature", "normalization":"linear", "autoscale":True, "vmin":0, "vmax":0, "colors":256}) self.plot_canvas[plot_canvas_index].setMinimumWidth(590) self.plot_canvas[plot_canvas_index].setMaximumWidth(590) self.tab[plot_canvas_index].layout().addWidget(self.plot_canvas[plot_canvas_index]) factor1 = ShadowPlot.get_factor(var1, self.workspace_units_to_cm) factor2 = ShadowPlot.get_factor(var2, self.workspace_units_to_cm) xmin, xmax = min(scaled_matrix.x_coord), max(scaled_matrix.x_coord) ymin, ymax = min(scaled_matrix.y_coord), max(scaled_matrix.y_coord) dim_x, dim_y = scaled_matrix.shape() origin = (xmin*factor1, ymin*factor2) scale = (abs((xmax-xmin)/dim_x)*factor1, abs((ymax-ymin)/dim_y)*factor2) data_to_plot = [] for y_index in range(0, dim_y): x_values = [] for x_index in range(0, dim_x): x_values.append(scaled_matrix.z_values[x_index, y_index]) data_to_plot.append(x_values) self.plot_canvas[plot_canvas_index].setImage(numpy.array(data_to_plot), origin=origin, scale=scale) self.plot_canvas[plot_canvas_index].setGraphXLabel(xtitle) self.plot_canvas[plot_canvas_index].setGraphYLabel(ytitle) self.plot_canvas[plot_canvas_index].setGraphTitle(title) self.progressBarSet(progressBarValue)
def __init__(self, x_scale_factor=1.0, y_scale_factor=1.0): super(ImageViewWithFWHM, self).__init__() self.plot_canvas = ImageView(parent=self) self.set_plot_canvas_default_settings() self.info_box = InfoBoxWidget(x_scale_factor, y_scale_factor) layout = QGridLayout() layout.addWidget(self.info_box, 0, 1, 1, 1) layout.addWidget(self.plot_canvas, 0, 0, 1, 1) layout.setColumnMinimumWidth(0, 600 * x_scale_factor) layout.setColumnMinimumWidth(1, 230 * x_scale_factor) self.setLayout(layout)
def setUp(self): super(TestImageView, self).setUp() self.plot = ImageView() self.plot.show() self.qWaitForWindowExposed(self.plot)
def showCriticalMessage(message, parent=None): msgBox = QMessageBox() if not parent is None: msgBox.setParent(parent) msgBox.setIcon(QMessageBox.Critical) msgBox.setText(message) msgBox.setStandardButtons(QMessageBox.Ok) msgBox.exec_() from PyQt5.QtWidgets import QApplication if __name__ == "__main__": print(SRWPlot.get_SRW_label(1)) print(SRWPlot.get_SRW_label(2)) print(SRWPlot.get_SRW_label(3)) print("--", SRWPlot.get_SRW_label(5), "--") app = QApplication([]) widget = QWidget() layout = QVBoxLayout() layout.addWidget(ImageView()) widget.setLayout(layout) widget.show() app.exec_()