Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark ES_MDA as recommended algorithm in GUI #9828

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/ert/gui/simulation/experiment_panel.py
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ def addExperimentConfigPanel(
experiment_type = panel.get_experiment_type()
self._experiment_widgets[experiment_type] = panel
self._experiment_type_combo.addDescriptionItem(
experiment_type.name(),
experiment_type.display_name(),
experiment_type.description(),
experiment_type.group(),
)
@@ -220,9 +220,11 @@ def getActions() -> list[QAction]:
return []

def get_current_experiment_type(self) -> Any:
experiment_type_name = self._experiment_type_combo.currentText()
experiment_type_display_name = self._experiment_type_combo.currentText()
return next(
w for w in self._experiment_widgets if w.name() == experiment_type_name
w
for w in self._experiment_widgets
if w.display_name() == experiment_type_display_name
)

def get_experiment_arguments(self) -> Any:
4 changes: 4 additions & 0 deletions src/ert/run_models/base_run_model.py
Original file line number Diff line number Diff line change
@@ -204,6 +204,10 @@ def log_at_startup(self) -> None:
@abstractmethod
def name(cls) -> str: ...

@classmethod
def display_name(cls) -> str:
return cls.name()

@classmethod
@abstractmethod
def description(cls) -> str: ...
2 changes: 1 addition & 1 deletion src/ert/run_models/iterated_ensemble_smoother.py
Original file line number Diff line number Diff line change
@@ -224,4 +224,4 @@ def name(cls) -> str:

@classmethod
def description(cls) -> str:
return "Sample parameters → [evaluate → update] several iterations"
return "Sample parameters → [evaluate → update] several iterations.\nDeprecated algorithm. Prefer ES-MDA."
6 changes: 5 additions & 1 deletion src/ert/run_models/multiple_data_assimilation.py
Original file line number Diff line number Diff line change
@@ -192,9 +192,13 @@ def parse_weights(weights: str) -> list[float]:
def name(cls) -> str:
return "Multiple data assimilation"

@classmethod
def display_name(cls) -> str:
return cls.name() + " - Recommended algorithm"

@classmethod
def description(cls) -> str:
return "[Sample|restart] → [evaluate → update] for each weight"
return "[Sample|restart] → [evaluate → update] for each weight."

@classmethod
def group(cls) -> str | None:
4 changes: 2 additions & 2 deletions tests/ert/ui_tests/gui/conftest.py
Original file line number Diff line number Diff line change
@@ -239,7 +239,7 @@ def func(experiment_mode, gui, click_done=True):
assert isinstance(experiment_panel, ExperimentPanel)
simulation_mode_combo = experiment_panel.findChild(QComboBox)
assert isinstance(simulation_mode_combo, QComboBox)
simulation_mode_combo.setCurrentText(experiment_mode.name())
simulation_mode_combo.setCurrentText(experiment_mode.display_name())
simulation_settings = experiment_panel._experiment_widgets[
experiment_panel.get_current_experiment_type()
]
@@ -255,7 +255,7 @@ def handle_dialog():
lambda: handle_run_path_dialog(gui, qtbot, delete_run_path=False),
)

if not experiment_mode.name() in {
if experiment_mode.name() not in {
"Ensemble experiment",
"Evaluate ensemble",
}:
2 changes: 1 addition & 1 deletion tests/ert/ui_tests/gui/test_csv_export.py
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ def test_csv_export(esmda_has_run, qtbot, ensemble_select):
def run_experiment_via_gui(gui, qtbot):
experiment_panel = get_child(gui, ExperimentPanel)
simulation_mode_combo = get_child(experiment_panel, QComboBox)
simulation_mode_combo.setCurrentText(EnsembleExperiment.name())
simulation_mode_combo.setCurrentText(EnsembleExperiment.display_name())
ensemble_experiment_panel = get_child(experiment_panel, EnsembleExperimentPanel)
ensemble_experiment_panel._ensemble_name_field.setText("iter-0")

15 changes: 9 additions & 6 deletions tests/ert/ui_tests/gui/test_main_window.py
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ def test_that_es_mda_is_disabled_when_weights_are_invalid(qtbot):
combo_box = get_child(gui, QComboBox, name="experiment_type")
combo_box.setCurrentIndex(3)

assert combo_box.currentText() == "Multiple data assimilation"
assert combo_box.currentText() == MultipleDataAssimilation.display_name()

es_mda_panel = get_child(gui, QWidget, name="ES_MDA_panel")
assert es_mda_panel
@@ -702,7 +702,7 @@ def test_that_es_mda_restart_run_box_is_disabled_when_there_are_no_cases(qtbot):
assert combo_box.count() == 7
combo_box.setCurrentIndex(3)

assert combo_box.currentText() == "Multiple data assimilation"
assert combo_box.currentText() == MultipleDataAssimilation.display_name()

es_mda_panel = get_child(gui, QWidget, name="ES_MDA_panel")
assert es_mda_panel
@@ -752,10 +752,13 @@ def test_validation_of_experiment_names_in_run_models(
run_experiment = get_child(experiment_panel, QWidget, name="run_experiment")

experiment_types_to_test = (
(EnsembleExperiment.name(), "Ensemble_experiment_panel"),
(EnsembleSmoother.name(), "ensemble_smoother_panel"),
(MultipleDataAssimilation.name(), "ES_MDA_panel"),
(IteratedEnsembleSmoother.name(), "iterated_ensemble_smoother_panel"),
(EnsembleExperiment.display_name(), "Ensemble_experiment_panel"),
(EnsembleSmoother.display_name(), "ensemble_smoother_panel"),
(
MultipleDataAssimilation.display_name(),
"ES_MDA_panel",
),
(IteratedEnsembleSmoother.display_name(), "iterated_ensemble_smoother_panel"),
)
for exp_type, panel_name in experiment_types_to_test:
experiment_types.setCurrentText(exp_type)
14 changes: 10 additions & 4 deletions tests/ert/ui_tests/gui/test_missing_parameters_to_update.py
Original file line number Diff line number Diff line change
@@ -5,6 +5,12 @@
from qtpy.QtWidgets import QComboBox

from ert.gui.simulation.experiment_panel import ExperimentPanel
from ert.run_models import (
EnsembleExperiment,
EnsembleSmoother,
IteratedEnsembleSmoother,
MultipleDataAssimilation,
)
from tests.ert.ui_tests.gui.conftest import get_child, open_gui_with_config


@@ -20,19 +26,19 @@ def test_no_updateable_parameters(qtbot):
for gui in open_gui_with_config("poly.ert"):
experiment_panel = get_child(gui, ExperimentPanel)
simulation_mode_combo = get_child(experiment_panel, QComboBox)
idx = simulation_mode_combo.findText("Ensemble smoother")
idx = simulation_mode_combo.findText(EnsembleSmoother.display_name())
assert not (
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled
)
idx = simulation_mode_combo.findText("Multiple data assimilation")
idx = simulation_mode_combo.findText(MultipleDataAssimilation.display_name())
assert not (
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled
)
idx = simulation_mode_combo.findText("Iterated ensemble smoother")
idx = simulation_mode_combo.findText(IteratedEnsembleSmoother.display_name())
assert not (
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled
)
idx = simulation_mode_combo.findText("Ensemble experiment")
idx = simulation_mode_combo.findText(EnsembleExperiment.display_name())
assert (
simulation_mode_combo.model().item(idx).flags() & Qt.ItemFlag.ItemIsEnabled
)
8 changes: 4 additions & 4 deletions tests/ert/ui_tests/gui/test_restart_esmda.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ def test_restart_esmda(ensemble_experiment_has_run_no_failure, qtbot):

experiment_panel = get_child(gui, ExperimentPanel)
simulation_mode_combo = get_child(experiment_panel, QComboBox)
simulation_mode_combo.setCurrentText(MultipleDataAssimilation.name())
simulation_mode_combo.setCurrentText(MultipleDataAssimilation.display_name())

es_mda_panel = gui.findChild(QWidget, name="ES_MDA_panel")
assert es_mda_panel
@@ -49,7 +49,7 @@ def test_active_realizations_esmda(opened_main_window_poly, qtbot):

experiment_panel = get_child(gui, ExperimentPanel)
simulation_mode_combo = get_child(experiment_panel, QComboBox)
simulation_mode_combo.setCurrentText(SingleTestRun.name())
simulation_mode_combo.setCurrentText(SingleTestRun.display_name())

single_test_run_panel = gui.findChild(QWidget, name="Single_test_run_panel")
assert single_test_run_panel
@@ -63,7 +63,7 @@ def test_active_realizations_esmda(opened_main_window_poly, qtbot):
== "Total progress 100% — Experiment completed."
)

simulation_mode_combo.setCurrentText(MultipleDataAssimilation.name())
simulation_mode_combo.setCurrentText(MultipleDataAssimilation.display_name())
es_mda_panel = gui.findChild(QWidget, name="ES_MDA_panel")
assert es_mda_panel
active_reals = gui.findChild(StringBox, "active_realizations_box")
@@ -88,7 +88,7 @@ def test_custom_weights_stored_and_retrieved_from_metadata_esmda(

experiment_panel = get_child(gui, ExperimentPanel)
simulation_mode_combo = get_child(experiment_panel, QComboBox)
simulation_mode_combo.setCurrentText(MultipleDataAssimilation.name())
simulation_mode_combo.setCurrentText(MultipleDataAssimilation.display_name())

es_mda_panel = gui.findChild(QWidget, name="ES_MDA_panel")
assert es_mda_panel