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