def __init__(self, plot_path, plot_config_path): QFrame.__init__(self) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.plot_figure = PlotFigure() self.canvas = FigureCanvas(self.plot_figure.getFigure()) self.canvas.setParent(self) self.canvas.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) size = QSize(297*2, 210*2) # A4 aspectratio self.canvas.setMaximumSize(size) self.canvas.setMinimumSize(size) self.setMaximumSize(size) self.setMinimumSize(size) self.popup = Popup(self) self.plot_config_loader = PlotSettingsLoader() self.plot_settings = PlotSettings() self.plot_settings.setPlotPath(plot_path) self.plot_settings.setPlotConfigPath(plot_config_path) self.connect(self.popup, SIGNAL('updateProgress(int)'), self.updateProgress) self.plot_context_data_fetcher = PlotContextDataFetcher() self.plot_context_data_fetcher.initialize(self.plot_context_data_fetcher.getModel()) self.plot_data_fetcher = PlotDataFetcher() self.plot_data_fetcher.initialize(self.plot_data_fetcher.getModel())
def test_read_file_all_wrong(self): data = "# SrU2F12 Raman spectrum\n# X = Freq (cm^-1); Y = Polycrystalline Raman intensity (arb. units)\n50 plop\nplip 100\n plop 100\n\n\n200 jhhhh hkhh\n plop 300 \n400 500 600 \n" x = [] y = [] self.canvas = PlotFigure() self.canvas.read_file(data) self.assertEqual(x, self.canvas.frequencies, "Wrong frequencies") self.assertEqual(y, self.canvas.intensities, "Wrong intensities")
def test_read_file(self): data = "# SrU2F12 Raman spectrum\n# X = Freq (cm^-1); Y = Polycrystalline Raman intensity (arb. units)\n486.40 211.39\n494.64 78.15\n504.37 181.35\n513.02 68.03\n534.32 30.33\n646.23 1000\n653.24 13.5" x = [486.40, 494.64, 504.37, 513.02, 534.32, 646.23, 653.24] y = [211.39, 78.15, 181.35, 68.03, 30.33, 1000, 13.5] self.canvas = PlotFigure() self.canvas.read_file(data) self.assertEqual(x, self.canvas.frequencies, "Wrong frequencies") self.assertEqual(y, self.canvas.intensities, "Wrong intensities")
def __init__(self): super().__init__() self.init_window() self.init_menubar() # File-Open self.canvas = PlotFigure() self.hbox3.addWidget(self.canvas) self.toolbar = NavigationToolbar(self.canvas, self) self.hbox2.addWidget(self.toolbar) self.init_checkbox_peaks() self.hbox4.addStretch(1) self.init_textline_peak_width()
def __init__(self): """Create a PlotView instance""" QFrame.__init__(self) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) # setup some default data values self.data = PlotData() self.data.x_data_type = "number" self.data.setValid(False) self.plot_figure = PlotFigure() self.plot_settings = PlotSettings() self.canvas = FigureCanvas(self.plot_figure.getFigure()) self.canvas.setParent(self) self.canvas.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.mouse_handler = MouseHandler(self)
def set_up(self): self.canvas = PlotFigure()