Exemplo n.º 1
0
def test_createNextStep_susceptible_in_progression():
    currState = {"r1": {("70+", "S"): 30.0}}
    progression = {"r1": {("70+", "S"): 7.0}}
    exposed = {"r1": {}}

    with pytest.raises(AssertionError):
        np.createNextStep(progression, exposed, currState, 1.0, False, None)
Exemplo n.º 2
0
def test_createNextStep_keep_susceptibles():
    currState = {"r1": {("70+", "S"): 30.0, ("70+", "E"): 20.0}}

    nextStep = np.createNextStep({"r1": {}}, {"r1": {}}, currState, 1.0, False,
                                 None)

    assert nextStep == {"r1": {("70+", "S"): 30.0, ("70+", "E"): 0.0}}
Exemplo n.º 3
0
def test_createNextStep_zero_susceptible():
    currState = {"r1": {("70+", "S"): 0., ("70+", "E"): 0.0}}
    progression = {"r1": {}}
    exposed = {"r1": {"70+": 0.}}

    nextStep = np.createNextStep(progression, exposed, currState, 1.0, False,
                                 None)

    assert nextStep == {"r1": {("70+", "S"): 0., ("70+", "E"): 0.}}
Exemplo n.º 4
0
def test_createNextStep_susceptible_smaller_than_exposed():
    currState = {"r1": {("70+", "S"): 10., ("70+", "E"): 10.}}
    progression = {"r1": {}}
    exposed = {"r1": {"70+": 15.}}
    nextStep = np.createNextStep(progression, exposed, currState, 1.0, False,
                                 None)

    assert nextStep == {
        "r1": {
            ("70+", "S"): 2.058911320946491,
            ("70+", "E"): 7.941088679053509
        }
    }

    currState = {"r1": {("70+", "S"): 0.5, ("70+", "E"): 0.}}
    progression = {"r1": {}}
    exposed = {"r1": {"70+": 0.75}}
    nextStep = np.createNextStep(progression, exposed, currState, 1.0, False,
                                 None)

    assert nextStep == {"r1": {("70+", "S"): 0., ("70+", "E"): 0.5}}
Exemplo n.º 5
0
def test_createNextStep_use_infection_rate():
    currState = {"r1": {("70+", "S"): 30.0, ("70+", "E"): 0.0}}
    progression = {"r1": {}}
    exposed = {"r1": {"70+": 20.0}}

    nextStep = np.createNextStep(progression, exposed, currState, 0.5, False,
                                 None)

    assert nextStep == {
        "r1": {
            ("70+", "S"): 22.61423230385344,
            ("70+", "E"): 7.38576769614656
        }
    }
Exemplo n.º 6
0
def test_createNextStep_update_infection():
    currState = {"r1": {("70+", "S"): 30.0, ("70+", "E"): 0.0}}
    progression = {"r1": {}}
    exposed = {"r1": {"70+": 20.0}}

    nextStep = np.createNextStep(progression, exposed, currState, 1.0, False,
                                 None)

    assert nextStep == {
        "r1": {
            ("70+", "S"): 15.22846460770688,
            ("70+", "E"): 14.77153539229312
        }
    }
Exemplo n.º 7
0
def test_createNextStep_progression_nodes():
    currState = {"r1": {("70+", "S"): 30.0, ("70+", "E"): 10.0}}
    progression = {"r1": {("70+", "E"): 7.0, ("70+", "A"): 3.0}}
    exposed = {"r1": {"70+": 10.0}}

    nextStep = np.createNextStep(progression, exposed, currState, 1.0, False,
                                 None)

    assert nextStep == {
        "r1": {
            ("70+", "S"): 21.374141812742014,
            ("70+", "E"): 15.625858187257986,
            ("70+", "A"): 3.0
        }
    }
Exemplo n.º 8
0
def test_createNextStep_region_mismatch_raises_assert_error(
        progression, exposed, currentState):
    with pytest.raises(AssertionError):
        np.createNextStep(progression, exposed, currentState, 1.0, False, None)