Fix a bug in the calculation of the concentration.
This commit is contained in:
parent
4722a5511c
commit
9e9f1a28bc
2 changed files with 3 additions and 4 deletions
|
|
@ -287,9 +287,8 @@ class Model:
|
|||
elif t0 < t <= t1:
|
||||
# Concentration while infected present.
|
||||
init_concentration = self.concentration(t0)
|
||||
time_present = t - t0
|
||||
fac = np.exp(-IVRR * time_present)
|
||||
return ((ER + Ni) / (IVRR * V)) * (1 - fac) + init_concentration * fac
|
||||
fac = np.exp(IVRR * (t0 - t))
|
||||
return ((ER * Ni) / (IVRR * V)) * (1 - fac) + init_concentration * fac
|
||||
else:
|
||||
# Concentration while infected not present.
|
||||
end_concentration = self.concentration(t1)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ def test_r0(baseline_model):
|
|||
concentrations = [baseline_model.concentration(t) for t in ts]
|
||||
npt.assert_allclose(
|
||||
concentrations,
|
||||
[0.000000e+00, 2.909211e-01, 1.273836e-04, 2.909210e-01, 5.577662e-08],
|
||||
[0.000000e+00, 2.891970e-01, 1.266287e-04, 2.891969e-01, 5.544607e-08],
|
||||
rtol=1e-5
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue