Closed AndrewC19 closed 2 years ago
I have observed a similar phenomenon. My guess is that it has something to do with this line, which incorporates dynamic rescaling into the sum over the vaccinated state. Perhaps this could be investigated?
Another thing I have noticed in the BaseVaccination
class is that the self.vaccinations
and sim.people.vaccinations
arrays get out-of-sync when dynamic rescaling takes effect (sim.rescale_vec[sim.t] > 1
). This makes the following line filter out the wrong agents leading to mismatch of vaccinations, too:
I cannot find where/why this occurs but suspect that during dynamic rescaling the order of sim.people
changes somehow. This is my only theory. For anyone coming across this I suggest to not use any internal arrays and use the attribute assigned to the agent as the source of truth instead. For example:
vacc_inds = vacc_inds[~sim.people.dead[vacc_inds]]
vacc_inds = vacc_inds[sim.people.vaccinations[vacc_inds] < self.p['doses']]
This has been fixed in 3.1 (to be released in the next couple days). The new output (updating cum_vaccinations
to cum_doses
) is:
[ True True True ... True True True] [ True True True ... True True True]
[21. 21. 21. ... 21. 21. 21.] [ 1. 29. 1. ... 12. 2. 16.]
[20000.0, 10000.0, 10000.0] [19745.0, 9842.0, 9842.0]
Short Description When setting a vaccination subtarget (e.g. prioritise the elderly), the cumulative number of vaccinated agents (
cum_vaccinated
) exceeds the total number of agents in the model (pop_size
) by a significant margin.Describe the bug After running a simple simulation with a population size of 10,000 and the pfizer vaccine, I end up with
cum_vaccinations = 30000.0
,cum_vaccinated = 10000.0
, andn_vaccinated = 10000.0
. This is the expected behaviour.However, when I change my simulation to use a pfizer vaccine with
subtarget=vaccinate_by_age
wherevaccinate_by_age
is the method found in tutorial 5, I end up withcum_vaccinations = 122534.0
,cum_vaccinated = 102754.0
, andn_vaccinated=9866.0
.In both cases,
people.vaccinations
contains 10000 values, between 0 and 2, and therefore no agent is vaccinated more than twice.How is it possible that in the second simulation the cumulative statistics exceed 20000?
For both vaccines, I set
days=list(range(35))
. If I'm not mistaken, this means that vaccines should only be given on days 0 to 35 of the simulation. However, when I look atpeople.date_vaccinated
, it appears that everyone is vaccinated on day 21 in the first simulation and I have dates which are greater than 35 in the second simulation.Should this be possible? The documentation says
days (int/arr): the day or array of days to apply the interventions
.As a side note, could you also explain the difference between
cum_vaccinated
andcum_vaccinations
and why, in the first example, the latter is three times greater.To reproduce
Thanks in advance!