Commit 8ff8bdd75c6f4da319357ecb1efb538b376af854
Merge branch 'integration' into devel
Showing
9 changed files
with
159 additions
and
35 deletions
ChangeLog
| 1 | +2016-01-04 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 2 | + | |
| 3 | + * Version 1.1.0 released | |
| 4 | + ======================== | |
| 5 | + | |
| 6 | + | |
| 7 | +2015-12-20 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 8 | + | |
| 9 | + * Bug fix version 1.0.1 released | |
| 10 | + ================================ | |
| 11 | + | |
| 12 | + Re-enable ctmodel computation for stacked analysis (#1609) | |
| 13 | + | |
| 14 | + | |
| 1 | 15 | 2015-12-18 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> |
| 2 | 16 | |
| 3 | 17 | * Version 1.0.0 released | ... | ... |
NEWS
| 1 | -New Features and Important Changes in ctools 1.0.0 | |
| 1 | +New Features and Important Changes in ctools 1.1.0 | |
| 2 | 2 | |
| 3 | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | |
| 5 | -18 December 2015 | |
| 5 | +4 January 2016 | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | 1. Introduction |
| 9 | 9 | --------------- |
| 10 | 10 | This document briefly summarizes executable by executable the most important |
| 11 | -changes made since the last release of ctools. The code complies to ctools | |
| 12 | -version 1.0.0 or above. | |
| 11 | +changes made since the last release of ctools. | |
| 13 | 12 | |
| 14 | 13 | |
| 15 | 14 | 2. Configuration |
| 16 | 15 | ----------------- |
| 17 | -A special post processing of the Python module libraries has been added for | |
| 18 | -Mac OS X 10.11 and higher (El Capitan). This post processing is a replacement for | |
| 19 | -setting DYLD_LIBRARY_PATH during unit testing since the environment variable is | |
| 20 | -ignored in certain circumstances by El Capitan. Any errors that occur in the | |
| 21 | -post-processing will be ignored. | |
| 16 | +None | |
| 22 | 17 | |
| 23 | 18 | |
| 24 | 19 | 3. Python interface |
| ... | ... | @@ -28,10 +23,7 @@ None |
| 28 | 23 | |
| 29 | 24 | 4. Support model |
| 30 | 25 | ---------------- |
| 31 | -Adapt the ctool::create_ebounds() method to the change in the GEbounds | |
| 32 | -interface (the extname argument has been removed from the GEbounds::load() | |
| 33 | -method and replaced by using the GFilename class to handle extension names | |
| 34 | -as part of the file name). | |
| 26 | +None | |
| 35 | 27 | |
| 36 | 28 | |
| 37 | 29 | 5. ctobssim - CTA observation simulation |
| ... | ... | @@ -106,18 +98,7 @@ None |
| 106 | 98 | |
| 107 | 99 | 19. cscripts |
| 108 | 100 | ------------ |
| 109 | -The following scripts have been added: | |
| 110 | -- csobsinfo: dump information in observation container | |
| 111 | -- csmodelinfo: dump information in model container | |
| 112 | -- csmodelmerge: merge model containers into single container | |
| 113 | -- cstsmapmerge: merge sliced TS map into single map | |
| 114 | -- csobs2caldb: creates calibration database from observation | |
| 115 | -- csiactdata: inspects IACT data | |
| 116 | - | |
| 117 | -The cshessobs script has been renamed to csiactobs. | |
| 118 | - | |
| 119 | -All GExceptions are replaced by Python RuntimeErrors as the GException | |
| 120 | -classes are not exposed to Python. | |
| 101 | +None | |
| 121 | 102 | |
| 122 | 103 | |
| 123 | 104 | 20. Examples | ... | ... |
README
configure.ac
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # Configuration for ctools - a set of tools for science analysis of CTA # |
| 3 | 3 | # data # |
| 4 | 4 | # ------------------------------------------------------------------------- # |
| 5 | -# Copyright (C) 2011-2015 Juergen Knoedlseder # | |
| 5 | +# Copyright (C) 2011-2016 Juergen Knoedlseder # | |
| 6 | 6 | # ------------------------------------------------------------------------- # |
| 7 | 7 | # # |
| 8 | 8 | # This program is free software: you can redistribute it and/or modify # | ... | ... |
ctools.pc.in
| ... | ... | @@ -8,7 +8,7 @@ Description: CTA science analysis tools |
| 8 | 8 | URL: http://cta.irap.omp.eu/ctools |
| 9 | 9 | Version: 1.1.0 |
| 10 | 10 | Requires: |
| 11 | -Requires.private: gammalib >= 1.0.0 | |
| 11 | +Requires.private: gammalib >= 1.1.0 | |
| 12 | 12 | Conflicts: |
| 13 | 13 | Cflags: -I${includedir}/ctools @OPENMP_CXXFLAGS@ |
| 14 | 14 | Libs: -L${libdir} -lctools | ... | ... |
doc/source/conf.py
| ... | ... | @@ -59,7 +59,7 @@ master_doc = 'contents' |
| 59 | 59 | |
| 60 | 60 | # General information about the project. |
| 61 | 61 | project = u'ctools' |
| 62 | -copyright = u'2014-2015, ctools developers' | |
| 62 | +copyright = u'2014-2016, ctools developers' | |
| 63 | 63 | |
| 64 | 64 | # The version info for the project you're documenting, acts as replacement for |
| 65 | 65 | # |version| and |release|, also used in various other places throughout the | ... | ... |
src/ctmodel/ctmodel.cpp
| ... | ... | @@ -411,7 +411,7 @@ void ctmodel::init_members(void) |
| 411 | 411 | m_gti.clear(); |
| 412 | 412 | m_has_cube = false; |
| 413 | 413 | m_append_cube = false; |
| 414 | - m_binned = false; | |
| 414 | + m_binned = false; | |
| 415 | 415 | |
| 416 | 416 | // Return |
| 417 | 417 | return; |
| ... | ... | @@ -435,7 +435,7 @@ void ctmodel::copy_members(const ctmodel& app) |
| 435 | 435 | m_gti = app.m_gti; |
| 436 | 436 | m_has_cube = app.m_has_cube; |
| 437 | 437 | m_append_cube = app.m_append_cube; |
| 438 | - m_binned = app.m_binned; | |
| 438 | + m_binned = app.m_binned; | |
| 439 | 439 | |
| 440 | 440 | // Return |
| 441 | 441 | return; |
| ... | ... | @@ -466,7 +466,7 @@ void ctmodel::get_parameters(void) |
| 466 | 466 | // If there are no observations in container then load them via user |
| 467 | 467 | // parameters |
| 468 | 468 | if (m_obs.size() == 0) { |
| 469 | - m_obs = get_observations(); | |
| 469 | + get_obs(); | |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Check if we got excactly one binned CTA observation |
| ... | ... | @@ -574,6 +574,134 @@ void ctmodel::get_parameters(void) |
| 574 | 574 | |
| 575 | 575 | |
| 576 | 576 | /***********************************************************************//** |
| 577 | + * @brief Get observation container | |
| 578 | + * | |
| 579 | + * Get an observation container according to the user parameters. The method | |
| 580 | + * supports loading of a individual FITS file or an observation definition | |
| 581 | + * file in XML format. | |
| 582 | + * | |
| 583 | + * If the input filename is empty, the method checks for the existence of the | |
| 584 | + * "expcube", "psfcube" and "bkgcube" parameters. If file names have been | |
| 585 | + * specified, the method loads the files and creates a dummy events cube that | |
| 586 | + * is appended to the observation container. | |
| 587 | + * | |
| 588 | + * If no file names are specified for the "expcube", "psfcube" or "bkgcube" | |
| 589 | + * parameters, the method reads the necessary parameters to build a CTA | |
| 590 | + * observation from scratch. | |
| 591 | + ***************************************************************************/ | |
| 592 | +void ctmodel::get_obs(void) | |
| 593 | +{ | |
| 594 | + // Get the filename from the input parameters | |
| 595 | + std::string filename = (*this)["inobs"].filename(); | |
| 596 | + | |
| 597 | + // If no observation definition file has been specified then read all | |
| 598 | + // parameters that are necessary to create an observation from scratch | |
| 599 | + if ((filename == "NONE") || (gammalib::strip_whitespace(filename) == "")) { | |
| 600 | + | |
| 601 | + // Get response cube filenames | |
| 602 | + std::string expcube = (*this)["expcube"].filename(); | |
| 603 | + std::string psfcube = (*this)["psfcube"].filename(); | |
| 604 | + std::string bkgcube = (*this)["bkgcube"].filename(); | |
| 605 | + | |
| 606 | + // If the filenames are valid then build an observation from cube | |
| 607 | + // response information | |
| 608 | + if ((expcube != "NONE") && (psfcube != "NONE") && (bkgcube != "NONE") && | |
| 609 | + (gammalib::strip_whitespace(expcube) != "") && | |
| 610 | + (gammalib::strip_whitespace(psfcube) != "") && | |
| 611 | + (gammalib::strip_whitespace(bkgcube) != "")) { | |
| 612 | + | |
| 613 | + // Get exposure, PSF and background cubes | |
| 614 | + GCTACubeExposure exposure(expcube); | |
| 615 | + GCTACubePsf psf(psfcube); | |
| 616 | + GCTACubeBackground background(bkgcube); | |
| 617 | + | |
| 618 | + // Create energy boundaries | |
| 619 | + GEbounds ebounds = create_ebounds(); | |
| 620 | + | |
| 621 | + // Create dummy sky map cube | |
| 622 | + GSkyMap map("CAR","GAL",0.0,0.0,1.0,1.0,1,1,ebounds.size()); | |
| 623 | + m_append_cube = true; | |
| 624 | + | |
| 625 | + // Create event cube | |
| 626 | + GCTAEventCube cube(map, ebounds, exposure.gti()); | |
| 627 | + | |
| 628 | + // Create CTA observation | |
| 629 | + GCTAObservation cta; | |
| 630 | + cta.events(cube); | |
| 631 | + cta.response(exposure, psf, background); | |
| 632 | + | |
| 633 | + // Append observation to container | |
| 634 | + m_obs.append(cta); | |
| 635 | + | |
| 636 | + } // endif: cube response information was available | |
| 637 | + | |
| 638 | + // ... otherwise build an observation from IRF response information | |
| 639 | + else { | |
| 640 | + | |
| 641 | + // Create CTA observation | |
| 642 | + GCTAObservation cta = create_cta_obs(); | |
| 643 | + | |
| 644 | + // Set response | |
| 645 | + set_obs_response(&cta); | |
| 646 | + | |
| 647 | + // Append observation to container | |
| 648 | + m_obs.append(cta); | |
| 649 | + | |
| 650 | + } | |
| 651 | + | |
| 652 | + } // endif: filename was "NONE" or "" | |
| 653 | + | |
| 654 | + // ... otherwise we have a file name | |
| 655 | + else { | |
| 656 | + | |
| 657 | + // If file is a FITS file then create an empty CTA observation | |
| 658 | + // and load file into observation | |
| 659 | + if (gammalib::is_fits(filename)) { | |
| 660 | + | |
| 661 | + // Allocate empty CTA observation | |
| 662 | + GCTAObservation cta; | |
| 663 | + | |
| 664 | + // Load data | |
| 665 | + cta.load(filename); | |
| 666 | + | |
| 667 | + // Set response | |
| 668 | + set_obs_response(&cta); | |
| 669 | + | |
| 670 | + // Append observation to container | |
| 671 | + m_obs.append(cta); | |
| 672 | + | |
| 673 | + // Signal that no XML file should be used for storage | |
| 674 | + m_use_xml = false; | |
| 675 | + | |
| 676 | + } | |
| 677 | + | |
| 678 | + // ... otherwise load file into observation container | |
| 679 | + else { | |
| 680 | + | |
| 681 | + // Load observations from XML file | |
| 682 | + m_obs.load(filename); | |
| 683 | + | |
| 684 | + // For all observations that have no response, set the response | |
| 685 | + // from the task parameters | |
| 686 | + set_response(m_obs); | |
| 687 | + | |
| 688 | + // Set observation boundary parameters (emin, emax, rad) | |
| 689 | + set_obs_bounds(m_obs); | |
| 690 | + | |
| 691 | + // Signal that XML file should be used for storage | |
| 692 | + m_use_xml = true; | |
| 693 | + | |
| 694 | + } // endelse: file was an XML file | |
| 695 | + | |
| 696 | + } | |
| 697 | + | |
| 698 | + // Return | |
| 699 | + return; | |
| 700 | + | |
| 701 | +} | |
| 702 | + | |
| 703 | + | |
| 704 | +/***********************************************************************//** | |
| 577 | 705 | * @brief Fill model into model cube |
| 578 | 706 | * |
| 579 | 707 | * @param[in] obs CTA observation. | ... | ... |
src/ctmodel/ctmodel.hpp
| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | |
| 35 | 35 | /* __Definitions _________________________________________________________ */ |
| 36 | 36 | #define CTMODEL_NAME "ctmodel" |
| 37 | -#define CTMODEL_VERSION "1.0.0" | |
| 37 | +#define CTMODEL_VERSION "1.0.1" | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | /***********************************************************************//** |
| ... | ... | @@ -79,6 +79,7 @@ protected: |
| 79 | 79 | void copy_members(const ctmodel& app); |
| 80 | 80 | void free_members(void); |
| 81 | 81 | void get_parameters(void); |
| 82 | + void get_obs(void); | |
| 82 | 83 | void fill_cube(const GCTAObservation* obs); |
| 83 | 84 | bool has_cube(void) const; |
| 84 | 85 | ... | ... |
src/ctmodel/ctmodel.par