Commit 5ffa84f1f592e0dc2179fb006be4693d9b1b7f19
Merge branch 'devel' of github.com:ctools/ctools into devel
Showing
13 changed files
with
50 additions
and
53 deletions
ChangeLog
configure.ac
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | ############################################################################# |
| 30 | 30 | # Initialisation # |
| 31 | 31 | ############################################################################# |
| 32 | -AC_INIT([ctools], [0.7.1], [jurgen.knodlseder@irap.omp.eu], [ctools]) | |
| 32 | +AC_INIT([ctools], [0.8.0], [jurgen.knodlseder@irap.omp.eu], [ctools]) | |
| 33 | 33 | AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) |
| 34 | 34 | AC_CONFIG_MACRO_DIR([m4]) |
| 35 | 35 | #AM_INIT_AUTOMAKE([gnu no-dependencies]) | ... | ... |
ctools.pc.in
| ... | ... | @@ -6,9 +6,9 @@ includedir=${prefix}/include |
| 6 | 6 | Name: ctools |
| 7 | 7 | Description: CTA science analysis tools |
| 8 | 8 | URL: http://cta.irap.omp.eu/ctools |
| 9 | -Version: 0.7.1 | |
| 9 | +Version: 0.8.0 | |
| 10 | 10 | Requires: |
| 11 | -Requires.private: gammalib >= 0.8.1 | |
| 11 | +Requires.private: gammalib >= 0.9.0 | |
| 12 | 12 | Conflicts: |
| 13 | 13 | Cflags: -I${includedir}/ctools @OPENMP_CXXFLAGS@ |
| 14 | 14 | Libs: -L${libdir} -lctools | ... | ... |
doc/Doxyfile
| ... | ... | @@ -32,7 +32,7 @@ PROJECT_NAME = ctools |
| 32 | 32 | # This could be handy for archiving the generated documentation or |
| 33 | 33 | # if some version control system is used. |
| 34 | 34 | |
| 35 | -PROJECT_NUMBER = 0.7.1 | |
| 35 | +PROJECT_NUMBER = 0.8.0 | |
| 36 | 36 | |
| 37 | 37 | # Using the PROJECT_BRIEF tag one can provide an optional one line description |
| 38 | 38 | # for a project that appears at the top of each page and should give viewer | ... | ... |
doc/source/conf.py
| ... | ... | @@ -73,10 +73,10 @@ copyright = u'2014, ctools developers' |
| 73 | 73 | # built documents. |
| 74 | 74 | # |
| 75 | 75 | # The short X.Y version. |
| 76 | -version = '0.7' | |
| 76 | +version = '0.8' | |
| 77 | 77 | |
| 78 | 78 | # The full version, including alpha/beta/rc tags. |
| 79 | -release = '0.7.2' | |
| 79 | +release = '0.8.0' | |
| 80 | 80 | |
| 81 | 81 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 82 | 82 | # for a list of supported languages. | ... | ... |
src/ctbin/ctbin.cpp
src/ctexpcube/ctexpcube.cpp
| ... | ... | @@ -252,8 +252,8 @@ void ctexpcube::run(void) |
| 252 | 252 | for (int i = 0; i < m_obs.size(); ++i) { |
| 253 | 253 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 254 | 254 | if (obs != NULL) { |
| 255 | - save_edisp[i] = obs->response().apply_edisp(); | |
| 256 | - obs->response().apply_edisp(m_apply_edisp); | |
| 255 | + save_edisp[i] = obs->response()->apply_edisp(); | |
| 256 | + obs->response()->apply_edisp(m_apply_edisp); | |
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
| ... | ... | @@ -282,7 +282,7 @@ void ctexpcube::run(void) |
| 282 | 282 | for (int i = 0; i < m_obs.size(); ++i) { |
| 283 | 283 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 284 | 284 | if (obs != NULL) { |
| 285 | - obs->response().apply_edisp(save_edisp[i]); | |
| 285 | + obs->response()->apply_edisp(save_edisp[i]); | |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| ... | ... | @@ -431,8 +431,8 @@ void ctexpcube::set_response(void) |
| 431 | 431 | // Yes ... |
| 432 | 432 | if (obs != NULL) { |
| 433 | 433 | |
| 434 | - // Set response if it isn't set already | |
| 435 | - if (obs->response().aeff() == NULL) { | |
| 434 | + // Set response if we don't have one | |
| 435 | + if (!obs->hasresponse()) { | |
| 436 | 436 | |
| 437 | 437 | // Load response information |
| 438 | 438 | std::string database = (*this)["caldb"].string(); | ... | ... |
src/ctlike/ctlike.cpp
| ... | ... | @@ -248,8 +248,8 @@ void ctlike::run(void) |
| 248 | 248 | for (int i = 0; i < m_obs.size(); ++i) { |
| 249 | 249 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 250 | 250 | if (obs != NULL) { |
| 251 | - save_edisp[i] = obs->response().apply_edisp(); | |
| 252 | - obs->response().apply_edisp(m_apply_edisp); | |
| 251 | + save_edisp[i] = obs->response()->apply_edisp(); | |
| 252 | + obs->response()->apply_edisp(m_apply_edisp); | |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| ... | ... | @@ -332,7 +332,7 @@ void ctlike::run(void) |
| 332 | 332 | for (int i = 0; i < m_obs.size(); ++i) { |
| 333 | 333 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 334 | 334 | if (obs != NULL) { |
| 335 | - obs->response().apply_edisp(save_edisp[i]); | |
| 335 | + obs->response()->apply_edisp(save_edisp[i]); | |
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
| ... | ... | @@ -448,9 +448,9 @@ void ctlike::get_parameters(void) |
| 448 | 448 | // Continue only if observation is a CTA observation |
| 449 | 449 | if (obs != NULL) { |
| 450 | 450 | |
| 451 | - // If there is no effective area information then | |
| 452 | - // set response from task parameters | |
| 453 | - if (obs->response().aeff() == NULL) { | |
| 451 | + // If response is not valid then set response from | |
| 452 | + // task parameters | |
| 453 | + if (!obs->hasresponse()) { | |
| 454 | 454 | |
| 455 | 455 | // Get calibration parameters |
| 456 | 456 | if (!asked_for_response) { | ... | ... |
src/ctmodel/ctmodel.cpp
| ... | ... | @@ -253,8 +253,8 @@ void ctmodel::run(void) |
| 253 | 253 | for (int i = 0; i < m_obs.size(); ++i) { |
| 254 | 254 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 255 | 255 | if (obs != NULL) { |
| 256 | - save_edisp[i] = obs->response().apply_edisp(); | |
| 257 | - obs->response().apply_edisp(m_apply_edisp); | |
| 256 | + save_edisp[i] = obs->response()->apply_edisp(); | |
| 257 | + obs->response()->apply_edisp(m_apply_edisp); | |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
| ... | ... | @@ -341,7 +341,7 @@ void ctmodel::run(void) |
| 341 | 341 | for (int i = 0; i < m_obs.size(); ++i) { |
| 342 | 342 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 343 | 343 | if (obs != NULL) { |
| 344 | - obs->response().apply_edisp(save_edisp[i]); | |
| 344 | + obs->response()->apply_edisp(save_edisp[i]); | |
| 345 | 345 | } |
| 346 | 346 | } |
| 347 | 347 | |
| ... | ... | @@ -554,7 +554,7 @@ void ctmodel::setup_obs(void) |
| 554 | 554 | GCTAObservation obs; |
| 555 | 555 | |
| 556 | 556 | // Load counts map in CTA observation |
| 557 | - obs.load_binned(m_infile); | |
| 557 | + obs.load(m_infile); | |
| 558 | 558 | |
| 559 | 559 | // Append CTA observation to container |
| 560 | 560 | m_obs.append(obs); |
| ... | ... | @@ -602,8 +602,8 @@ void ctmodel::setup_obs(void) |
| 602 | 602 | throw GException::no_cube(G_SETUP_OBS); |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - // Set response if it isn't set already | |
| 606 | - if (obs->response().aeff() == NULL) { | |
| 605 | + // Set response if we don't have one | |
| 606 | + if (!obs->hasresponse()) { | |
| 607 | 607 | |
| 608 | 608 | // Set calibration database. If specified parameter is a |
| 609 | 609 | // directory then use this as the pathname to the calibration | ... | ... |
src/ctobssim/ctobssim.cpp
| ... | ... | @@ -33,8 +33,8 @@ |
| 33 | 33 | #include "GTools.hpp" |
| 34 | 34 | |
| 35 | 35 | /* __ Method name definitions ____________________________________________ */ |
| 36 | -#define G_SIMULATE_SOURCE "ctobssim::simulate_source(GCTAObservation*,"\ | |
| 37 | - " GPhotons&)" | |
| 36 | +#define G_SIMULATE_SOURCE "ctobssim::simulate_source(GCTAObservation*, "\ | |
| 37 | + "GModels&, GRan&, GLog*)" | |
| 38 | 38 | |
| 39 | 39 | /* __ Constants __________________________________________________________ */ |
| 40 | 40 | const double g_roi_margin = 0.5; //!< Simulation radius margin (degrees) |
| ... | ... | @@ -263,8 +263,8 @@ void ctobssim::run(void) |
| 263 | 263 | for (int i = 0; i < m_obs.size(); ++i) { |
| 264 | 264 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 265 | 265 | if (obs != NULL) { |
| 266 | - save_edisp[i] = obs->response().apply_edisp(); | |
| 267 | - obs->response().apply_edisp(m_apply_edisp); | |
| 266 | + save_edisp[i] = obs->response()->apply_edisp(); | |
| 267 | + obs->response()->apply_edisp(m_apply_edisp); | |
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
| ... | ... | @@ -380,7 +380,7 @@ void ctobssim::run(void) |
| 380 | 380 | for (int i = 0; i < m_obs.size(); ++i) { |
| 381 | 381 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 382 | 382 | if (obs != NULL) { |
| 383 | - obs->response().apply_edisp(save_edisp[i]); | |
| 383 | + obs->response()->apply_edisp(save_edisp[i]); | |
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
| ... | ... | @@ -664,7 +664,12 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, |
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | // Get CTA response |
| 667 | - const GCTAResponse& rsp = obs->response(); | |
| 667 | + const GCTAResponseIrf* rsp = dynamic_cast<const GCTAResponseIrf*>(obs->response()); | |
| 668 | + if (rsp == NULL) { | |
| 669 | + std::string msg = "Response is not an IRF response.\n" + | |
| 670 | + obs->response()->print(); | |
| 671 | + throw GException::invalid_value(G_SIMULATE_SOURCE, msg); | |
| 672 | + } | |
| 668 | 673 | |
| 669 | 674 | // Make sure that the observation holds a CTA event list. If this |
| 670 | 675 | // is not the case then allocate and attach a CTA event list now. |
| ... | ... | @@ -723,9 +728,9 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, |
| 723 | 728 | // has energy dispersion then add margin |
| 724 | 729 | GEnergy e_true_min = emin; |
| 725 | 730 | GEnergy e_true_max = emax; |
| 726 | - if (rsp.use_edisp()) { | |
| 727 | - e_true_min = rsp.ebounds_src(e_true_min).emin(); | |
| 728 | - e_true_max = rsp.ebounds_src(e_true_max).emax(); | |
| 731 | + if (rsp->use_edisp()) { | |
| 732 | + e_true_min = rsp->ebounds_src(e_true_min).emin(); | |
| 733 | + e_true_max = rsp->ebounds_src(e_true_max).emax(); | |
| 729 | 734 | } |
| 730 | 735 | |
| 731 | 736 | // Dump energy range |
| ... | ... | @@ -822,10 +827,10 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, |
| 822 | 827 | |
| 823 | 828 | // Simulate event. Note that this method |
| 824 | 829 | // includes the deadtime correction. |
| 825 | - GCTAEventAtom* event = rsp.mc(m_area, | |
| 826 | - photons[i], | |
| 827 | - *obs, | |
| 828 | - ran); | |
| 830 | + GCTAEventAtom* event = rsp->mc(m_area, | |
| 831 | + photons[i], | |
| 832 | + *obs, | |
| 833 | + ran); | |
| 829 | 834 | if (event != NULL) { |
| 830 | 835 | |
| 831 | 836 | // Use event only if it falls within ROI | ... | ... |
src/ctselect/ctselect.cpp
| ... | ... | @@ -641,8 +641,8 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) |
| 641 | 641 | } |
| 642 | 642 | else { |
| 643 | 643 | |
| 644 | - // Readload observation from FITS file | |
| 645 | - obs->load(file); | |
| 644 | + // Re-read observation from FITS object | |
| 645 | + obs->read(file); | |
| 646 | 646 | |
| 647 | 647 | } |
| 648 | 648 | ... | ... |
src/ctskymap/ctskymap.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * ctskymap - CTA sky mapping tool * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2011-2013 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2011-2014 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -366,7 +366,7 @@ void ctskymap::get_parameters(void) |
| 366 | 366 | |
| 367 | 367 | // Load unbinned CTA observation |
| 368 | 368 | GCTAObservation obs; |
| 369 | - obs.load_unbinned(m_evfile); | |
| 369 | + obs.load(m_evfile); | |
| 370 | 370 | |
| 371 | 371 | // Append CTA observation to container |
| 372 | 372 | m_obs.append(obs); | ... | ... |
test/test_python.py
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | # This script illustrates how to build an unbinned analysis pipeline using |
| 4 | 4 | # the ctools. |
| 5 | 5 | # |
| 6 | -# Copyright (C) 2011 Jurgen Knodlseder | |
| 6 | +# Copyright (C) 2011-2014 Juergen Knoedlseder | |
| 7 | 7 | # |
| 8 | 8 | # This program is free software: you can redistribute it and/or modify |
| 9 | 9 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -122,17 +122,8 @@ def pipeline_v2(model_name="data/crab.xml", \ |
| 122 | 122 | FITS files on disk. All data is only hold in memory. |
| 123 | 123 | """ |
| 124 | 124 | # Set script parameters |
| 125 | - #model_name = "data/crab.xml" | |
| 126 | - caldb = "irf" | |
| 127 | - irf = "cta_dummy_irf" | |
| 128 | - #ra = 83.63 | |
| 129 | - #dec = 22.01 | |
| 130 | - #rad_sim = 10.0 | |
| 131 | - #tstart = 0.0 | |
| 132 | - #tstop = 1800.0 | |
| 133 | - #emin = 0.1 | |
| 134 | - #emax = 100.0 | |
| 135 | - #rad_select = 3.0 | |
| 125 | + caldb = "irf" | |
| 126 | + irf = "cta_dummy_irf" | |
| 136 | 127 | |
| 137 | 128 | # Simulate events |
| 138 | 129 | sim = ctobssim() | ... | ... |