diff --git a/ChangeLog b/ChangeLog index 73d6216..9e39f28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2016-01-04 Juergen Knoedlseder + + * Version 1.1.0 released + ======================== + + +2015-12-20 Juergen Knoedlseder + + * Bug fix version 1.0.1 released + ================================ + + Re-enable ctmodel computation for stacked analysis (#1609) + + 2015-12-18 Juergen Knoedlseder * Version 1.0.0 released diff --git a/NEWS b/NEWS index 726f545..f39f1e4 100644 --- a/NEWS +++ b/NEWS @@ -1,24 +1,19 @@ -New Features and Important Changes in ctools 1.0.0 +New Features and Important Changes in ctools 1.1.0 Author(s) : Juergen Knoedlseder -18 December 2015 +4 January 2016 1. Introduction --------------- This document briefly summarizes executable by executable the most important -changes made since the last release of ctools. The code complies to ctools -version 1.0.0 or above. +changes made since the last release of ctools. 2. Configuration ----------------- -A special post processing of the Python module libraries has been added for -Mac OS X 10.11 and higher (El Capitan). This post processing is a replacement for -setting DYLD_LIBRARY_PATH during unit testing since the environment variable is -ignored in certain circumstances by El Capitan. Any errors that occur in the -post-processing will be ignored. +None 3. Python interface @@ -28,10 +23,7 @@ None 4. Support model ---------------- -Adapt the ctool::create_ebounds() method to the change in the GEbounds -interface (the extname argument has been removed from the GEbounds::load() -method and replaced by using the GFilename class to handle extension names -as part of the file name). +None 5. ctobssim - CTA observation simulation @@ -106,18 +98,7 @@ None 19. cscripts ------------ -The following scripts have been added: -- csobsinfo: dump information in observation container -- csmodelinfo: dump information in model container -- csmodelmerge: merge model containers into single container -- cstsmapmerge: merge sliced TS map into single map -- csobs2caldb: creates calibration database from observation -- csiactdata: inspects IACT data - -The cshessobs script has been renamed to csiactobs. - -All GExceptions are replaced by Python RuntimeErrors as the GException -classes are not exposed to Python. +None 20. Examples diff --git a/README b/README index ff2e503..5d259ff 100644 --- a/README +++ b/README @@ -1,8 +1,8 @@ ctools information ================== -Version: 1.0.0 (18 December 2015) +Version: 1.1.0dev (4 January 2016) Author: Juergen Knodlseder (jurgen.knodlseder@irap.omp.eu) -GammaLib dependency: 1.0.0 +GammaLib dependency: 1.1.0dev License information diff --git a/configure.ac b/configure.ac index 6dc7d39..6e89db5 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Configuration for ctools - a set of tools for science analysis of CTA # # data # # ------------------------------------------------------------------------- # -# Copyright (C) 2011-2015 Juergen Knoedlseder # +# Copyright (C) 2011-2016 Juergen Knoedlseder # # ------------------------------------------------------------------------- # # # # This program is free software: you can redistribute it and/or modify # diff --git a/ctools.pc.in b/ctools.pc.in index 809b34b..340a402 100644 --- a/ctools.pc.in +++ b/ctools.pc.in @@ -8,7 +8,7 @@ Description: CTA science analysis tools URL: http://cta.irap.omp.eu/ctools Version: 1.1.0 Requires: -Requires.private: gammalib >= 1.0.0 +Requires.private: gammalib >= 1.1.0 Conflicts: Cflags: -I${includedir}/ctools @OPENMP_CXXFLAGS@ Libs: -L${libdir} -lctools diff --git a/doc/source/conf.py b/doc/source/conf.py index 687a51a..8a3bc3d 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -59,7 +59,7 @@ master_doc = 'contents' # General information about the project. project = u'ctools' -copyright = u'2014-2015, ctools developers' +copyright = u'2014-2016, ctools developers' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index 9aa8bda..8351883 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -411,7 +411,7 @@ void ctmodel::init_members(void) m_gti.clear(); m_has_cube = false; m_append_cube = false; - m_binned = false; + m_binned = false; // Return return; @@ -435,7 +435,7 @@ void ctmodel::copy_members(const ctmodel& app) m_gti = app.m_gti; m_has_cube = app.m_has_cube; m_append_cube = app.m_append_cube; - m_binned = app.m_binned; + m_binned = app.m_binned; // Return return; @@ -466,7 +466,7 @@ void ctmodel::get_parameters(void) // If there are no observations in container then load them via user // parameters if (m_obs.size() == 0) { - m_obs = get_observations(); + get_obs(); } // Check if we got excactly one binned CTA observation @@ -574,6 +574,134 @@ void ctmodel::get_parameters(void) /***********************************************************************//** + * @brief Get observation container + * + * Get an observation container according to the user parameters. The method + * supports loading of a individual FITS file or an observation definition + * file in XML format. + * + * If the input filename is empty, the method checks for the existence of the + * "expcube", "psfcube" and "bkgcube" parameters. If file names have been + * specified, the method loads the files and creates a dummy events cube that + * is appended to the observation container. + * + * If no file names are specified for the "expcube", "psfcube" or "bkgcube" + * parameters, the method reads the necessary parameters to build a CTA + * observation from scratch. + ***************************************************************************/ +void ctmodel::get_obs(void) +{ + // Get the filename from the input parameters + std::string filename = (*this)["inobs"].filename(); + + // If no observation definition file has been specified then read all + // parameters that are necessary to create an observation from scratch + if ((filename == "NONE") || (gammalib::strip_whitespace(filename) == "")) { + + // Get response cube filenames + std::string expcube = (*this)["expcube"].filename(); + std::string psfcube = (*this)["psfcube"].filename(); + std::string bkgcube = (*this)["bkgcube"].filename(); + + // If the filenames are valid then build an observation from cube + // response information + if ((expcube != "NONE") && (psfcube != "NONE") && (bkgcube != "NONE") && + (gammalib::strip_whitespace(expcube) != "") && + (gammalib::strip_whitespace(psfcube) != "") && + (gammalib::strip_whitespace(bkgcube) != "")) { + + // Get exposure, PSF and background cubes + GCTACubeExposure exposure(expcube); + GCTACubePsf psf(psfcube); + GCTACubeBackground background(bkgcube); + + // Create energy boundaries + GEbounds ebounds = create_ebounds(); + + // Create dummy sky map cube + GSkyMap map("CAR","GAL",0.0,0.0,1.0,1.0,1,1,ebounds.size()); + m_append_cube = true; + + // Create event cube + GCTAEventCube cube(map, ebounds, exposure.gti()); + + // Create CTA observation + GCTAObservation cta; + cta.events(cube); + cta.response(exposure, psf, background); + + // Append observation to container + m_obs.append(cta); + + } // endif: cube response information was available + + // ... otherwise build an observation from IRF response information + else { + + // Create CTA observation + GCTAObservation cta = create_cta_obs(); + + // Set response + set_obs_response(&cta); + + // Append observation to container + m_obs.append(cta); + + } + + } // endif: filename was "NONE" or "" + + // ... otherwise we have a file name + else { + + // If file is a FITS file then create an empty CTA observation + // and load file into observation + if (gammalib::is_fits(filename)) { + + // Allocate empty CTA observation + GCTAObservation cta; + + // Load data + cta.load(filename); + + // Set response + set_obs_response(&cta); + + // Append observation to container + m_obs.append(cta); + + // Signal that no XML file should be used for storage + m_use_xml = false; + + } + + // ... otherwise load file into observation container + else { + + // Load observations from XML file + m_obs.load(filename); + + // For all observations that have no response, set the response + // from the task parameters + set_response(m_obs); + + // Set observation boundary parameters (emin, emax, rad) + set_obs_bounds(m_obs); + + // Signal that XML file should be used for storage + m_use_xml = true; + + } // endelse: file was an XML file + + } + + // Return + return; + +} + + +/***********************************************************************//** * @brief Fill model into model cube * * @param[in] obs CTA observation. diff --git a/src/ctmodel/ctmodel.hpp b/src/ctmodel/ctmodel.hpp index 39a30a8..17bdd5d 100644 --- a/src/ctmodel/ctmodel.hpp +++ b/src/ctmodel/ctmodel.hpp @@ -34,7 +34,7 @@ /* __Definitions _________________________________________________________ */ #define CTMODEL_NAME "ctmodel" -#define CTMODEL_VERSION "1.0.0" +#define CTMODEL_VERSION "1.0.1" /***********************************************************************//** @@ -79,6 +79,7 @@ protected: void copy_members(const ctmodel& app); void free_members(void); void get_parameters(void); + void get_obs(void); void fill_cube(const GCTAObservation* obs); bool has_cube(void) const; diff --git a/src/ctmodel/ctmodel.par b/src/ctmodel/ctmodel.par index 8534e95..39ae83b 100644 --- a/src/ctmodel/ctmodel.par +++ b/src/ctmodel/ctmodel.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: ctmodel.par # -# Version: 1.0.0 # +# Version: 1.0.1 # # # # Author: Juergen Knoedlseder # # Jurgen.Knodlseder@irap.omp.eu #