def test_basic_simulation_100_runs(data_api): network, _ = np.createNetworkOfPopulation( data_api.read_table("human/compartment-transition", "compartment-transition"), data_api.read_table("human/population", "population"), data_api.read_table("human/commutes", "commutes"), data_api.read_table("human/mixing-matrix", "mixing-matrix"), data_api.read_table("human/infectious-compartments", "infectious-compartments"), data_api.read_table("human/infection-probability", "infection-probability"), data_api.read_table("human/initial-infections", "initial-infections"), data_api.read_table("human/trials", "trials"), data_api.read_table("human/start-end-date", "start-end-date"), ) runs = [] rand = random.Random(1) issues = [] for _ in range(100): regions = rand.choices(list(network.graph.nodes()), k=1) assert network.initialState[regions[0]][("[17,70)", "E")] == 0 df, new_issues = np.basicSimulationInternalAgeStructure( network, {regions[0]: { "[17,70)": 10.0 }}, numpy.random.default_rng(123)) result = calculateInfectiousOverTime(df, network.infectiousStates) result.pop( ) # TODO: due to historical reasons we have to ignore the last entry runs.append(result) issues.extend(new_issues) result = common.generateMeanPlot(runs) _assert_baseline(result) assert not issues
def test_basic_simulation_with_dampening(data_api): network, _ = np.createNetworkOfPopulation( data_api.read_table("human/compartment-transition", "compartment-transition"), data_api.read_table("human/population", "population"), data_api.read_table("human/commutes", "commutes"), data_api.read_table("human/mixing-matrix", "mixing-matrix"), data_api.read_table("human/infectious-compartments", "infectious-compartments"), data_api.read_table("human/infection-probability", "infection-probability"), data_api.read_table("human/initial-infections", "initial-infections"), data_api.read_table("human/trials", "trials"), data_api.read_table("human/start-end-date", "start-end-date"), data_api.read_table("human/movement-multipliers", "movement-multipliers"), ) df, issues = np.basicSimulationInternalAgeStructure( network, {"S08000016": { "[17,70)": 10.0 }}, numpy.random.default_rng(123)) result = calculateInfectiousOverTime(df, network.infectiousStates) _assert_baseline(result) assert not issues
def test_basic_simulation(data_api): network = np.createNetworkOfPopulation( data_api.read_table("human/compartment-transition"), data_api.read_table("human/population"), data_api.read_table("human/commutes"), data_api.read_table("human/mixing-matrix"), data_api.read_table("human/infectious-compartments"), data_api.read_table("human/infection-probability"), data_api.read_table("human/initial-infections"), data_api.read_table("human/trials"), ) result = calculateInfectiousOverTime( np.basicSimulationInternalAgeStructure( network, 200, {"S08000016": { "[17,70)": 10.0 }}), network.infectiousStates) _assert_baseline(result)