Skip to content

Commit

Permalink
Fix bug where seed was not set for manual initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide committed Aug 21, 2024
1 parent 5dc1fcb commit ac2d917
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def initialize_from_scratch(_: Any) -> None:
ensemble=ensemble_selector.currentData(),
active_realizations=[int(i) for i in members_model.getSelectedItems()],
parameters=parameters,
random_seed=self.ert_config.random_seed,
)

def update_button_state() -> None:
Expand Down
4 changes: 4 additions & 0 deletions tests/unit_tests/gui/tools/test_manage_experiments_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@pytest.mark.usefixtures("copy_poly_case")
def test_init_prior(qtbot, storage):
config = ErtConfig.from_file("poly.ert")
config.random_seed = 1234
notifier = ErtNotifier(config.config_path)
notifier.set_storage(storage)
ensemble = storage.create_experiment(
Expand Down Expand Up @@ -46,6 +47,9 @@ def test_init_prior(qtbot, storage):
ensemble.get_ensemble_state()
== [RealizationStorageState.INITIALIZED] * config.model_config.num_realizations
)
assert ensemble.load_parameters("COEFFS")[
"transformed_values"
].mean() == pytest.approx(1.41487404)


@pytest.mark.usefixtures("copy_poly_case")
Expand Down

0 comments on commit ac2d917

Please sign in to comment.