diff --git a/src/ert/gui/simulation/multiple_data_assimilation_panel.py b/src/ert/gui/simulation/multiple_data_assimilation_panel.py index d9a154fe5fa..5e550b41951 100644 --- a/src/ert/gui/simulation/multiple_data_assimilation_panel.py +++ b/src/ert/gui/simulation/multiple_data_assimilation_panel.py @@ -103,9 +103,9 @@ def __init__( self._active_realizations_model, # type: ignore "config/simulation/active_realizations", ) + self._active_realizations_field.setObjectName("active_realizations_box") self._active_realizations_field.setValidator(RangeStringArgument(ensemble_size)) self._ensemble_selector = EnsembleSelector(notifier) - self._realizations_from_fs() layout.addRow("Active realizations:", self._active_realizations_field) self._restart_box = QCheckBox("") @@ -114,6 +114,7 @@ def __init__( self._restart_box.toggled.connect(self.update_experiment_edit) self._restart_box.setEnabled(bool(self._ensemble_selector._ensemble_list())) + self._ensemble_selector.setEnabled(False) layout.addRow("Restart run:", self._restart_box) self._ensemble_selector.ensemble_populated.connect(self.restart_run_toggled) @@ -189,6 +190,11 @@ def restart_run_toggled(self) -> None: if self._restart_box.isChecked() else MultipleDataAssimilation.default_weights ) + if self._restart_box.isChecked(): + self._realizations_from_fs() + else: + # If box is unchecked we reset to the default mask + self._active_realizations_field.model.setValue(value="") def _createInputForWeights(self, layout: QFormLayout) -> None: relative_iteration_weights_model = ValueModel(self.weights) diff --git a/tests/ert/ui_tests/gui/test_restart_esmda.py b/tests/ert/ui_tests/gui/test_restart_esmda.py index 05723301520..6c7c8e312ed 100644 --- a/tests/ert/ui_tests/gui/test_restart_esmda.py +++ b/tests/ert/ui_tests/gui/test_restart_esmda.py @@ -4,7 +4,7 @@ from ert.gui.ertwidgets import StringBox from ert.gui.simulation.experiment_panel import ExperimentPanel from ert.gui.simulation.run_dialog import RunDialog -from ert.run_models import MultipleDataAssimilation +from ert.run_models import MultipleDataAssimilation, SingleTestRun from .conftest import get_child @@ -40,6 +40,44 @@ def test_restart_esmda(ensemble_experiment_has_run_no_failure, qtbot): ) +def test_active_realizations_esmda(opened_main_window_poly, qtbot): + """This runs a single test run and then verifies that this does + not interfere with the activate realizations in the es_mda panel + unless the restart from that specific ensemble is checked. + """ + gui = opened_main_window_poly + + experiment_panel = get_child(gui, ExperimentPanel) + simulation_mode_combo = get_child(experiment_panel, QComboBox) + simulation_mode_combo.setCurrentText(SingleTestRun.name()) + + single_test_run_panel = gui.findChild(QWidget, name="Single_test_run_panel") + assert single_test_run_panel + run_experiment = experiment_panel.findChild(QWidget, name="run_experiment") + qtbot.mouseClick(run_experiment, Qt.MouseButton.LeftButton) + qtbot.waitUntil(lambda: gui.findChild(RunDialog) is not None) + run_dialog = gui.findChild(RunDialog) + qtbot.waitUntil(lambda: run_dialog.is_simulation_done() == True, timeout=15000) + assert ( + run_dialog._total_progress_label.text() + == "Total progress 100% — Experiment completed." + ) + + simulation_mode_combo.setCurrentText(MultipleDataAssimilation.name()) + es_mda_panel = gui.findChild(QWidget, name="ES_MDA_panel") + assert es_mda_panel + active_reals = gui.findChild(StringBox, "active_realizations_box") + assert active_reals.text() == "0-19" + + restart_checkbox = es_mda_panel.findChild(QCheckBox, name="restart_checkbox_esmda") + assert restart_checkbox + assert not restart_checkbox.isChecked() + restart_checkbox.click() + assert active_reals.text() == "0" + restart_checkbox.click() + assert active_reals.text() == "0-19" + + def test_custom_weights_stored_and_retrieved_from_metadata_esmda( opened_main_window_minimal_realizations, qtbot ):