Commit 5ffa84f1f592e0dc2179fb006be4693d9b1b7f19
Merge branch 'devel' of github.com:ctools/ctools into devel
Showing
13 changed files
with
50 additions
and
53 deletions
ChangeLog
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | * Version 0.8.0 released | 3 | * Version 0.8.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Adapt to GammaLib 0.9.0 interface | ||
| 6 | ctbin now always merges event lists into a single counts cube | 7 | ctbin now always merges event lists into a single counts cube |
| 7 | Add ctexpcube tool | 8 | Add ctexpcube tool |
| 8 | Support energy dispersion in ctobssim, ctlike and ctmodel | 9 | Support energy dispersion in ctobssim, ctlike and ctmodel |
configure.ac
| @@ -29,7 +29,7 @@ | @@ -29,7 +29,7 @@ | ||
| 29 | ############################################################################# | 29 | ############################################################################# |
| 30 | # Initialisation # | 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 | AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) | 33 | AC_CONFIG_SRCDIR([src/ctselect/ctselect.cpp]) |
| 34 | AC_CONFIG_MACRO_DIR([m4]) | 34 | AC_CONFIG_MACRO_DIR([m4]) |
| 35 | #AM_INIT_AUTOMAKE([gnu no-dependencies]) | 35 | #AM_INIT_AUTOMAKE([gnu no-dependencies]) |
ctools.pc.in
| @@ -6,9 +6,9 @@ includedir=${prefix}/include | @@ -6,9 +6,9 @@ includedir=${prefix}/include | ||
| 6 | Name: ctools | 6 | Name: ctools |
| 7 | Description: CTA science analysis tools | 7 | Description: CTA science analysis tools |
| 8 | URL: http://cta.irap.omp.eu/ctools | 8 | URL: http://cta.irap.omp.eu/ctools |
| 9 | -Version: 0.7.1 | 9 | +Version: 0.8.0 |
| 10 | Requires: | 10 | Requires: |
| 11 | -Requires.private: gammalib >= 0.8.1 | 11 | +Requires.private: gammalib >= 0.9.0 |
| 12 | Conflicts: | 12 | Conflicts: |
| 13 | Cflags: -I${includedir}/ctools @OPENMP_CXXFLAGS@ | 13 | Cflags: -I${includedir}/ctools @OPENMP_CXXFLAGS@ |
| 14 | Libs: -L${libdir} -lctools | 14 | Libs: -L${libdir} -lctools |
doc/Doxyfile
| @@ -32,7 +32,7 @@ PROJECT_NAME = ctools | @@ -32,7 +32,7 @@ PROJECT_NAME = ctools | ||
| 32 | # This could be handy for archiving the generated documentation or | 32 | # This could be handy for archiving the generated documentation or |
| 33 | # if some version control system is used. | 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 | # Using the PROJECT_BRIEF tag one can provide an optional one line description | 37 | # Using the PROJECT_BRIEF tag one can provide an optional one line description |
| 38 | # for a project that appears at the top of each page and should give viewer | 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,10 +73,10 @@ copyright = u'2014, ctools developers' | ||
| 73 | # built documents. | 73 | # built documents. |
| 74 | # | 74 | # |
| 75 | # The short X.Y version. | 75 | # The short X.Y version. |
| 76 | -version = '0.7' | 76 | +version = '0.8' |
| 77 | 77 | ||
| 78 | # The full version, including alpha/beta/rc tags. | 78 | # The full version, including alpha/beta/rc tags. |
| 79 | -release = '0.7.2' | 79 | +release = '0.8.0' |
| 80 | 80 | ||
| 81 | # The language for content autogenerated by Sphinx. Refer to documentation | 81 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 82 | # for a list of supported languages. | 82 | # for a list of supported languages. |
src/ctbin/ctbin.cpp
| @@ -430,7 +430,7 @@ void ctbin::get_parameters(void) | @@ -430,7 +430,7 @@ void ctbin::get_parameters(void) | ||
| 430 | try { | 430 | try { |
| 431 | 431 | ||
| 432 | // Load event list in CTA observation | 432 | // Load event list in CTA observation |
| 433 | - obs.load_unbinned(m_evfile); | 433 | + obs.load(m_evfile); |
| 434 | 434 | ||
| 435 | // Append CTA observation to container | 435 | // Append CTA observation to container |
| 436 | m_obs.append(obs); | 436 | m_obs.append(obs); |
src/ctexpcube/ctexpcube.cpp
| @@ -252,8 +252,8 @@ void ctexpcube::run(void) | @@ -252,8 +252,8 @@ void ctexpcube::run(void) | ||
| 252 | for (int i = 0; i < m_obs.size(); ++i) { | 252 | for (int i = 0; i < m_obs.size(); ++i) { |
| 253 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 253 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 254 | if (obs != NULL) { | 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,7 +282,7 @@ void ctexpcube::run(void) | ||
| 282 | for (int i = 0; i < m_obs.size(); ++i) { | 282 | for (int i = 0; i < m_obs.size(); ++i) { |
| 283 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 283 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 284 | if (obs != NULL) { | 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,8 +431,8 @@ void ctexpcube::set_response(void) | ||
| 431 | // Yes ... | 431 | // Yes ... |
| 432 | if (obs != NULL) { | 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 | // Load response information | 437 | // Load response information |
| 438 | std::string database = (*this)["caldb"].string(); | 438 | std::string database = (*this)["caldb"].string(); |
src/ctlike/ctlike.cpp
| @@ -248,8 +248,8 @@ void ctlike::run(void) | @@ -248,8 +248,8 @@ void ctlike::run(void) | ||
| 248 | for (int i = 0; i < m_obs.size(); ++i) { | 248 | for (int i = 0; i < m_obs.size(); ++i) { |
| 249 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 249 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 250 | if (obs != NULL) { | 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,7 +332,7 @@ void ctlike::run(void) | ||
| 332 | for (int i = 0; i < m_obs.size(); ++i) { | 332 | for (int i = 0; i < m_obs.size(); ++i) { |
| 333 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 333 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 334 | if (obs != NULL) { | 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,9 +448,9 @@ void ctlike::get_parameters(void) | ||
| 448 | // Continue only if observation is a CTA observation | 448 | // Continue only if observation is a CTA observation |
| 449 | if (obs != NULL) { | 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 | // Get calibration parameters | 455 | // Get calibration parameters |
| 456 | if (!asked_for_response) { | 456 | if (!asked_for_response) { |
src/ctmodel/ctmodel.cpp
| @@ -253,8 +253,8 @@ void ctmodel::run(void) | @@ -253,8 +253,8 @@ void ctmodel::run(void) | ||
| 253 | for (int i = 0; i < m_obs.size(); ++i) { | 253 | for (int i = 0; i < m_obs.size(); ++i) { |
| 254 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 254 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 255 | if (obs != NULL) { | 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,7 +341,7 @@ void ctmodel::run(void) | ||
| 341 | for (int i = 0; i < m_obs.size(); ++i) { | 341 | for (int i = 0; i < m_obs.size(); ++i) { |
| 342 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 342 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 343 | if (obs != NULL) { | 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,7 +554,7 @@ void ctmodel::setup_obs(void) | ||
| 554 | GCTAObservation obs; | 554 | GCTAObservation obs; |
| 555 | 555 | ||
| 556 | // Load counts map in CTA observation | 556 | // Load counts map in CTA observation |
| 557 | - obs.load_binned(m_infile); | 557 | + obs.load(m_infile); |
| 558 | 558 | ||
| 559 | // Append CTA observation to container | 559 | // Append CTA observation to container |
| 560 | m_obs.append(obs); | 560 | m_obs.append(obs); |
| @@ -602,8 +602,8 @@ void ctmodel::setup_obs(void) | @@ -602,8 +602,8 @@ void ctmodel::setup_obs(void) | ||
| 602 | throw GException::no_cube(G_SETUP_OBS); | 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 | // Set calibration database. If specified parameter is a | 608 | // Set calibration database. If specified parameter is a |
| 609 | // directory then use this as the pathname to the calibration | 609 | // directory then use this as the pathname to the calibration |
src/ctobssim/ctobssim.cpp
| @@ -33,8 +33,8 @@ | @@ -33,8 +33,8 @@ | ||
| 33 | #include "GTools.hpp" | 33 | #include "GTools.hpp" |
| 34 | 34 | ||
| 35 | /* __ Method name definitions ____________________________________________ */ | 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 | /* __ Constants __________________________________________________________ */ | 39 | /* __ Constants __________________________________________________________ */ |
| 40 | const double g_roi_margin = 0.5; //!< Simulation radius margin (degrees) | 40 | const double g_roi_margin = 0.5; //!< Simulation radius margin (degrees) |
| @@ -263,8 +263,8 @@ void ctobssim::run(void) | @@ -263,8 +263,8 @@ void ctobssim::run(void) | ||
| 263 | for (int i = 0; i < m_obs.size(); ++i) { | 263 | for (int i = 0; i < m_obs.size(); ++i) { |
| 264 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 264 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 265 | if (obs != NULL) { | 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,7 +380,7 @@ void ctobssim::run(void) | ||
| 380 | for (int i = 0; i < m_obs.size(); ++i) { | 380 | for (int i = 0; i < m_obs.size(); ++i) { |
| 381 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 381 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| 382 | if (obs != NULL) { | 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,7 +664,12 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, | ||
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | // Get CTA response | 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 | // Make sure that the observation holds a CTA event list. If this | 674 | // Make sure that the observation holds a CTA event list. If this |
| 670 | // is not the case then allocate and attach a CTA event list now. | 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,9 +728,9 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, | ||
| 723 | // has energy dispersion then add margin | 728 | // has energy dispersion then add margin |
| 724 | GEnergy e_true_min = emin; | 729 | GEnergy e_true_min = emin; |
| 725 | GEnergy e_true_max = emax; | 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 | // Dump energy range | 736 | // Dump energy range |
| @@ -822,10 +827,10 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, | @@ -822,10 +827,10 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, | ||
| 822 | 827 | ||
| 823 | // Simulate event. Note that this method | 828 | // Simulate event. Note that this method |
| 824 | // includes the deadtime correction. | 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 | if (event != NULL) { | 834 | if (event != NULL) { |
| 830 | 835 | ||
| 831 | // Use event only if it falls within ROI | 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,8 +641,8 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) | ||
| 641 | } | 641 | } |
| 642 | else { | 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 | * ctskymap - CTA sky mapping tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -366,7 +366,7 @@ void ctskymap::get_parameters(void) | @@ -366,7 +366,7 @@ void ctskymap::get_parameters(void) | ||
| 366 | 366 | ||
| 367 | // Load unbinned CTA observation | 367 | // Load unbinned CTA observation |
| 368 | GCTAObservation obs; | 368 | GCTAObservation obs; |
| 369 | - obs.load_unbinned(m_evfile); | 369 | + obs.load(m_evfile); |
| 370 | 370 | ||
| 371 | // Append CTA observation to container | 371 | // Append CTA observation to container |
| 372 | m_obs.append(obs); | 372 | m_obs.append(obs); |
test/test_python.py
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | # This script illustrates how to build an unbinned analysis pipeline using | 3 | # This script illustrates how to build an unbinned analysis pipeline using |
| 4 | # the ctools. | 4 | # the ctools. |
| 5 | # | 5 | # |
| 6 | -# Copyright (C) 2011 Jurgen Knodlseder | 6 | +# Copyright (C) 2011-2014 Juergen Knoedlseder |
| 7 | # | 7 | # |
| 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by | 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,17 +122,8 @@ def pipeline_v2(model_name="data/crab.xml", \ | ||
| 122 | FITS files on disk. All data is only hold in memory. | 122 | FITS files on disk. All data is only hold in memory. |
| 123 | """ | 123 | """ |
| 124 | # Set script parameters | 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 | # Simulate events | 128 | # Simulate events |
| 138 | sim = ctobssim() | 129 | sim = ctobssim() |