Ejemplo n.º 1
0
    def __init__(self, parent):
        QMainWindow.__init__(self, parent)

        self.setMinimumWidth(750)
        self.setMinimumHeight(500)

        self.setWindowTitle("Plotting")
        self.activateWindow()

        self.__plot_data = None

        self.__plot_metrics_tracker = PlotMetricsTracker()
        self.__plot_metrics_tracker.addScaleType("value", float)
        self.__plot_metrics_tracker.addScaleType("depth", float)
        self.__plot_metrics_tracker.addScaleType("pca", float)
        self.__plot_metrics_tracker.addScaleType("index", int)
        self.__plot_metrics_tracker.addScaleType("count", int)
        self.__plot_metrics_tracker.addScaleType("time", CTime)

        self.__central_tab = QTabWidget()
        self.__central_tab.currentChanged.connect(self.currentPlotChanged)

        self.__plot_panel_tracker = PlotPanelTracker(self.__central_tab)
        self.__plot_panel_tracker.addKeyTypeTester(
            "summary", PlotDataFetcher.isSummaryKey)
        self.__plot_panel_tracker.addKeyTypeTester(
            "block", PlotDataFetcher.isBlockObservationKey)
        self.__plot_panel_tracker.addKeyTypeTester("gen_kw",
                                                   PlotDataFetcher.isGenKWKey)
        self.__plot_panel_tracker.addKeyTypeTester(
            "gen_data", PlotDataFetcher.isGenDataKey)
        self.__plot_panel_tracker.addKeyTypeTester(
            "custom_pca", PlotDataFetcher.isCustomPcaDataKey)

        central_widget = QWidget()
        central_layout = QVBoxLayout()
        central_layout.setContentsMargins(0, 0, 0, 0)
        central_widget.setLayout(central_layout)

        self.__toolbar = PlotToolBar()
        self.__toolbar.resetScalesClicked.connect(self.resetCurrentScales)

        central_layout.addWidget(self.__toolbar)
        central_layout.addWidget(self.__central_tab)

        self.setCentralWidget(central_widget)

        self.__plot_panels = []
        """:type: list of PlotPanel"""

        self.addPlotPanel("Ensemble plot",
                          "gui/plots/simple_plot.html",
                          short_name="EP")
        self.addPlotPanel("Ensemble overview plot",
                          "gui/plots/simple_overview_plot.html",
                          short_name="EOP")
        self.addPlotPanel("Ensemble statistics",
                          "gui/plots/ensemble_statistics_plot.html",
                          short_name="ES")
        self.addPlotPanel("Histogram",
                          "gui/plots/histogram.html",
                          short_name="Histogram")
        self.addPlotPanel("Distribution",
                          "gui/plots/gen_kw.html",
                          short_name="Distribution")
        self.addPlotPanel("RFT plot", "gui/plots/rft.html", short_name="RFT")
        self.addPlotPanel("RFT overview plot",
                          "gui/plots/rft_overview.html",
                          short_name="oRFT")
        self.addPlotPanel("Ensemble plot",
                          "gui/plots/gen_data.html",
                          short_name="epGenData")
        self.addPlotPanel("Ensemble overview plot",
                          "gui/plots/gen_data_overview.html",
                          short_name="eopGenData")
        self.addPlotPanel("Ensemble statistics",
                          "gui/plots/gen_data_statistics_plot.html",
                          short_name="esGenData")
        self.addPlotPanel("PCA plot", "gui/plots/pca.html", short_name="PCA")

        self.__data_type_keys_widget = DataTypeKeysWidget()
        self.__data_type_keys_widget.dataTypeKeySelected.connect(
            self.keySelected)
        self.addDock("Data types", self.__data_type_keys_widget)

        current_case = CaseSelectorModel().getCurrentChoice()
        self.__case_selection_widget = CaseSelectionWidget(current_case)
        self.__case_selection_widget.caseSelectionChanged.connect(
            self.caseSelectionChanged)
        plot_case_dock = self.addDock("Plot case",
                                      self.__case_selection_widget)

        self.__customize_plot_widget = CustomizePlotWidget()
        self.__customize_plot_widget.customPlotSettingsChanged.connect(
            self.plotSettingsChanged)
        customize_plot_dock = self.addDock("Customize",
                                           self.__customize_plot_widget)

        self.__toolbar.exportClicked.connect(self.exportActivePlot)
        self.__toolbar.plotScalesChanged.connect(self.plotSettingsChanged)
        self.__toolbar.reportStepChanged.connect(self.plotSettingsChanged)

        self.__exporter = None
        self.tabifyDockWidget(plot_case_dock, customize_plot_dock)

        plot_case_dock.show()
        plot_case_dock.raise_()

        self.__plot_cases = self.__case_selection_widget.getPlotCaseNames()
Ejemplo n.º 2
0
    def __init__(self, ert, parent):
        QMainWindow.__init__(self, parent)

        self.__ert = ert
        """:type: ert.enkf.enkf_main.EnKFMain"""

        self.setMinimumWidth(750)
        self.setMinimumHeight(500)

        self.setWindowTitle("Plotting")
        self.activateWindow()

        self.__central_tab = QTabWidget()
        self.__central_tab.currentChanged.connect(self.currentPlotChanged)

        central_widget = QWidget()
        central_layout = QVBoxLayout()
        central_layout.setContentsMargins(0, 0, 0, 0)
        central_widget.setLayout(central_layout)

        central_layout.addWidget(self.__central_tab)

        self.setCentralWidget(central_widget)

        key_manager = ert.getKeyManager()
        """:type: ert.enkf.key_manager.KeyManager """

        self.__plot_widgets = []
        """:type: list of PlotWidget"""

        self.__data_gatherers = []
        """:type: list of PlotDataGatherer """

        summary_gatherer = self.createDataGatherer(
            PDG.gatherSummaryData,
            key_manager.isSummaryKey,
            refcaseGatherFunc=PDG.gatherSummaryRefcaseData,
            observationGatherFunc=PDG.gatherSummaryObservationData)
        gen_data_gatherer = self.createDataGatherer(
            PDG.gatherGenDataData,
            key_manager.isGenDataKey,
            observationGatherFunc=PDG.gatherGenDataObservationData)
        gen_kw_gatherer = self.createDataGatherer(PDG.gatherGenKwData,
                                                  key_manager.isGenKwKey)
        custom_kw_gatherer = self.createDataGatherer(PDG.gatherCustomKwData,
                                                     key_manager.isCustomKwKey)

        self.addPlotWidget("Ensemble", plots.plotEnsemble,
                           [summary_gatherer, gen_data_gatherer])
        self.addPlotWidget("Statistics", plots.plotStatistics,
                           [summary_gatherer, gen_data_gatherer])
        self.addPlotWidget("Histogram", plots.plotHistogram,
                           [gen_kw_gatherer, custom_kw_gatherer])
        self.addPlotWidget("Gaussian KDE", plots.plotGaussianKDE,
                           [gen_kw_gatherer, custom_kw_gatherer])
        self.addPlotWidget("Distribution", plots.plotDistribution,
                           [gen_kw_gatherer, custom_kw_gatherer])

        self.__data_types_key_model = DataTypeKeysListModel(ert)

        self.__data_type_keys_widget = DataTypeKeysWidget(
            self.__data_types_key_model)
        self.__data_type_keys_widget.dataTypeKeySelected.connect(
            self.keySelected)
        self.addDock("Data types", self.__data_type_keys_widget)

        current_case = CaseSelectorModel().getCurrentChoice()
        self.__case_selection_widget = CaseSelectionWidget(current_case)
        self.__case_selection_widget.caseSelectionChanged.connect(
            self.keySelected)
        plot_case_dock = self.addDock("Plot case",
                                      self.__case_selection_widget)

        self.__customize_plot_widget = CustomizePlotWidget()
        self.__customize_plot_widget.customPlotSettingsChanged.connect(
            self.keySelected)
        customize_plot_dock = self.addDock("Customize",
                                           self.__customize_plot_widget)

        self.tabifyDockWidget(plot_case_dock, customize_plot_dock)

        plot_case_dock.show()
        plot_case_dock.raise_()

        self.__plot_widgets[self.__central_tab.currentIndex()].setActive()
        self.__data_type_keys_widget.selectDefault()