Skip to content

Commit

Permalink
Introduced ipre-seeded immunity
Browse files Browse the repository at this point in the history
  • Loading branch information
arindamsaha1507 committed Dec 1, 2023
1 parent 06d9645 commit 45b8ec0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion facs/base/person.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import numpy as np
import yaml

from facs.readers.read_disease_yml import read_disease_yml
from .needs import Needs
from .location_types import building_types_dict, building_types_data
from .utils import (
Expand All @@ -26,6 +27,7 @@
from .house import House
from .household import Household
from .location import Location
from .disease import Disease


needs = Needs("covid_data/needs.csv", list(building_types_dict.keys()))
Expand All @@ -34,6 +36,8 @@
vac_data = yaml.safe_load(f)
antivax_chance = vac_data["antivax_fraction"]

immune_duration = read_disease_yml("covid_data/disease_covid19.yml").immunity_duration


@dataclass
class Person:
Expand Down Expand Up @@ -69,6 +73,10 @@ def __post_init__(self):
if np.random.rand() < antivax_chance: # 5% are antivaxxers.
self.antivax = True

if np.random.rand() < 0.5: # 50% immune initially
self.status = "immune"
self.phase_duration = np.random.poisson(immune_duration)

self.age = np.random.choice(91, p=self.ages) # age in years
self.job = np.random.choice(4, 1, p=[0.865, 0.015, 0.08, 0.04])[0]
# 0=default, 1=teacher (1.5%), 2=shop worker (8%), 3=health worker (4%)
Expand Down Expand Up @@ -210,7 +218,7 @@ def recover(self, e, location):
e.time, self.location.location_x, self.location.location_x, location, e.rank
)

def progress_condition(self, e, t, disease):
def progress_condition(self, e, t, disease: Disease):
"""Progress the condition of a person."""
if self.status_change_time > t:
return
Expand Down

0 comments on commit 45b8ec0

Please sign in to comment.