Skip to content

Commit 588802d

Browse files
author
Yngve S. Kristiansen
committed
rename variable
1 parent 97a0b19 commit 588802d

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/semeio/workflows/ahm_analysis/ahmanalysis.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ def _replace(s: str) -> str:
236236
)
237237
# loop over keys and calculate the KS matrix,
238238
# conditioning one parameter at the time.
239-
updated_combinations = deepcopy(combinations)
240-
for group_name, obs_group in combinations.items():
241-
print("Processing:", group_name)
239+
obs_group_to_observations = deepcopy(combinations)
240+
for obs_group, observations in combinations.items():
241+
print("Processing:", obs_group)
242242

243243
# Use localization to evaluate change of parameters for each observation
244244
# The order of the context managers is important, as we want to create a new
@@ -261,7 +261,7 @@ def _replace(s: str) -> str:
261261
update_log = _run_ministep(
262262
prior_storage=prior_ensemble,
263263
target_storage=target_ensemble,
264-
obs_group=obs_group,
264+
observations=observations,
265265
data_parameters=field_parameters + gen_kw_names,
266266
observation_settings=observation_settings,
267267
es_settings=es_settings,
@@ -270,29 +270,29 @@ def _replace(s: str) -> str:
270270
# Get the active vs total observation info
271271
df_update_log = make_update_log_df(update_log)
272272
except ErtAnalysisError:
273-
logger.error(f"Analysis failed for: {obs_group}")
274-
del updated_combinations[group_name]
273+
logger.error(f"Analysis failed for: {observations}")
274+
del obs_group_to_observations[obs_group]
275275
continue
276276
# Get the updated scalar parameter distributions
277277
target_ensemble.load_all_gen_kw_data().to_csv(
278-
ahmanalysis_reports_dir / f"{group_name}.csv"
278+
ahmanalysis_reports_dir / f"{obs_group}.csv"
279279
)
280280

281-
active_obs.at["ratio", group_name] = (
281+
active_obs.at["ratio", obs_group] = (
282282
str(count_active_observations(df_update_log))
283283
+ " active/"
284284
+ str(len(df_update_log.index))
285285
)
286286
# Get misfit values
287-
misfitval[group_name] = [
287+
misfitval[obs_group] = [
288288
calc_observationsgroup_misfit(
289-
group_name,
289+
obs_group,
290290
df_update_log,
291291
LibresFacade.load_all_misfit_data(prior_ensemble),
292292
)
293293
]
294294
# Calculate Ks matrix for scalar parameters
295-
kolmogorov_smirnov_data[group_name] = kolmogorov_smirnov_data[
295+
kolmogorov_smirnov_data[obs_group] = kolmogorov_smirnov_data[
296296
"Parameters"
297297
].map(
298298
calc_kolmogorov_smirnov(
@@ -344,7 +344,7 @@ def make_update_log_df(update_log: SmootherSnapshot) -> pd.DataFrame:
344344
def _run_ministep(
345345
prior_storage: Ensemble,
346346
target_storage: Ensemble,
347-
obs_group: Iterable[str],
347+
observations: Iterable[str],
348348
data_parameters: Iterable[str],
349349
observation_settings: ObservationSettings,
350350
es_settings: ESSettings,
@@ -355,7 +355,7 @@ def _run_ministep(
355355
return smoother_update(
356356
prior_storage=prior_storage,
357357
posterior_storage=target_storage,
358-
observations=obs_group,
358+
observations=observations,
359359
parameters=data_parameters,
360360
update_settings=copy.deepcopy(observation_settings),
361361
es_settings=es_settings,

tests/workflows/ahm_analysis/test_ahm_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_make_update_log_df(snake_oil_config, snapshot):
2828
log = _run_ministep(
2929
prior_storage=prior_ens,
3030
target_storage=posterior_ens,
31-
obs_group=sorted(prior_ens.experiment.observation_keys),
31+
observations=sorted(prior_ens.experiment.observation_keys),
3232
data_parameters=sorted(prior_ens.experiment.parameter_configuration.keys()),
3333
observation_settings=snake_oil_config.analysis_config.observation_settings,
3434
es_settings=snake_oil_config.analysis_config.es_settings,

0 commit comments

Comments
 (0)