def __init__(self, main, title, ylabel, xlabel, yunit, xunit, itemlist=False, toolbar=False): super(Plot, self).__init__() self._plot = CurveDialog(toolbar=toolbar, wintitle=title, options=dict(ylabel=ylabel, yunit=yunit, xlabel=xlabel, xunit=xunit)) if itemlist: self._plot.get_itemlist_panel().show() set_size_policy(self, QSizePolicy.Expanding, QSizePolicy.Expanding) set_size_policy(self._plot, QSizePolicy.Expanding, QSizePolicy.Expanding) QtCore.QMetaObject.connectSlotsByName(self) self.setObjectName("Plot") main.addWidget(self._plot)
def __init__(self, *args, **kwargs): win = CurveDialog(edit=False, toolbar=True) # Make Plot plot = win.get_plot() self.verticalLayout_5.addWidget(plot) self.fret_line_plot = plot FRETLineGenerator.__init__(self, **kwargs) self.fit = mfm.FitQtThread() # the fit has to be a QtThread self.fit.data = self._data_points self.verbose = kwargs.get('verbose', chisurf.verbose) self.model_names = [str(model[0].name) for model in self.models] self.comboBox.addItems(self.model_names) self.model = self.current_model_index self.actionModel_changed.triggered.connect(self.onModelChanged) self.actionParameter_changed.triggered.connect(self.onParameterChanged) self.actionUpdate_Parameter.triggered.connect(self.update_parameter) self.actionCalculate_FRET_Line.triggered.connect(self.onCalculate) self.actionClear_plot.triggered.connect(self.onClearPlot) self.onModelChanged() self.update_parameter() self.hide()
def plot(*items): win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() for item in items: plot.add_item(item) win.show() win.exec_()
def taurusTrendMain(): from taurus.qt.qtgui.extra_guiqwt.builder import make from taurus.qt.qtgui.application import TaurusApplication from guiqwt.plot import CurveDialog from guiqwt.tools import HRangeTool import taurus.core.util.argparse import sys parser = taurus.core.util.argparse.get_taurus_parser() parser.set_usage("%prog [options] [<model1> [<model2>] ...]") parser.set_description("a taurus application for plotting 1D data sets") parser.add_option("-x", "--x-axis-mode", dest="x_axis_mode", default='d', metavar="t|d|e", help="interpret X values as timestamps (t), time deltas (d) or event numbers (e). Accepted values: t|d|e") parser.add_option("-b", "--buffer", dest="max_buffer_size", default='16384', help="maximum number of values to be plotted (when reached, the oldest values will be discarded)") parser.add_option("-a", "--use-archiving", action="store_true", dest="use_archiving", default=False) parser.add_option("--demo", action="store_true", dest="demo", default=False, help="show a demo of the widget") app = TaurusApplication( cmd_line_parser=parser, app_name="taurusplot2", app_version=taurus.Release.version) args = app.get_command_line_args() options = app.get_command_line_options() # check & process options stackModeMap = dict(t='datetime', d='deltatime', e='event') if options.x_axis_mode.lower() not in stackModeMap: parser.print_help(sys.stderr) sys.exit(1) stackMode = stackModeMap[options.x_axis_mode.lower()] if options.demo: args.append('eval:rand()') w = CurveDialog(edit=False, toolbar=True, wintitle="Taurus Trend") # set archiving if options.use_archiving: raise NotImplementedError('Archiving support is not yet implemented') w.setUseArchiving(True) w.add_tool(HRangeTool) # w.add_tool(TaurusCurveChooserTool) # w.add_tool(TimeAxisTool) if len(args) == 0: parser.print_help(sys.stderr) sys.exit(1) plot = w.get_plot() for a in args: item = TaurusTrendItem(stackMode=stackMode, buffersize=int(options.max_buffer_size)) plot.add_item(item) item.setModel(a) w.show() sys.exit(app.exec_())
def hist(data): """Plots histogram""" win = CurveDialog(edit=False, toolbar=True, wintitle="Histogram test") plot = win.get_plot() plot.add_item(make.histogram(data)) win.show() win.exec_()
def testTool(tool): from taurus.qt.qtgui.application import TaurusApplication from guiqwt.plot import CurveDialog app = TaurusApplication() win = CurveDialog(edit=False, toolbar=True) win.add_tool(tool) win.show() win.exec_()
def test(): """Test""" from numpy.random import normal data = normal(0, 1, (2000, )) win = CurveDialog(edit=False, toolbar=True, wintitle="Histogram test") plot = win.get_plot() plot.add_item(make.histogram(data)) win.show() win.exec_()
def __init__(self, title, x_axis='lin', x_label='x', y_label='y'): '''Init plot and curves''' self.plot_dlg = CurveDialog(edit=False, toolbar=False, wintitle=title, options=dict(xlabel=x_label, ylabel=y_label)) self.curves = [] self._x_axis = x_axis self._init_plot(x_label, y_label)
def __init__(self, parent): super(plotWidget, self).__init__() self.setAcceptDrops(True) # Just some button connected to `plot` method self.resize(500, 500) self.gWindow = CurveDialog(edit=False, toolbar=True) self.lay = QHBoxLayout() self.teditor = QLabel("Hello How are you") self.lay.addWidget(self.gWindow) self.setLayout(self.lay)
def test_graph_window_properly_added_to_MDI(self): self.graph = CurveDialog(wintitle="XXX YYH #DKLJLKFE Kadk #kdfd", icon="guiqwt.svg", edit=False, toolbar=True, options=None, parent=self.aw, panels=None) self.aw.addSubWindow(self.graph) self.assertEqual(self.aw.mdi.subWindowList()[-1].windowTitle(), self.graph.windowTitle())
def taurusCurveMain(): from taurus.qt.qtgui.extra_guiqwt.builder import make from taurus.qt.qtgui.application import TaurusApplication from guiqwt.plot import CurveDialog from guiqwt.tools import HRangeTool from taurus.qt.qtgui.extra_guiqwt.tools import TaurusCurveChooserTool, TimeAxisTool import taurus.core.util.argparse import sys parser = taurus.core.util.argparse.get_taurus_parser() parser.set_usage("%prog [options] [<model1> [<model2>] ...]") parser.set_description("a taurus application for plotting 1D data sets") app = TaurusApplication(cmd_line_parser=parser, app_name="taurusplot2", app_version=taurus.Release.version) args = app.get_command_line_args() win = CurveDialog(edit=False, toolbar=True, wintitle="TaurusPlot2", options=dict(title="", xlabel="xlabel", ylabel="ylabel")) win.add_tool(HRangeTool) win.add_tool(TaurusCurveChooserTool) win.add_tool(TimeAxisTool) plot = win.get_plot() for a in args: mx_my = a.split('|') n = len(mx_my) if n == 1: mx, my = None, mx_my[0] elif n == 2: mx, my = mx_my else: print "Invalid model: %s\n" % mx_my parser.print_help(sys.stderr) sys.exit(1) # cycle colors style = make.style.next() color = style[0] linestyle = style[1:] plot.add_item( make.curve(mx, my, color=color, linestyle=linestyle, linewidth=2)) win.get_itemlist_panel().show() plot.set_items_readonly(False) win.show() win.exec_()
def plot(*items): win = CurveDialog( edit=False, toolbar=True, wintitle="CurveDialog test", options=dict(title="Title", xlabel="xlabel", ylabel="ylabel"), ) plot = win.get_plot() for item in items: plot.add_item(item) # plot.set_axis_font("left", QFont("Courier")) win.get_itemlist_panel().show() plot.set_items_readonly(False) win.show() win.exec_()
def openCurveDialog(self): self.curvedialog = CurveDialog(edit=False, toolbar=True, wintitle="CurveDialog", options=dict(title="Title", xlabel="xlabel", ylabel="ylabel")) plot = self.curvedialog.get_plot() for array in self.csvmodel.array: item = make.curve(np.array(range(array.data.size)), array.data, color="b") plot.add_item(item) plot.set_axis_font("left", QFont("Courier")) self.curvedialog.get_itemlist_panel().show() plot.set_items_readonly(False) self.curvedialog.show()
def test(): """Test""" # -- Create QApplication import guidata _app = guidata.qapplication() # -- import numpy as np x = np.linspace(-10, 10, 200) y = x*np.exp(-x) item = make.curve(x, y, color="b") win = CurveDialog() plot = win.get_plot() plot.add_item(item) plot.set_axis_direction("left", True) plot.set_axis_direction("bottom", True) win.show() win.exec_()
def get_point(*args): """ Plot curves and return selected point(s) coordinates """ win = CurveDialog(_("Select one point then press OK to accept"), edit=True) default = win.add_tool(SelectPointTool, title="Test", on_active_item=True, mode="create", end_callback=test_function) default.activate() plot = win.get_plot() for cx, cy in args: item = make.mcurve(cx, cy) plot.add_item(item) plot.set_active_item(item) win.show() if win.exec_(): return default.get_coordinates()
def testFcn(self): x = np.linspace(0, 100, 1000) y = (np.random.rand(len(x)) - 0.5).cumsum() curve = make.curve(x, y, "ab", "b") range = make.range(0, 5) disp2 = make.computations(range, "TL", [(curve, "min=%.5f", lambda x, y: y.min()), (curve, "max=%.5f", lambda x, y: y.max()), (curve, "avg=%.5f", lambda x, y: y.mean())]) legend = make.legend("TR") items = [curve, range, disp2, legend] win = CurveDialog(edit=False, toolbar=True, parent=self) plot = win.get_plot() for item in items: plot.add_item(item) win.show()
def test(): """Test""" # -- Create QApplication import guidata _app = guidata.qapplication() # -- import numpy as np x = np.linspace(1, 10, 200) y = np.exp(-x) y[0] = 0 item = make.curve(x, y, color="b") item = make.error(x, y, None, y*.23) win = CurveDialog() plot = win.get_plot() plot.set_axis_scale("left", "log") plot.set_axis_scale("bottom", "log") # plot.set_axis_limits("left", 4.53999297625e-05, 22026.4657948) plot.add_item(item) win.show() win.exec_()
def __init__( self, verbose=False, settings_file=None ): super(TransientDecayGenerator, self).__init__() uic.loadUi( os.path.join( os.path.dirname( __file__ ), 'dye_diffusion2.ui' ), self ) if settings_file is None: settings_file = os.path.join( os.path.dirname( __file__ ), 'dye_diffusion.json' ) self.pdb_selector = PDBSelector() self.verticalLayout_10.addWidget(self.pdb_selector) self._settings_file = None self.settings_file = settings_file fp = open(settings_file) settings = json.load(fp) fp.close() DonorDecay.__init__(self, **settings) ## User-interface self.actionLoad_PDB.triggered.connect(self.onLoadPDB) self.actionLoad_settings.triggered.connect(self.onLoadSettings) self.doubleSpinBox_6.valueChanged.connect(self.onSimulationTimeChanged) self.doubleSpinBox_7.valueChanged.connect(self.onSimulationDtChanged) self.pushButton_3.clicked.connect(self.update_all) self.pushButton_4.clicked.connect(self.onSaveHist) self.pushButton_5.clicked.connect(self.onSaveAV) self.tmp_dir = tempfile.gettempdir() print("Temporary Directory: %s" % self.tmp_dir) ## Decay-Curve fd = CurveDialog(edit=False, toolbar=True) self.plot_decay = fd.get_plot() self.hist_curve = make.curve([1], [1], color="r", linewidth=1) self.unquenched_curve = make.curve([1], [1], color="b", linewidth=1) self.plot_decay.add_item(self.hist_curve) self.plot_decay.add_item(self.unquenched_curve) self.plot_decay.set_scales('lin', 'log') self.verticalLayout_2.addWidget(fd) ## Diffusion-Trajectory-Curve options = dict(title="Trajectory", xlabel="time [ns]", ylabel=("|R-<R>|")) fd = CurveDialog(edit=False, toolbar=True, options=options) self.plot_diffusion = fd.get_plot() self.diffusion_curve = make.curve([1], [1], color="b", linewidth=1) self.plot_diffusion.add_item(self.diffusion_curve) self.plot_diffusion.set_scales('lin', 'lin') self.verticalLayout_6.addWidget(fd) options = dict(xlabel="corr. time [ns]", ylabel=("A.Corr.(|R-<R>|)")) fd = CurveDialog(edit=False, toolbar=True, options=options) self.plot_autocorr = fd.get_plot() self.diffusion_autocorrelation = make.curve([1], [1], color="r", linewidth=1) self.plot_autocorr.add_item(self.diffusion_autocorrelation) self.plot_autocorr.set_scales('log', 'lin') self.verticalLayout_6.addWidget(fd) ## Protein Structure self.molview = MolQtWidget(self, enableUi=False) self.verticalLayout_4.addWidget(self.molview) self.diff_file = None self.av_slow_file = None self.av_fast_file = None
def __init__(self, fit): Plot.__init__(self, fit) self.layout = QtWidgets.QVBoxLayout(self) self.source = fit.surface self.d1 = np.array([0.0]) self.d2 = np.array([0.0]) top_left = QtWidgets.QFrame(self) top_left.setMaximumHeight(150) top_left.setFrameShape(QtWidgets.QFrame.StyledPanel) topl = QtWidgets.QVBoxLayout(top_left) top_right = QtWidgets.QFrame(self) top_right.setMaximumHeight(150) top_right.setFrameShape(QtWidgets.QFrame.StyledPanel) topr = QtWidgets.QVBoxLayout(top_right) bottom = QtWidgets.QFrame(self) bottom.setFrameShape(QtWidgets.QFrame.StyledPanel) bot = QtWidgets.QVBoxLayout(bottom) splitter1 = QtWidgets.QSplitter(QtCore.Qt.Horizontal) splitter1.addWidget(top_left) splitter1.addWidget(top_right) splitter2 = QtWidgets.QSplitter(QtCore.Qt.Vertical) splitter2.addWidget(splitter1) splitter2.addWidget(bottom) self.splitter = splitter2 self.layout.addWidget(splitter2) # x-axis win = CurveDialog() self.g_xplot = win.get_plot() self.g_xhist_m = make.histogram([], color='#ff00ff') self.g_xhist_a = make.histogram([], color='#6f0000') self.g_xplot.add_item(self.g_xhist_a) self.g_xplot.add_item(self.g_xhist_m) topl.addWidget(self.g_xplot) # y-axis win = CurveDialog() self.g_yplot = win.get_plot() self.g_yhist_m = make.histogram([], color='#00ff00') self.g_yhist_a = make.histogram([], color='#006600') self.g_yplot.add_item(self.g_yhist_a) self.g_yplot.add_item(self.g_yhist_m) topr.addWidget(self.g_yplot) # 2D-Histogram self.g_hist2d_m = make.histogram2D(np.array([0.0, 0.0]), np.array([0.0, 0.0]), logscale=True) self.g_hist2d_a = make.histogram2D(np.array([0.0, 0.0]), np.array([0.0, 0.0]), logscale=True) self.g_hist2d_m.set_color_map('hot') self.g_hist2d_a.set_color_map('Blues') #self.g_hist2d_m.set_interpolation(INTERP_LINEAR) #self.g_hist2d_a.set_interpolation(INTERP_LINEAR) win = ImageDialog(edit=False, toolbar=False) self.g_xyplot = win.get_plot() self.g_xyplot.set_aspect_ratio(lock=False) self.g_xyplot.add_item(self.g_hist2d_a) self.g_xyplot.add_item(self.g_hist2d_m) bot.addWidget(win) #selection self.selection_x = make.range(.25, .5) self.g_xplot.add_item(self.selection_x) self.selection_y = make.range(.25, .5) self.g_yplot.add_item(self.selection_y) self.pltControl = SurfacePlotWidget(self) self.widgets = [self.pltControl]
def __init__( self, *args, dye_diffusion_settings_file: str = None, verbose: bool = chisurf.verbose, **kwargs ): if dye_diffusion_settings_file is None: dye_diffusion_settings_file = os.path.join( chisurf.settings.package_directory, './settings/sample.json' ) settings = json.load( chisurf.fio.zipped.open_maybe_zipped( filename=dye_diffusion_settings_file, mode='r' ) ) super().__init__( *args, verbose=verbose, **settings ) QtWidgets.QWidget.__init__(self) uic.loadUi( os.path.join( os.path.dirname(os.path.abspath(__file__)), "dye_diffusion2.ui" ), self ) self.pdb_selector = PDBSelector() self.verticalLayout_10.addWidget(self.pdb_selector) self._settings_file = None self.settings_file = dye_diffusion_settings_file self.protein_quenching = chisurf.fluorescence.av.widgets.ProteinQuenchingWidget( k_quench_protein=kwargs.get('k_quench_protein', 5.0), ) self.verticalLayout_11.addWidget(self.protein_quenching) self.dye_parameter = chisurf.fluorescence.av.dynamic.DyeParameterWidget(**kwargs) self.verticalLayout_14.addWidget(self.dye_parameter) self.sticking = chisurf.fluorescence.av.dynamic.StickingParameterWidget() self.verticalLayout_13.addWidget(self.sticking) # # User-interface self.actionLoad_PDB.triggered.connect(self.onLoadPDB) self.actionLoad_settings.triggered.connect(self.onLoadSettings) self.actionSave_AV.triggered.connect(self.onSaveAV) self.actionLoad_settings.triggered.connect(self.onLoadSettings) self.actionUpdate_all.triggered.connect(self.update_model) self.actionSave_histogram.triggered.connect(self.onSaveHist) self.actionSave_trajectory.triggered.connect(self.onSaveTrajectory) self.doubleSpinBox_6.valueChanged.connect(self.onSimulationTimeChanged) self.doubleSpinBox_7.valueChanged.connect(self.onSimulationDtChanged) self.tmp_dir = tempfile.gettempdir() print("Temporary Directory: %s" % self.tmp_dir) ## Decay-Curve fd = CurveDialog(edit=False, toolbar=True) self.plot_decay = fd.get_plot() self.hist_curve = make.curve([1], [1], color="r", linewidth=1) self.unquenched_curve = make.curve([1], [1], color="b", linewidth=1) self.plot_decay.add_item(self.hist_curve) self.plot_decay.add_item(self.unquenched_curve) self.plot_decay.set_scales('lin', 'log') self.verticalLayout_2.addWidget(fd) ## Diffusion-Trajectory-Curve options = dict(title="Trajectory", xlabel="time [ns]", ylabel=("|R-<R>|")) fd = CurveDialog(edit=False, toolbar=True, options=options) self.plot_diffusion = fd.get_plot() self.diffusion_curve = make.curve([1], [1], color="b", linewidth=1) self.plot_diffusion.add_item(self.diffusion_curve) self.plot_diffusion.set_scales('lin', 'lin') self.verticalLayout_6.addWidget(fd) options = dict(xlabel="corr. time [ns]", ylabel=("A.Corr.(|R-<R>|)")) fd = CurveDialog(edit=False, toolbar=True, options=options) self.plot_autocorr = fd.get_plot() self.diffusion_autocorrelation = make.curve([1], [1], color="r", linewidth=1) self.plot_autocorr.add_item(self.diffusion_autocorrelation) self.plot_autocorr.set_scales('log', 'lin') self.verticalLayout_6.addWidget(fd) ## Protein Structure self.molview = MolQtWidget(self, enableUi=False) self.verticalLayout_4.addWidget(self.molview) self.diff_file = None self.av_slow_file = None self.av_fast_file = None self.hide()
import datetime class stockDataCollector(object): def __init__(self, stockName): super(stockDataCollector, self).__init__() self.stockName = stockName self.stockDataFrame = 0 self.start = datetime.datetime(1900, 1, 1) self.end = datetime.date.today() def _getStockdata(self): self.stockDataFrame = data.DataReader(self.stockName, 'yahoo', self.start, self.end) return self.stockDataFrame if __name__ == '__main__': _app = guidata.qapplication() main = stockDataCollector("AAPL") sro = main._getStockdata() x1 = sro.index x2 = x1.Date y1 = sro['Close'].values curve = make.curve(x1, y1, "ab", "b") gWindow = CurveDialog(edit=False, toolbar=False) plotw = gWindow.get_plot() plotw.add_item(curve) gWindow.show() gWindow.exec_()
def __init__(self, fit, d_scalex='lin', d_scaley='lin', r_scalex='lin', r_scaley='lin'): Plot.__init__(self) self.layout = QtGui.QVBoxLayout(self) self.fit = fit bottom = QtGui.QFrame(self) bottom.setFrameShape(QtGui.QFrame.StyledPanel) botl = QtGui.QVBoxLayout(bottom) top = QtGui.QFrame(self) top.setMaximumHeight(140) top.setFrameShape(QtGui.QFrame.StyledPanel) topl = QtGui.QVBoxLayout(top) splitter1 = QtGui.QSplitter(QtCore.Qt.Vertical) splitter1.addWidget(top) splitter1.addWidget(bottom) self.layout.addWidget(splitter1) # Data-Fit dialog fd = CurveDialog(edit=False, toolbar=True) #self.get_itemlist_panel().show() plot = fd.get_plot() self.data_curve = make.curve([1], [1], color="b", linewidth=1) self.irf_curve = make.curve([1], [1], color="r", linewidth=1) self.model_curve = make.curve([1], [1], color="g", linewidth=4) plot.add_item(self.data_curve) plot.add_item(self.irf_curve) plot.add_item(self.model_curve) self.dataPlot = plot botl.addWidget(fd) splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal) topl.addWidget(splitter1) # Residual dialog win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() plot.do_autoscale(True) self.residual_curve = make.curve([1], [1], color="r", linewidth=2) plot.add_item(self.residual_curve) self.chi2_label = make.label("", "R", (-10, 27), "R") plot.add_item(self.chi2_label) title = make.label("w.res.", "R", (0, -40), "R") plot.add_item(title) self.residualPlot = plot splitter1.addWidget(plot) win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() plot.do_autoscale(True) self.autocorr_curve = make.curve([1], [1], color="r", linewidth=2) plot.add_item(self.autocorr_curve) title = make.label("auto.cor.", "R", (0, -40), "R") plot.add_item(title) self.autoCorrPlot = plot splitter1.addWidget(plot) self.pltControl = linePlotWidget(self, d_scalex, d_scaley, r_scalex, r_scaley)
def __init__( self, fit: fitting.fit.FitGroup, f_scalex: str = 'log', f_scaley: str = 'lin', e_scalex: str = 'log', e_scaley: str = 'lin', *args, **kwargs ): self.fit = fit ## Distance distribution plot fd = CurveDialog(edit=False, toolbar=False) plot = fd.get_plot() self.p_rda_plot = plot self.verticalLayout_12.addWidget(fd) self.p_rda_curve = make.curve([1], [1], color="r", linewidth=2) plot.add_item(self.p_rda_curve) ## Fluorescence intensity plot win = CurveDialog(edit=False, toolbar=False) plot = win.get_plot() plot.do_autoscale(True) title = make.label("FDA,FD0", "R", (0, 10), "R") plot.add_item(title) self.fd0_curve = make.curve([1], [1], color="g", linewidth=2) self.fda_curve = make.curve([1], [1], color="r", linewidth=2) plot.add_item(self.fd0_curve) plot.add_item(self.fda_curve) self.fd_plot = plot self.fd_plot.set_scales(f_scalex, f_scaley) self.verticalLayout.addWidget(plot) ## Calculated E(t) plot win = CurveDialog(edit=False, toolbar=False) plot = win.get_plot() plot.do_autoscale(True) self.et_curve = make.curve([1], [1], color="b", linewidth=2) plot.add_item(self.et_curve) title = make.label("E(t)", "R", (0, 10), "R") plot.add_item(title) self.et_plot = plot self.et_plot.set_scales(e_scalex, e_scaley) self.verticalLayout_2.addWidget(plot) ## weighted-residuals of inversion win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() plot.do_autoscale(True) self.wres_curve = make.curve([1], [1], color="m", linewidth=2) plot.add_item(self.wres_curve) title = make.label("w.res", "R", (0, 10), "R") plot.add_item(title) self.wres_plot = plot self.wres_plot.set_scales('lin', 'lin') self.verticalLayout_3.addWidget(plot) ## L-Curve plot win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() plot.do_autoscale(True) self.l_curve_1 = make.curve([1], [1], color="k", linewidth=2) plot.add_item(self.l_curve_1) title = make.label("Reg.", "R", (0, 10), "R") plot.set_titles(ylabel='reg. par', xlabel='Chi2r') plot.add_item(title) self.l_curve_plot_1 = plot self.l_curve_plot_1.set_scales('lin', 'lin') self.verticalLayout_4.addWidget(self.l_curve_plot_1) win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() plot.do_autoscale(True) self.l_curve_2 = make.curve([1], [1], color="k", linewidth=2) plot.add_item(self.l_curve_2) title = make.label("L-Curve", "R", (0, 10), "R") plot.set_titles(ylabel='|x| (sol. norm)', xlabel='Chi2r') plot.add_item(title) self.l_curve_plot_2 = plot self.l_curve_plot_2.set_scales('log', 'log') self.verticalLayout_7.addWidget(self.l_curve_plot_2)
def __init__( self, fit: fitting.fit.FitGroup, d_scalex: str = 'lin', d_scaley: str = 'lin', r_scalex: str = 'lin', r_scaley: str = 'lin', **kwargs ): super(GlobalAnisotropy, self).__init__( fit=fit, **kwargs ) self.verbose = kwargs.get('verbose', chisurf.verbose) self.layout = QtWidgets.QVBoxLayout(self) self.fit = fit bottom = QtWidgets.QFrame(self) bottom.setFrameShape(QtWidgets.QFrame.StyledPanel) botl = QtWidgets.QVBoxLayout(bottom) top = QtWidgets.QFrame(self) top.setMaximumHeight(140) top.setFrameShape(QtWidgets.QFrame.StyledPanel) topl = QtWidgets.QVBoxLayout(top) splitter1 = QtWidgets.QSplitter(QtCore.Qt.Vertical) splitter1.addWidget(top) splitter1.addWidget(bottom) self.layout.addWidget(splitter1) # Data-Fit dialog fd = CurveDialog(edit=False, toolbar=True) #self.get_itemlist_panel().show() plot = fd.get_plot() self.data_curve_vv = make.curve([], [], color="b", linewidth=1) self.irf_curve_vv = make.curve([], [], color="r", linewidth=1) self.model_curve_vv = make.curve([], [], color="g", linewidth=4) self.data_curve_vh = make.curve([], [], color="c", linewidth=1) self.irf_curve_vh = make.curve([], [], color="m", linewidth=1) self.model_curve_vh = make.curve([], [], color="k", linewidth=4) plot.add_item(self.data_curve_vv) plot.add_item(self.irf_curve_vv) plot.add_item(self.model_curve_vv) plot.add_item(self.data_curve_vh) plot.add_item(self.irf_curve_vh) plot.add_item(self.model_curve_vh) self.dataPlot = plot botl.addWidget(fd) splitter1 = QtWidgets.QSplitter(QtCore.Qt.Horizontal) topl.addWidget(splitter1) # Residual dialog win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() plot.do_autoscale(True) self.residual_curve_vv = make.curve([], [], color="r", linewidth=2) self.residual_curve_vh = make.curve([], [], color="b", linewidth=2) plot.add_item(self.residual_curve_vv) plot.add_item(self.residual_curve_vh) self.chi2_label = make.label("", "R", (-10, 27), "R") plot.add_item(self.chi2_label) title = make.label("w.res.", "R", (0, -40), "R") plot.add_item(title) self.residualPlot = plot splitter1.addWidget(plot) win = CurveDialog(edit=False, toolbar=True) plot = win.get_plot() plot.do_autoscale(True) self.autocorr_curve_vv = make.curve([], [], color="r", linewidth=2) self.autocorr_curve_vh = make.curve([], [], color="b", linewidth=2) plot.add_item(self.autocorr_curve_vv) plot.add_item(self.autocorr_curve_vh) title = make.label("auto.cor.", "R", (0, -40), "R") plot.add_item(title) self.autoCorrPlot = plot splitter1.addWidget(plot) self.pltControl = LinePlotWidget( self, d_scalex, d_scaley, r_scalex, r_scaley )