-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
133 lines (104 loc) · 4.03 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
SLIDES_TEX = slides-bayreuth.tex
SLIDES_PDF = $(SLIDES_TEX:.tex=.pdf)
.PHONY: slides \
plots.all plots.coefficients plots.optimized plots.zeroguess plots.rampdown\
tables.all \
numericals.all numericals.zeroguess numericals.rampdown\
touch \
clean.all clean.temp clean.slides clean.plots clean.numericals
OPTENV = optenv/problem.py optenv/parameters.py optenv/material.json
ZEROGUESS_OPTCONTROLS = $(shell python3 optenv/filenames.py --experiment=zeroguess --type=optcontrols)
ZEROGUESS_REPORTS = $(shell python3 optenv/filenames.py --experiment=zeroguess --type=reports)
RAMPDOWN_OPTCONTROLS = $(shell optenv/filenames.py --experiment=rampdown --type=optcontrols)
RAMPDOWN_REPORTS = $(shell optenv/filenames.py --experiment=rampdown --type=reports)
RAMPDOWN_NOOPT_CONTROLS = $(subst rampdown,rampdown-noopt, $(RAMPDOWN_OPTCONTROLS))
RAMPDOWN_NOOPT_REPORTS = $(subst rampdown,rampdown-noopt, $(RAMPDOWN_REPORTS))
# a dirty hack to make optenv package visible for the python scripts
# works only if make is called from the project root dir (which is normally the case)
# export PYTHONPATH = :
slides: $(SLIDES_PDF)
$(SLIDES_PDF): \
$(SLIDES_TEX) \
plots.all \
tables.all
latexmk -xelatex -f $(SLIDES_TEX)
plots/coefficients/vhc.pdf: \
plots/_src/vhc.py \
plots/_src/metropolis.mplstyle \
$(OPTENV)
mkdir -p plots/coefficients
python3 plots/_src/vhc.py --outfile=$@
plots/coefficients/kappa.pdf: \
plots/_src/vhc.py \
plots/_src/metropolis.mplstyle \
$(OPTENV)
mkdir -p plots/coefficients
python3 plots/_src/kappa.py --outfile=$@
plots/optimized/zeroguess.pdf: \
plots/_src/zeroguess.py \
plots/_src/metropolis.mplstyle \
$(ZEROGUESS_OPTCONTROLS)
mkdir -p plots/optimized
python3 plots/_src/zeroguess.py --outfile=$@
plots/optimized/rampdown.pdf: \
plots/_src/rampdown.py \
plots/_src/metropolis.mplstyle \
$(RAMPDOWN_OPTCONTROLS) \
$(RAMPDOWN_NOOPT_CONTROLS)
mkdir -p plots/optimized
python3 plots/_src/rampdown.py --outfile=$@
tables/zeroguess.tex: $(ZEROGUESS_REPORTS) tables/_src/zeroguess.py
python3 tables/_src/zeroguess.py > tables/zeroguess.tex
tables/rampdown.tex: \
$(RAMPDOWN_REPORTS) \
$(RAMPDOWN_NOOPT_REPORTS) \
tables/_src/rampdown.py
python3 tables/_src/rampdown.py > tables/rampdown.tex
# since the grouped targets feature was introduces in make since v4.3
# and we want to keep the project compatible with make >= 4.1
# here is a dirty workaround for the grouped targets
numericals/zeroguess/%.json: numericals/zeroguess/%.npy ;
numericals/zeroguess/%.npy : \
numericals/_src/optimize-zeroguess.py \
$(OPTENV)
mkdir -p numericals/zeroguess
python3 numericals/_src/optimize-zeroguess.py --outfile=$@
numericals/rampdown/%.json: numericals/rampdown/%.npy ;
numericals/rampdown/%.npy: \
numericals/_src/optimize-rampdown.py \
$(OPTENV)
mkdir -p numericals/rampdown
python3 numericals/_src/optimize-rampdown.py --outfile=$@
numericals/rampdown-noopt/%.json: numericals/rampdown-noopt/%.npy ;
numericals/rampdown-noopt/%.npy: \
numericals/_src/optimize-rampdown.py \
$(OPTENV)
mkdir -p numericals/rampdown-noopt
python3 numericals/_src/optimize-rampdown.py --no-opt --outfile=$@
# PHONY
plots.all: plots.coefficients plots.optimized
plots.coefficients: plots/coefficients/vhc.pdf plots/coefficients/kappa.pdf
plots.optimized: plots.zeroguess plots.rampdown
plots.zeroguess: plots/optimized/zeroguess.pdf
plots.rampdown: plots/optimized/rampdown.pdf
tables.all: tables/zeroguess.tex tables/rampdown.tex
numericals.all: numericals.zeroguess numericals.rampdown
numericals.zeroguess: $(ZEROGUESS_OPTCONTROLS) $(ZEROGUESS_REPORTS)
numericals.rampdown: \
$(RAMPDOWN_OPTCONTROLS) $(RAMPDOWN_REPORTS) \
$(RAMPDOWN_NOOPT_CONTROLS) $(RAMPDOWN_NOOPT_REPORTS)
touch:
touch numericals/rampdown/*
touch numericals/rampdown-noopt/*
touch numericals/zeroguess/*
clean.all: clean.slides clean.plots clean.numericals
clean.temp:
latexmk -c
clean.slides:
latexmk -C
clean.plots:
rm -rf plots/coefficients/*
rm -rf plots/optimized/*
clean.numericals:
rm -rf numericals/zeroguess/*
rm -rf numericals/rampdown/*