Skip to content

Commit

Permalink
Added typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
arindamsaha1507 committed Nov 17, 2023
1 parent 50a09ea commit ec94971
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions facs/base/household.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
"""Module for the Household class."""

from __future__ import annotations

import random

from dataclasses import dataclass, field
from typing import TYPE_CHECKING

from .person import Person
from .utils import probability

if TYPE_CHECKING:
from .facs import Ecosystem
from .disease import Disease


HOME_INTERACTION_FRACTION = 0.2
# people are within 2m at home of a specific other person 20% of the time.
Expand Down Expand Up @@ -52,19 +59,19 @@ def is_infected(self):

return self.get_infectious_count() > 0

def evolve(self, e, disease):
def evolve(self, eco: Ecosystem, disease: Disease):
"""Evolve the household."""

ic = self.get_infectious_count()
for i in range(0, self.size):
if self.agents[i].status == "susceptible":
if ic > 0:
infection_chance = (
e.contact_rate_multiplier["house"]
eco.contact_rate_multiplier["house"]
* disease.infection_rate
* HOME_INTERACTION_FRACTION
* ic
)
# house infection already incorporates airflow, because derived from literature.
if probability(infection_chance):
self.agents[i].infect(e)
self.agents[i].infect(eco)

0 comments on commit ec94971

Please sign in to comment.