Commit b4fa17e4 by Peter Jentsch

### fix bug in shift... use distributions rather than sampler

parent 0c4e34f0
 ... @@ -39,7 +39,7 @@ const contact_time_distributions = load_contact_time_distributions() ... @@ -39,7 +39,7 @@ const contact_time_distributions = load_contact_time_distributions() function shift_contact_distributions(sampler_matrix::AbstractMatrix{T},proportion) where T<:Distributions.PoissonADSampler function shift_contact_distributions(sampler_matrix::AbstractMatrix{T},proportion) where T<:Distributions.PoissonADSampler return map(sampler_matrix) do sampler return map(sampler_matrix) do sampler μ_old = sampler.μ μ_old = sampler.μ return Distributions.PoissonADSampler(μ_old*proportion) return Poisson(μ_old*proportion) end end end end ... ...
 ... @@ -101,9 +101,9 @@ function load_mixing_matrices() ... @@ -101,9 +101,9 @@ function load_mixing_matrices() return map(t -> from_mean.(Geometric{Float64},t),workschool_mixing), map(t -> from_mean.(Geometric{Float64}, t),rest_mixing) return map(t -> from_mean.(Geometric{Float64},t),workschool_mixing), map(t -> from_mean.(Geometric{Float64}, t),rest_mixing) end end function make_sampler(λ) # function make_sampler(λ) return Distributions.PoissonADSampler(λ)#Distributions.DiscreteNonParametricSampler(0:durmax,[pdf(Poisson(λ),x) for x in 0:durmax]) # return Distributions.PoissonADSampler(λ)#Distributions.DiscreteNonParametricSampler(0:durmax,[pdf(Poisson(λ),x) for x in 0:durmax]) end # end function load_contact_time_distributions() function load_contact_time_distributions() distkey = "Distributions.Poisson" distkey = "Distributions.Poisson" fnames = ( fnames = ( ... @@ -113,7 +113,7 @@ function load_contact_time_distributions() ... @@ -113,7 +113,7 @@ function load_contact_time_distributions() ) ) contact_distributions_tuple = map(fnames) do fname contact_distributions_tuple = map(fnames) do fname dat = deserialize(joinpath(PACKAGE_FOLDER,"intervals_model_output","simulation_output","\$fname.dat")) dat = deserialize(joinpath(PACKAGE_FOLDER,"intervals_model_output","simulation_output","\$fname.dat")) return map(p -> make_sampler(mode(p.particles)), as_symmetric_matrix(dat[distkey].P)) return map(p -> Poisson(mode(p.particles)), as_symmetric_matrix(dat[distkey].P)) end end return contact_distributions_tuple return contact_distributions_tuple end end ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!