Commit d0da27ce27a9ca64163e30f22ec47b1906e6090a

Authored by Luigi Tibaldo
1 parent accdc3ba

added new empty script

cscripts/Makefile.am
1 ############################################################################# 1 #############################################################################
  2 +
2 # Makefile for cscripts scripts # 3 # Makefile for cscripts scripts #
  4 +
3 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
  6 +
4 # Copyright (C) 2016-2019 Juergen Knoedlseder # 7 # Copyright (C) 2016-2019 Juergen Knoedlseder #
  8 +
5 # ------------------------------------------------------------------------- # 9 # ------------------------------------------------------------------------- #
  10 +
6 # # 11 # #
  12 +
7 # This program is free software: you can redistribute it and/or modify # 13 # This program is free software: you can redistribute it and/or modify #
  14 +
8 # it under the terms of the GNU General Public License as published by # 15 # it under the terms of the GNU General Public License as published by #
  16 +
9 # the Free Software Foundation, either version 3 of the License, or # 17 # the Free Software Foundation, either version 3 of the License, or #
  18 +
10 # (at your option) any later version. # 19 # (at your option) any later version. #
  20 +
11 # # 21 # #
  22 +
12 # This program is distributed in the hope that it will be useful, # 23 # This program is distributed in the hope that it will be useful, #
  24 +
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of # 25 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
  26 +
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # 27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  28 +
15 # GNU General Public License for more details. # 29 # GNU General Public License for more details. #
  30 +
16 # # 31 # #
  32 +
17 # You should have received a copy of the GNU General Public License # 33 # You should have received a copy of the GNU General Public License #
  34 +
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. # 35 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
  36 +
19 # # 37 # #
  38 +
20 ############################################################################# 39 #############################################################################
21 40
  41 +
  42 +
22 # Scripts to be distributed in $(pyexecdir)/cscripts 43 # Scripts to be distributed in $(pyexecdir)/cscripts
  44 +
23 pythonscripts = $(top_builddir)/cscripts/__init__.py \ 45 pythonscripts = $(top_builddir)/cscripts/__init__.py \
  46 +
24 $(srcdir)/csbkgmodel.py \ 47 $(srcdir)/csbkgmodel.py \
  48 +
25 $(srcdir)/cscaldb.py \ 49 $(srcdir)/cscaldb.py \
  50 +
26 $(srcdir)/csebins.py \ 51 $(srcdir)/csebins.py \
  52 +
27 $(srcdir)/csinfo.py \ 53 $(srcdir)/csinfo.py \
  54 +
28 $(srcdir)/cslightcrv.py \ 55 $(srcdir)/cslightcrv.py \
  56 +
29 $(srcdir)/csmodelinfo.py \ 57 $(srcdir)/csmodelinfo.py \
  58 +
30 $(srcdir)/csmodelmerge.py \ 59 $(srcdir)/csmodelmerge.py \
  60 +
31 $(srcdir)/csmodelselect.py \ 61 $(srcdir)/csmodelselect.py \
  62 +
32 $(srcdir)/csmodelsois.py \ 63 $(srcdir)/csmodelsois.py \
  64 +
33 $(srcdir)/csobs2caldb.py \ 65 $(srcdir)/csobs2caldb.py \
  66 +
34 $(srcdir)/csobsdef.py \ 67 $(srcdir)/csobsdef.py \
  68 +
35 $(srcdir)/csobsinfo.py \ 69 $(srcdir)/csobsinfo.py \
  70 +
36 $(srcdir)/csobsselect.py \ 71 $(srcdir)/csobsselect.py \
  72 +
37 $(srcdir)/csphagen.py \ 73 $(srcdir)/csphagen.py \
  74 +
38 $(srcdir)/csphasecrv.py \ 75 $(srcdir)/csphasecrv.py \
  76 +
39 $(srcdir)/cspull.py \ 77 $(srcdir)/cspull.py \
  78 +
40 $(srcdir)/csresmap.py \ 79 $(srcdir)/csresmap.py \
  80 +
41 $(srcdir)/csresspec.py \ 81 $(srcdir)/csresspec.py \
  82 +
42 $(srcdir)/csroot2caldb.py \ 83 $(srcdir)/csroot2caldb.py \
  84 +
43 $(srcdir)/cssens.py \ 85 $(srcdir)/cssens.py \
  86 +
44 $(srcdir)/csspec.py \ 87 $(srcdir)/csspec.py \
  88 +
45 $(srcdir)/cssrcdetect.py \ 89 $(srcdir)/cssrcdetect.py \
  90 +
46 $(srcdir)/cstsdist.py \ 91 $(srcdir)/cstsdist.py \
  92 +
47 $(srcdir)/cstsmapmerge.py \ 93 $(srcdir)/cstsmapmerge.py \
  94 +
48 $(srcdir)/cstsmapsplit.py \ 95 $(srcdir)/cstsmapsplit.py \
  96 +
49 $(srcdir)/csviscube.py \ 97 $(srcdir)/csviscube.py \
  98 +
  99 + $(srcdir)/csscs.py \
50 $(srcdir)/csworkflow.py \ 100 $(srcdir)/csworkflow.py \
  101 +
51 $(srcdir)/csfindobs.py \ 102 $(srcdir)/csfindobs.py \
  103 +
52 $(srcdir)/csiactcopy.py \ 104 $(srcdir)/csiactcopy.py \
  105 +
53 $(srcdir)/csiactdata.py \ 106 $(srcdir)/csiactdata.py \
  107 +
54 $(srcdir)/csiactobs.py \ 108 $(srcdir)/csiactobs.py \
  109 +
55 $(srcdir)/obsutils.py \ 110 $(srcdir)/obsutils.py \
  111 +
56 $(srcdir)/modutils.py \ 112 $(srcdir)/modutils.py \
  113 +
57 $(srcdir)/calutils.py \ 114 $(srcdir)/calutils.py \
  115 +
58 $(srcdir)/ioutils.py \ 116 $(srcdir)/ioutils.py \
  117 +
59 $(srcdir)/mputils.py 118 $(srcdir)/mputils.py
60 119
  120 +
  121 +
61 # Parfiles to be distributed in $(prefix)/syspfiles 122 # Parfiles to be distributed in $(prefix)/syspfiles
  123 +
62 parfiles = $(srcdir)/csbkgmodel.par \ 124 parfiles = $(srcdir)/csbkgmodel.par \
  125 +
63 $(srcdir)/cscaldb.par \ 126 $(srcdir)/cscaldb.par \
  127 +
64 $(srcdir)/csebins.par \ 128 $(srcdir)/csebins.par \
  129 +
65 $(srcdir)/cslightcrv.par \ 130 $(srcdir)/cslightcrv.par \
  131 +
66 $(srcdir)/csmodelinfo.par \ 132 $(srcdir)/csmodelinfo.par \
  133 +
67 $(srcdir)/csmodelmerge.par \ 134 $(srcdir)/csmodelmerge.par \
  135 +
68 $(srcdir)/csmodelselect.par \ 136 $(srcdir)/csmodelselect.par \
  137 +
69 $(srcdir)/csmodelsois.par \ 138 $(srcdir)/csmodelsois.par \
  139 +
70 $(srcdir)/csobs2caldb.par \ 140 $(srcdir)/csobs2caldb.par \
  141 +
71 $(srcdir)/csobsdef.par \ 142 $(srcdir)/csobsdef.par \
  143 +
72 $(srcdir)/csobsinfo.par \ 144 $(srcdir)/csobsinfo.par \
  145 +
73 $(srcdir)/csobsselect.par \ 146 $(srcdir)/csobsselect.par \
  147 +
74 $(srcdir)/csphagen.par \ 148 $(srcdir)/csphagen.par \
  149 +
75 $(srcdir)/csphasecrv.par \ 150 $(srcdir)/csphasecrv.par \
  151 +
76 $(srcdir)/cspull.par \ 152 $(srcdir)/cspull.par \
  153 +
77 $(srcdir)/csresmap.par \ 154 $(srcdir)/csresmap.par \
  155 +
78 $(srcdir)/csresspec.par \ 156 $(srcdir)/csresspec.par \
  157 +
79 $(srcdir)/csroot2caldb.par \ 158 $(srcdir)/csroot2caldb.par \
  159 +
80 $(srcdir)/cssens.par \ 160 $(srcdir)/cssens.par \
  161 +
81 $(srcdir)/csspec.par \ 162 $(srcdir)/csspec.par \
  163 +
82 $(srcdir)/cssrcdetect.par \ 164 $(srcdir)/cssrcdetect.par \
  165 +
83 $(srcdir)/cstsdist.par \ 166 $(srcdir)/cstsdist.par \
  167 +
84 $(srcdir)/cstsmapmerge.par \ 168 $(srcdir)/cstsmapmerge.par \
  169 +
85 $(srcdir)/cstsmapsplit.par \ 170 $(srcdir)/cstsmapsplit.par \
  171 +
86 $(srcdir)/csviscube.par \ 172 $(srcdir)/csviscube.par \
  173 +
  174 + $(srcdir)/csscs.par \
87 $(srcdir)/csworkflow.par \ 175 $(srcdir)/csworkflow.par \
  176 +
88 $(srcdir)/csfindobs.par \ 177 $(srcdir)/csfindobs.par \
  178 +
89 $(srcdir)/csiactcopy.par \ 179 $(srcdir)/csiactcopy.par \
  180 +
90 $(srcdir)/csiactdata.par \ 181 $(srcdir)/csiactdata.par \
  182 +
91 $(srcdir)/csiactobs.par 183 $(srcdir)/csiactobs.par
92 184
  185 +
  186 +
93 # Scripts for which symbolic links will be created in bindir 187 # Scripts for which symbolic links will be created in bindir
  188 +
94 linkscripts = csbkgmodel \ 189 linkscripts = csbkgmodel \
  190 +
95 cscaldb \ 191 cscaldb \
  192 +
96 csebins \ 193 csebins \
  194 +
97 csinfo \ 195 csinfo \
  196 +
98 cslightcrv \ 197 cslightcrv \
  198 +
99 csmodelinfo \ 199 csmodelinfo \
  200 +
100 csmodelmerge \ 201 csmodelmerge \
  202 +
101 csmodelselect \ 203 csmodelselect \
  204 +
102 csmodelsois \ 205 csmodelsois \
  206 +
103 csobs2caldb \ 207 csobs2caldb \
  208 +
104 csobsdef \ 209 csobsdef \
  210 +
105 csobsinfo \ 211 csobsinfo \
  212 +
106 csobsselect \ 213 csobsselect \
  214 +
107 csphagen \ 215 csphagen \
  216 +
108 csphasecrv \ 217 csphasecrv \
  218 +
109 cspull \ 219 cspull \
  220 +
110 csresmap \ 221 csresmap \
  222 +
111 csresspec \ 223 csresspec \
  224 +
112 csroot2caldb \ 225 csroot2caldb \
  226 +
113 cssens \ 227 cssens \
  228 +
114 csspec \ 229 csspec \
  230 +
115 cssrcdetect \ 231 cssrcdetect \
  232 +
116 cstsdist \ 233 cstsdist \
  234 +
117 cstsmapmerge \ 235 cstsmapmerge \
  236 +
118 cstsmapsplit \ 237 cstsmapsplit \
  238 +
119 csviscube \ 239 csviscube \
  240 +
  241 + csscs \
120 csworkflow \ 242 csworkflow \
  243 +
121 csfindobs \ 244 csfindobs \
  245 +
122 csiactcopy \ 246 csiactcopy \
  247 +
123 csiactdata \ 248 csiactdata \
  249 +
124 csiactobs 250 csiactobs
125 251
  252 +
  253 +
126 # Test scripts to be distributed in $(pyexecdir)/cscripts/tests 254 # Test scripts to be distributed in $(pyexecdir)/cscripts/tests
  255 +
127 testscripts = $(srcdir)/tests/__init__.py \ 256 testscripts = $(srcdir)/tests/__init__.py \
  257 +
128 $(top_srcdir)/test/testing.py \ 258 $(top_srcdir)/test/testing.py \
  259 +
129 $(top_srcdir)/test/test_python_cscripts.py \ 260 $(top_srcdir)/test/test_python_cscripts.py \
  261 +
130 $(top_srcdir)/test/test_cscript.py \ 262 $(top_srcdir)/test/test_cscript.py \
  263 +
131 $(top_srcdir)/test/test_cscaldb.py \ 264 $(top_srcdir)/test/test_cscaldb.py \
  265 +
132 $(top_srcdir)/test/test_csbkgmodel.py \ 266 $(top_srcdir)/test/test_csbkgmodel.py \
  267 +
133 $(top_srcdir)/test/test_csebins.py \ 268 $(top_srcdir)/test/test_csebins.py \
  269 +
134 $(top_srcdir)/test/test_csfindobs.py \ 270 $(top_srcdir)/test/test_csfindobs.py \
  271 +
135 $(top_srcdir)/test/test_csinfo.py \ 272 $(top_srcdir)/test/test_csinfo.py \
  273 +
136 $(top_srcdir)/test/test_cslightcrv.py \ 274 $(top_srcdir)/test/test_cslightcrv.py \
  275 +
137 $(top_srcdir)/test/test_csmodelinfo.py \ 276 $(top_srcdir)/test/test_csmodelinfo.py \
  277 +
138 $(top_srcdir)/test/test_csmodelmerge.py \ 278 $(top_srcdir)/test/test_csmodelmerge.py \
  279 +
139 $(top_srcdir)/test/test_csmodelselect.py \ 280 $(top_srcdir)/test/test_csmodelselect.py \
  281 +
140 $(top_srcdir)/test/test_csmodelsois.py \ 282 $(top_srcdir)/test/test_csmodelsois.py \
  283 +
141 $(top_srcdir)/test/test_csobs2caldb.py \ 284 $(top_srcdir)/test/test_csobs2caldb.py \
  285 +
142 $(top_srcdir)/test/test_csobsdef.py \ 286 $(top_srcdir)/test/test_csobsdef.py \
  287 +
143 $(top_srcdir)/test/test_csobsinfo.py \ 288 $(top_srcdir)/test/test_csobsinfo.py \
  289 +
144 $(top_srcdir)/test/test_csobsselect.py \ 290 $(top_srcdir)/test/test_csobsselect.py \
  291 +
145 $(top_srcdir)/test/test_csphagen.py \ 292 $(top_srcdir)/test/test_csphagen.py \
  293 +
146 $(top_srcdir)/test/test_csphasecrv.py \ 294 $(top_srcdir)/test/test_csphasecrv.py \
  295 +
147 $(top_srcdir)/test/test_cspull.py \ 296 $(top_srcdir)/test/test_cspull.py \
  297 +
148 $(top_srcdir)/test/test_csresmap.py \ 298 $(top_srcdir)/test/test_csresmap.py \
  299 +
149 $(top_srcdir)/test/test_csresspec.py \ 300 $(top_srcdir)/test/test_csresspec.py \
  301 +
150 $(top_srcdir)/test/test_csroot2caldb.py \ 302 $(top_srcdir)/test/test_csroot2caldb.py \
  303 +
151 $(top_srcdir)/test/test_cssens.py \ 304 $(top_srcdir)/test/test_cssens.py \
  305 +
152 $(top_srcdir)/test/test_csspec.py \ 306 $(top_srcdir)/test/test_csspec.py \
  307 +
153 $(top_srcdir)/test/test_cssrcdetect.py \ 308 $(top_srcdir)/test/test_cssrcdetect.py \
  309 +
154 $(top_srcdir)/test/test_cstsdist.py \ 310 $(top_srcdir)/test/test_cstsdist.py \
  311 +
155 $(top_srcdir)/test/test_cstsmapmerge.py \ 312 $(top_srcdir)/test/test_cstsmapmerge.py \
  313 +
156 $(top_srcdir)/test/test_cstsmapsplit.py \ 314 $(top_srcdir)/test/test_cstsmapsplit.py \
  315 +
157 $(top_srcdir)/test/test_csviscube.py \ 316 $(top_srcdir)/test/test_csviscube.py \
  317 +
  318 + $(top_srcdir)/test/test_csscs.py \
158 $(top_srcdir)/test/test_csworkflow.py \ 319 $(top_srcdir)/test/test_csworkflow.py \
  320 +
159 $(top_srcdir)/test/test_obsutils.py \ 321 $(top_srcdir)/test/test_obsutils.py \
  322 +
160 $(top_srcdir)/test/test_mputils.py \ 323 $(top_srcdir)/test/test_mputils.py \
  324 +
161 $(top_srcdir)/test/test_csiactcopy.py \ 325 $(top_srcdir)/test/test_csiactcopy.py \
  326 +
162 $(top_srcdir)/test/test_csiactdata.py \ 327 $(top_srcdir)/test/test_csiactdata.py \
  328 +
163 $(top_srcdir)/test/test_csiactobs.py 329 $(top_srcdir)/test/test_csiactobs.py
164 330
  331 +
  332 +
165 # Test data to be distributed in $(pyexecdir)/cscripts/tests/data 333 # Test data to be distributed in $(pyexecdir)/cscripts/tests/data
  334 +
166 testdata = $(top_srcdir)/test/data/crab.xml \ 335 testdata = $(top_srcdir)/test/data/crab.xml \
  336 +
167 $(top_srcdir)/test/data/obs_unbinned.xml \ 337 $(top_srcdir)/test/data/obs_unbinned.xml \
  338 +
168 $(top_srcdir)/test/data/obs_unbinned_two.xml \ 339 $(top_srcdir)/test/data/obs_unbinned_two.xml \
  340 +
169 $(top_srcdir)/test/data/obs_stacked.xml \ 341 $(top_srcdir)/test/data/obs_stacked.xml \
  342 +
170 $(top_srcdir)/test/data/obs_stacked_two.xml \ 343 $(top_srcdir)/test/data/obs_stacked_two.xml \
  344 +
171 $(top_srcdir)/test/data/crab_events.fits \ 345 $(top_srcdir)/test/data/crab_events.fits \
  346 +
172 $(top_srcdir)/test/data/crab_cntmap.fits \ 347 $(top_srcdir)/test/data/crab_cntmap.fits \
  348 +
173 $(top_srcdir)/test/data/crab_expcube.fits.gz \ 349 $(top_srcdir)/test/data/crab_expcube.fits.gz \
  350 +
174 $(top_srcdir)/test/data/crab_psfcube.fits.gz \ 351 $(top_srcdir)/test/data/crab_psfcube.fits.gz \
  352 +
175 $(top_srcdir)/test/data/crab_edispcube.fits.gz \ 353 $(top_srcdir)/test/data/crab_edispcube.fits.gz \
  354 +
176 $(top_srcdir)/test/data/crab_bkgcube.fits.gz \ 355 $(top_srcdir)/test/data/crab_bkgcube.fits.gz \
  356 +
177 $(top_srcdir)/test/data/crab_onoff.xml \ 357 $(top_srcdir)/test/data/crab_onoff.xml \
  358 +
178 $(top_srcdir)/test/data/crab_offaxis1.fits.gz \ 359 $(top_srcdir)/test/data/crab_offaxis1.fits.gz \
  360 +
179 $(top_srcdir)/test/data/crab_offaxis2.fits.gz \ 361 $(top_srcdir)/test/data/crab_offaxis2.fits.gz \
  362 +
180 $(top_srcdir)/test/data/crab_exclusion.fits.gz \ 363 $(top_srcdir)/test/data/crab_exclusion.fits.gz \
  364 +
181 $(top_srcdir)/test/data/crab_src_reg.reg \ 365 $(top_srcdir)/test/data/crab_src_reg.reg \
  366 +
182 $(top_srcdir)/test/data/crab_bkg_reg.reg \ 367 $(top_srcdir)/test/data/crab_bkg_reg.reg \
  368 +
183 $(top_srcdir)/test/data/tsmap_0.fits \ 369 $(top_srcdir)/test/data/tsmap_0.fits \
  370 +
184 $(top_srcdir)/test/data/tsmap_1.fits \ 371 $(top_srcdir)/test/data/tsmap_1.fits \
  372 +
185 $(top_srcdir)/test/data/exclusion.reg \ 373 $(top_srcdir)/test/data/exclusion.reg \
  374 +
186 $(top_srcdir)/test/data/pntdef_minimal.dat \ 375 $(top_srcdir)/test/data/pntdef_minimal.dat \
  376 +
187 $(top_srcdir)/test/data/pntdef_maximal.dat \ 377 $(top_srcdir)/test/data/pntdef_maximal.dat \
  378 +
188 $(top_srcdir)/test/data/models.txt \ 379 $(top_srcdir)/test/data/models.txt \
  380 +
189 $(top_srcdir)/test/data/tsmaps.txt \ 381 $(top_srcdir)/test/data/tsmaps.txt \
  382 +
190 $(top_srcdir)/test/data/model_cube_background1.xml \ 383 $(top_srcdir)/test/data/model_cube_background1.xml \
  384 +
191 $(top_srcdir)/test/data/model_cube_background2.xml \ 385 $(top_srcdir)/test/data/model_cube_background2.xml \
  386 +
192 $(top_srcdir)/test/data/crab_bkgcube.xml \ 387 $(top_srcdir)/test/data/crab_bkgcube.xml \
  388 +
193 $(top_srcdir)/test/data/irf.root \ 389 $(top_srcdir)/test/data/irf.root \
  390 +
194 $(top_srcdir)/test/data/irf_file.fits.gz \ 391 $(top_srcdir)/test/data/irf_file.fits.gz \
  392 +
195 $(top_srcdir)/test/data/workflow.xml \ 393 $(top_srcdir)/test/data/workflow.xml \
  394 +
196 $(top_srcdir)/test/data/butterfly.txt \ 395 $(top_srcdir)/test/data/butterfly.txt \
  396 +
197 $(top_srcdir)/test/data/pha.fits \ 397 $(top_srcdir)/test/data/pha.fits \
  398 +
198 $(top_srcdir)/test/data/pha_channels.fits \ 399 $(top_srcdir)/test/data/pha_channels.fits \
  400 +
199 $(top_srcdir)/test/data/pull.dat \ 401 $(top_srcdir)/test/data/pull.dat \
  402 +
200 $(top_srcdir)/test/data/sensitivity.dat \ 403 $(top_srcdir)/test/data/sensitivity.dat \
  404 +
201 $(top_srcdir)/test/data/sensitivity_integral.dat \ 405 $(top_srcdir)/test/data/sensitivity_integral.dat \
  406 +
202 $(top_srcdir)/test/data/skymap.fits \ 407 $(top_srcdir)/test/data/skymap.fits \
  408 +
203 $(top_srcdir)/test/data/spectrum.fits \ 409 $(top_srcdir)/test/data/spectrum.fits \
  410 +
204 $(top_srcdir)/test/data/residual.fits \ 411 $(top_srcdir)/test/data/residual.fits \
  412 +
205 $(top_srcdir)/test/data/residual_onoff.fits \ 413 $(top_srcdir)/test/data/residual_onoff.fits \
  414 +
206 $(top_srcdir)/test/data/lightcurve.fits \ 415 $(top_srcdir)/test/data/lightcurve.fits \
  416 +
207 $(top_srcdir)/test/data/ts.dat \ 417 $(top_srcdir)/test/data/ts.dat \
  418 +
208 $(top_srcdir)/test/data/models_spatial.xml \ 419 $(top_srcdir)/test/data/models_spatial.xml \
  420 +
209 $(top_srcdir)/test/data/models_spectral.xml \ 421 $(top_srcdir)/test/data/models_spectral.xml \
  422 +
210 $(top_srcdir)/test/data/model_filefunction.txt \ 423 $(top_srcdir)/test/data/model_filefunction.txt \
  424 +
211 $(top_srcdir)/test/data/model_map.fits.gz \ 425 $(top_srcdir)/test/data/model_map.fits.gz \
  426 +
212 $(top_srcdir)/test/data/model_mapcube.fits.gz \ 427 $(top_srcdir)/test/data/model_mapcube.fits.gz \
  428 +
213 $(top_srcdir)/test/data/iact_runlist.dat \ 429 $(top_srcdir)/test/data/iact_runlist.dat \
  430 +
214 $(top_srcdir)/test/data/iact_runlist_1.dat \ 431 $(top_srcdir)/test/data/iact_runlist_1.dat \
  432 +
215 $(top_srcdir)/test/data/iact_runlist_2.dat \ 433 $(top_srcdir)/test/data/iact_runlist_2.dat \
  434 +
216 $(top_srcdir)/test/data/model_temporal_phasecurve.xml \ 435 $(top_srcdir)/test/data/model_temporal_phasecurve.xml \
  436 +
217 $(top_srcdir)/test/data/model_temporal_phasecurve.fits \ 437 $(top_srcdir)/test/data/model_temporal_phasecurve.fits \
  438 +
218 $(top_srcdir)/test/data/phased_events.fits.gz \ 439 $(top_srcdir)/test/data/phased_events.fits.gz \
  440 +
219 $(top_srcdir)/test/data/onoff_arf.fits.gz \ 441 $(top_srcdir)/test/data/onoff_arf.fits.gz \
  442 +
220 $(top_srcdir)/test/data/onoff_arf1.fits.gz \ 443 $(top_srcdir)/test/data/onoff_arf1.fits.gz \
  444 +
221 $(top_srcdir)/test/data/onoff_arf2.fits.gz \ 445 $(top_srcdir)/test/data/onoff_arf2.fits.gz \
  446 +
222 $(top_srcdir)/test/data/onoff_model.xml \ 447 $(top_srcdir)/test/data/onoff_model.xml \
  448 +
223 $(top_srcdir)/test/data/onoff_obs.xml \ 449 $(top_srcdir)/test/data/onoff_obs.xml \
  450 +
224 $(top_srcdir)/test/data/onoff_obs1.xml \ 451 $(top_srcdir)/test/data/onoff_obs1.xml \
  452 +
225 $(top_srcdir)/test/data/onoff_obs2.xml \ 453 $(top_srcdir)/test/data/onoff_obs2.xml \
  454 +
226 $(top_srcdir)/test/data/onoff_obs_stacked.xml \ 455 $(top_srcdir)/test/data/onoff_obs_stacked.xml \
  456 +
227 $(top_srcdir)/test/data/onoff_pha_off.fits.gz \ 457 $(top_srcdir)/test/data/onoff_pha_off.fits.gz \
  458 +
228 $(top_srcdir)/test/data/onoff_pha_off1.fits.gz \ 459 $(top_srcdir)/test/data/onoff_pha_off1.fits.gz \
  460 +
229 $(top_srcdir)/test/data/onoff_pha_off2.fits.gz \ 461 $(top_srcdir)/test/data/onoff_pha_off2.fits.gz \
  462 +
230 $(top_srcdir)/test/data/onoff_pha_on.fits.gz \ 463 $(top_srcdir)/test/data/onoff_pha_on.fits.gz \
  464 +
231 $(top_srcdir)/test/data/onoff_pha_on1.fits.gz \ 465 $(top_srcdir)/test/data/onoff_pha_on1.fits.gz \
  466 +
232 $(top_srcdir)/test/data/onoff_pha_on2.fits.gz \ 467 $(top_srcdir)/test/data/onoff_pha_on2.fits.gz \
  468 +
233 $(top_srcdir)/test/data/onoff_rmf.fits.gz \ 469 $(top_srcdir)/test/data/onoff_rmf.fits.gz \
  470 +
234 $(top_srcdir)/test/data/onoff_rmf1.fits.gz \ 471 $(top_srcdir)/test/data/onoff_rmf1.fits.gz \
  472 +
235 $(top_srcdir)/test/data/onoff_rmf2.fits.gz \ 473 $(top_srcdir)/test/data/onoff_rmf2.fits.gz \
  474 +
236 $(top_srcdir)/test/data/model_crab_radialacceptance.xml \ 475 $(top_srcdir)/test/data/model_crab_radialacceptance.xml \
  476 +
237 $(top_srcdir)/test/data/sigdist_map.fits.gz \ 477 $(top_srcdir)/test/data/sigdist_map.fits.gz \
  478 +
238 $(top_srcdir)/test/data/variability.fits.gz \ 479 $(top_srcdir)/test/data/variability.fits.gz \
  480 +
239 $(top_srcdir)/test/data/viscube.fits.gz \ 481 $(top_srcdir)/test/data/viscube.fits.gz \
  482 +
240 $(top_srcdir)/test/data/hess_bkg_lookup.fits 483 $(top_srcdir)/test/data/hess_bkg_lookup.fits
241 484
  485 +
  486 +
242 # Test data to be distributed in $(pyexecdir)/cscripts/tests/data/iactdata 487 # Test data to be distributed in $(pyexecdir)/cscripts/tests/data/iactdata
  488 +
243 testiactdata = $(top_srcdir)/test/data/iactdata/hdu-index.fits.gz \ 489 testiactdata = $(top_srcdir)/test/data/iactdata/hdu-index.fits.gz \
  490 +
244 $(top_srcdir)/test/data/iactdata/master.json \ 491 $(top_srcdir)/test/data/iactdata/master.json \
  492 +
245 $(top_srcdir)/test/data/iactdata/obs-index.fits.gz 493 $(top_srcdir)/test/data/iactdata/obs-index.fits.gz
246 494
  495 +
  496 +
247 # Test data to be distributed in $(pyexecdir)/cscripts/tests/data/iactdata/events 497 # Test data to be distributed in $(pyexecdir)/cscripts/tests/data/iactdata/events
  498 +
248 testiactevents = $(top_srcdir)/test/data/iactdata/events/irf_file.fits.gz \ 499 testiactevents = $(top_srcdir)/test/data/iactdata/events/irf_file.fits.gz \
  500 +
249 $(top_srcdir)/test/data/iactdata/events/events_0.fits.gz \ 501 $(top_srcdir)/test/data/iactdata/events/events_0.fits.gz \
  502 +
250 $(top_srcdir)/test/data/iactdata/events/events_1.fits.gz \ 503 $(top_srcdir)/test/data/iactdata/events/events_1.fits.gz \
  504 +
251 $(top_srcdir)/test/data/iactdata/events/events_2.fits.gz \ 505 $(top_srcdir)/test/data/iactdata/events/events_2.fits.gz \
  506 +
252 $(top_srcdir)/test/data/iactdata/events/events_3.fits.gz \ 507 $(top_srcdir)/test/data/iactdata/events/events_3.fits.gz \
  508 +
253 $(top_srcdir)/test/data/iactdata/events/events_4.fits.gz \ 509 $(top_srcdir)/test/data/iactdata/events/events_4.fits.gz \
  510 +
254 $(top_srcdir)/test/data/iactdata/events/events_5.fits.gz \ 511 $(top_srcdir)/test/data/iactdata/events/events_5.fits.gz \
  512 +
255 $(top_srcdir)/test/data/iactdata/events/events_6.fits.gz \ 513 $(top_srcdir)/test/data/iactdata/events/events_6.fits.gz \
  514 +
256 $(top_srcdir)/test/data/iactdata/events/events_7.fits.gz \ 515 $(top_srcdir)/test/data/iactdata/events/events_7.fits.gz \
  516 +
257 $(top_srcdir)/test/data/iactdata/events/events_8.fits.gz 517 $(top_srcdir)/test/data/iactdata/events/events_8.fits.gz
258 518
  519 +
  520 +
259 # Install scripts, parfiles, test scripts and test data. Note that we don't 521 # Install scripts, parfiles, test scripts and test data. Note that we don't
  522 +
260 # need to prepend $(DESTDIR) here (not fully clear why, but that's the way 523 # need to prepend $(DESTDIR) here (not fully clear why, but that's the way
  524 +
261 # it is) 525 # it is)
  526 +
262 binscriptsdir = $(bindir) 527 binscriptsdir = $(bindir)
  528 +
263 binscripts_DATA = $(binscripts) 529 binscripts_DATA = $(binscripts)
  530 +
264 pythonscriptsdir = $(pyexecdir)/cscripts 531 pythonscriptsdir = $(pyexecdir)/cscripts
  532 +
265 pythonscripts_DATA = $(pythonscripts) 533 pythonscripts_DATA = $(pythonscripts)
  534 +
266 pfilesdir = $(prefix)/syspfiles 535 pfilesdir = $(prefix)/syspfiles
  536 +
267 pfiles_DATA = $(parfiles) 537 pfiles_DATA = $(parfiles)
  538 +
268 testscriptsdir = $(pyexecdir)/cscripts/tests 539 testscriptsdir = $(pyexecdir)/cscripts/tests
  540 +
269 testscripts_DATA = $(testscripts) 541 testscripts_DATA = $(testscripts)
  542 +
270 testdatadir = $(pyexecdir)/cscripts/tests/data 543 testdatadir = $(pyexecdir)/cscripts/tests/data
  544 +
271 testdata_DATA = $(testdata) 545 testdata_DATA = $(testdata)
  546 +
272 testiactdatadir = $(pyexecdir)/cscripts/tests/data/iactdata 547 testiactdatadir = $(pyexecdir)/cscripts/tests/data/iactdata
  548 +
273 testiactdata_DATA = $(testiactdata) 549 testiactdata_DATA = $(testiactdata)
  550 +
274 testiacteventsdir = $(pyexecdir)/cscripts/tests/data/iactdata/events 551 testiacteventsdir = $(pyexecdir)/cscripts/tests/data/iactdata/events
  552 +
275 testiactevents_DATA = $(testiactevents) 553 testiactevents_DATA = $(testiactevents)
276 554
  555 +
  556 +
277 # Files to be distributed in the tar file 557 # Files to be distributed in the tar file
  558 +
278 EXTRA_DIST = $(binscripts) $(pythonscripts) $(parfiles) \ 559 EXTRA_DIST = $(binscripts) $(pythonscripts) $(parfiles) \
  560 +
279 $(testscripts) $(testdata) $(testiactdata) \ 561 $(testscripts) $(testdata) $(testiactdata) \
  562 +
280 $(testiactevents) 563 $(testiactevents)
281 564
  565 +
  566 +
282 # Add install hook rule to copy cscripts without .py into the bindir 567 # Add install hook rule to copy cscripts without .py into the bindir
  568 +
283 install-data-hook: 569 install-data-hook:
  570 +
284 @binlist='$(binscripts)';\ 571 @binlist='$(binscripts)';\
  572 +
285 for p in $$binlist; do \ 573 for p in $$binlist; do \
  574 +
286 chmod +x "$(DESTDIR)$(bindir)/$$p"; \ 575 chmod +x "$(DESTDIR)$(bindir)/$$p"; \
  576 +
287 done 577 done
  578 +
288 @linklist='$(linkscripts)';\ 579 @linklist='$(linkscripts)';\
  580 +
289 for p in $$linklist; do \ 581 for p in $$linklist; do \
  582 +
290 rm -rf "$(DESTDIR)$(bindir)/$$p"; \ 583 rm -rf "$(DESTDIR)$(bindir)/$$p"; \
  584 +
291 cp "$(DESTDIR)$(pyexecdir)/cscripts/$$p.py" "$(DESTDIR)$(bindir)/$$p"; \ 585 cp "$(DESTDIR)$(pyexecdir)/cscripts/$$p.py" "$(DESTDIR)$(bindir)/$$p"; \
  586 +
292 chmod +x "$(DESTDIR)$(bindir)/$$p"; \ 587 chmod +x "$(DESTDIR)$(bindir)/$$p"; \
  588 +
293 done 589 done
294 590
  591 +
  592 +
295 # Uninstall hook rule to remove the cscripts from the bindir 593 # Uninstall hook rule to remove the cscripts from the bindir
  594 +
296 uninstall-hook: 595 uninstall-hook:
  596 +
297 @linklist='$(linkscripts)';\ 597 @linklist='$(linkscripts)';\
  598 +
298 for p in $$linklist; do \ 599 for p in $$linklist; do \
  600 +
299 rm -rf "$(DESTDIR)$(bindir)/$$p"; \ 601 rm -rf "$(DESTDIR)$(bindir)/$$p"; \
  602 +
300 done 603 done
301 604
  605 +
  606 +
302 # Files to be removed in build directory 607 # Files to be removed in build directory
  608 +
303 clean-local: 609 clean-local:
  610 +
304 @if ! [ '@top_srcdir@' -ef '@top_builddir@' ]; then \ 611 @if ! [ '@top_srcdir@' -ef '@top_builddir@' ]; then \
  612 +
305 rm -rf $(top_builddir)/cscripts/cs*.py; \ 613 rm -rf $(top_builddir)/cscripts/cs*.py; \
  614 +
306 rm -rf $(top_builddir)/cscripts/obsutils.py; \ 615 rm -rf $(top_builddir)/cscripts/obsutils.py; \
  616 +
307 rm -rf $(top_builddir)/cscripts/modutils.py; \ 617 rm -rf $(top_builddir)/cscripts/modutils.py; \
  618 +
308 rm -rf $(top_builddir)/cscripts/calutils.py; \ 619 rm -rf $(top_builddir)/cscripts/calutils.py; \
  620 +
309 rm -rf $(top_builddir)/cscripts/ioutils.py; \ 621 rm -rf $(top_builddir)/cscripts/ioutils.py; \
  622 +
310 rm -rf $(top_builddir)/cscripts/mputils.py; \ 623 rm -rf $(top_builddir)/cscripts/mputils.py; \
  624 +
311 rm -rf $(top_builddir)/cscripts/*.par; \ 625 rm -rf $(top_builddir)/cscripts/*.par; \
  626 +
312 fi 627 fi
  628 +
313 rm -rf $(top_builddir)/cscripts/*.pyc 629 rm -rf $(top_builddir)/cscripts/*.pyc
  630 +
314 rm -rf $(top_builddir)/cscripts/__pycache__ 631 rm -rf $(top_builddir)/cscripts/__pycache__
315 632
  633 +
  634 +
316 # Uninstall the cscripts Python module 635 # Uninstall the cscripts Python module
  636 +
317 uninstall-local: 637 uninstall-local:
  638 +
318 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/*.pyc 639 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/*.pyc
  640 +
319 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/*.pyc 641 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/*.pyc
  642 +
320 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/__pycache__ 643 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/__pycache__
  644 +
321 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/tests/*.pyc 645 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/tests/*.pyc
  646 +
322 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/tests/__pycache__ 647 rm -rf $(DESTDIR)$(pyexecdir)/cscripts/tests/__pycache__
  648 +
cscripts/__init__.py.in
1 # ========================================================================== 1 # ==========================================================================
  2 +
2 # cscripts Python module 3 # cscripts Python module
  4 +
3 # 5 #
  6 +
4 # Copyright (C) 2015-2018 Juergen Knoedlseder 7 # Copyright (C) 2015-2018 Juergen Knoedlseder
  8 +
5 # 9 #
  10 +
6 # This program is free software: you can redistribute it and/or modify 11 # This program is free software: you can redistribute it and/or modify
  12 +
7 # it under the terms of the GNU General Public License as published by 13 # it under the terms of the GNU General Public License as published by
  14 +
8 # the Free Software Foundation, either version 3 of the License, or 15 # the Free Software Foundation, either version 3 of the License, or
  16 +
9 # (at your option) any later version. 17 # (at your option) any later version.
  18 +
10 # 19 #
  20 +
11 # This program is distributed in the hope that it will be useful, 21 # This program is distributed in the hope that it will be useful,
  22 +
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of 23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  24 +
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26 +
14 # GNU General Public License for more details. 27 # GNU General Public License for more details.
  28 +
15 # 29 #
  30 +
16 # You should have received a copy of the GNU General Public License 31 # You should have received a copy of the GNU General Public License
  32 +
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 33 # along with this program. If not, see <http://www.gnu.org/licenses/>.
  34 +
18 # 35 #
  36 +
19 # ========================================================================== 37 # ==========================================================================
  38 +
20 # Python version check 39 # Python version check
  40 +
21 import sys 41 import sys
  42 +
22 req_version = (2,6) 43 req_version = (2,6)
  44 +
23 cur_version = sys.version_info 45 cur_version = sys.version_info
24 46
  47 +
  48 +
25 # List all scripts in this module 49 # List all scripts in this module
  50 +
26 __all__ = [ 51 __all__ = [
  52 +
27 "csbkgmodel", 53 "csbkgmodel",
  54 +
28 "cscaldb", 55 "cscaldb",
  56 +
29 "csebins", 57 "csebins",
  58 +
30 "csinfo", 59 "csinfo",
  60 +
31 "cslightcrv", 61 "cslightcrv",
  62 +
32 "csmodelinfo", 63 "csmodelinfo",
  64 +
33 "csmodelmerge", 65 "csmodelmerge",
  66 +
34 "csmodelselect", 67 "csmodelselect",
  68 +
35 "csmodelsois", 69 "csmodelsois",
  70 +
36 "csobs2caldb", 71 "csobs2caldb",
  72 +
37 "csobsdef", 73 "csobsdef",
  74 +
38 "csobsinfo", 75 "csobsinfo",
  76 +
39 "csobsselect", 77 "csobsselect",
  78 +
40 "csphagen", 79 "csphagen",
  80 +
41 "csphasecrv", 81 "csphasecrv",
  82 +
42 "cspull", 83 "cspull",
  84 +
43 "csresmap", 85 "csresmap",
  86 +
44 "csresspec", 87 "csresspec",
  88 +
45 "csroot2caldb", 89 "csroot2caldb",
  90 +
46 "cssens", 91 "cssens",
  92 +
47 "csspec", 93 "csspec",
  94 +
48 "cssrcdetect", 95 "cssrcdetect",
  96 +
49 "cstsdist", 97 "cstsdist",
  98 +
50 "cstsmapmerge", 99 "cstsmapmerge",
  100 +
51 "cstsmapsplit", 101 "cstsmapsplit",
  102 +
52 "csviscube", 103 "csviscube",
  104 +
  105 + "csscs",
53 "csworkflow", 106 "csworkflow",
  107 +
54 "obsutils", 108 "obsutils",
  109 +
55 "modutils", 110 "modutils",
  111 +
56 "calutils", 112 "calutils",
  113 +
57 "ioutils", 114 "ioutils",
  115 +
58 "mputils" 116 "mputils"
  117 +
59 ] 118 ]
  119 +
60 if cur_version > req_version: 120 if cur_version > req_version:
  121 +
61 __all__.extend(["csfindobs", 122 __all__.extend(["csfindobs",
  123 +
62 "csiactcopy", 124 "csiactcopy",
  125 +
63 "csiactdata", 126 "csiactdata",
  127 +
64 "csiactobs"]) 128 "csiactobs"])
65 129
  130 +
  131 +
66 # Import 132 # Import
  133 +
67 from cscripts.csbkgmodel import csbkgmodel 134 from cscripts.csbkgmodel import csbkgmodel
  135 +
68 from cscripts.cscaldb import cscaldb 136 from cscripts.cscaldb import cscaldb
  137 +
69 from cscripts.csebins import csebins 138 from cscripts.csebins import csebins
  139 +
70 from cscripts.csinfo import csinfo 140 from cscripts.csinfo import csinfo
  141 +
71 from cscripts.cslightcrv import cslightcrv 142 from cscripts.cslightcrv import cslightcrv
  143 +
72 from cscripts.csmodelinfo import csmodelinfo 144 from cscripts.csmodelinfo import csmodelinfo
  145 +
73 from cscripts.csmodelmerge import csmodelmerge 146 from cscripts.csmodelmerge import csmodelmerge
  147 +
74 from cscripts.csmodelselect import csmodelselect 148 from cscripts.csmodelselect import csmodelselect
  149 +
75 from cscripts.csmodelsois import csmodelsois 150 from cscripts.csmodelsois import csmodelsois
  151 +
76 from cscripts.csobs2caldb import csobs2caldb 152 from cscripts.csobs2caldb import csobs2caldb
  153 +
77 from cscripts.csobsdef import csobsdef 154 from cscripts.csobsdef import csobsdef
  155 +
78 from cscripts.csobsinfo import csobsinfo 156 from cscripts.csobsinfo import csobsinfo
  157 +
79 from cscripts.csobsselect import csobsselect 158 from cscripts.csobsselect import csobsselect
  159 +
80 from cscripts.csphagen import csphagen 160 from cscripts.csphagen import csphagen
  161 +
81 from cscripts.csphasecrv import csphasecrv 162 from cscripts.csphasecrv import csphasecrv
  163 +
82 from cscripts.cspull import cspull 164 from cscripts.cspull import cspull
  165 +
83 from cscripts.csresmap import csresmap 166 from cscripts.csresmap import csresmap
  167 +
84 from cscripts.csresspec import csresspec 168 from cscripts.csresspec import csresspec
  169 +
85 from cscripts.csroot2caldb import csroot2caldb 170 from cscripts.csroot2caldb import csroot2caldb
  171 +
86 from cscripts.cssens import cssens 172 from cscripts.cssens import cssens
  173 +
87 from cscripts.csspec import csspec 174 from cscripts.csspec import csspec
  175 +
88 from cscripts.cssrcdetect import cssrcdetect 176 from cscripts.cssrcdetect import cssrcdetect
  177 +
89 from cscripts.cstsdist import cstsdist 178 from cscripts.cstsdist import cstsdist
  179 +
90 from cscripts.cstsmapmerge import cstsmapmerge 180 from cscripts.cstsmapmerge import cstsmapmerge
  181 +
91 from cscripts.cstsmapsplit import cstsmapsplit 182 from cscripts.cstsmapsplit import cstsmapsplit
  183 +
92 from cscripts.csviscube import csviscube 184 from cscripts.csviscube import csviscube
  185 +
  186 +from cscripts.csscs import csscs
93 from cscripts.csworkflow import csworkflow 187 from cscripts.csworkflow import csworkflow
  188 +
94 from cscripts import obsutils 189 from cscripts import obsutils
  190 +
95 from cscripts import modutils 191 from cscripts import modutils
  192 +
96 from cscripts import calutils 193 from cscripts import calutils
  194 +
97 from cscripts import ioutils 195 from cscripts import ioutils
  196 +
98 if cur_version > req_version: 197 if cur_version > req_version:
  198 +
99 from cscripts.csfindobs import csfindobs 199 from cscripts.csfindobs import csfindobs
  200 +
100 from cscripts.csiactcopy import csiactcopy 201 from cscripts.csiactcopy import csiactcopy
  202 +
101 from cscripts.csiactdata import csiactdata 203 from cscripts.csiactdata import csiactdata
  204 +
102 from cscripts.csiactobs import csiactobs 205 from cscripts.csiactobs import csiactobs
103 206
  207 +
  208 +
104 # Delete version check variables 209 # Delete version check variables
  210 +
105 del sys 211 del sys
  212 +
106 del req_version 213 del req_version
  214 +
107 del cur_version 215 del cur_version
108 216
  217 +
  218 +
109 # Add test function 219 # Add test function
  220 +
110 def test(): 221 def test():
  222 +
111 """ 223 """
  224 +
112 Run cscripts tests. 225 Run cscripts tests.
  226 +
113 """ 227 """
  228 +
114 from cscripts.tests import test_python_cscripts 229 from cscripts.tests import test_python_cscripts
  230 +
115 test_python_cscripts.test(installed=True) 231 test_python_cscripts.test(installed=True)
116 232
  233 +
  234 +
117 # Add version 235 # Add version
  236 +
118 __version__ = '@PACKAGE_VERSION@' 237 __version__ = '@PACKAGE_VERSION@'
  238 +
cscripts/csscs.par 0 โ†’ 100644
  1 +#############################################################################
  2 +# #
  3 +# CTA Science Analysis Tools #
  4 +# #
  5 +# ------------------------------------------------------------------------- #
  6 +# #
  7 +# File: csscs.par #
  8 +# #
  9 +# Author: Luigi Tibaldo #
  10 +# luigi.tibaldo@irap.omp.eu #
  11 +# IRAP #
  12 +# #
  13 +# Purpose: Parameter file for the csscs script #
  14 +# #
  15 +#############################################################################
  16 +#
  17 +# General parameters
  18 +#===================
  19 +# Your parameters go here
  20 +
  21 +#
  22 +# Standard parameters
  23 +#====================
  24 +chatter, i, h, 2,0,4, "Chattiness of output"
  25 +clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
  26 +debug, b, h, no,,, "Activate debugging mode?"
  27 +mode, s, h, ql,,, "Mode of automatic parameters"
  28 +logfile, f, h, csscs.log,,, "Log filename"
cscripts/csscs.py 0 โ†’ 100755
  1 +#! /usr/bin/env python
  2 +# ==========================================================================
  3 +# Spectral component separation script
  4 +#
  5 +# Copyright (C) 2020 Luigi Tibaldo
  6 +#
  7 +# This program is free software: you can redistribute it and/or modify
  8 +# it under the terms of the GNU General Public License as published by
  9 +# the Free Software Foundation, either version 3 of the License, or
  10 +# (at your option) any later version.
  11 +#
  12 +# This program is distributed in the hope that it will be useful,
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 +# GNU General Public License for more details.
  16 +#
  17 +# You should have received a copy of the GNU General Public License
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
  19 +#
  20 +# ==========================================================================
  21 +import sys
  22 +import gammalib
  23 +import ctools
  24 +
  25 +
  26 +# ================= #
  27 +# csscs class #
  28 +# ================= #
  29 +class csscs(ctools.csobservation):
  30 + """
  31 + Spectral component separation script
  32 + """
  33 +
  34 + # Constructor
  35 + def __init__(self, *argv):
  36 + """
  37 + Constructor
  38 +
  39 + Parameters
  40 + ----------
  41 + argv : list of str
  42 + List of IRAF command line parameter strings of the form
  43 + ``parameter=3``.
  44 + """
  45 + # Initialise application by calling the base class constructor
  46 + self._init_csobservation(self.__class__.__name__, ctools.__version__, argv)
  47 +
  48 + # Return
  49 + return
  50 +
  51 + # State methods for pickling
  52 + def __getstate__(self):
  53 + """
  54 + Extend ctools.csobservation __getstate__ method
  55 +
  56 + Returns
  57 + -------
  58 + state : dict
  59 + Pickled instance
  60 + """
  61 + # Set pickled dictionary
  62 + state = {'base' : ctools.csobservation.__getstate__(self)}
  63 +
  64 + # Return pickled dictionary
  65 + return state
  66 +
  67 + def __setstate__(self, state):
  68 + """
  69 + Extend ctools.csobservation __setstate__ method
  70 +
  71 + Parameters
  72 + ----------
  73 + state : dict
  74 + Pickled instance
  75 + """
  76 + # Set state
  77 + ctools.csobservation.__setstate__(self, state['base'])
  78 +
  79 + # Return
  80 + return
  81 +
  82 +
  83 + # Private methods
  84 + def _get_parameters(self):
  85 + """
  86 + Get parameters from parfile
  87 + """
  88 + # TODO: Add code to query all relevant parameters
  89 +
  90 + # Write input parameters into logger
  91 + self._log_parameters(gammalib.TERSE)
  92 +
  93 + # Return
  94 + return
  95 +
  96 +
  97 + # Public methods
  98 + def run(self):
  99 + """
  100 + Run the script
  101 + """
  102 + # Switch screen logging on in debug mode
  103 + if self._logDebug():
  104 + self._log.cout(True)
  105 +
  106 + # Get parameters
  107 + self._get_parameters()
  108 +
  109 + # TODO: Your code goes here
  110 +
  111 + # Return
  112 + return
  113 +
  114 + def save(self):
  115 + """
  116 + Save something
  117 + """
  118 + # Write header
  119 + self._log_header1(gammalib.TERSE, 'Save something')
  120 +
  121 + # TODO: Your code goes here
  122 +
  123 + # Return
  124 + return
  125 +
  126 +
  127 +# ======================== #
  128 +# Main routine entry point #
  129 +# ======================== #
  130 +if __name__ == '__main__':
  131 +
  132 + # Create instance of application
  133 + app = csscs(sys.argv)
  134 +
  135 + # Execute application
  136 + app.execute()
doc/source/users/reference_manual/csscs.rst 0 โ†’ 100644
  1 +.. _csscs:
  2 +
  3 +csscs
  4 +==============================
  5 +
  6 +ToDo: Describe in a one liner what the script is doing.
  7 +
  8 +
  9 +Synopsis
  10 +--------
  11 +
  12 +ToDo: Desribe in detail what the script is doing, what it takes on input and
  13 +what it produces on output. Please do not write more than 80 characters per
  14 +line since this file is also used to produce a help text for the terminal.
  15 +
  16 +
  17 +General parameters
  18 +------------------
  19 +
  20 +ToDo: Add here your parameters.
  21 +
  22 +
  23 +Standard parameters
  24 +-------------------
  25 +
  26 +``(chatter = 2) [integer]``
  27 + Verbosity of the executable:
  28 + ``chatter = 0``: no information will be logged
  29 +
  30 + ``chatter = 1``: only errors will be logged
  31 +
  32 + ``chatter = 2``: errors and actions will be logged
  33 +
  34 + ``chatter = 3``: report about the task execution
  35 +
  36 + ``chatter = 4``: detailed report about the task execution
  37 +
  38 +``(clobber = yes) [boolean]``
  39 + Specifies whether an existing output file should be overwritten.
  40 +
  41 +``(debug = no) [boolean]``
  42 + Enables debug mode. In debug mode the executable will dump any log file output to the console.
  43 +
  44 +``(mode = ql) [string]``
  45 + Mode of automatic parameters (default is ``ql``, i.e. "query and learn").
  46 +
  47 +``(logfile = csscs.log) [string]``
  48 + Name of log file.
  49 +
  50 +
  51 +Related tools or scripts
  52 +------------------------
  53 +
  54 +None
doc/source/users/reference_manual/index.rst
1 .. _reference: 1 .. _reference:
2 2
  3 +
  4 +
3 Reference Manual 5 Reference Manual
  6 +
4 ================ 7 ================
5 8
  9 +
  10 +
6 This manual provides reference information for all ctools and csripts. 11 This manual provides reference information for all ctools and csripts.
  12 +
7 General information on ctools usage can be found `here 13 General information on ctools usage can be found `here
  14 +
8 <../user_manual/introduction.html>`_. The description of user parameters in the reference 15 <../user_manual/introduction.html>`_. The description of user parameters in the reference
  16 +
9 manual is documented `here <usage.html>`__. 17 manual is documented `here <usage.html>`__.
10 18
11 19
  20 +
  21 +
  22 +
12 Below you find links to the command line reference for all available tools and scripts. 23 Below you find links to the command line reference for all available tools and scripts.
13 24
  25 +
  26 +
14 ctools 27 ctools
  28 +
15 ------ 29 ------
16 30
  31 +
  32 +
17 .. toctree:: 33 .. toctree::
  34 +
18 :maxdepth: 1 35 :maxdepth: 1
19 36
  37 +
  38 +
20 ctbin --- Generates counts cube <ctbin> 39 ctbin --- Generates counts cube <ctbin>
  40 +
21 ctbkgcube --- Generates background cube <ctbkgcube> 41 ctbkgcube --- Generates background cube <ctbkgcube>
  42 +
22 ctbutterfly --- Compute butterfly <ctbutterfly> 43 ctbutterfly --- Compute butterfly <ctbutterfly>
  44 +
23 ctcubemask --- Filter counts cube <ctcubemask> 45 ctcubemask --- Filter counts cube <ctcubemask>
  46 +
24 ctedispcube --- Generates energy dispersion cube <ctedispcube> 47 ctedispcube --- Generates energy dispersion cube <ctedispcube>
  48 +
25 cterror --- Calculates likelihood profile errors <cterror> 49 cterror --- Calculates likelihood profile errors <cterror>
  50 +
26 ctexpcube --- Generates exposure cube <ctexpcube> 51 ctexpcube --- Generates exposure cube <ctexpcube>
  52 +
27 ctfindvar --- Search for source variability <ctfindvar> 53 ctfindvar --- Search for source variability <ctfindvar>
  54 +
28 ctlike --- Performs maximum likelihood fitting <ctlike> 55 ctlike --- Performs maximum likelihood fitting <ctlike>
  56 +
29 ctmapcube --- Generates a map cube <ctmapcube> 57 ctmapcube --- Generates a map cube <ctmapcube>
  58 +
30 ctmodel --- Computes model counts cube <ctmodel> 59 ctmodel --- Computes model counts cube <ctmodel>
  60 +
31 ctobssim --- Simulate observations <ctobssim> 61 ctobssim --- Simulate observations <ctobssim>
  62 +
32 ctphase --- Computes the phase of each event <ctphase> 63 ctphase --- Computes the phase of each event <ctphase>
  64 +
33 ctprob --- Computes event probability for a given model <ctprob> 65 ctprob --- Computes event probability for a given model <ctprob>
  66 +
34 ctpsfcube --- Generates point spread function cube <ctpsfcube> 67 ctpsfcube --- Generates point spread function cube <ctpsfcube>
  68 +
35 ctselect --- Selects event data <ctselect> 69 ctselect --- Selects event data <ctselect>
  70 +
36 ctskymap --- Generates sky map <ctskymap> 71 ctskymap --- Generates sky map <ctskymap>
  72 +
37 cttsmap --- Generates Test Statistic map <cttsmap> 73 cttsmap --- Generates Test Statistic map <cttsmap>
  74 +
38 ctulimit --- Calculates upper limit <ctulimit> 75 ctulimit --- Calculates upper limit <ctulimit>
39 76
40 77
  78 +
  79 +
  80 +
41 cscripts 81 cscripts
  82 +
42 -------- 83 --------
43 84
  85 +
  86 +
44 .. toctree:: 87 .. toctree::
  88 +
45 :maxdepth: 1 89 :maxdepth: 1
46 90
  91 +
  92 +
  93 + csscs --- ToDo: Describe what script is doing <csscs>
47 csbkgmodel --- Generates background model for 3D analysis <csbkgmodel> 94 csbkgmodel --- Generates background model for 3D analysis <csbkgmodel>
  95 +
48 cscaldb --- Lists available instrument response functions <cscaldb> 96 cscaldb --- Lists available instrument response functions <cscaldb>
  97 +
49 csebins --- Generates energy boundaries for stacked analysis <csebins> 98 csebins --- Generates energy boundaries for stacked analysis <csebins>
  99 +
50 cslightcrv --- Computes light curve <cslightcrv> 100 cslightcrv --- Computes light curve <cslightcrv>
  101 +
51 csmodelinfo --- Shows model container content <csmodelinfo> 102 csmodelinfo --- Shows model container content <csmodelinfo>
  103 +
52 csmodelmerge --- Merges several model containers into one file <csmodelmerge> 104 csmodelmerge --- Merges several model containers into one file <csmodelmerge>
  105 +
53 csmodelselect --- Select models from model definition file <csmodelselect> 106 csmodelselect --- Select models from model definition file <csmodelselect>
  107 +
54 csmodelsois --- Generate map cube from subset of models <csmodelsois> 108 csmodelsois --- Generate map cube from subset of models <csmodelsois>
  109 +
55 csobsdef --- Generates observation definition file <csobsdef> 110 csobsdef --- Generates observation definition file <csobsdef>
  111 +
56 csobsinfo --- Shows observation container content <csobsinfo> 112 csobsinfo --- Shows observation container content <csobsinfo>
  113 +
57 csobsselect --- Select observations from observation definition file <csobsselect> 114 csobsselect --- Select observations from observation definition file <csobsselect>
  115 +
58 csphagen --- Generates PHA, ARF, RMF files based on source/background regions <csphagen> 116 csphagen --- Generates PHA, ARF, RMF files based on source/background regions <csphagen>
  117 +
59 csphasecrv --- Computes phase curve <csphasecrv> 118 csphasecrv --- Computes phase curve <csphasecrv>
  119 +
60 cspull --- Generates pull distribution <cspull> 120 cspull --- Generates pull distribution <cspull>
  121 +
61 csresmap --- Generates residual map <csresmap> 122 csresmap --- Generates residual map <csresmap>
  123 +
62 csresspec --- Generates residual spectrum <csresspec> 124 csresspec --- Generates residual spectrum <csresspec>
  125 +
63 csroot2caldb --- Creates a caldb entry from a ROOT file <csroot2caldb> 126 csroot2caldb --- Creates a caldb entry from a ROOT file <csroot2caldb>
  127 +
64 cssens --- Computes CTA sensitivity <cssens> 128 cssens --- Computes CTA sensitivity <cssens>
  129 +
65 csspec --- Computes spectral points <csspec> 130 csspec --- Computes spectral points <csspec>
  131 +
66 cssrcdetect --- Detects sources in sky map <cssrcdetect> 132 cssrcdetect --- Detects sources in sky map <cssrcdetect>
  133 +
67 cstsdist --- Generates Test Statistic distribution <cstsdist> 134 cstsdist --- Generates Test Statistic distribution <cstsdist>
  135 +
68 cstsmapmerge --- Merges slices from Test Statistic map computations <cstsmapmerge> 136 cstsmapmerge --- Merges slices from Test Statistic map computations <cstsmapmerge>
  137 +
69 cstsmapsplit --- Creates commands to split the Test Statistic map computations <cstsmapsplit> 138 cstsmapsplit --- Creates commands to split the Test Statistic map computations <cstsmapsplit>
  139 +
70 csviscube --- Computes visibility cube <csviscube> 140 csviscube --- Computes visibility cube <csviscube>
71 141
72 142
  143 +
  144 +
  145 +
73 Scripts to manage an IACT database 146 Scripts to manage an IACT database
  147 +
74 ---------------------------------- 148 ----------------------------------
75 149
  150 +
  151 +
76 .. warning:: 152 .. warning::
77 153
  154 +
  155 +
78 The ``csiactdata``, ``csiactobs``, ``csfindobs`` and ``csiactcopy`` scripts 156 The ``csiactdata``, ``csiactobs``, ``csfindobs`` and ``csiactcopy`` scripts
  157 +
79 rely on the ``json`` Python module which is only available in Python 2.6 158 rely on the ``json`` Python module which is only available in Python 2.6
  159 +
80 or higher. These scripts will not work on older Python versions. 160 or higher. These scripts will not work on older Python versions.
81 161
  162 +
  163 +
82 .. toctree:: 164 .. toctree::
  165 +
83 :maxdepth: 1 166 :maxdepth: 1
84 167
  168 +
  169 +
85 csobs2caldb --- Creates a caldb entry from an input observation <csobs2caldb> 170 csobs2caldb --- Creates a caldb entry from an input observation <csobs2caldb>
  171 +
86 csiactdata --- Shows information about IACT data available on the user machine <csiactdata> 172 csiactdata --- Shows information about IACT data available on the user machine <csiactdata>
  173 +
87 csiactobs --- Generates observation definition file for IACT data from observation IDs <csiactobs> 174 csiactobs --- Generates observation definition file for IACT data from observation IDs <csiactobs>
  175 +
88 csfindobs --- Generates a list of IACT observation IDs <csfindobs> 176 csfindobs --- Generates a list of IACT observation IDs <csfindobs>
  177 +
89 csiactcopy --- Copies IACT data from one location to another <csiactcopy> 178 csiactcopy --- Copies IACT data from one location to another <csiactcopy>
  179 +
test/test_csscs.py 0 โ†’ 100644
  1 +#! /usr/bin/env python
  2 +# ==========================================================================
  3 +# This scripts performs unit tests for the csscs script.
  4 +#
  5 +# Copyright (C) 2020 Luigi Tibaldo
  6 +#
  7 +# This program is free software: you can redistribute it and/or modify
  8 +# it under the terms of the GNU General Public License as published by
  9 +# the Free Software Foundation, either version 3 of the License, or
  10 +# (at your option) any later version.
  11 +#
  12 +# This program is distributed in the hope that it will be useful,
  13 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15 +# GNU General Public License for more details.
  16 +#
  17 +# You should have received a copy of the GNU General Public License
  18 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
  19 +#
  20 +# ==========================================================================
  21 +import os
  22 +import gammalib
  23 +import cscripts
  24 +from testing import test
  25 +
  26 +
  27 +# ========================= #
  28 +# Test class for csscs script #
  29 +# ========================= #
  30 +class Test(test):
  31 + """
  32 + Test class for csscs script
  33 +
  34 + This test class makes unit tests for the csscs script by using it from
  35 + the command line and from Python.
  36 + """
  37 +
  38 + # Constructor
  39 + def __init__(self):
  40 + """
  41 + Constructor
  42 + """
  43 + # Call base class constructor
  44 + test.__init__(self)
  45 +
  46 + # Return
  47 + return
  48 +
  49 + # Set test functions
  50 + def set(self):
  51 + """
  52 + Set all test functions
  53 + """
  54 + # Set test name
  55 + self.name('csscs')
  56 +
  57 + # Append tests
  58 + self.append(self._test_cmd, 'Test csscs on command line')
  59 + self.append(self._test_python, 'Test csscs from Python')
  60 + self.append(self._test_pickeling, 'Test csscs pickeling')
  61 +
  62 + # Return
  63 + return
  64 +
  65 + # Test csscs on command line
  66 + def _test_cmd(self):
  67 + """
  68 + Test csscs on the command line
  69 + """
  70 + # Set script name
  71 + csscs = self._script('csscs')
  72 +
  73 + # Setup csscs command
  74 + cmd = csscs+' logfile="csscs_cmd1.log" chatter=1'
  75 +
  76 + # Check if execution was successful
  77 + self.test_value(self._execute(cmd), 0,
  78 + 'Check successful execution from command line')
  79 +
  80 + # Check csscs --help
  81 + self._check_help(csscs)
  82 +
  83 + # Return
  84 + return
  85 +
  86 + # Test csscs from Python
  87 + def _test_python(self):
  88 + """
  89 + Test csscs from Python
  90 + """
  91 + # Allocate csscs
  92 + script = cscripts.csscs()
  93 +
  94 + # Check that saving does not nothing
  95 + script['logfile'] = 'csscs_py0.log'
  96 + script.logFileOpen()
  97 + script.save()
  98 + self.test_assert(not os.path.isfile('csscs_py0.fits'),
  99 + 'Check that no FITS file has been created')
  100 +
  101 + # Check that clearing does not lead to an exception or segfault
  102 + script.clear()
  103 +
  104 + # Now set csscs parameters
  105 + script['logfile'] = 'csscs_py1.log'
  106 + script['chatter'] = 2
  107 +
  108 + # Run csscs script
  109 + script.logFileOpen()
  110 + script.run()
  111 +
  112 + # Check result
  113 + self._check_result(script)
  114 +
  115 + # Return
  116 + return
  117 +
  118 + # Test csscs pickeling
  119 + def _test_pickeling(self):
  120 + """
  121 + Test csscs pickeling
  122 + """
  123 + # Perform pickeling test of empty class
  124 + self._pickeling(cscripts.csscs())
  125 +
  126 + # Setup script for pickling text
  127 + script = cscripts.csscs()
  128 + script['logfile'] = 'csscs_py1_pickle.log'
  129 + script['chatter'] = 2
  130 +
  131 + # Perform pickeling tests of filled class
  132 + obj = self._pickeling(script)
  133 +
  134 + # Run csscs script and save result
  135 + obj.logFileOpen() # Make sure we get a log file
  136 + obj.run()
  137 + obj.save()
  138 +
  139 + # TODO: Check result file
  140 +
  141 + # Return
  142 + return
  143 +
  144 + # Check csscs result
  145 + def _check_result(self, script):
  146 + """
  147 + Check content of script
  148 +
  149 + Parameters
  150 + ----------
  151 + script : `~cscripts.csscs`
  152 + csscs instance
  153 + """
  154 + # TODO: Implement test on script result
  155 +
  156 + # Return
  157 + return
test/test_python_cscripts.py
1 #! /usr/bin/env python 1 #! /usr/bin/env python
  2 +
2 # ========================================================================== 3 # ==========================================================================
  4 +
3 # This scripts performs unit tests for cscripts 5 # This scripts performs unit tests for cscripts
  6 +
4 # 7 #
  8 +
5 # Copyright (C) 2016-2019 Juergen Knoedlseder 9 # Copyright (C) 2016-2019 Juergen Knoedlseder
  10 +
6 # 11 #
  12 +
7 # This program is free software: you can redistribute it and/or modify 13 # This program is free software: you can redistribute it and/or modify
  14 +
8 # it under the terms of the GNU General Public License as published by 15 # it under the terms of the GNU General Public License as published by
  16 +
9 # the Free Software Foundation, either version 3 of the License, or 17 # the Free Software Foundation, either version 3 of the License, or
  18 +
10 # (at your option) any later version. 19 # (at your option) any later version.
  20 +
11 # 21 #
  22 +
12 # This program is distributed in the hope that it will be useful, 23 # This program is distributed in the hope that it will be useful,
  24 +
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
  26 +
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28 +
15 # GNU General Public License for more details. 29 # GNU General Public License for more details.
  30 +
16 # 31 #
  32 +
17 # You should have received a copy of the GNU General Public License 33 # You should have received a copy of the GNU General Public License
  34 +
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 35 # along with this program. If not, see <http://www.gnu.org/licenses/>.
  36 +
19 # 37 #
  38 +
20 # ========================================================================== 39 # ==========================================================================
  40 +
21 import os 41 import os
  42 +
22 import sys 43 import sys
  44 +
23 import gammalib 45 import gammalib
  46 +
24 import cscripts 47 import cscripts
  48 +
25 sys.path.append(os.path.dirname(os.path.abspath(__file__))) 49 sys.path.append(os.path.dirname(os.path.abspath(__file__)))
  50 +
26 import test_cscript 51 import test_cscript
  52 +
27 import test_cscaldb 53 import test_cscaldb
  54 +
28 import test_csbkgmodel 55 import test_csbkgmodel
  56 +
29 import test_csebins 57 import test_csebins
  58 +
30 import test_csfindobs 59 import test_csfindobs
  60 +
31 import test_csinfo 61 import test_csinfo
  62 +
32 import test_cslightcrv 63 import test_cslightcrv
  64 +
33 import test_csmodelinfo 65 import test_csmodelinfo
  66 +
34 import test_csmodelmerge 67 import test_csmodelmerge
  68 +
35 import test_csmodelselect 69 import test_csmodelselect
  70 +
36 import test_csmodelsois 71 import test_csmodelsois
  72 +
37 import test_csobs2caldb 73 import test_csobs2caldb
  74 +
38 import test_csobsdef 75 import test_csobsdef
  76 +
39 import test_csobsinfo 77 import test_csobsinfo
  78 +
40 import test_csobsselect 79 import test_csobsselect
  80 +
41 import test_csphagen 81 import test_csphagen
  82 +
42 import test_csphasecrv 83 import test_csphasecrv
  84 +
43 import test_cspull 85 import test_cspull
  86 +
44 import test_csresmap 87 import test_csresmap
  88 +
45 import test_csresspec 89 import test_csresspec
  90 +
46 import test_csroot2caldb 91 import test_csroot2caldb
  92 +
47 import test_cssens 93 import test_cssens
  94 +
48 import test_csspec 95 import test_csspec
  96 +
49 import test_cssrcdetect 97 import test_cssrcdetect
  98 +
50 import test_cstsdist 99 import test_cstsdist
  100 +
51 import test_cstsmapmerge 101 import test_cstsmapmerge
  102 +
52 import test_cstsmapsplit 103 import test_cstsmapsplit
  104 +
53 import test_csviscube 105 import test_csviscube
  106 +
  107 +import test_csscs
54 import test_csworkflow 108 import test_csworkflow
  109 +
55 import test_obsutils 110 import test_obsutils
  111 +
56 import test_mputils 112 import test_mputils
  113 +
57 import test_csiactcopy 114 import test_csiactcopy
  115 +
58 import test_csiactdata 116 import test_csiactdata
  117 +
59 import test_csiactobs 118 import test_csiactobs
60 119
61 120
  121 +
  122 +
  123 +
62 # ================== # 124 # ================== #
  125 +
63 # Perform unit tests # 126 # Perform unit tests #
  127 +
64 # ================== # 128 # ================== #
  129 +
65 def test(installed=False, debug=False): 130 def test(installed=False, debug=False):
  131 +
66 """ 132 """
  133 +
67 Perform cscripts unit testing. 134 Perform cscripts unit testing.
68 135
  136 +
  137 +
69 Parameters 138 Parameters
  139 +
70 ---------- 140 ----------
  141 +
71 installed : bool, optional 142 installed : bool, optional
  143 +
72 Flag indicating whether the script has been installed or not 144 Flag indicating whether the script has been installed or not
  145 +
73 debug : bool, optional 146 debug : bool, optional
  147 +
74 Enables debugging 148 Enables debugging
  149 +
75 """ 150 """
  151 +
76 # If we have an installed version then create a temporary directory and 152 # If we have an installed version then create a temporary directory and
  153 +
77 # copy over all information that is needed 154 # copy over all information that is needed
  155 +
78 if installed: 156 if installed:
79 157
  158 +
  159 +
80 # Create temporary working directory 160 # Create temporary working directory
  161 +
81 import tempfile 162 import tempfile
  163 +
82 path = tempfile.mkdtemp() 164 path = tempfile.mkdtemp()
  165 +
83 os.chdir(path) 166 os.chdir(path)
84 167
  168 +
  169 +
85 # Get test directory 170 # Get test directory
  171 +
86 import inspect 172 import inspect
  173 +
87 testdir = inspect.getfile(cscripts.tests) 174 testdir = inspect.getfile(cscripts.tests)
  175 +
88 dirname = os.path.dirname(testdir) 176 dirname = os.path.dirname(testdir)
89 177
  178 +
  179 +
90 # Copy test data in "data" directory 180 # Copy test data in "data" directory
  181 +
91 os.system('cp -r %s %s' % (dirname+'/data', 'data')) 182 os.system('cp -r %s %s' % (dirname+'/data', 'data'))
92 183
  184 +
  185 +
93 # Set test data environment variable 186 # Set test data environment variable
  187 +
94 os.environ['TEST_DATA'] = 'data' 188 os.environ['TEST_DATA'] = 'data'
95 189
  190 +
  191 +
96 # ... otherwise set the calibration database to the one shipped with the 192 # ... otherwise set the calibration database to the one shipped with the
  193 +
97 # package; we don't need to set the 'TEST_DATA', this is done by the 194 # package; we don't need to set the 'TEST_DATA', this is done by the
  195 +
98 # test environment 196 # test environment
  197 +
99 else: 198 else:
  199 +
100 os.environ['CALDB'] = '%s/caldb' % (os.environ['TEST_SRCDIR']) 200 os.environ['CALDB'] = '%s/caldb' % (os.environ['TEST_SRCDIR'])
101 201
  202 +
  203 +
102 # Create a local "pfiles" directory and set PFILES environment variable 204 # Create a local "pfiles" directory and set PFILES environment variable
  205 +
103 try: 206 try:
  207 +
104 os.mkdir('pfiles') 208 os.mkdir('pfiles')
  209 +
105 except: 210 except:
  211 +
106 pass 212 pass
  213 +
107 os.environ['PFILES'] = 'pfiles' 214 os.environ['PFILES'] = 'pfiles'
108 215
  216 +
  217 +
109 # Copy the cscripts parameter files into the "pfiles" directory. For a 218 # Copy the cscripts parameter files into the "pfiles" directory. For a
  219 +
110 # non-installed test we copy the parameter files from the "cscripts" 220 # non-installed test we copy the parameter files from the "cscripts"
  221 +
111 # source directory into the "pfiles" directory, for an installed version 222 # source directory into the "pfiles" directory, for an installed version
  223 +
112 # we get all parameter files from the "syspfiles" directory. Also make 224 # we get all parameter files from the "syspfiles" directory. Also make
  225 +
113 # sure that all parameter files are writable. 226 # sure that all parameter files are writable.
  227 +
114 if not installed: 228 if not installed:
  229 +
115 os.system('cp -r %s/cscripts/*.par pfiles/'% (os.environ['TEST_SRCDIR'])) 230 os.system('cp -r %s/cscripts/*.par pfiles/'% (os.environ['TEST_SRCDIR']))
  231 +
116 os.system('chmod u+w pfiles/*') 232 os.system('chmod u+w pfiles/*')
  233 +
117 else: 234 else:
  235 +
118 os.system('cp -r %s/syspfiles/*.par pfiles/' % (os.environ['CTOOLS'])) 236 os.system('cp -r %s/syspfiles/*.par pfiles/' % (os.environ['CTOOLS']))
  237 +
119 os.system('chmod u+w pfiles/*') 238 os.system('chmod u+w pfiles/*')
120 239
  240 +
  241 +
121 # Define list of test suites 242 # Define list of test suites
  243 +
122 tests = [test_cscript.Test(), 244 tests = [test_cscript.Test(),
  245 +
123 test_csbkgmodel.Test(), 246 test_csbkgmodel.Test(),
  247 +
124 test_cscaldb.Test(), 248 test_cscaldb.Test(),
  249 +
125 test_csebins.Test(), 250 test_csebins.Test(),
  251 +
126 test_csinfo.Test(), 252 test_csinfo.Test(),
  253 +
127 test_cslightcrv.Test(), 254 test_cslightcrv.Test(),
  255 +
128 test_csmodelinfo.Test(), 256 test_csmodelinfo.Test(),
  257 +
129 test_csmodelmerge.Test(), 258 test_csmodelmerge.Test(),
  259 +
130 test_csmodelselect.Test(), 260 test_csmodelselect.Test(),
  261 +
131 test_csmodelsois.Test(), 262 test_csmodelsois.Test(),
  263 +
132 test_csobs2caldb.Test(), 264 test_csobs2caldb.Test(),
  265 +
133 test_csobsdef.Test(), 266 test_csobsdef.Test(),
  267 +
134 test_csobsinfo.Test(), 268 test_csobsinfo.Test(),
  269 +
135 test_csobsselect.Test(), 270 test_csobsselect.Test(),
  271 +
136 test_csphagen.Test(), 272 test_csphagen.Test(),
  273 +
137 test_csphasecrv.Test(), 274 test_csphasecrv.Test(),
  275 +
138 test_cspull.Test(), 276 test_cspull.Test(),
  277 +
139 test_csresmap.Test(), 278 test_csresmap.Test(),
  279 +
140 test_csresspec.Test(), 280 test_csresspec.Test(),
  281 +
141 test_csroot2caldb.Test(), 282 test_csroot2caldb.Test(),
  283 +
142 test_cssens.Test(), 284 test_cssens.Test(),
  285 +
143 test_csspec.Test(), 286 test_csspec.Test(),
  287 +
144 test_cssrcdetect.Test(), 288 test_cssrcdetect.Test(),
  289 +
145 test_cstsdist.Test(), 290 test_cstsdist.Test(),
  291 +
146 test_cstsmapmerge.Test(), 292 test_cstsmapmerge.Test(),
  293 +
147 test_cstsmapsplit.Test(), 294 test_cstsmapsplit.Test(),
  295 +
148 test_csviscube.Test(), 296 test_csviscube.Test(),
  297 +
  298 + test_csscs.Test(),
149 test_csworkflow.Test(), 299 test_csworkflow.Test(),
  300 +
150 test_obsutils.Test(), 301 test_obsutils.Test(),
  302 +
151 test_mputils.Test()] 303 test_mputils.Test()]
152 304
  305 +
  306 +
153 # Append tests for Python 2.6+ (the IACT cscripts depend on the json 307 # Append tests for Python 2.6+ (the IACT cscripts depend on the json
  308 +
154 # module which is only available since Python 2.6+) 309 # module which is only available since Python 2.6+)
  310 +
155 ver = sys.version.split()[0] 311 ver = sys.version.split()[0]
  312 +
156 if ver >= '2.6.0': 313 if ver >= '2.6.0':
157 314
  315 +
  316 +
158 # Check for VHEFITS environment variable 317 # Check for VHEFITS environment variable
  318 +
159 if 'VHEFITS' in os.environ: 319 if 'VHEFITS' in os.environ:
160 320
  321 +
  322 +
161 # If the environment variable exists then unset it for the test 323 # If the environment variable exists then unset it for the test
  324 +
162 # cases. Since Python is executed in a subprocess this will not 325 # cases. Since Python is executed in a subprocess this will not
  326 +
163 # impact the environment variable in the parent shell. 327 # impact the environment variable in the parent shell.
  328 +
164 del os.environ['VHEFITS'] 329 del os.environ['VHEFITS']
165 330
  331 +
  332 +
166 # Append IACT script tests to list of test suites 333 # Append IACT script tests to list of test suites
  334 +
167 tests.extend([test_csfindobs.Test(), 335 tests.extend([test_csfindobs.Test(),
  336 +
168 test_csiactcopy.Test(), 337 test_csiactcopy.Test(),
  338 +
169 test_csiactdata.Test(), 339 test_csiactdata.Test(),
  340 +
170 test_csiactobs.Test()]) 341 test_csiactobs.Test()])
171 342
  343 +
  344 +
172 # Allocate test suite container 345 # Allocate test suite container
  346 +
173 suites = gammalib.GTestSuites('cscripts unit testing') 347 suites = gammalib.GTestSuites('cscripts unit testing')
174 348
  349 +
  350 +
175 # Set test suites and append them to suite container 351 # Set test suites and append them to suite container
  352 +
176 for suite in tests: 353 for suite in tests:
  354 +
177 suite.set() 355 suite.set()
  356 +
178 suites.append(suite) 357 suites.append(suite)
179 358
  359 +
  360 +
180 # Run test suite 361 # Run test suite
  362 +
181 success = suites.run() 363 success = suites.run()
182 364
  365 +
  366 +
183 # Save test results 367 # Save test results
  368 +
184 if not installed: 369 if not installed:
  370 +
185 suites.save('reports/cscripts.xml') 371 suites.save('reports/cscripts.xml')
  372 +
186 else: 373 else:
  374 +
187 suites.save('cscripts_reports.xml') 375 suites.save('cscripts_reports.xml')
188 376
  377 +
  378 +
189 # If debuging is requested then print test suites 379 # If debuging is requested then print test suites
  380 +
190 if debug: 381 if debug:
  382 +
191 print(suites) 383 print(suites)
192 384
  385 +
  386 +
193 # Remove temporary direction 387 # Remove temporary direction
  388 +
194 if installed: 389 if installed:
  390 +
195 os.system('rm -rf %s' % (path)) 391 os.system('rm -rf %s' % (path))
196 392
  393 +
  394 +
197 # Raise an exception in case of failure 395 # Raise an exception in case of failure
  396 +
198 if not success: 397 if not success:
  398 +
199 raise RuntimeError('At least one error occured during the test.') 399 raise RuntimeError('At least one error occured during the test.')
200 400
  401 +
  402 +
201 # Return 403 # Return
  404 +
202 return 405 return
203 406
204 407
  408 +
  409 +
  410 +
205 # ======================== # 411 # ======================== #
  412 +
206 # Main routine entry point # 413 # Main routine entry point #
  414 +
207 # ======================== # 415 # ======================== #
  416 +
208 if __name__ == '__main__': 417 if __name__ == '__main__':
209 418
  419 +
  420 +
210 # Run tests 421 # Run tests
  422 +
211 test() 423 test()
  424 +