Exemple #1
0
def test_stopstart(workdir):
    """Run the test_stopstart setting."""
    with chdir_context(workdir):
        configs = sim.read_config("cfg_check1")
        sim.run_disease_simulation(configs, write_epi=True)
        configs = sim.read_config("cfg_check2")
        sim.run_disease_simulation(configs, write_epi=True)
        configs = sim.read_config("cfg_check3")
        sim.run_disease_simulation(configs, write_epi=True)

        assert_equal_files("test1.out", "test1_stopstart.out.expected")
        assert_equal_files("test2.out", "test2_stopstart.out.expected")
        assert_equal_files("test3.out", "test3_stopstart.out.expected")
Exemple #2
0
def test_det(workdir):
    """Run the test_det setting."""
    with chdir_context(workdir):
        configs = sim.read_config("cfg_test_det")
        sim.run_disease_simulation(configs, write_epi=True)

        assert_equal_files("test_det.out", "test_det.out.expected")
Exemple #3
0
import patchsim as sim


class MyIntervention:
    def __init__(self):
        self.original_beta = None
        self.reduced_beta = None

    def __call__(self, configs, patch_df, params, Theta, seeds, vaxs, t):
        if self.original_beta is None:
            self.original_beta = params["beta"]
            self.reduced_beta = params["beta"] * 0.9

        # For first 10 step do nothing to beta
        if t < 10:
            params["beta"] = self.original_beta
        # Next 10 steps keep it low
        elif 10 <= t < 20:
            params["beta"] = self.reduced_beta
        # After that restore
        else:
            params["beta"] = self.original_beta


configs = sim.read_config('cfg_test_foi')
my_intervention = MyIntervention()

sim.run_disease_simulation(configs,
                           write_epi=True,
                           intervene_step=my_intervention)
Exemple #4
0
import sys
sys.path.append('../')
import patchsim as sim
configs = sim.read_config('cfg_test_stoc')
sim.run_disease_simulation(configs,write_epi=True)
Exemple #5
0
import sys
sys.path.append('../')
import patchsim as sim
configs = sim.read_config('cfg_test_det')
sim.run_disease_simulation(configs, write_epi=True)
Exemple #6
0
import sys
sys.path.append('../')
import patchsim as sim
configs = sim.read_config('cfg_paramfile')
sim.run_disease_simulation(configs, write_epi=True)
Exemple #7
0
import sys
sys.path.append('../')
import patchsim as sim

configs = sim.read_config('cfg_check1')
sim.run_disease_simulation(configs, write_epi=True)
configs = sim.read_config('cfg_check2')
sim.run_disease_simulation(configs, write_epi=True)
configs = sim.read_config('cfg_check3')
sim.run_disease_simulation(configs, write_epi=True)