-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
164 lines (129 loc) · 4.46 KB
/
Makefile
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#######################################
# filename: Makefile
# author: Dylan Morris <[email protected]>
#
# description: Makefile for running
# analysis for the Morris, Rossine et al
# study of optimal and mistimed interventions
# in SIR models
#######################################
#######################################
# commands and expected bash settings
#
# (check these match your machine
# if you are having trouble reproducing
# the analysis)
#######################################
RM = rm -f
MKDIR = @mkdir -p
CP = @cp
##################################
# directory structure
##################################
OUTPUT = out
SRC = src
RESULTS = $(OUTPUT)/results
FIGURES = $(OUTPUT)/figures
MS = ms
MSFIGS = $(MS)/figures
##################################
# file formats
##################################
SRCEXT = py
FIGEXT = pdf
#################################
# all targets
##################################
.PHONY: all
all: depend results figures
###################################
# external dependency installation
###################################
PY_DEP_FILE = requirements.txt
.PHONY: depend
depend:
pip3 install -r $(PY_DEP_FILE)
###################################
# Paths to important files
###################################
PLOTTING_STYLE = $(SRC)/plotting_style.$(SRCEXT)
PARAMETERS = $(SRC)/parameters.$(SRCEXT)
SIMULATION = $(SRC)/InterventionSIR.$(SRCEXT)
OPTIMIZATION = $(SRC)/optimize_interventions.$(SRCEXT)
TAU_SWEEP_RUNNER = $(SRC)/calc_fixed_optima.$(SRCEXT)
TOFFSET_SWEEP_RUNNER = $(SRC)/toffset_parameter_sweep.$(SRCEXT)
EARLY_LATE_SWEEP_RUNNER = $(SRC)/early_late_parameter_sweep.$(SRCEXT)
## numerics depedencies:
NUMERICS = $(SIMULATION) $(OPTIMIZATION) $(PARAMETERS)
## figure dependencies
PLOT_DEPS = $(PLOTTING_STYLE) $(NUMERICS)
## figure targets
FIGURE_NAMES = figure-interventions.$(FIGEXT) figure-mistimed.$(FIGEXT) figure-parameter-sweep.$(FIGEXT) figure-f-sigma-of-tau.$(FIGEXT)
FIGURE_PATHS = $(addprefix $(FIGURES)/, $(FIGURE_NAMES))
MS_FIGURE_PATHS = $(addprefix $(MSFIGS)/, $(FIGURE_NAMES))
## output targets
TAU_SWEEP = $(RESULTS)/tau_sweep_default_params.csv
TAU_TOFFSET_SWEEP = $(RESULTS)/toffset_tau_sweep.csv
GAMMA_TOFFSET_SWEEP = $(RESULTS)/toffset_gamma_sweep.csv
TAU_EARLY_LATE_SWEEP = $(RESULTS)/early_late_tau_sweep.csv
GAMMA_EARLY_LATE_SWEEP = $(RESULTS)/early_late_gamma_sweep.csv
HEATMAP_OPT_SWEEPS = $(TAU_TOFFSET_SWEEP) $(GAMMA_TOFFSET_SWEEP) $(TAU_EARLY_LATE_SWEEP) $(GAMMA_EARLY_LATE_SWEEP)
###################################
# Rules for output
###################################
$(FIGURES)/%.$(FIGEXT): $(SRC)/%.$(SRCEXT) $(PLOT_DEPS)
$(MKDIR) $(FIGURES)
./$< $@
$(FIGURES)/figure-interventions.$(FIGEXT): $(SRC)/figure-interventions.$(SRCEXT) $(TAU_SWEEP) $(PLOT_DEPS)
$(MKDIR) $(FIGURES)
./$< $(TAU_SWEEP) $@
$(FIGURES)/figure-f-sigma-of-tau.$(FIGEXT): $(SRC)/figure-f-sigma-of-tau.$(SRCEXT) $(TAU_SWEEP) $(PLOT_DEPS)
$(MKDIR) $(FIGURES)
./$< $(TAU_SWEEP) $@
$(FIGURES)/figure-parameter-sweep.$(FIGEXT): $(SRC)/figure-parameter-sweep.$(SRCEXT) $(HEATMAP_OPT_SWEEPS) $(PLOT_DEPS)
$(MKDIR) $(FIGURES)
./$< $(HEATMAP_OPT_SWEEPS) $@
$(MSFIGS)/%.$(FIGEXT): $(FIGURES)/%.$(FIGEXT)
$(MKDIR) $(MSFIGS)
$(CP) $< $@
$(TAU_SWEEP): $(TAU_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< $@
$(GAMMA_TOFFSET_SWEEP): $(TOFFSET_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< gamma maintain-suppress-time $@
$(TAU_TOFFSET_SWEEP): $(TOFFSET_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< tau maintain-suppress-time $@
$(GAMMA_EARLY_LATE_SWEEP): $(EARLY_LATE_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< gamma maintain-suppress-time $@
$(TAU_EARLY_LATE_SWEEP): $(EARLY_LATE_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< tau maintain-suppress-time $@
$(GAMMA_TOFFSET_SWEEP_FIXED): $(TOFFSET_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< gamma fixed $@
$(TAU_TOFFSET_SWEEP_FIXED): $(TOFFSET_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< tau fixed $@
$(GAMMA_EARLY_LATE_SWEEP_FIXED): $(EARLY_LATE_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< gamma fixed $@
$(TAU_EARLY_LATE_SWEEP_FIXED): $(EARLY_LATE_SWEEP_RUNNER) $(NUMERICS)
$(MKDIR) $(RESULTS)
./$< tau fixed $@
.PHONY: results
results: $(TAU_SWEEP) $(HEATMAP_OPT_SWEEPS) $(HEATMAP_FIXED_SWEEPS)
.PHONY: figures
figures: $(FIGURE_PATHS) $(MS_FIGURE_PATHS)
.PHONY: clean rmtemp
# removes tempfiles generated by
# python, emacs
rmtemp:
$(RM) src/*~*
$(RM) src/*#*
$(RM) -r src/__pycache__
# removes all output
clean: rmtemp
$(RM) -r out