Skip to content

Commit

Permalink
Turn off projection in localization
Browse files Browse the repository at this point in the history
  • Loading branch information
dafeda committed Nov 24, 2022
1 parent 12d10ac commit 624ce42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 39 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def package_files(directory):
"fastapi",
"filelock",
"graphlib_backport; python_version < '3.9'",
"iterative_ensemble_smoother>=0.0.3",
"iterative_ensemble_smoother>=0.0.4",
"jinja2",
"matplotlib",
"numpy",
Expand Down
55 changes: 17 additions & 38 deletions src/ert/analysis/_es_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ def correlated_parameter_response_pairs(
# State-measurement correlation matrix
c_AY = np.linalg.inv(Sigma_A) @ C_AY @ np.linalg.inv(Sigma_Y)

# _, corr_idx_Y = np.where(np.triu(np.abs(c_AY)) > correlation_threshold)
_, corr_idx_Y = np.where(np.abs(c_AY) > correlation_threshold)
return corr_idx_Y

Expand Down Expand Up @@ -207,8 +206,9 @@ def analysis_ES(
noise = rng.standard_normal(size=(len(observation_values), Y.shape[1]))
if module.localization():
A_ES_loc = []
N = A.shape[1]
p = A.shape[0]
for i in range(A.shape[0]):
N = A.shape[1]
A_chunk = A[i, :].reshape(-1, N)
corr_idx_Y = correlated_parameter_response_pairs(
A_chunk,
Expand All @@ -227,6 +227,7 @@ def analysis_ES(
noise[corr_idx_Y],
module.get_truncation(),
ies.InversionType(module.inversion),
projection=False,
)
A_ES_loc.append(A_loc)
_save_to_temporary_storage(
Expand Down Expand Up @@ -290,7 +291,7 @@ def analysis_IES(
# Looping over local analysis update_step
for update_step in updatestep:

Y, observation_handle = update.load_observations_and_responses(
S, observation_handle = update.load_observations_and_responses(
source_fs,
obs,
alpha,
Expand All @@ -313,41 +314,19 @@ def analysis_IES(

A = _get_A_matrix(temp_storage, update_step.parameters)

if module.localization():
corr_idx_Y = correlated_parameter_response_pairs(
A, Y, module.localization_correlation_threshold()
)
Y_loc = Y[corr_idx_Y, :]
observation_errors_loc = observation_errors[corr_idx_Y]
observation_values_loc = observation_values[corr_idx_Y]
noise = rng.standard_normal(size=(len(observation_values_loc), Y.shape[1]))

A_loc = iterative_ensemble_smoother.update_step(
Y_loc,
A,
observation_errors_loc,
observation_values_loc,
noise,
ensemble_mask=np.array(ens_mask),
observation_mask=observation_mask,
inversion=ies.InversionType(module.inversion),
truncation=module.get_truncation(),
)
_save_to_temporary_storage(temp_storage, update_step.parameters, A_loc)
else:
noise = rng.standard_normal(size=(len(observation_values), Y.shape[1]))
A = iterative_ensemble_smoother.update_step(
Y,
A,
observation_errors,
observation_values,
noise,
ensemble_mask=np.array(ens_mask),
observation_mask=observation_mask,
inversion=ies.InversionType(module.inversion),
truncation=module.get_truncation(),
)
_save_to_temporary_storage(temp_storage, update_step.parameters, A)
noise = rng.standard_normal(size=(len(observation_values), S.shape[1]))
A = iterative_ensemble_smoother.update_step(
S,
A,
observation_errors,
observation_values,
noise,
ensemble_mask=np.array(ens_mask),
observation_mask=observation_mask,
inversion=ies.InversionType(module.inversion),
truncation=module.get_truncation(),
)
_save_to_temporary_storage(temp_storage, update_step.parameters, A)

_save_temporary_storage_to_disk(
target_fs, ensemble_config, temp_storage, iens_active_index
Expand Down

0 comments on commit 624ce42

Please sign in to comment.