Skip to content

Commit

Permalink
Test would always fail for viral load zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Peng committed Oct 9, 2020
1 parent b324dcc commit 4e14f9b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion covid19_outbreak_simulator/plugins/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def select(ind, counts=None):
n_tested += 1
affected = isinstance(ind.infected, float)
if affected:
lod_sensitivity = ind.test_sensitivity(time, args.sensitivity[1]) if len(args.sensitivity) == 2 else 1
test_lod = args.sensitivity[1] if len(args.sensitivity) == 2 else 0
lod_sensitivity = ind.test_sensitivity(time, test_lod)
#
sensitivity = lod_sensitivity * args.sensitivity[0]
res = sensitivity == 1 or sensitivity > numpy.random.uniform()

Expand Down
5 changes: 4 additions & 1 deletion covid19_outbreak_simulator/population.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ def viral_load(self, time):
def test_sensitivity(self, time, lod):
# return transmissibility at specified time
viral_load = self.viral_load(time)
if viral_load >= lod:
if viral_load == 0.0:
# if it is 0, it will already be 0
return 0
elif viral_load >= lod:
return 1
else:
return viral_load / lod
Expand Down

0 comments on commit 4e14f9b

Please sign in to comment.