From e136c4300f89bb95bc3c59a5db2c14a87f11874c Mon Sep 17 00:00:00 2001 From: monty Date: Sun, 6 Aug 2023 11:35:13 -0600 Subject: [PATCH] filename --- Project.toml | 2 +- src/AffineInvariantMCMC.jl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 4b0288a..285173d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "AffineInvariantMCMC" uuid = "a0f608ac-68d0-5108-ad9a-0cdca73324f3" -version = "1.2.1" +version = "1.2.2" [deps] JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" diff --git a/src/AffineInvariantMCMC.jl b/src/AffineInvariantMCMC.jl index 6554dc6..9c85ed9 100644 --- a/src/AffineInvariantMCMC.jl +++ b/src/AffineInvariantMCMC.jl @@ -40,8 +40,8 @@ Reference: Goodman & Weare, "Ensemble samplers with affine invariance", Communications in Applied Mathematics and Computational Science, DOI: 10.2140/camcos.2010.5.65, 2010. """ -function sample(llhood::Function, numwalkers::Integer, x0::AbstractMatrix, numsamples_perwalker::Integer, thinning::Integer, a::Number=2.; filename::AbstractString, load::Bool=true, save::Bool=true, rng::Random.AbstractRNG=Random.GLOBAL_RNG) - if isfile(filename) && load +function sample(llhood::Function, numwalkers::Integer, x0::AbstractMatrix, numsamples_perwalker::Integer, thinning::Integer, a::Number=2.; filename::AbstractString="", load::Bool=true, save::Bool=true, rng::Random.AbstractRNG=Random.GLOBAL_RNG) + if filename != "" && isfile(filename) && load chain, llhoodvals = JLD2.load(filename, "chain", "llhoods") end x = copy(x0) @@ -75,7 +75,7 @@ function sample(llhood::Function, numwalkers::Integer, x0::AbstractMatrix, numsa end end end - if save && filename != "" + if save && filename != "" JLD2.save(filename, "chain", chain, "llhoods", llhoodvals) end return chain, llhoodvals