-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
198 lines (166 loc) · 5.84 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
OUTDIR = build
OBS_VERSION=v0.6.3_v05
SIM_VERSION=20201023_v0.6.3_prod5_local_wo_n_islands
OBSDIR = observations/$(OBS_VERSION)
SIMDIR = simulations
AICT_CONFIG = config/aict.yaml
CUTS_CONFIG = config/quality_cuts.yaml
CUTS_CONFIG_DATA = $(CUTS_CONFIG)
TEL_NAME = LST_LSTCam
GAMMA_FILE = gamma_20deg_180deg_off0.4deg_$(SIM_VERSION)
GAMMA_DIFFUSE_FILE = gamma-diffuse_20deg_180deg_$(SIM_VERSION)
PROTON_FILE = proton_20deg_180deg_$(SIM_VERSION)
ELECTRON_FILE = electron_20deg_180deg_$(SIM_VERSION)
CRAB_RUNS=2922 2923 2924 2925 2929 2930 2931 2932 2933 2934 2965 2966 2967 2968 2969 2970 2971 2972 \
2973 2974 2975 2976 2977 2988 2989 2990 2991 2992 3004 3005 3006 3007 3008 3009 3010 3011 3012
#MRK421_RUNS=2113 2114 2115 2116 2117 2130 2131 2132 2133
#MRK501_RUNS=2606 2607 2608 2610 2612 2613
CRAB_DL2=$(addsuffix .h5, $(addprefix $(OUTDIR)/dl2_$(OBS_VERSION)_LST-1.Run0, $(CRAB_RUNS)))
#MRK421_DL2=$(addsuffix .h5, $(addprefix $(OUTDIR)/dl2_$(OBS_VERSION)_LST-1.Run0, $(MRK421_RUNS)))
#MRK501_DL2=$(addsuffix .h5, $(addprefix $(OUTDIR)/dl2_$(OBS_VERSION)_LST-1.Run0, $(MRK501_RUNS)))
all: $(OUTDIR)/cv_separation.h5 \
$(OUTDIR)/cv_disp.h5 \
$(OUTDIR)/cv_regressor.h5 \
$(OUTDIR)/regressor_plots.pdf \
$(OUTDIR)/disp_plots.pdf \
$(OUTDIR)/separator_plots.pdf \
$(OUTDIR)/dl2_$(GAMMA_FILE)_testing.h5 \
$(OUTDIR)/dl2_$(GAMMA_DIFFUSE_FILE)_testing.h5 \
$(OUTDIR)/dl2_$(PROTON_FILE)_testing.h5 \
$(OUTDIR)/dl2_$(ELECTRON_FILE)_testing.h5 \
$(OUTDIR)/pyirf.fits.gz \
$(OUTDIR)/obs-index.fits.gz \
$(CRAB_DL2) \
$(OUTDIR)/crab_theta2.pdf \
# $(MRK421_DL2) \
$(OUTDIR)/mrk421_theta2.pdf \
$(MRK501_DL2) \
$(OUTDIR)/mrk501_theta2.pdf
#file convert
$(OUTDIR)/%_aict.h5: $(OBSDIR)/%.h5 file_convert.py | $(OUTDIR)
python file_convert.py \
$< \
$@ \
$(TEL_NAME)
$(OUTDIR)/%_aict.h5: $(SIMDIR)/%.h5 file_convert.py | $(OUTDIR)
python file_convert.py \
$< \
$@ \
$(TEL_NAME)
#precuts
$(OUTDIR)/%_precuts.h5: $(OUTDIR)/%_aict.h5 $(CUTS_CONFIG) | $(OUTDIR)
aict_apply_cuts \
$(CUTS_CONFIG) \
$< \
$@
#train models
$(OUTDIR)/separator.pkl $(OUTDIR)/cv_separation.h5: $(CUTS_CONFIG) $(AICT_CONFIG) $(OUTDIR)/dl1_$(PROTON_FILE)_training_precuts.h5
$(OUTDIR)/separator.pkl $(OUTDIR)/cv_separation.h5: $(OUTDIR)/dl1_$(GAMMA_DIFFUSE_FILE)_training_precuts.h5
aict_train_separation_model \
$(AICT_CONFIG) \
$(OUTDIR)/dl1_$(GAMMA_DIFFUSE_FILE)_training_precuts.h5 \
$(OUTDIR)/dl1_$(PROTON_FILE)_training_precuts.h5 \
$(OUTDIR)/cv_separation.h5 \
$(OUTDIR)/separator.pkl
$(OUTDIR)/disp.pkl $(OUTDIR)/sign.pkl $(OUTDIR)/cv_disp.h5: $(CUTS_CONFIG) $(AICT_CONFIG) $(OUTDIR)/dl1_$(GAMMA_DIFFUSE_FILE)_training_precuts.h5
aict_train_disp_regressor \
$(AICT_CONFIG) \
$(OUTDIR)/dl1_$(GAMMA_DIFFUSE_FILE)_training_precuts.h5 \
$(OUTDIR)/cv_disp.h5 \
$(OUTDIR)/disp.pkl \
$(OUTDIR)/sign.pkl
$(OUTDIR)/regressor.pkl $(OUTDIR)/cv_regressor.h5: $(CUTS_CONFIG) $(AICT_CONFIG) $(OUTDIR)/dl1_$(GAMMA_FILE)_training_precuts.h5
aict_train_energy_regressor \
$(AICT_CONFIG) \
$(OUTDIR)/dl1_$(GAMMA_FILE)_training_precuts.h5 \
$(OUTDIR)/cv_regressor.h5 \
$(OUTDIR)/regressor.pkl
#apply models
$(OUTDIR)/dl2_%.h5: $(OUTDIR)/dl1_%_aict.h5 $(OUTDIR)/separator.pkl $(OUTDIR)/disp.pkl $(OUTDIR)/regressor.pkl $(AICT_CONFIG) $(CUTS_CONFIG_DATA) add_coords.py
aict_apply_cuts \
$(CUTS_CONFIG_DATA) \
$< $@ \
--chunksize=100000
aict_apply_separation_model \
$(AICT_CONFIG) \
$@ \
$(OUTDIR)/separator.pkl \
--chunksize=100000
aict_apply_disp_regressor \
$(AICT_CONFIG) \
$@ \
$(OUTDIR)/disp.pkl \
$(OUTDIR)/sign.pkl \
--chunksize=100000
aict_apply_energy_regressor \
$(AICT_CONFIG) \
$@ \
$(OUTDIR)/regressor.pkl \
--chunksize=100000
python add_coords.py \
$@
#performance plots
$(OUTDIR)/regressor_plots.pdf: $(AICT_CONFIG) $(OUTDIR)/cv_regressor.h5 | $(OUTDIR)
aict_plot_regressor_performance \
$(AICT_CONFIG) \
$(OUTDIR)/cv_regressor.h5 \
$(OUTDIR)/regressor.pkl \
-o $@
$(OUTDIR)/separator_plots.pdf: $(AICT_CONFIG) $(OUTDIR)/cv_separation.h5 | $(OUTDIR)
aict_plot_separator_performance \
$(AICT_CONFIG) \
$(OUTDIR)/cv_separation.h5 \
$(OUTDIR)/separator.pkl \
-o $@
$(OUTDIR)/disp_plots.pdf: $(AICT_CONFIG) $(OUTDIR)/cv_disp.h5 $(OUTDIR)/dl1_$(GAMMA_DIFFUSE_FILE)_training_precuts.h5 | $(OUTDIR)
aict_plot_disp_performance \
$(AICT_CONFIG) \
$(OUTDIR)/cv_disp.h5 \
$(OUTDIR)/dl1_$(GAMMA_DIFFUSE_FILE)_training_precuts.h5 \
$(OUTDIR)/disp.pkl \
$(OUTDIR)/sign.pkl \
-o $@
#observations
$(OUTDIR)/crab_theta2.pdf: theta2_wobble.py plotting.py calculation.py $(CRAB_DL2) $(OUTDIR)/pyirf.fits.gz | $(OUTDIR)
python theta2_wobble.py \
$(OUTDIR)/crab_theta2.pdf \
$(CRAB_DL2) \
'Crab' \
$(OUTDIR)/pyirf.fits.gz \
0.03 \
0.85
$(OUTDIR)/mrk421_theta2.pdf: theta2_wobble.py plotting.py calculation.py $(MRK421_DL2) $(OUTDIR)/pyirf.fits.gz | $(OUTDIR)
python theta2_wobble.py \
$(OUTDIR)/mrk421_theta2.pdf \
$(MRK421_DL2) \
'Mrk 421' \
$(OUTDIR)/pyirf.fits.gz \
0.03 \
0.85
$(OUTDIR)/mrk501_theta2.pdf: theta2_wobble.py plotting.py calculation.py $(MRK501_DL2) $(OUTDIR)/pyirf.fits.gz | $(OUTDIR)
python theta2_wobble.py \
$(OUTDIR)/mrk501_theta2.pdf \
$(MRK501_DL2) \
'Mrk 501' \
$(OUTDIR)/pyirf.fits.gz \
0.03 \
0.85
#pyirf sensitivity and irfs
$(OUTDIR)/pyirf.fits.gz: pyirf_sensitivity.py $(OUTDIR)/dl2_$(GAMMA_FILE)_testing.h5 $(OUTDIR)/dl2_$(PROTON_FILE)_testing.h5 $(OUTDIR)/dl2_$(ELECTRON_FILE)_testing.h5 | $(OUTDIR)
python pyirf_sensitivity.py \
$(OUTDIR)/dl2_$(GAMMA_FILE)_testing.h5 \
$(OUTDIR)/dl2_$(PROTON_FILE)_testing.h5 \
$(OUTDIR)/dl2_$(ELECTRON_FILE)_testing.h5 \
$(OUTDIR)/pyirf.fits.gz
#GADF DL3 files
$(OUTDIR)/obs-index.fits.gz $(OUTDIR)/hdu-index.fits.gz: to_dl3.py calculation.py $(CRAB_DL2) $(OUTDIR)/pyirf.fits.gz | $(OUTDIR)
python to_dl3.py \
$(OUTDIR) \
$(CRAB_DL2) \
'Crab' \
$(OUTDIR)/pyirf.fits.gz
$(OUTDIR):
mkdir -p $(OUTDIR)
clean:
rm -rf $(OUTDIR)
.PHONY: all clean