Closed pausz closed 3 years ago
@pausz Thanks! I believe this is correct. When you start off the simulation, 1 agent = 1 person. So 25 imported infections is 25 infected agents. As the scale factor increases, 1 agent > 1 person. In the limit, 1 agent = 25.5 infected people. So then 25 imported infections = 0.96 infected agents. This will round to 1 almost all the time, but very occasionally 0. If you set pop_scale to be 50, then it should be 1 half the time and 0 half the time. Each infected agent will correspond to 50 imported infections, and you can't infect half an agent, so it should be 0 (=0) half the time and 1 (=50) half the time, averaging out to 25.
@cliffckerr excellent, thank you for the explanation! And yes, if I set pop_scale to 50, it does rescale_factor 1.0, 1.0, 3.58 ... & and then 50, so that in the limit of t-> inf, the number of imports is 1 half the time and 0 half the time.
Expected behavior; closing
Describe the bug
There seems to be an issue with rescaling in
cv.Strain.apply()
. In immunity.py, line 121, the variablerescale_factor
changes value. This is in a setting, wherepop_scale
has been specified. I'm unsure if this is expected behavior and I'm not understanding how rescaling works, but it seems odd. Therescale_factor
starts as 1.0, then goes through an intermediate value and then settles in the value given inpop_scale
. As a result, the first time we apply cv.strain(), we infectn_imports
agents, rather than a value close ton_imports/rescale_factor
.To reproduce
Steps to reproduce the behavior:
For model issues:
Expected behavior
In the case
pop_scale
is specified, I'd expect the resulting number of imports of the specific strain, to be the number of imports specified in cv.strain() divided bypop_scale
, throughout the whole simulation. For the specific values used in this example, the resulting ratio is 0.98-ish. I'd expect that sc.randround() would produces values of 0 or 1, but not larger than 1.Screenshots or outputs I added some good ol' print statements :see_no_evil:
The rescale factor is 1.0, then 1.0 again, then 3.5831807999999996
and finally it takes the value of
pop_scale
Platform:
pip install -e
;