Skip to content

Commit

Permalink
Fix bug due to init being in unconstrained domain
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelBrand1 committed Feb 14, 2024
1 parent bd386d2 commit d8eeded
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions EpiAware/src/epimodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ struct DirectInfections <: AbstractEpiModel
data::EpiData
end

function (epi_model::DirectInfections)(recent_incidence, _I_t)
nothing, epi_model.data.transformation(_I_t)
function (epi_model::DirectInfections)(recent_incidence, unc_I_t)
nothing, epi_model.data.transformation(unc_I_t)
end

struct ExpGrowthRate <: AbstractEpiModel
data::EpiData
end

function (epi_model::ExpGrowthRate)(recent_incidence, rt)
new_incidence = recent_incidence * exp(rt)
new_incidence, new_incidence
function (epi_model::ExpGrowthRate)(unc_recent_incidence, rt)
new_unc_recent_incidence = unc_recent_incidence + rt
new_unc_recent_incidence, epi_model.data.transformation(new_unc_recent_incidence)
end

struct Renewal <: AbstractEpiModel
Expand Down
5 changes: 3 additions & 2 deletions EpiAware/test/test_epimodel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ end
rt = log(2) / 7.0 # doubling time of 7 days

expected_new_incidence = recent_incidence[end] * exp(rt)
expected_output = expected_new_incidence, expected_new_incidence
expected_output = log(expected_new_incidence), expected_new_incidence


@test rt_model(recent_incidence[end], rt) == expected_output
@test rt_model(log(recent_incidence[end]), rt)[1] expected_output[1]
@test rt_model(log(recent_incidence[end]), rt)[2] expected_output[2]
end

@testitem "DirectInfections function" begin
Expand Down

0 comments on commit d8eeded

Please sign in to comment.