Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More verbose naming #95

Merged
merged 7 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/EnsembleKalmanProcesses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ end


"""
find_ekp_stepsize(ekp::EnsembleKalmanProcess{FT, IT, Inversion}, g::Array{FT, 2}; cov_threshold::FT=0.01) where {FT}
find_ekp_stepsize(ekp::EnsembleKalmanProcess{FT, IT, Inversion}, g::AbstractArray{FT, 2}; cov_threshold::FT=0.01) where {FT}
Find largest stepsize for the EK solver that leads to a reduction of the determinant of the sample
covariance matrix no greater than cov_threshold.
"""
function find_ekp_stepsize(ekp::EnsembleKalmanProcess{FT, IT, Inversion}, g::Array{FT, 2}; cov_threshold::FT=0.01) where {FT, IT}
function find_ekp_stepsize(ekp::EnsembleKalmanProcess{FT, IT, Inversion}, g::AbstractArray{FT, 2}; cov_threshold::FT=0.01) where {FT, IT}
accept_stepsize = false
if !isempty(ekp.Δt)
Δt = deepcopy(ekp.Δt[end])
Expand Down
6 changes: 6 additions & 0 deletions test/EnsembleKalmanProcesses/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ using CalibrateEmulateSample.ParameterDistributionStorage
ekiobj = EnsembleKalmanProcesses.EnsembleKalmanProcess(initial_ensemble,
y_obs, Γy, Inversion())

# Find EKI timestep
g_ens = G(ekiobj.u[end]')'
Δ = find_ekp_stepsize(ekiobj, g_ens)
@test Δ ≈ 0.0625

# EKI iterations
for i in 1:N_iter
params_i = ekiobj.u[end]
Expand All @@ -77,6 +82,7 @@ using CalibrateEmulateSample.ParameterDistributionStorage
# Plot evolution of the EKI particles
eki_final_result = vec(mean(ekiobj.u[end], dims=1))

TEST_PLOT_OUTPUT = false
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running test/EnsembleKalmanProcesses/runtests.jl, it seems like TEST_PLOT_OUTPUT is not defined. Can you verify this behavior @odunbar ?

In theory we should run the tests as a block i.e from test/runtests.jl and so this is where TEST_PLOT_OUTPUT is defined (via a get method with 0 default if the CES_TEST_PLOT_OUTPUT variable is not defined). If you directly run the EKP block from test/EnsembleKalmanProcesses/runtests.jl you would need to define it.

So i would remove the line you've added here. Otherwise these run for me! Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: I've removed this in latest commit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

if TEST_PLOT_OUTPUT
gr()
p = plot(ekiobj.u[1][:,1], ekiobj.u[1][:,2], seriestype=:scatter)
Expand Down