Skip to content

Commit

Permalink
initialize func without noise input
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Jun 21, 2024
1 parent b9ad06a commit 08f9c31
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/ekp_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,45 @@ initialize(config::ExperimentConfig; kwargs...) = initialize(
kwargs...,
)

function initialize(

Check warning on line 217 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L217

Added line #L217 was not covered by tests
ensemble_size,
observations,
prior,
output_dir;
rng_seed = 1234,
ekp_kwargs...,
)
Random.seed!(rng_seed)
rng_ekp = Random.MersenneTwister(rng_seed)

Check warning on line 226 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L225-L226

Added lines #L225 - L226 were not covered by tests

initial_ensemble =

Check warning on line 228 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L228

Added line #L228 was not covered by tests
EKP.construct_initial_ensemble(rng_ekp, prior, ensemble_size)
eki = EKP.EnsembleKalmanProcess(

Check warning on line 230 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L230

Added line #L230 was not covered by tests
initial_ensemble,
observations,
EKP.Inversion();
rng = rng_ekp,
failure_handler_method = EKP.SampleSuccGauss(),
ekp_kwargs...,
)

param_dict = get_param_dict(prior)

Check warning on line 239 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L239

Added line #L239 was not covered by tests

save_parameter_ensemble(

Check warning on line 241 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L241

Added line #L241 was not covered by tests
EKP.get_u_final(eki), # constraints applied when saving
prior,
param_dict,
output_dir,
"parameters.toml",
0, # Initial iteration = 0
)

# Save the EKI object in the 'iteration_000' folder
eki_path = joinpath(output_dir, "iteration_000", "eki_file.jld2")
JLD2.save_object(eki_path, eki)
return eki

Check warning on line 253 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L251-L253

Added lines #L251 - L253 were not covered by tests
end

function initialize(
ensemble_size,
observations,
Expand Down

0 comments on commit 08f9c31

Please sign in to comment.