diff --git a/src/ert/_c_wrappers/analysis/analysis_module.py b/src/ert/_c_wrappers/analysis/analysis_module.py index d8b53dd8dd3..f8c9784a33e 100644 --- a/src/ert/_c_wrappers/analysis/analysis_module.py +++ b/src/ert/_c_wrappers/analysis/analysis_module.py @@ -51,14 +51,15 @@ def get_mode_variables(mode: AnalysisMode) -> Dict[str, "VariableInfo"]: "LOCALIZATION": { "type": bool, "value": DEFAULT_LOCALIZATION, - "labelname": "Switch for adaptive localization", + "labelname": "Adaptive localization", }, "LOCALIZATION_CORRELATION_THRESHOLD": { "type": float, "min": 0.0, "value": DEFAULT_LOCALIZATION_CORRELATION_THRESHOLD, "max": 1.0, - "labelname": "Threshold defining high correlation", + "step": 0.1, + "labelname": "Adaptive localization correlation threshold", }, } ies_variables: Dict[str, "VariableInfo"] = { @@ -198,6 +199,11 @@ def set_var(self, var_name: str, value: Union[float, int, bool, str]): f"Variable {var_name} expected type {var['type']}" f" received value `{value}` of type `{type(value)}`" ) + # When config is first read, `value` is a string that's either "False" or "True", + # but since bool("False") is True we need to convert it to bool. + if not isinstance(value, bool): + value = value.lower() != "false" + var["value"] = var["type"](value) else: raise KeyError(f"Variable {var_name} not found in module") diff --git a/src/ert/gui/ertwidgets/analysismodulevariablespanel.py b/src/ert/gui/ertwidgets/analysismodulevariablespanel.py index debecbbad4c..9a1c99bf7ba 100644 --- a/src/ert/gui/ertwidgets/analysismodulevariablespanel.py +++ b/src/ert/gui/ertwidgets/analysismodulevariablespanel.py @@ -122,6 +122,17 @@ def __init__(self, analysis_module_name: str, facade: LibresFacade): lambda value: self.update_truncation_spinners(value, truncation_spinner) ) + localization_checkbox = self.widget_from_layout(layout, "LOCALIZATION") + localization_correlation_spinner = self.widget_from_layout( + layout, "LOCALIZATION_CORRELATION_THRESHOLD" + ) + localization_correlation_spinner.setEnabled(localization_checkbox.isChecked()) + localization_checkbox.stateChanged.connect( + lambda localization_is_on: localization_correlation_spinner.setEnabled(True) + if localization_is_on + else localization_correlation_spinner.setEnabled(False) + ) + self.setLayout(layout) self.blockSignals(False) @@ -166,6 +177,7 @@ def createSpinBox( def createCheckBox(self, variable_name, variable_value, variable_type): spinner = QCheckBox() spinner.setChecked(variable_value) + spinner.setObjectName(variable_name) spinner.clicked.connect( partial(self.valueChanged, variable_name, variable_type, spinner) )