def getArguments(self, parent=None): description = "The MDA Ensemble Smoother requires some information before running:" dialog = CustomDialog("MDA Ensemble Smoother", description, parent) iterated_target_case_format_model = DefaultNameFormatModel( self.getDefaultTargetCaseFormat()) iterated_target_case_format_box = StringBox( iterated_target_case_format_model, "Target case format", "config/simulation/iterated_target_case_format") iterated_target_case_format_box.setValidator( ProperNameFormatArgument()) iteration_weights_path_model = DefaultPathModel("", must_exist=True) iteration_weights_path_chooser = PathChooser( iteration_weights_path_model, path_label="Iteration weights file") custom_iteration_weights_model = StringModel("1") custom_iteration_weights_box = StringBox( custom_iteration_weights_model, "Custom iteration weights", "config/simulation/iteration_weights") custom_iteration_weights_box.setValidator(NumberListStringArgument()) option_widget = OptionWidget("Relative Weights") option_widget.addHelpedWidget("Custom", custom_iteration_weights_box) option_widget.addHelpedWidget("File", iteration_weights_path_chooser) dialog.addOption(iterated_target_case_format_box) dialog.addOption(option_widget) dialog.addSpace() dialog.addWidget( QLabel("Example Custom Relative Weights: '8,4,2,1'\n" "This means MDA-ES will half the weight\n" "applied to the Observation Errors from one\n" "iteration to the next across 4 iterations."), "Note") dialog.addButtons() success = dialog.showAndTell() if success: optioned_widget = option_widget.getCurrentWidget() if optioned_widget == iteration_weights_path_chooser: weights = iteration_weights_path_model.getPath() elif optioned_widget == custom_iteration_weights_box: weights = custom_iteration_weights_model.getValue() else: weights = "1" return [iterated_target_case_format_model.getValue(), weights] raise CancelPluginException("User cancelled!")
def getArguments(self, parent=None): description = "The CSV export requires some information before it starts:" dialog = CustomDialog("CSV Export", description, parent) default_csv_output_path = self.getDataKWValue("CSV_OUTPUT_PATH", default="output.csv") output_path_model = DefaultPathModel(default_csv_output_path) output_path_chooser = PathChooser(output_path_model, path_label="Output file path") design_matrix_default = self.getDataKWValue("DESIGN_MATRIX_PATH", default="") design_matrix_path_model = DefaultPathModel(design_matrix_default, is_required=False, must_exist=True) design_matrix_path_chooser = PathChooser( design_matrix_path_model, path_label="Design Matrix path") all_case_list = self.getAllCaseList() list_edit = ListEditBox(all_case_list, "List of cases to export") infer_iteration_model = DefaultBooleanModel() infer_iteration_checkbox = CheckBox(infer_iteration_model, label="Infer iteration number", show_label=False) infer_iteration_checkbox.setToolTip(CSVExportJob.INFER_HELP) dialog.addOption(output_path_chooser) dialog.addOption(design_matrix_path_chooser) dialog.addOption(list_edit) dialog.addOption(infer_iteration_checkbox) dialog.addButtons() success = dialog.showAndTell() if success: design_matrix_path = design_matrix_path_model.getPath() if design_matrix_path.strip() == "": design_matrix_path = None case_list = ",".join(list_edit.getItems()) return [ output_path_model.getPath(), case_list, design_matrix_path, infer_iteration_model.isTrue() ] raise CancelPluginException("User cancelled!")
trajectory_model = PathModel("wellpath", must_be_a_directory=True, must_be_a_file=False, must_exist=True) trajectory_chooser = PathChooser(trajectory_model) fs_manager = self.ert().getEnkfFsManager() all_case_list = fs_manager.getCaseList() all_case_list = [case for case in all_case_list if fs_manager.caseHasData(case)] list_edit = ListEditBox(all_case_list) infer_iteration_check = QCheckBox() infer_iteration_check.setChecked(True) infer_iteration_check.setToolTip(GenDataRFTCSVExportJob.INFER_HELP) dialog.addLabeledOption("Output file path", output_path_chooser) dialog.addLabeledOption("Trajectory file", trajectory_chooser) dialog.addLabeledOption("List of cases to export", list_edit) dialog.addLabeledOption("Infer iteration number", infer_iteration_check) dialog.addButtons() success = dialog.showAndTell() if success: case_list = ",".join(list_edit.getItems()) try: return [output_path_model.getPath(), trajectory_model.getPath(), case_list, infer_iteration_check.isChecked()] except ValueError: pass raise CancelPluginException("User cancelled!")
def getArguments(self, parent=None): raise CancelPluginException("Cancel test!")