예제 #1
0
    def __init__(self):
        SimulationConfigPanel.__init__(self, EnsembleExperiment())

        layout = QFormLayout()

        case_model = CaseSelectorModel()
        case_selector = ComboChoice(case_model, "Current case", "init/current_case_selection")
        layout.addRow(case_selector.getLabel(), case_selector)

        runpath_model = RunPathModel()
        runpath_label = ActiveLabel(runpath_model, "Runpath", "config/simulation/runpath")
        layout.addRow(runpath_label.getLabel(), runpath_label)


        number_of_realizations_model = EnsembleSizeModel()
        number_of_realizations_label = ActiveLabel(number_of_realizations_model, "Number of realizations", "config/ensemble/num_realizations")
        layout.addRow(number_of_realizations_label.getLabel(), number_of_realizations_label)

        active_realizations_model = ActiveRealizationsModel()
        self.active_realizations_field = StringBox(active_realizations_model, "Active realizations", "config/simulation/active_realizations")
        self.active_realizations_field.setValidator(RangeStringArgument(number_of_realizations_model.getValue()))
        layout.addRow(self.active_realizations_field.getLabel(), self.active_realizations_field)

        self.active_realizations_field.validationChanged.connect(self.simulationConfigurationChanged)


        self.setLayout(layout)
예제 #2
0
    def addInitializeFromScratchTab(self):
        self.addTab("Initialize from scratch")

        case_model = CaseSelectorModel()
        case_selector = ComboChoice(case_model, "Target case",
                                    "init/current_case_selection")
        self.addRow(case_selector)

        row_group = RowGroup()

        parameter_model = InitializationParametersModel()
        parameter_check_list = CheckList(parameter_model, "Parameters",
                                         "init/select_parameters")
        parameter_check_list.setMaximumWidth(300)
        row_group.addWidget(parameter_check_list)

        member_model = InitializationMembersModel()
        member_check_list = CheckList(member_model, "Members",
                                      "init/select_members")
        member_check_list.setMaximumWidth(150)
        row_group.addWidget(member_check_list)

        self.addRow(row_group)

        self.addSpace(10)

        initialize_from_scratch = InitializeFromScratchModel()
        self.addRow(
            Button(initialize_from_scratch,
                   help_link="init/initialize_from_scratch"))

        self.addSpace(10)
예제 #3
0
    def addShowCaseInfo(self):
        self.addTab("Case Info")

        case_widget = HelpedWidget("Select case", "init/select_case_for_info")

        model = AllCasesModel()
        self.combo = QComboBox()
        self.combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
        self.combo.setMinimumContentsLength(20)
        self.combo.setModel(model)
        self.combo.currentIndexChanged.connect(self.showInfoForCase)

        case_widget.addWidget(self.combo)
        case_widget.addStretch()
        self.addRow(case_widget)

        area_widget = HelpedWidget("Case info", "init/selected_case_info")

        self.text_area = QTextEdit()
        self.text_area.setReadOnly(True)
        self.text_area.setMinimumHeight(300)

        area_widget.addWidget(self.text_area)
        area_widget.addStretch()
        self.addRow(area_widget)

        choice = CaseSelectorModel().getCurrentChoice()
        self.combo.setCurrentIndex(model.indexOf(choice))
예제 #4
0
    def addInitializeFromExistingTab(self):
        self.addTab("Initialize from existing")

        case_model = CaseSelectorModel()
        target_case_selector = ComboChoice(case_model, "Target case",
                                           "init/current_case_selection")
        self.addRow(target_case_selector)

        initialized_cases = ComboChoice(InitializedCaseSelectorModel(),
                                        "Source case", "init/source_case")
        self.addRow(initialized_cases)

        #self.addRow("State", "Analyzed/Forecast")

        timestep_group = RowGroup("Timestep")
        history_length = HistoryLengthModel()
        history_length_spinner = IntegerSpinner(history_length, "Timestep",
                                                "config/init/history_length")
        timestep_group.addWidget(history_length_spinner)

        initial = QToolButton()
        initial.setText("Initial")
        initial.clicked.connect(history_length.setToMin)
        timestep_group.addWidget(initial)

        end_of_time = QToolButton()
        end_of_time.setText("End of time")
        end_of_time.clicked.connect(history_length.setToMax)
        timestep_group.addWidget(end_of_time)

        timestep_group.addGroupStretch()

        self.addRow(timestep_group)

        self.addSpace(10)

        row_group = RowGroup()
        parameter_model = InitializationParametersModel()
        parameter_check_list = CheckList(parameter_model, "Parameters",
                                         "init/select_parameters")
        parameter_check_list.setMaximumWidth(300)
        row_group.addWidget(parameter_check_list)

        member_model = InitializationMembersModel()
        member_check_list = CheckList(member_model, "Members",
                                      "init/select_members")
        member_check_list.setMaximumWidth(150)
        row_group.addWidget(member_check_list)

        self.addRow(row_group)

        self.addSpace(10)

        initialize_from_existing = InitializeFromExistingCaseModel()
        self.addRow(
            Button(initialize_from_existing,
                   help_link="init/initialize_from_existing"))

        self.addSpace(10)
예제 #5
0
    def getChoices(self):
        """ @rtype: StringList """
        copy = list(self.__initialized_cases)
        current_case = CaseSelectorModel().getCurrentChoice()

        if current_case in copy:
            copy.remove(current_case)

        return copy
예제 #6
0
    def __init__(self):
        '''
        Fills in the input panel for sensitivity study parameters.
        '''

        SimulationConfigPanel.__init__(self, SensitivityStudy())

        layout = QFormLayout()

        case_model = CaseSelectorModel()
        case_selector = ComboChoice(case_model, "Current case",
                                    "init/current_case_selection")
        layout.addRow(case_selector.getLabel(), case_selector)

        runpath_model = RunPathModel()
        runpath_label = ActiveLabel(runpath_model, "Runpath",
                                    "config/simulation/runpath")
        layout.addRow(runpath_label.getLabel(), runpath_label)

        number_of_realizations_model = EnsembleSizeModel()
        number_of_realizations_label = ActiveLabel(
            number_of_realizations_model, "Number of realizations",
            "config/ensemble/num_realizations")
        layout.addRow(number_of_realizations_label.getLabel(),
                      number_of_realizations_label)

        sensitivity_target_case_format_model = SensitivityTargetCaseFormatModel(
        )
        self.iterated_target_case_format_field = StringBox(
            sensitivity_target_case_format_model, "Target case format",
            "config/simulation/sensitivity_target_case_format")
        self.iterated_target_case_format_field.setValidator(
            ProperNameFormatStringArgument())
        layout.addRow(self.iterated_target_case_format_field.getLabel(),
                      self.iterated_target_case_format_field)

        self.parameters_popup_button = QToolButton()
        self.parameters_popup_button.setIcon(
            util.resourceIcon("ide/small/cog_edit.png"))
        self.parameters_popup_button.clicked.connect(self.showParametersPopup)
        self.parameters_popup_button.setMaximumSize(20, 20)

        layout.addRow("Parameters:", self.parameters_popup_button)

        active_realizations_model = ActiveRealizationsModel()
        self.active_realizations_field = StringBox(
            active_realizations_model, "Active realizations",
            "config/simulation/active_realizations")
        self.active_realizations_field.setValidator(
            RangeStringArgument(number_of_realizations_model.getValue()))
        layout.addRow(self.active_realizations_field.getLabel(),
                      self.active_realizations_field)

        self.active_realizations_field.validationChanged.connect(
            self.simulationConfigurationChanged)

        self.setLayout(layout)
예제 #7
0
    def __init__(self):
        self.__current_case = None
        self.__initialized_cases = []

        CaseList().observable().attach(CaseList.LIST_CHANGED_EVENT,
                                       self.__caseListChanged)
        CaseSelectorModel().observable().attach(
            CaseSelectorModel.CURRENT_CHOICE_CHANGED_EVENT,
            self.__currentCaseChanged)
        self.__fetchCases()

        super(InitializedCaseSelectorModel, self).__init__()
예제 #8
0
    def runSimulation(self):
        case_name = CaseSelectorModel().getCurrentChoice()
        message = "Are you sure you want to use case '%s' for initialization of the initial ensemble when running the simulations?" % case_name
        start_simulations = QMessageBox.question(self, "Start simulations?", message, QMessageBox.Yes | QMessageBox.No )

        if start_simulations == QMessageBox.Yes:
            run_model = self.getCurrentSimulationMode()

            dialog = RunDialog(run_model)
            dialog.startSimulation()
            dialog.exec_()

            CaseList().externalModificationNotification() # simulations may have added new cases.
예제 #9
0
    def __init__(self):
        CaseSelectorModel().observable().attach(
            CaseSelectorModel.CURRENT_CHOICE_CHANGED_EVENT, self.__caseChanged)
        EnsembleSizeModel().observable().attach(
            EnsembleSizeModel.SPINNER_VALUE_CHANGED_EVENT, self.__caseChanged)
        InitializeFromScratchModel().observable().attach(
            InitializeFromScratchModel.BUTTON_TRIGGERED_EVENT,
            self.__caseChanged)
        InitializeFromExistingCaseModel().observable().attach(
            InitializeFromScratchModel.BUTTON_TRIGGERED_EVENT,
            self.__caseChanged)

        super(IsCaseInitializedModel, self).__init__()
예제 #10
0
    def __init__(self):
        QWidget.__init__(self)

        self.setMinimumWidth(500)
        self.setMinimumHeight(200)
        self.__dynamic = False

        self.setWindowTitle("Load results manually")
        self.activateWindow()

        layout = QFormLayout()
        current_case = CaseSelectorModel().getCurrentChoice()

        run_path_text = QTextEdit()
        run_path_text.setText(self.readCurrentRunPath())
        run_path_text.setDisabled(True)
        run_path_text.setFixedHeight(80)

        layout.addRow("Load data from current run path: ", run_path_text)

        self.__case_model = AllCasesModel()
        self.__case_combo = QComboBox()
        self.__case_combo.setSizeAdjustPolicy(
            QComboBox.AdjustToMinimumContentsLength)
        self.__case_combo.setMinimumContentsLength(20)
        self.__case_combo.setModel(self.__case_model)
        self.__case_combo.setCurrentIndex(
            self.__case_model.indexOf(current_case))
        layout.addRow("Load into case:", self.__case_combo)

        self.__active_realizations_model = LoadResultsRealizationsModel(
            EnsembleSizeModel().getValue())
        self.__active_realizations_field = StringBox(
            self.__active_realizations_model, "Realizations to load",
            "load_results_manually/Realizations")
        self.__active_realizations_field.setValidator(RangeStringArgument())
        layout.addRow(self.__active_realizations_field.getLabel(),
                      self.__active_realizations_field)

        self.__iterations_count = LoadResultsModel().getIterationCount()

        self._iterations_model = LoadResultsIterationsModel(
            self.__iterations_count)
        self._iterations_field = StringBox(self._iterations_model,
                                           "Iteration to load",
                                           "load_results_manually/iterations")
        self._iterations_field.setValidator(IntegerArgument())
        layout.addRow(self._iterations_field.getLabel(),
                      self._iterations_field)

        self.setLayout(layout)
예제 #11
0
    def trigger(self):
        if self.__export_widget is None:
            self.__export_widget = ref(ExportPanel(self.parent()))
            self.__exporter = Exporter()
            self.__export_widget().runExport.connect(self.__exporter.runExport)

        self.__export_widget().setSelectedCase(
            CaseSelectorModel().getCurrentChoice())
        self.__dialog = ref(
            ClosableDialog("Export", self.__export_widget(), self.parent()))
        self.__export_widget().updateExportButton.connect(
            self.__dialog().toggleButton)
        self.__dialog().addButton("Export", self.export)
        self.__dialog().show()
예제 #12
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setMinimumWidth(500)
        self.setMinimumHeight(200)
        self.__dynamic = False

        self.setWindowTitle("Export data")
        self.activateWindow()

        layout = QFormLayout()
        current_case = CaseSelectorModel().getCurrentChoice()

        self.__case_model = AllCasesModel()
        self.__case_combo = QComboBox()
        self.__case_combo.setSizeAdjustPolicy(
            QComboBox.AdjustToMinimumContentsLength)
        self.__case_combo.setMinimumContentsLength(20)
        self.__case_combo.setModel(self.__case_model)
        self.__case_combo.setCurrentIndex(
            self.__case_model.indexOf(current_case))
        layout.addRow("Select case:", self.__case_combo)

        self.__export_keyword_model = ExportKeywordModel()

        self.__kw_model = self.__export_keyword_model.getKeyWords()
        self.__keywords = QComboBox()
        self.__keywords.addItems(self.__kw_model)
        layout.addRow("Select keyword:", self.__keywords)

        self.__active_realizations_model = ExportRealizationsModel(
            EnsembleSizeModel().getValue())
        self.__active_realizations_field = StringBox(
            self.__active_realizations_model, "Active realizations",
            "config/simulation/active_realizations")
        self.__active_realizations_field.setValidator(RangeStringArgument())
        self.__active_realizations_field.validationChanged.connect(
            self.validateExportDialog)
        layout.addRow(self.__active_realizations_field.getLabel(),
                      self.__active_realizations_field)

        file_name_button = QToolButton()
        file_name_button.setText("Browse")
        file_name_button.clicked.connect(self.selectFileDirectory)

        self.__defaultPath = QDir.currentPath() + "/export"
        self.__file_name = QLineEdit()
        self.__file_name.setEnabled(False)
        self.__file_name.setText(self.__defaultPath)
        self.__file_name.textChanged.connect(self.validateExportDialog)
        self.__file_name.setMinimumWidth(250)

        file_name_layout = QHBoxLayout()
        file_name_layout.addWidget(self.__file_name)
        file_name_layout.addWidget(file_name_button)
        layout.addRow("Select directory to save files to:", file_name_layout)

        self.__gen_kw_file_types = ["Parameter list", "Template based"]
        self.__field_kw_file_types = ["Eclipse GRDECL", "RMS roff"]
        self.__gen_data_file_types = ["Gen data"]

        self.__file_type_model = self.__field_kw_file_types
        self.__file_type_combo = QComboBox()
        self.__file_type_combo.setSizeAdjustPolicy(QComboBox.AdjustToContents)
        self.__file_type_combo.addItems(self.__file_type_model)
        layout.addRow("Select file format:", self.__file_type_combo)

        self.__report_step = QLineEdit()
        layout.addRow("Report step:", self.__report_step)

        self.__gen_data_report_step_model = []
        self.__gen_data_report_step = QComboBox()
        layout.addRow("Report step:", self.__gen_data_report_step)

        self.setLayout(layout)
        self.__keywords.currentIndexChanged.connect(self.keywordSelected)
        self.keywordSelected()
예제 #13
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()
    def __init__(self):
        SimulationConfigPanel.__init__(self, IteratedEnsembleSmoother())

        layout = QFormLayout()

        case_model = CaseSelectorModel()
        case_selector = ComboChoice(case_model, "Current case",
                                    "init/current_case_selection")
        layout.addRow(case_selector.getLabel(), case_selector)

        run_path_model = RunPathModel()
        run_path_label = ActiveLabel(run_path_model, "Runpath",
                                     "config/simulation/runpath")
        layout.addRow(run_path_label.getLabel(), run_path_label)

        number_of_realizations_model = EnsembleSizeModel()
        number_of_realizations_label = ActiveLabel(
            number_of_realizations_model, "Number of realizations",
            "config/ensemble/num_realizations")
        layout.addRow(number_of_realizations_label.getLabel(),
                      number_of_realizations_label)

        num_iterations_model = NumberOfIterationsModel()
        num_iterations_spinner = IntegerSpinner(
            num_iterations_model, "Number of iterations",
            "config/simulation/number_of_iterations")
        layout.addRow(num_iterations_spinner.getLabel(),
                      num_iterations_spinner)

        iterated_target_case_format_model = TargetCaseFormatModel()
        self.iterated_target_case_format_field = StringBox(
            iterated_target_case_format_model, "Target case format",
            "config/simulation/iterated_target_case_format")
        self.iterated_target_case_format_field.setValidator(
            ProperNameFormatArgument())
        layout.addRow(self.iterated_target_case_format_field.getLabel(),
                      self.iterated_target_case_format_field)

        iterated_analysis_module_model = IteratedAnalysisModuleModel()
        self.iterated_analysis_module_choice = ComboChoice(
            iterated_analysis_module_model, "Analysis Module",
            "config/analysis/iterated_analysis_module")

        self.variables_popup_button = QToolButton()
        self.variables_popup_button.setIcon(
            util.resourceIcon("ide/small/cog_edit.png"))
        self.variables_popup_button.clicked.connect(self.showVariablesPopup)
        self.variables_popup_button.setMaximumSize(20, 20)

        self.variables_layout = QHBoxLayout()
        self.variables_layout.addWidget(self.iterated_analysis_module_choice,
                                        0, Qt.AlignLeft)
        self.variables_layout.addWidget(self.variables_popup_button, 0,
                                        Qt.AlignLeft)
        self.variables_layout.setContentsMargins(QMargins(0, 0, 0, 0))
        self.variables_layout.addStretch()

        layout.addRow(self.iterated_analysis_module_choice.getLabel(),
                      self.variables_layout)

        active_realizations_model = ActiveRealizationsModel()
        self.active_realizations_field = StringBox(
            active_realizations_model, "Active realizations",
            "config/simulation/active_realizations")
        self.active_realizations_field.setValidator(RangeStringArgument())
        layout.addRow(self.active_realizations_field.getLabel(),
                      self.active_realizations_field)

        self.iterated_target_case_format_field.validationChanged.connect(
            self.simulationConfigurationChanged)
        self.active_realizations_field.validationChanged.connect(
            self.simulationConfigurationChanged)

        self.setLayout(layout)
예제 #15
0
 def readCurrentRunPath(self):
     current_case = CaseSelectorModel().getCurrentChoice()
     run_path = LoadResultsModel().getCurrentRunPath()
     run_path = run_path.replace("<ERTCASE>", current_case)
     run_path = run_path.replace("<ERT-CASE>", current_case)
     return run_path
예제 #16
0
    def __init__(self, ert, parent):
        QMainWindow.__init__(self, parent)

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

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

        self.setMinimumWidth(850)
        self.setMinimumHeight(650)

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

        self._plot_customizer = PlotCustomizer(self)

        def plotConfigCreator(key):
            return PlotConfigFactory.createPlotConfigForKey(ert, key)

        self._plot_customizer.setPlotConfigCreator(plotConfigCreator)
        self._plot_customizer.settingsChanged.connect(self.keySelected)

        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)

        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, historyGatherFunc=PDG.gatherSummaryHistoryData)
        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.addPlotWidget(CROSS_CASE_STATISTICS, plots.plotCrossCaseStatistics, [gen_kw_gatherer, custom_kw_gatherer])


        data_types_key_model = DataTypeKeysListModel(ert)

        self._data_type_keys_widget = DataTypeKeysWidget(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)
        self.addDock("Plot case", self._case_selection_widget)

        current_plot_widget = self._plot_widgets[self._central_tab.currentIndex()]
        current_plot_widget.setActive()
        self._data_type_keys_widget.selectDefault()
        self._updateCustomizer(current_plot_widget)
예제 #17
0
파일: plot_window.py 프로젝트: bramirex/ert
    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()
예제 #18
0
 def setCurrectCase(self):
     current_case = CaseSelectorModel().getCurrentChoice()
     self.__case_combo.setCurrentIndex(
         self.__case_model.indexOf(current_case))