コード例 #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 __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)
コード例 #3
0
 def __init__(self):
     self.__active_realizations = self.getDefaultValue()
     self.__custom = False
     EnsembleSizeModel().observable().attach(
         EnsembleSizeModel.SPINNER_VALUE_CHANGED_EVENT,
         self.__ensembleSizeChanged)
     super(ActiveRealizationsModel, self).__init__()
コード例 #4
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)
コード例 #5
0
    def getActiveRealizationsMask(self):
        count = EnsembleSizeModel().getValue()

        mask = BoolVector.createActiveMask(self.getValue())

        if mask is None:
            raise ValueError("Error while parsing range string!")

        if len(mask) > count:
            raise ValueError("Mask size changed %d != %d!" %
                             (count, len(mask)))

        return mask
コード例 #6
0
ファイル: load_results_panel.py プロジェクト: danielfmva/ert
    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)
コード例 #7
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()
コード例 #8
0
    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)
コード例 #9
0
 def getDefaultValue(self):
     size = EnsembleSizeModel().getValue()
     return "0-%d" % (size - 1)