|
19 | 19 | # ══════════════════════════════════════════════════════════════════════ |
20 | 20 | # CONFIGURATION – pick ONE tutorial and ONE run (1, 2, or 3) |
21 | 21 | # ══════════════════════════════════════════════════════════════════════ |
22 | | -TUTORIAL = "vaccination" # "household", "testing", or "vaccination" |
23 | | -RUN = 4 # 1, 2, or 3 (see tables below) |
| 22 | +TUTORIAL = "household" # "household", "testing", or "vaccination" |
| 23 | +RUN = 2 # 1, 2, or 3 (see tables below) |
24 | 24 |
|
25 | 25 | # ── 3 runs per tutorial ────────────────────────────────────────────── |
26 | 26 | # |
|
67 | 67 | "vaccination": {"exe": "tutorial_abm_vaccination", "file": "abm_vaccination.txt", "title": "Tutorial 3 – Vaccination"}, |
68 | 68 | } |
69 | 69 |
|
70 | | -cfg = _config[TUTORIAL] |
71 | | -run_cfg = RUNS[TUTORIAL][RUN] |
72 | | -root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..") |
73 | | -bin_dir = os.path.join(root_dir, "build", "bin") |
74 | | -exe_path = os.path.join(bin_dir, cfg["exe"]) |
75 | | -fpath = os.path.join(bin_dir, cfg["file"]) |
| 70 | +cfg = _config[TUTORIAL] |
| 71 | +run_cfg = RUNS[TUTORIAL][RUN] |
| 72 | +root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..") |
| 73 | +bin_dir = os.path.join(root_dir, "build", "bin") |
| 74 | +exe_path = os.path.join(bin_dir, cfg["exe"]) |
| 75 | +fpath = os.path.join(bin_dir, cfg["file"]) |
76 | 76 |
|
77 | 77 | # ── Run the executable ──────────────────────────────────────────────── |
78 | 78 | cmd = [exe_path] + run_cfg["args"] |
|
88 | 88 |
|
89 | 89 | # ── Infection-state columns & colours ───────────────────────────────── |
90 | 90 | states = ['S', 'E', 'I_NS', 'I_Sy', 'I_Sev', 'I_Crit', 'R', 'D'] |
91 | | -colors = ['blue', 'orange', 'gold', 'red', 'darkred', 'purple', 'green', 'black'] |
| 91 | +colors = ['blue', 'orange', 'gold', 'red', |
| 92 | + 'darkred', 'purple', 'green', 'black'] |
92 | 93 | labels = ['Susceptible', 'Exposed', 'Infected (No Symptoms)', |
93 | 94 | 'Infected (Symptomatic)', 'Infected (Severe)', |
94 | 95 | 'Infected (Critical)', 'Recovered', 'Dead'] |
|
110 | 111 | ax.set_ylim(bottom=0) |
111 | 112 |
|
112 | 113 | plt.tight_layout() |
113 | | -outpng = f'abm_{TUTORIAL}_run{RUN}.png' |
| 114 | +outpng = os.path.join(fpath, f'abm_{TUTORIAL}_run{RUN}.png') |
114 | 115 | plt.savefig(outpng, dpi=300, bbox_inches='tight') |
115 | 116 | print(f"\nFinal counts:\n{final.to_string()}") |
116 | | -print(f"Plot saved as '{outpng}'") |
| 117 | +print(f"Plot saved at '{outpng}'") |
117 | 118 | plt.show() |
0 commit comments