-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCodeRunnerFile.py
More file actions
51 lines (37 loc) · 1.57 KB
/
tempCodeRunnerFile.py
File metadata and controls
51 lines (37 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import fpsim as fp
from locations import nuhdss
# Register custom location; this is necessary to include when setting up any scripts using the 'nuhdss' location
fp.defaults.register_location('nuhdss', nuhdss)
def run_simulation():
# Number of agents to simulate
n_agents = 50000
# Define the start and end year for the simulation
start_year = 2012
end_year = 2030
# Define the effect size
effect_size = 0.6
# Coverage levels to simulate
coverages = [0.45, 0.6, 0.8]
# Create a list to store scenarios
scenarios = []
# Create scenarios for each coverage level
for coverage in coverages:
init_factor = 1.0 + effect_size * coverage
scen = fp.make_scen(method='Injectables', init_factor=init_factor, year=2025)
scenarios.append((scen, f'Campaign_{coverage}'))
# Set the parameters for the simulation including location, number of agents, and time frame
pars = fp.pars(location='nuhdss', n_agents=n_agents, start_year=start_year, end_year=end_year)
# Create a Scenarios object with the defined parameters and set the number of repeats
scens = fp.Scenarios(pars=pars, repeats=3)
# Add the baseline scenario
scens.add_scen(label='Baseline')
# Add the campaign scenarios
for scen, label in scenarios:
scens.add_scen(scen, label=label)
# Run the simulation for all scenarios
scens.run()
# Plot the results of the simulation
scens.plot()
# Run the simulation when the script is executed
if __name__ == '__main__':
run_simulation()