diff --git a/src/ert/analysis/_es_update.py b/src/ert/analysis/_es_update.py index 9ab3bf83fe2..5fa744f2785 100644 --- a/src/ert/analysis/_es_update.py +++ b/src/ert/analysis/_es_update.py @@ -192,7 +192,9 @@ def analysis_ES( ] = observation_handle.update_snapshot observation_values = observation_handle.observation_values observation_errors = observation_handle.observation_errors - if len(observation_values) == 0: + + nobservations = len(observation_values) + if nobservations == 0: raise ErtAnalysisError( f"No active observations for update step: {update_step.name}." ) @@ -203,13 +205,13 @@ def analysis_ES( ) if A is not None: - noise = rng.standard_normal(size=(len(observation_values), Y.shape[1])) + nrealizations = A.shape[1] + nparameters = A.shape[0] + noise = rng.standard_normal(size=(nobservations, nrealizations)) if module.localization(): A_ES_loc = [] - N = A.shape[1] - p = A.shape[0] - for i in range(A.shape[0]): - A_chunk = A[i, :].reshape(-1, N) + for i in range(nparameters): + A_chunk = A[i, :].reshape(1, nrealizations) corr_idx_Y = _correlated_parameter_response_pairs( A_chunk, Y, @@ -291,7 +293,7 @@ def analysis_IES( # Looping over local analysis update_step for update_step in updatestep: - S, observation_handle = update.load_observations_and_responses( + Y, observation_handle = update.load_observations_and_responses( source_fs, obs, alpha, @@ -307,16 +309,18 @@ def analysis_IES( observation_values = observation_handle.observation_values observation_errors = observation_handle.observation_errors observation_mask = observation_handle.obs_mask - if len(observation_values) == 0: + + nobservations = len(observation_values) + if nobservations == 0: raise ErtAnalysisError( f"No active observations for update step: {update_step.name}." ) A = _get_A_matrix(temp_storage, update_step.parameters) - - noise = rng.standard_normal(size=(len(observation_values), S.shape[1])) + nrealizations = A.shape[1] + noise = rng.standard_normal(size=(nobservations, nrealizations)) A = iterative_ensemble_smoother.update_step( - S, + Y, A, observation_errors, observation_values,