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 Jul 23, 2024
1 parent 25dab9d commit 20a8bb9
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 @@ -215,6 +215,45 @@ initialize(config::ExperimentConfig; kwargs...) = initialize(
kwargs...,
)

function initialize(

Check warning on line 218 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L218

Added line #L218 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 227 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L226-L227

Added lines #L226 - L227 were not covered by tests

initial_ensemble =

Check warning on line 229 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L229

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

Check warning on line 231 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L231

Added line #L231 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 240 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L240

Added line #L240 was not covered by tests

save_parameter_ensemble(

Check warning on line 242 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L242

Added line #L242 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 254 in src/ekp_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/ekp_interface.jl#L252-L254

Added lines #L252 - L254 were not covered by tests
end

function initialize(
ensemble_size,
observations,
Expand Down

0 comments on commit 20a8bb9

Please sign in to comment.