def test_doInternalInfectionProcess_no_infectious(): current_state = {("m", "S"): 300.0, ("m", "A"): 0.0, ("m", "I"): 0.0} age_matrix = {"m": {"m": 0.2}} new_infected = np.getInternalInfectiousContactsInNode( current_state, age_matrix, 1.0, ["I", "A"], False, None) assert new_infected["m"] == 0.0
def test_doInternalInfectionProcess_only_A_and_I_count_as_infectious(): current_state = { ("m", "S"): 300.0, ("m", "E"): 100.0, ("m", "A"): 0.0, ("m", "I"): 0.0, ("m", "H"): 100.0, ("m", "D"): 100.0, ("m", "R"): 100.0, } age_matrix = {"m": {"m": 0.2}} new_infected = np.getInternalInfectiousContactsInNode( current_state, age_matrix, 1.0, ["I", "A"], False, None) assert new_infected["m"] == 0.0
def test_doInternalInfectionProcess_between_ages(): current_state = { ("m", "S"): 20.0, ("m", "A"): 150.0, ("m", "I"): 300, ("o", "S"): 15.0, ("o", "A"): 200.0, ("o", "I"): 100.0, } age_matrix = {"m": {"m": 0.2, "o": 0.5}, "o": {"o": 0.3, "m": 0.5}} new_infected = np.getInternalInfectiousContactsInNode( current_state, age_matrix, 1.0, ["I", "A"], False, None) assert new_infected["m"] == (20.0 / 470.0) * ((450.0 * 0.2) + (300.0 * 0.5)) assert new_infected["o"] == (15.0 / 315.0) * ((300.0 * 0.3) + (450.0 * 0.5))
def test_doInternalInfectionProcess_simple(susceptible, infectious, asymptomatic, contact_rate, dampening): current_state = { ("m", "S"): susceptible, ("m", "A"): asymptomatic, ("m", "I"): infectious } age_matrix = {"m": {"m": contact_rate}} new_infected = np.getInternalInfectiousContactsInNode( current_state, age_matrix, dampening, ["I", "A"], False, None) probability_of_susceptible = susceptible / (susceptible + infectious + asymptomatic) contacts = contact_rate * (asymptomatic + infectious) assert new_infected[ "m"] == probability_of_susceptible * contacts * dampening