covid19-model/simulator

possible bug in defining tmax for pushing household exposures

odorgergo opened this issue · 1 comments

Hi! I have a question about the tmax variable that is passed to the __push_household_exposure_infector_to_j function in dynamics.py:

tmax = (self.state_started_at['ipre'][infector] + self.delta_ipre_to_isym[infector] +
self.delta_isym_to_dead[infector] if self.bernoulli_is_fatal[infector] else self.delta_isym_to_resi[infector])

It seams to me that if self.bernoulli_is_fatal[infector] is False, then tmax can be smaller than the current time, and this actually occurs fairly often while running the code (making household infections much less likely). There seems to be a similar issue in lines 762 and 1027. Can you please clarify this for me?

Thanks in advance!

Hi!
You indeed found a bug here. There is a parenthesis missing around then inner if-else statement. The line should read

tmax = (self.state_started_at['ipre'][infector] + self.delta_ipre_to_isym[infector] + 
    (self.delta_isym_to_dead[infector] if self.bernoulli_is_fatal[infector] else self.delta_isym_to_resi[infector]) )

and similarly for the other occurrences. We will fix this presently.
Thanks a lot for the very close look at the code!