Example #1
0
 def trigger(self):
     if self._run_widget is None:
         self._run_widget = RunAnalysisPanel()
     self._dialog = ClosableDialog("Run Analysis", self._run_widget,
                                   self.parent())
     self._dialog.addButton("Run", self.run)
     self._dialog.exec_()
Example #2
0
    def trigger(self):
        case_management_widget = CaseInitializationConfigurationPanel(
            self.ert, self.notifier)

        dialog = ClosableDialog("Manage cases", case_management_widget,
                                self.parent())
        dialog.exec_()
Example #3
0
 def trigger(self):
     if self.__import_widget is None:
         self.__import_widget = LoadResultsPanel()
     self.__dialog = ClosableDialog("Load results manually", self.__import_widget, self.parent())
     self.__import_widget.setCurrectCase()
     self.__dialog.addButton("Load", self.load)
     self.__dialog.exec_()
Example #4
0
 def trigger(self):
     if self.__import_widget is None:
         self.__import_widget = LoadResultsPanel()
     self.__dialog = ClosableDialog("Load results manually", self.__import_widget, self.parent())
     self.__import_widget.setCurrectCase()
     self.__dialog.addButton("Load", self.load)
     self.__dialog.exec_()
Example #5
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(getCurrentCaseName())
        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()
Example #6
0
    def trigger(self):
        if self.__export_widget is None:
            self.__export_widget = ref(ExportPanel(self.parent()))
            self.__export_widget().runExport.connect(self._run_export)

        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()
Example #7
0
class LoadResultsTool(Tool):
    def __init__(self):
        super(LoadResultsTool, self).__init__("Load results manually", "tools/load_manually", resourceIcon("ide/table_import"))
        self.__import_widget = None
        self.__dialog = None
        self.setVisible(False)




    def trigger(self):
        if self.__import_widget is None:
            self.__import_widget = LoadResultsPanel()
        self.__dialog = ClosableDialog("Load results manually", self.__import_widget, self.parent())
        self.__import_widget.setCurrectCase()
        self.__dialog.addButton("Load", self.load)
        self.__dialog.exec_()

    def load(self):
        self.__import_widget.load()
        self.__dialog.accept()

    def toggleAdvancedMode(self, advanced_mode):
        self.setVisible(advanced_mode)
        if not LoadResultsModel.isValidRunPath():
            self.setEnabled(False)
Example #8
0
class RunAnalysisTool(Tool):
    def __init__(self, ert, notifier):
        self.ert = ert
        self.notifier = notifier
        super().__init__("Run analysis", "tools/run_analysis",
                         resourceIcon("formula.svg"))
        self._run_widget = None
        self._dialog = None
        self._selected_case_name = None

    def trigger(self):
        if self._run_widget is None:
            self._run_widget = RunAnalysisPanel(self.ert, self.notifier)
        self._dialog = ClosableDialog("Run analysis", self._run_widget,
                                      self.parent())
        self._dialog.addButton("Run", self.run)
        self._dialog.exec_()

    def run(self):
        target = self._run_widget.target_case()
        source = self._run_widget.source_case()

        if len(target) == 0:
            self._report_empty_target()
            return

        try:
            analyse(self.ert, target, source)
            error = None
        except ErtAnalysisError as e:
            error = str(e)
        except Exception as e:
            error = f"Uknown exception occured with error: {str(e)}"

        msg = QMessageBox()
        msg.setWindowTitle("Run analysis")
        msg.setStandardButtons(QMessageBox.Ok)

        if not error:
            msg.setIcon(QMessageBox.Information)
            msg.setText(f"Successfully ran analysis for case '{source}'.")
            msg.exec_()
        else:
            msg.setIcon(QMessageBox.Warning)
            msg.setText(f"Unable to run analysis for case '{source}'.\n"
                        f"The following error occured: {error}")
            msg.exec_()
            return

        self.notifier.ertChanged.emit()
        self._dialog.accept()

    def _report_empty_target(self):
        msg = QMessageBox()
        msg.setWindowTitle("Invalid target")
        msg.setIcon(QMessageBox.Warning)
        msg.setText("Target case can not be empty")
        msg.setStandardButtons(QMessageBox.Ok)
        msg.exec_()
Example #9
0
class RunAnalysisTool(Tool):
    def __init__(self):
        super(RunAnalysisTool, self).__init__("Run Analysis",
                                              "tools/run_analysis",
                                              resourceIcon("ide/table_import"))
        self._run_widget = None
        self._dialog = None
        self._selected_case_name = None

    def trigger(self):
        if self._run_widget is None:
            self._run_widget = RunAnalysisPanel()
        self._dialog = ClosableDialog("Run Analysis", self._run_widget,
                                      self.parent())
        self._dialog.addButton("Run", self.run)
        self._dialog.exec_()

    def run(self):
        target = self._run_widget.target_case()
        source = self._run_widget.source_case()

        if len(target) == 0:
            self._report_empty_target()
            return

        success = analyse(target, source)

        msg = QMessageBox()
        msg.setWindowTitle("Run Analysis")
        msg.setStandardButtons(QMessageBox.Ok)

        if success:
            msg.setIcon(QMessageBox.Information)
            msg.setText(
                "Successfully ran analysis for case '{}'.".format(source))
            msg.exec_()
        else:
            msg.setIcon(QMessageBox.Warning)
            msg.setText("Unable to run analysis for case '{}'.".format(source))
            msg.exec_()
            return

        ert_shared.ERT.ertChanged.emit()
        self._dialog.accept()

    def _report_empty_target(self):
        msg = QMessageBox()
        msg.setWindowTitle("Invalid Target")
        msg.setIcon(QMessageBox.Warning)
        msg.setText("Target case can not be empty")
        msg.setStandardButtons(QMessageBox.Ok)
        msg.exec_()
Example #10
0
class RunAnalysisTool(Tool):
    def __init__(self):
        super(RunAnalysisTool, self).__init__("Run Analysis",
                                              "tools/run_analysis",
                                              resourceIcon("ide/table_import"))
        self._run_widget = None
        self._dialog = None
        self._selected_case_name = None

    def trigger(self):
        if self._run_widget is None:
            self._run_widget = RunAnalysisPanel()
        self._dialog = ClosableDialog("Run Analysis", self._run_widget,
                                      self.parent())
        self._dialog.addButton("Run", self.run)
        self._dialog.exec_()

    def run(self):
        target = self._run_widget.target_case()
        source = self._run_widget.source_case()

        ert = ERT.ert
        fs_manager = ert.getEnkfFsManager()
        es_update = ESUpdate(ert)

        target_fs = fs_manager.getFileSystem(target)
        source_fs = fs_manager.getFileSystem(source)
        run_context = ErtRunContext.ensemble_smoother_update(
            source_fs,
            target_fs,
        )
        success = es_update.smootherUpdate(run_context)

        if not success:
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Warning)
            msg.setWindowTitle("Run Analysis")
            msg.setText("Unable to run analysis for case '%s'." % source)
            msg.setStandardButtons(QMessageBox.Ok)
            msg.exec_()
            return

        ERT.ertChanged.emit()
        self._dialog.accept()
Example #11
0
class RunAnalysisTool(Tool):
    def __init__(self):
        super(RunAnalysisTool, self).__init__("Run Analysis", "tools/run_analysis", resourceIcon("ide/table_import"))
        self._run_widget = None
        self._dialog = None
        self._selected_case_name = None
        self.setVisible(False)


    def trigger(self):
        if self._run_widget is None:
            self._run_widget = RunAnalysisPanel()
        self._dialog = ClosableDialog("Run Analysis", self._run_widget, self.parent())
        self._dialog.addButton("Run", self.run)
        self._dialog.exec_()

    def run(self):
        target = self._run_widget.target_case()
        source = self._run_widget.source_case()

        ert = ERT.ert
        fs_manager = ert.getEnkfFsManager() 
        es_update = ESUpdate(ert)

        target_fs = fs_manager.getFileSystem(target)
        source_fs = fs_manager.getFileSystem(source)
        success = es_update.smootherUpdate( source_fs , target_fs )

        if not success:
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Warning)
            msg.setWindowTitle("Run Analysis")
            msg.setText("Unable to run analysis for case '%s'." % source)
            msg.setStandardButtons(QMessageBox.Ok)
            msg.exec_()
            return

        ERT.ertChanged.emit()
        self._dialog.accept()

    def toggleAdvancedMode(self, advanced_mode):
        self.setVisible(advanced_mode)
Example #12
0
class LoadResultsTool(Tool):
    def __init__(self, facade):
        self.facade = facade
        super().__init__(
            "Load results manually",
            "tools/load_manually",
            resourceIcon("upload.svg"),
        )
        self.__import_widget = None
        self.__dialog = None
        self.setEnabled(self.is_valid_run_path())

    def trigger(self):
        if self.__import_widget is None:
            self.__import_widget = LoadResultsPanel(self.facade)
        self.__dialog = ClosableDialog("Load results manually",
                                       self.__import_widget, self.parent())
        self.__import_widget.setCurrectCase()
        self.__dialog.addButton("Load", self.load)
        self.__dialog.exec_()

    def load(self):
        self.__import_widget.load()
        self.__dialog.accept()

    def is_valid_run_path(self) -> bool:
        """A run path is considered valid if we can
        insert realisation and iteration numbers"""
        try:
            # pylint: disable=pointless-statement
            self.facade.run_path % (0, 0)
            return True
        except TypeError:
            try:
                # pylint: disable=pointless-statement
                self.facade.run_path % 0
                return True
            except TypeError:
                return False
Example #13
0
 def trigger(self):
     if self._run_widget is None:
         self._run_widget = RunAnalysisPanel()
     self._dialog = ClosableDialog("Run Analysis", self._run_widget, self.parent())
     self._dialog.addButton("Run", self.run)
     self._dialog.exec_()
Example #14
0
 def trigger(self):
     run_workflow_widget = RunWorkflowWidget()
     dialog = ClosableDialog("Run workflow", run_workflow_widget,
                             self.parent())
     dialog.exec_()
     ERT.emitErtChange()  # workflow may have added new cases.
Example #15
0
 def trigger(self):
     run_workflow_widget = RunWorkflowWidget()
     dialog = ClosableDialog("Run workflow", run_workflow_widget, self.parent())
     dialog.exec_()
     ERT.emitErtChange() # workflow may have added new cases.
Example #16
0
    def trigger(self):
        case_management_widget = CaseInitializationConfigurationPanel()

        dialog = ClosableDialog("Manage Cases", case_management_widget, self.parent())
        dialog.exec_()