From 71b4aaad98656a2a65c31f13e33ee6f1c45db3bb Mon Sep 17 00:00:00 2001 From: Blunde1 Date: Fri, 1 Dec 2023 14:10:57 +0100 Subject: [PATCH] Implement property iteration on BRM! --- src/ert/run_models/iterated_ensemble_smoother.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ert/run_models/iterated_ensemble_smoother.py b/src/ert/run_models/iterated_ensemble_smoother.py index e38af708dd7..b9c16ca1773 100644 --- a/src/ert/run_models/iterated_ensemble_smoother.py +++ b/src/ert/run_models/iterated_ensemble_smoother.py @@ -65,6 +65,14 @@ def __init__( # It is initialized later, but kept track of here self.sies_smoother = None + @property + def iteration(self) -> int: + """Returns the SIES iteration number, starting at 1.""" + if self.sies_smoother is None: + return 1 + else: + return self.sies_smoother.iteration + def analyzeStep( self, prior_storage: EnsembleAccessor, @@ -182,8 +190,7 @@ def run_experiment( current_iter - 1, ) - assert self.sies_smoother is not None, "smoother must be initialized" - analysis_success = current_iter < self.sies_smoother.iteration + analysis_success = current_iter < self.iteration if analysis_success: update_success = True break