diff --git a/ChangeLog b/ChangeLog index e317908..a805c3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2016-02-22 Juergen Knoedlseder +2016-02-24 Juergen Knoedlseder * Version 1.1.0 released ======================== + Add publish() methods to tools producing images (#1231) Read ahead output filename in cterror (#1700) Subdivide simulation energy range in ctobssim (#1673) Delete existing events before simulation in ctobssim (#1663) diff --git a/NEWS b/NEWS index b271dd7..7302d9e 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.1.0 Author(s) : Juergen Knoedlseder -22 February 2016 +24 February 2016 1. Introduction @@ -81,7 +81,8 @@ Intervals) extensions. 7. ctbin - CTA event binning ---------------------------- -None +Add publish() method to publish the counts cube via a SAMP Hub to Virtual +Observatory interoperable tools (e.g. Aladin). 8. ctlike - Maximum likelihood fitting @@ -89,24 +90,28 @@ None None -9. cttsmap - Generation of Test Statistics map ----------------------------------------------- -None +9. cttsmap - Generation of Test Statistic map +--------------------------------------------- +Add publish() method to publish the Test Statistic map via a SAMP Hub to +Virtual Observatory interoperable tools (e.g. Aladin). 10. ctskymap - CTA sky mapping ------------------------------ -None +Add publish() method to publish the sky map via a SAMP Hub to Virtual +Observatory interoperable tools (e.g. Aladin). 11. ctmodel - CTA counts cube modelling --------------------------------------- -None +Add publish() method to publish the model cube via a SAMP Hub to Virtual +Observatory interoperable tools (e.g. Aladin). 12. ctexpcube - CTA exposure cube generation -------------------------------------------- -None +Add publish() method to publish the exposure cube via a SAMP Hub to +Virtual Observatory interoperable tools (e.g. Aladin). 13. ctpsfcube - CTA point spread function cube generation @@ -116,12 +121,14 @@ None 14. ctbkgcube - CTA background cube generation ---------------------------------------------- -None +Add publish() method to publish the background cube via a SAMP Hub to +Virtual Observatory interoperable tools (e.g. Aladin). 15. ctcubemask - CTA cube filtering ----------------------------------- -None +Add publish() method to publish the masked counts cube via a SAMP Hub +to Virtual Observatory interoperable tools (e.g. Aladin). 16. ctbutterfly - Generate butterfly diagrams diff --git a/doc/source/reference_manual/ctbin.rst b/doc/source/reference_manual/ctbin.rst index 729654c..e0bb555 100644 --- a/doc/source/reference_manual/ctbin.rst +++ b/doc/source/reference_manual/ctbin.rst @@ -78,6 +78,9 @@ General parameters Standard parameters ------------------- +``(publish = no) [boolean]`` + Specifies whether the counts cube should be published on VO Hub. + ``(chatter = 2) [integer]`` Verbosity of the executable: chatter = 0: no information will be logged @@ -91,7 +94,7 @@ Standard parameters chatter = 4: detailed report about the task execution ``(clobber = yes) [boolean]`` - Specifies whether an existing output counts cube should be overwritten. + Specifies whether an existing output counts cube file should be overwritten. ``(debug = no) [boolean]`` Enables debug mode. In debug mode the executable will dump any log file output to the console. diff --git a/doc/source/reference_manual/ctbkgcube.rst b/doc/source/reference_manual/ctbkgcube.rst index f7c75d8..fa97e02 100644 --- a/doc/source/reference_manual/ctbkgcube.rst +++ b/doc/source/reference_manual/ctbkgcube.rst @@ -111,6 +111,9 @@ General parameters Standard parameters ------------------- +``(publish = no) [boolean]`` + Specifies whether the background cube should be published on VO Hub. + ``(chatter = 2) [integer]`` Verbosity of the executable: chatter = 0: no information will be logged @@ -124,7 +127,7 @@ Standard parameters chatter = 4: detailed report about the task execution ``(clobber = yes) [boolean]`` - Specifies whether an existing output background cube should be overwritten. + Specifies whether an existing output background cube file should be overwritten. ``(debug = no) [boolean]`` Enables debug mode. In debug mode the executable will dump any log file output to the console. diff --git a/doc/source/reference_manual/ctcubemask.rst b/doc/source/reference_manual/ctcubemask.rst index e7feb23..59fddd8 100644 --- a/doc/source/reference_manual/ctcubemask.rst +++ b/doc/source/reference_manual/ctcubemask.rst @@ -69,6 +69,9 @@ General parameters Standard parameters ------------------- +``(publish = no) [boolean]`` + Specifies whether the counts cube should be published on VO Hub. + ``(chatter = 2) [integer]`` Verbosity of the executable: chatter = 0: no information will be logged @@ -82,7 +85,7 @@ Standard parameters chatter = 4: detailed report about the task execution ``(clobber = yes) [boolean]`` - Specifies whether an existing output counts cube should be overwritten. + Specifies whether an existing output counts cube file should be overwritten. ``(debug = no) [boolean]`` Enables debug mode. In debug mode the executable will dump any log file output to the console. diff --git a/doc/source/reference_manual/ctexpcube.rst b/doc/source/reference_manual/ctexpcube.rst index 2189814..0cf1512 100644 --- a/doc/source/reference_manual/ctexpcube.rst +++ b/doc/source/reference_manual/ctexpcube.rst @@ -105,6 +105,9 @@ General parameters Standard parameters ------------------- +``(publish = no) [boolean]`` + Specifies whether the exposure cube should be published on VO Hub. + ``(chatter = 2) [integer]`` Verbosity of the executable: chatter = 0: no information will be logged @@ -118,7 +121,7 @@ Standard parameters chatter = 4: detailed report about the task execution ``(clobber = yes) [boolean]`` - Specifies whether an existing output exposure cube should be overwritten. + Specifies whether an existing output exposure cube file should be overwritten. ``(debug = no) [boolean]`` Enables debug mode. In debug mode the executable will dump any log file output to the console. diff --git a/doc/source/reference_manual/ctmodel.rst b/doc/source/reference_manual/ctmodel.rst index 1d27606..7a356c1 100644 --- a/doc/source/reference_manual/ctmodel.rst +++ b/doc/source/reference_manual/ctmodel.rst @@ -138,6 +138,9 @@ General parameters Standard parameters ------------------- +``(publish = no) [boolean]`` + Specifies whether the model cube should be published on VO Hub. + ``(chatter = 2) [integer]`` Verbosity of the executable: chatter = 0: no information will be logged diff --git a/doc/source/reference_manual/ctskymap.rst b/doc/source/reference_manual/ctskymap.rst index 96a713f..e7abc02 100644 --- a/doc/source/reference_manual/ctskymap.rst +++ b/doc/source/reference_manual/ctskymap.rst @@ -60,6 +60,9 @@ General parameters Standard parameters ------------------- +``(publish = no) [boolean]`` + Specifies whether the sky map should be published on VO Hub. + ``(chatter = 2) [integer]`` Verbosity of the executable: chatter = 0: no information will be logged @@ -73,7 +76,7 @@ Standard parameters chatter = 4: detailed report about the task execution ``(clobber = yes) [boolean]`` - Specifies whether an existing output counts cube should be overwritten. + Specifies whether an existing output sky map file should be overwritten. ``(debug = no) [boolean]`` Enables debug mode. In debug mode the executable will dump any log file output to the console. diff --git a/doc/source/reference_manual/cttsmap.rst b/doc/source/reference_manual/cttsmap.rst index b52e37b..aa26737 100644 --- a/doc/source/reference_manual/cttsmap.rst +++ b/doc/source/reference_manual/cttsmap.rst @@ -94,6 +94,9 @@ General parameters Standard parameters ------------------- +``(publish = no) [boolean]`` + Specifies whether the TS map should be published on VO Hub. + ``(chatter = 2) [integer]`` Verbosity of the executable: chatter = 0: no information will be logged @@ -107,7 +110,7 @@ Standard parameters chatter = 4: detailed report about the task execution ``(clobber = yes) [boolean]`` - Specifies whether an existing output counts cube should be overwritten. + Specifies whether an existing output TS map file should be overwritten. ``(debug = no) [boolean]`` Enables debug mode. In debug mode the executable will dump any log file output to the console. diff --git a/pyext/ctbin.i b/pyext/ctbin.i index 76b70fc..8fcea66 100644 --- a/pyext/ctbin.i +++ b/pyext/ctbin.i @@ -1,7 +1,7 @@ /*************************************************************************** * ctbin - Event binning tool * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2014 by Juergen Knoedlseder * + * copyright (C) 2010-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; GCTAEventCube cube(void) const; }; diff --git a/pyext/ctbkgcube.i b/pyext/ctbkgcube.i index 1e321da..ced3574 100644 --- a/pyext/ctbkgcube.i +++ b/pyext/ctbkgcube.i @@ -1,7 +1,7 @@ /*************************************************************************** * ctbkgcube - Background cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Chia-Chun Lu * + * copyright (C) 2014-2016 by Chia-Chun Lu * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GCTACubeBackground& bkgcube(void) const; const GModels& models(void) const; }; diff --git a/pyext/ctcubemask.i b/pyext/ctcubemask.i index caeab73..6877bea 100644 --- a/pyext/ctcubemask.i +++ b/pyext/ctcubemask.i @@ -1,7 +1,7 @@ /*************************************************************************** * ctcubemask - Cube filter tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014 Chia-Chun Lu * + * copyright (C) 2014-2016 Chia-Chun Lu * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; }; diff --git a/pyext/ctexpcube.i b/pyext/ctexpcube.i index e1c7404..a672876 100644 --- a/pyext/ctexpcube.i +++ b/pyext/ctexpcube.i @@ -1,7 +1,7 @@ /*************************************************************************** * ctexpcube - Exposure cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Juergen Knoedlseder * + * copyright (C) 2014-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GCTACubeExposure& expcube(void) const; }; diff --git a/pyext/ctmodel.i b/pyext/ctmodel.i index 33d5f56..9a4e823 100644 --- a/pyext/ctmodel.i +++ b/pyext/ctmodel.i @@ -1,7 +1,7 @@ /*************************************************************************** * ctmodel - Model cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2012-2015 by Juergen Knoedlseder * + * copyright (C) 2012-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; const GCTAEventCube& cube(void) const; void cube(const GCTAEventCube& cube); diff --git a/pyext/ctskymap.i b/pyext/ctskymap.i index ad99ed6..8ad7396 100644 --- a/pyext/ctskymap.i +++ b/pyext/ctskymap.i @@ -1,7 +1,7 @@ /*************************************************************************** * ctskymap - Sky mapping tool * * ----------------------------------------------------------------------- * - * copyright (C) 2012-2015 by Juergen Knoedlseder * + * copyright (C) 2012-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GSkyMap& map(void) const; }; diff --git a/pyext/cttsmap.i b/pyext/cttsmap.i index 99104e5..0954d2c 100644 --- a/pyext/cttsmap.i +++ b/pyext/cttsmap.i @@ -1,7 +1,7 @@ /*************************************************************************** * cttsmap - TS map calculation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Michael Mayer * + * copyright (C) 2014-2016 by Michael Mayer * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -47,6 +47,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; const GSkyMap& tsmap(void) const; }; diff --git a/src/ctbin/ctbin.cpp b/src/ctbin/ctbin.cpp index ddffa12..fb79c0d 100644 --- a/src/ctbin/ctbin.cpp +++ b/src/ctbin/ctbin.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctbin - Event binning tool * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2015 by Juergen Knoedlseder * + * copyright (C) 2010-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -302,6 +302,11 @@ void ctbin::run(void) log << m_obs << std::endl; } + // Optionally publish counts cube + if (m_publish) { + publish(); + } + // Return return; } @@ -310,26 +315,18 @@ void ctbin::run(void) /***********************************************************************//** * @brief Save counts cube * - * This method saves the counts cube into a FITS file. + * Saves the counts cube into a FITS file. ***************************************************************************/ void ctbin::save(void) { // Write header if (logTerse()) { log << std::endl; - if (m_obs.size() > 1) { - log.header1("Save observations"); - } - else { - log.header1("Save observation"); - } + log.header1("Save counts cube"); } - // Get output filename - m_outcube = (*this)["outcube"].filename(); - // Save only if filename is non-empty - if (m_outcube.length() > 0) { + if (!m_outcube.is_empty()) { // Get CTA observation from observation container GCTAObservation* obs = dynamic_cast(m_obs[0]); @@ -337,9 +334,9 @@ void ctbin::save(void) // Save only if observation is valid if (obs != NULL) { - // Dump filename + // Log filename if (logTerse()) { - log << "Save \""+m_outcube+"\"" << std::endl; + log << "Save \""+m_outcube+"\"." << std::endl; } // Save cube @@ -354,6 +351,38 @@ void ctbin::save(void) } +/***********************************************************************//** + * @brief Publish counts cube + * + * @param[in] name Counts cube name. + ***************************************************************************/ +void ctbin::publish(const std::string& name) +{ + // Write header + if (logTerse()) { + log << std::endl; + log.header1("Publish counts cube"); + } + + // Set default name is user name is empty + std::string user_name(name); + if (user_name.empty()) { + user_name = CTBIN_NAME; + } + + // Log filename + if (logTerse()) { + log << "Publish \""+user_name+"\" counts cube." << std::endl; + } + + // Publish counts cube + m_cube.publish(user_name); + + // Return + return; +} + + /*========================================================================== = = = Private methods = @@ -367,7 +396,8 @@ void ctbin::init_members(void) { // Initialise members m_outcube.clear(); - m_usepnt = false; + m_usepnt = false; + m_publish = false; // Initialise protected members m_obs.clear(); @@ -392,6 +422,7 @@ void ctbin::copy_members(const ctbin& app) // Copy attributes m_outcube = app.m_outcube; m_usepnt = app.m_usepnt; + m_publish = app.m_publish; // Copy protected members m_obs = app.m_obs; @@ -452,6 +483,9 @@ void ctbin::get_parameters(void) // Get energy boundaries m_ebounds = cube.ebounds(); + // Get remaining parameters + m_publish = (*this)["publish"].boolean(); + // Optionally read ahead parameters so that they get correctly // dumped into the log file if (read_ahead()) { diff --git a/src/ctbin/ctbin.hpp b/src/ctbin/ctbin.hpp index f589eff..7c67aae 100644 --- a/src/ctbin/ctbin.hpp +++ b/src/ctbin/ctbin.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctbin - Event binning tool * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2015 by Juergen Knoedlseder * + * copyright (C) 2010-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -34,7 +34,7 @@ /* __Definitions _________________________________________________________ */ #define CTBIN_NAME "ctbin" -#define CTBIN_VERSION "1.0.0" +#define CTBIN_VERSION "1.1.0" /***********************************************************************//** @@ -78,6 +78,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; GCTAEventCube cube(void) const; @@ -91,8 +92,9 @@ protected: void obs_cube(void); // User parameters - std::string m_outcube; //!< Output counts map file + GFilename m_outcube; //!< Output counts map file name bool m_usepnt; //!< Use pointing instead of xref/yref parameters + bool m_publish; //!< Publish counts cube? // Protected members GObservations m_obs; //!< Observation container diff --git a/src/ctbin/ctbin.par b/src/ctbin/ctbin.par index 8cb60ab..8ce64dc 100644 --- a/src/ctbin/ctbin.par +++ b/src/ctbin/ctbin.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: ctbin.par # -# Version: 1.0.0 # +# Version: 1.1.0 # # # # Author: Jurgen Knodlseder # # Jurgen.Knodlseder@irap.omp.eu # @@ -44,6 +44,7 @@ proj, s, a, "CAR",AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" # # Standard parameters #==================== +publish, b, h, no,,, "Publish counts cube on VO Hub?" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated" diff --git a/src/ctbkgcube/ctbkgcube.cpp b/src/ctbkgcube/ctbkgcube.cpp index 47535b0..85b613a 100644 --- a/src/ctbkgcube/ctbkgcube.cpp +++ b/src/ctbkgcube/ctbkgcube.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctbkgcube - Background cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Chia-Chun Lu * + * copyright (C) 2014-2016 by Chia-Chun Lu * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -340,6 +340,11 @@ void ctbkgcube::run(void) // Recover original models m_obs.models(models_orig); + // Optionally publish background cube + if (m_publish) { + publish(); + } + // Return return; } @@ -348,7 +353,8 @@ void ctbkgcube::run(void) /***********************************************************************//** * @brief Save background cube * - * Save the background cube into the file specified by the outfile parameter. + * Save the background cube into a FITS file and the output model into an + * XML file. ***************************************************************************/ void ctbkgcube::save(void) { @@ -358,18 +364,30 @@ void ctbkgcube::save(void) log.header1("Save background cube"); } - // Get output filenames - std::string outfile = (*this)["outcube"].filename(); - std::string outmodel = (*this)["outmodel"].filename(); + // Save only if filename is non-empty + if (!m_outcube.is_empty()) { + + // Log filename + if (logTerse()) { + log << "Save \""+m_outcube+"\"." << std::endl; + } - // Save background cube - m_background.save(outfile, clobber()); + // Save background cube + m_background.save(m_outcube, clobber()); + + } // Write output models if filename is valid - if ((outmodel.length() > 0) && (gammalib::tolower(outmodel) != "none")) { + if ((!m_outmodel.is_empty()) && + (gammalib::tolower(m_outmodel.url()) != "none")) { + + // Log filename + if (logTerse()) { + log << "Save \""+m_outmodel.url()+"\"." << std::endl; + } - // Save output model for binned analyses - m_outmdl.save(outmodel); + // Save output model for stacked analyses + m_outmdl.save(m_outmodel.url()); } @@ -378,6 +396,38 @@ void ctbkgcube::save(void) } +/***********************************************************************//** + * @brief Publish background cube + * + * @param[in] name Background cube name. + ***************************************************************************/ +void ctbkgcube::publish(const std::string& name) +{ + // Write header + if (logTerse()) { + log << std::endl; + log.header1("Publish background cube"); + } + + // Set default name is user name is empty + std::string user_name(name); + if (user_name.empty()) { + user_name = CTBKGCUBE_NAME; + } + + // Log filename + if (logTerse()) { + log << "Publish \""+user_name+"\" background cube." << std::endl; + } + + // Publish exposure cube + m_background.cube().publish(user_name); + + // Return + return; +} + + /*========================================================================== = = = Private methods = @@ -392,6 +442,7 @@ void ctbkgcube::init_members(void) // Initialise members m_outcube.clear(); m_outmodel.clear(); + m_publish = false; m_obs.clear(); m_background.clear(); m_bkgmdl.clear(); @@ -412,6 +463,7 @@ void ctbkgcube::copy_members(const ctbkgcube& app) // Copy members m_outmodel = app.m_outmodel; m_outcube = app.m_outcube; + m_publish = app.m_publish; m_obs = app.m_obs; m_background = app.m_background; m_bkgmdl = app.m_bkgmdl; @@ -499,6 +551,9 @@ void ctbkgcube::get_parameters(void) m_obs.models(models); } + // Get remaining parameters + m_publish = (*this)["publish"].boolean(); + // Read output filenames (if needed) if (read_ahead()) { m_outcube = (*this)["outcube"].filename(); diff --git a/src/ctbkgcube/ctbkgcube.hpp b/src/ctbkgcube/ctbkgcube.hpp index 86a5093..8de0f5b 100644 --- a/src/ctbkgcube/ctbkgcube.hpp +++ b/src/ctbkgcube/ctbkgcube.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctbkgcube - Background cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Chia-Chun Lu * + * copyright (C) 2014-2016 by Chia-Chun Lu * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -34,7 +34,7 @@ /* __Definitions _________________________________________________________ */ #define CTBKGCUBE_NAME "ctbkgcube" -#define CTBKGCUBE_VERSION "1.0.0" +#define CTBKGCUBE_VERSION "1.1.0" /***********************************************************************//** @@ -59,6 +59,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GCTACubeBackground& bkgcube(void) const; const GModels& models(void) const; @@ -70,11 +71,14 @@ protected: void get_parameters(void); void fill_cube(GCTAObservation* obs); + // User parameters + GFilename m_outcube; //!< Filename of output cube + GFilename m_outmodel; //!< Filename of output XML model + bool m_publish; //!< Publish background cube? + // Protected members - std::string m_outcube; //!< Filename of output cube - std::string m_outmodel; //!< Filename of output XML model GObservations m_obs; //!< Observation container - GCTACubeBackground m_background; //!< Background cube response + GCTACubeBackground m_background; //!< Background cube GModels m_bkgmdl; //!< CTA background models GModels m_outmdl; //!< Output models }; diff --git a/src/ctbkgcube/ctbkgcube.par b/src/ctbkgcube/ctbkgcube.par index da61602..0de9d88 100644 --- a/src/ctbkgcube/ctbkgcube.par +++ b/src/ctbkgcube/ctbkgcube.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: ctbkgcube.par # -# Version: 1.0.0 # +# Version: 1.1.0 # # # # Author: Chia-Chun Lu # # c.lu@mpi-hd.mpg.de # @@ -49,6 +49,7 @@ proj, s, a, "CAR", AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" # # Standard parameters #==================== +publish, b, h, no,,, "Publish sky map on VO Hub?" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated" diff --git a/src/ctcubemask/ctcubemask.cpp b/src/ctcubemask/ctcubemask.cpp index 19216a3..0b47ec7 100644 --- a/src/ctcubemask/ctcubemask.cpp +++ b/src/ctcubemask/ctcubemask.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctcubemask - Cube filter tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Chia-Chun Lu * + * copyright (C) 2014-2016 by Chia-Chun Lu * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -282,6 +282,11 @@ void ctcubemask::run(void) log << m_obs << std::endl; } + // Optionally publish counts cube + if (m_publish) { + publish(); + } + // Return return; } @@ -312,10 +317,10 @@ void ctcubemask::save(void) if (logTerse()) { log << std::endl; if (m_obs.size() > 1) { - log.header1("Save observations"); + log.header1("Save counts cubes"); } else { - log.header1("Save observation"); + log.header1("Save counts cube"); } } @@ -335,6 +340,52 @@ void ctcubemask::save(void) /***********************************************************************//** + * @brief Publish counts cube + * + * @param[in] name Counts cube name. + * + * Publishes the first counts cube in the observation container on the VO + * Hub. + ***************************************************************************/ +void ctcubemask::publish(const std::string& name) +{ + // Write header + if (logTerse()) { + log << std::endl; + log.header1("Publish counts cube"); + } + + // Set default name is user name is empty + std::string user_name(name); + if (user_name.empty()) { + user_name = CTCUBEMASK_NAME; + } + + // Get first CTA observation from observation container + GCTAObservation* obs = dynamic_cast(m_obs[0]); + if (obs != NULL) { + + // Get counts cube + GCTAEventCube* cube = dynamic_cast(obs->events()); + if (cube != NULL) { + + // Log filename + if (logTerse()) { + log << "Publish \""+user_name+"\" counts cube." << std::endl; + } + + // Publish counts cube + cube->map().publish(user_name); + + } + } + + // Return + return; +} + + +/***********************************************************************//** * @brief Get application parameters * * @exception GException::invalid_value @@ -402,10 +453,14 @@ void ctcubemask::get_parameters(void) m_select_energy = false; } + // Get remaining parameters + m_publish = (*this)["publish"].boolean(); + // Optionally read ahead parameters so that they get correctly // dumped into the log file if (read_ahead()) { m_outcube = (*this)["outcube"].filename(); + m_prefix = (*this)["prefix"].string(); } // Return @@ -586,12 +641,13 @@ void ctcubemask::init_members(void) m_regfile.clear(); m_outcube.clear(); m_prefix.clear(); - m_usepnt = false; - m_ra = 0.0; - m_dec = 0.0; - m_rad = 0.0; - m_emin = 0.0; - m_emax = 0.0; + m_usepnt = false; + m_ra = 0.0; + m_dec = 0.0; + m_rad = 0.0; + m_emin = 0.0; + m_emax = 0.0; + m_publish = false; // Initialise protected members m_obs.clear(); @@ -621,6 +677,7 @@ void ctcubemask::copy_members(const ctcubemask& app) m_rad = app.m_rad; m_emin = app.m_emin; m_emax = app.m_emax; + m_publish = app.m_publish; // Copy protected members m_obs = app.m_obs; @@ -705,14 +762,21 @@ std::string ctcubemask::set_outfile_name(const std::string& filename) const ***************************************************************************/ void ctcubemask::save_fits(void) { - // Get output filename - m_outcube = (*this)["outcube"].filename(); + // Save only if filename is non-empty + if (!m_outcube.is_empty()) { - // Get CTA observation from observation container - GCTAObservation* obs = dynamic_cast(m_obs[0]); + // Get CTA observation from observation container + GCTAObservation* obs = dynamic_cast(m_obs[0]); - // Save event list - save_counts_map(obs, m_outcube); + // Log filename + if (logTerse()) { + log << "Save \""+m_outcube+"\"." << std::endl; + } + + // Save event list + save_counts_map(obs, m_outcube); + + } // Return return; @@ -732,12 +796,8 @@ void ctcubemask::save_fits(void) ***************************************************************************/ void ctcubemask::save_xml(void) { - // Get output filename and prefix - m_outcube = (*this)["m_outcube"].filename(); - m_prefix = (*this)["prefix"].string(); - // Issue warning if output filename has no .xml suffix - std::string suffix = gammalib::tolower(m_outcube.substr(m_outcube.length()-4,4)); + std::string suffix = gammalib::tolower(m_outcube.url().substr(m_outcube.length()-4,4)); if (suffix != ".xml") { log << "*** WARNING: Name of observation definition output file \""+ m_outcube+"\"" << std::endl; @@ -763,6 +823,11 @@ void ctcubemask::save_xml(void) // Store output file name in observation obs->eventfile(outfile); + // Log filename + if (logTerse()) { + log << "Save \""+outfile+"\"." << std::endl; + } + // Save event list save_counts_map(obs, outfile); diff --git a/src/ctcubemask/ctcubemask.hpp b/src/ctcubemask/ctcubemask.hpp index d967532..4011766 100644 --- a/src/ctcubemask/ctcubemask.hpp +++ b/src/ctcubemask/ctcubemask.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctcubemask - Cube filter tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Chia-Chun Lu * + * copyright (C) 2014-2016 by Chia-Chun Lu * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -36,7 +36,7 @@ /* __Definitions _________________________________________________________ */ #define CTCUBEMASK_NAME "ctcubemask" -#define CTCUBEMASK_VERSION "1.0.0" +#define CTCUBEMASK_VERSION "1.1.0" /***********************************************************************//** @@ -61,6 +61,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; protected: @@ -78,9 +79,8 @@ protected: const std::string& outfile) const; // User parameters - //std::string m_infile; //!< Input event list or XML file - std::string m_regfile; //!< ds9 region file - std::string m_outcube; //!< Output event list or XML file + GFilename m_regfile; //!< ds9 region file + GFilename m_outcube; //!< Output event list or XML file std::string m_prefix; //!< Prefix for multiple counts maps bool m_usepnt; //!< Use pointing instead of RA/DEC parameters double m_ra; //!< RA of ROI centre @@ -88,6 +88,7 @@ protected: double m_rad; //!< ROI radius double m_emin; //!< Lower energy double m_emax; //!< Upper energy + bool m_publish; //!< Publish counts cube? // Protected members GObservations m_obs; //!< Observations container diff --git a/src/ctcubemask/ctcubemask.par b/src/ctcubemask/ctcubemask.par index 56669df..bfc48c9 100644 --- a/src/ctcubemask/ctcubemask.par +++ b/src/ctcubemask/ctcubemask.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: ctcubemask.par # -# Version: 1.0.0 # +# Version: 1.1.0 # # # # Author: Chia-Chun Lu # # c.lu@mpi-hd.mpg.de # @@ -17,7 +17,7 @@ # # General parameters #=================== -inobs, f, a, "cntmap.fits",,, "Input counts cube or observation definition XML file" +inobs, f, a, "cntcube.fits",,, "Input counts cube or observation definition XML file" outcube, f, a, "filtered_cube.fits",,, "Output counts cube or observation definition XML file" prefix, s, h, "filtered_",,, "Prefix for counts cube in observation definition XML file" @@ -35,7 +35,9 @@ emax, r, a, 100.0,,, "Upper energy limit (TeV)" # # Standard parameters #==================== +publish, b, h, no,,, "Publish counts cube on VO Hub?" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated" mode, s, h, "ql",,, "Mode of automatic parameters" +logfile, f, h, "ctcubemask.par.log",,, "Log filename" diff --git a/src/ctexpcube/ctexpcube.cpp b/src/ctexpcube/ctexpcube.cpp index 21bab79..6c2c8e8 100644 --- a/src/ctexpcube/ctexpcube.cpp +++ b/src/ctexpcube/ctexpcube.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctexpcube - Exposure cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Juergen Knoedlseder * + * copyright (C) 2014-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -258,6 +258,11 @@ void ctexpcube::run(void) } } + // Optionally publish exposure cube + if (m_publish) { + publish(); + } + // Return return; } @@ -265,6 +270,8 @@ void ctexpcube::run(void) /***********************************************************************//** * @brief Save exposure cube + * + * Saves the exposure cube into a FITS file. ***************************************************************************/ void ctexpcube::save(void) { @@ -274,11 +281,50 @@ void ctexpcube::save(void) log.header1("Save exposure cube"); } - // Get output filename - m_outcube = (*this)["outcube"].filename(); + // Save only if filename is non-empty + if (!m_outcube.is_empty()) { + + // Log filename + if (logTerse()) { + log << "Save \""+m_outcube+"\"." << std::endl; + } + + // Save exposure cube + m_expcube.save(m_outcube, clobber()); + + } + + // Return + return; +} + + +/***********************************************************************//** + * @brief Publish exposure cube + * + * @param[in] name Exposure cube name. + ***************************************************************************/ +void ctexpcube::publish(const std::string& name) +{ + // Write header + if (logTerse()) { + log << std::endl; + log.header1("Publish exposure cube"); + } + + // Set default name is user name is empty + std::string user_name(name); + if (user_name.empty()) { + user_name = CTEXPCUBE_NAME; + } - // Save exposure cube - m_expcube.save(m_outcube, clobber()); + // Log filename + if (logTerse()) { + log << "Publish \""+user_name+"\" exposure cube." << std::endl; + } + + // Publish exposure cube + m_expcube.cube().publish(user_name); // Return return; @@ -299,6 +345,7 @@ void ctexpcube::init_members(void) // Initialise members m_outcube.clear(); m_apply_edisp = false; + m_publish = false; // Initialise protected members m_obs.clear(); @@ -319,6 +366,7 @@ void ctexpcube::copy_members(const ctexpcube& app) // Copy attributes m_outcube = app.m_outcube; m_apply_edisp = app.m_apply_edisp; + m_publish = app.m_publish; // Copy protected members m_obs = app.m_obs; @@ -390,6 +438,9 @@ void ctexpcube::get_parameters(void) } // endelse: cube loaded from file + // Get remaining parameters + m_publish = (*this)["publish"].boolean(); + // Read output filename (if needed) if (read_ahead()) { m_outcube = (*this)["outcube"].filename(); diff --git a/src/ctexpcube/ctexpcube.hpp b/src/ctexpcube/ctexpcube.hpp index 8a6cfda..e0d78f0 100644 --- a/src/ctexpcube/ctexpcube.hpp +++ b/src/ctexpcube/ctexpcube.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctexpcube - Exposure cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Juergen Knoedlseder * + * copyright (C) 2014-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -34,7 +34,7 @@ /* __Definitions _________________________________________________________ */ #define CTEXPCUBE_NAME "ctexpcube" -#define CTEXPCUBE_VERSION "1.0.0" +#define CTEXPCUBE_VERSION "1.1.0" /***********************************************************************//** @@ -59,6 +59,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GCTACubeExposure& expcube(void) const; protected: @@ -69,8 +70,9 @@ protected: void get_parameters(void); // User parameters - std::string m_outcube; //!< Output exposure cube file - bool m_apply_edisp; //!< Apply energy dispersion? + GFilename m_outcube; //!< Output exposure cube file + bool m_apply_edisp; //!< Apply energy dispersion? + bool m_publish; //!< Publish exposure cube? // Protected members GObservations m_obs; //!< Observation container diff --git a/src/ctexpcube/ctexpcube.par b/src/ctexpcube/ctexpcube.par index f0ea8bf..987a956 100644 --- a/src/ctexpcube/ctexpcube.par +++ b/src/ctexpcube/ctexpcube.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: ctexpcube.par # -# Version: 1.0.0 # +# Version: 1.1.0 # # # # Author: Juergen Knoedlseder # # Jurgen.Knodlseder@irap.omp.eu # @@ -48,6 +48,7 @@ proj, s, a, "CAR", AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" # # Standard parameters #==================== +publish, b, h, no,,, "Publish sky map on VO Hub?" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated" diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index e7280ea..266f937 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -324,6 +324,11 @@ void ctmodel::run(void) } } + // Optionally publish model cube + if (m_publish) { + publish(); + } + // Return return; } @@ -343,15 +348,12 @@ void ctmodel::save(void) log.header1("Save cube"); } - // Make sure we have the FITS filename - m_outcube = (*this)["outcube"].filename(); - // Save only if filename is non-empty - if (m_outcube.length() > 0) { + if (!m_outcube.is_empty()) { // Dump filename if (logTerse()) { - log << "Save \""+m_outcube+"\"" << std::endl; + log << "Save \""+m_outcube+"\"." << std::endl; } // Save model cube into FITS file @@ -365,6 +367,38 @@ void ctmodel::save(void) /***********************************************************************//** + * @brief Publish model cube + * + * @param[in] name Model cube name. + ***************************************************************************/ +void ctmodel::publish(const std::string& name) +{ + // Write header + if (logTerse()) { + log << std::endl; + log.header1("Publish model cube"); + } + + // Set default name is user name is empty + std::string user_name(name); + if (user_name.empty()) { + user_name = CTMODEL_NAME; + } + + // Log filename + if (logTerse()) { + log << "Publish \""+user_name+"\" model cube." << std::endl; + } + + // Publish model cube + m_cube.map().publish(user_name); + + // Return + return; +} + + +/***********************************************************************//** * @brief Set model cube * * @param[in] cube Model cube. @@ -403,6 +437,7 @@ void ctmodel::init_members(void) // Initialise members m_outcube.clear(); m_apply_edisp = false; + m_publish = false; // Initialise protected members m_obs.clear(); @@ -427,6 +462,7 @@ void ctmodel::copy_members(const ctmodel& app) // Copy attributes m_outcube = app.m_outcube; m_apply_edisp = app.m_apply_edisp; + m_publish = app.m_publish; // Copy protected members m_obs = app.m_obs; @@ -550,6 +586,9 @@ void ctmodel::get_parameters(void) } // endif: we had no cube yet + // Get remaining parameters + m_publish = (*this)["publish"].boolean(); + // Read optionally output cube filenames if (read_ahead()) { m_outcube = (*this)["outcube"].filename(); diff --git a/src/ctmodel/ctmodel.hpp b/src/ctmodel/ctmodel.hpp index 17bdd5d..5fd44c5 100644 --- a/src/ctmodel/ctmodel.hpp +++ b/src/ctmodel/ctmodel.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctmodel - Model cube generation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2012-2015 by Juergen Knoedlseder * + * copyright (C) 2012-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -34,7 +34,7 @@ /* __Definitions _________________________________________________________ */ #define CTMODEL_NAME "ctmodel" -#define CTMODEL_VERSION "1.0.1" +#define CTMODEL_VERSION "1.1.0" /***********************************************************************//** @@ -68,6 +68,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; const GCTAEventCube& cube(void) const; void cube(const GCTAEventCube& cube); @@ -84,8 +85,9 @@ protected: bool has_cube(void) const; // User parameters - std::string m_outcube; //!< Output model cube - bool m_apply_edisp; //!< Apply energy dispersion? + GFilename m_outcube; //!< Output model cube + bool m_apply_edisp; //!< Apply energy dispersion? + bool m_publish; //!< Publish model cube? // Protected members GObservations m_obs; //!< Observation container diff --git a/src/ctmodel/ctmodel.par b/src/ctmodel/ctmodel.par index 39ae83b..acfdb69 100644 --- a/src/ctmodel/ctmodel.par +++ b/src/ctmodel/ctmodel.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: ctmodel.par # -# Version: 1.0.1 # +# Version: 1.1.0 # # # # Author: Juergen Knoedlseder # # Jurgen.Knodlseder@irap.omp.eu # @@ -62,6 +62,7 @@ proj, s, a, "CAR", AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" # # Standard parameters #==================== +publish, b, h, no,,, "Publish model cube on VO Hub?" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated" diff --git a/src/ctskymap/ctskymap.cpp b/src/ctskymap/ctskymap.cpp index 2fce299..23db30d 100644 --- a/src/ctskymap/ctskymap.cpp +++ b/src/ctskymap/ctskymap.cpp @@ -290,15 +290,21 @@ void ctskymap::run(void) } // endfor: looped over observations + // Optionally publish sky map + if (m_publish) { + publish(); + } + // Return return; } /***********************************************************************//** - * @brief Save observation + * @brief Save sky map * - * This method saves the counts map(s) into (a) FITS file(s). + * Saves the sky map into a FITS file. The FITS file name is specified by the + * @p outname parameter. ***************************************************************************/ void ctskymap::save(void) { @@ -308,15 +314,12 @@ void ctskymap::save(void) log.header1("Save sky map"); } - // Get output filename - m_outmap = (*this)["outmap"].filename(); - // Save only if filename is non-empty - if (m_outmap.length() > 0) { + if (!m_outmap.is_empty()) { - // Dump filename + // Log filename if (logTerse()) { - log << "Save \""+m_outmap+"\"" << std::endl; + log << "Save \""+m_outmap+"\"." << std::endl; } // Save sky map @@ -330,6 +333,38 @@ void ctskymap::save(void) /***********************************************************************//** + * @brief Publish sky map + * + * @param[in] name Sky map name. + ***************************************************************************/ +void ctskymap::publish(const std::string& name) +{ + // Write header + if (logTerse()) { + log << std::endl; + log.header1("Publish sky map"); + } + + // Set default name is user name is empty + std::string user_name(name); + if (user_name.empty()) { + user_name = CTSKYMAP_NAME; + } + + // Log filename + if (logTerse()) { + log << "Publish \""+user_name+"\" sky map." << std::endl; + } + + // Publish sky map + m_skymap.publish(user_name); + + // Return + return; +} + + +/***********************************************************************//** * @brief Get application parameters * * Get all task parameters from parameter file or (if required) by querying @@ -359,12 +394,13 @@ void ctskymap::get_parameters(void) m_skymap = create_map(m_obs); // Get remaining parameters - m_emin = (*this)["emin"].real(); - m_emax = (*this)["emax"].real(); + m_emin = (*this)["emin"].real(); + m_emax = (*this)["emax"].real(); + m_publish = (*this)["publish"].boolean(); // Read ahead parameters if (read_ahead()) { - m_outmap = (*this)["outmap"].filename(); + m_outmap = (*this)["outmap"].filename(); } // Return @@ -478,8 +514,9 @@ void ctskymap::init_members(void) // Initialise members m_obs.clear(); m_skymap.clear(); - m_emin = 0.0; - m_emax = 0.0; + m_emin = 0.0; + m_emax = 0.0; + m_publish = false; // Return return; @@ -494,10 +531,11 @@ void ctskymap::init_members(void) void ctskymap::copy_members(const ctskymap& app) { // Copy attributes - m_obs = app.m_obs; - m_skymap = app.m_skymap; - m_emin = app.m_emin; - m_emax = app.m_emax; + m_obs = app.m_obs; + m_skymap = app.m_skymap; + m_emin = app.m_emin; + m_emax = app.m_emax; + m_publish = app.m_publish; // Return return; diff --git a/src/ctskymap/ctskymap.hpp b/src/ctskymap/ctskymap.hpp index 0b7ccd3..5f6498b 100644 --- a/src/ctskymap/ctskymap.hpp +++ b/src/ctskymap/ctskymap.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * ctskymap - Sky mapping tool * * ----------------------------------------------------------------------- * - * copyright (C) 2010-2015 by Juergen Knoedlseder * + * copyright (C) 2010-2016 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -34,7 +34,7 @@ /* __Definitions _________________________________________________________ */ #define CTSKYMAP_NAME "ctskymap" -#define CTSKYMAP_VERSION "1.0.0" +#define CTSKYMAP_VERSION "1.1.0" /***********************************************************************//** @@ -61,6 +61,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GSkyMap& map(void) const; protected: @@ -72,10 +73,10 @@ protected: void map_events(GCTAObservation* obs); // User parameters - std::string m_outmap; //!< Output counts map + GFilename m_outmap; //!< Output file name double m_emin; //!< Minimum energy (TeV) double m_emax; //!< Maximum energy (TeV) - + bool m_publish; //!< Publish sky map? // Protected members GObservations m_obs; //!< Observation container diff --git a/src/ctskymap/ctskymap.par b/src/ctskymap/ctskymap.par index 0ba7fad..1604c3d 100644 --- a/src/ctskymap/ctskymap.par +++ b/src/ctskymap/ctskymap.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: ctskymap.par # -# Version: 1.0.0 # +# Version: 1.1.0 # # # # Author: Jurgen Knodlseder # # knodlseder@cesr.fr # @@ -41,6 +41,7 @@ proj, s, a, "CAR", AIT|AZP|CAR|MER|MOL|STG|TAN,, "Projection method" # # Standard parameters #==================== +publish, b, h, no,,, "Publish sky map on VO Hub?" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated" diff --git a/src/cttsmap/cttsmap.cpp b/src/cttsmap/cttsmap.cpp index 460ec20..bd13524 100644 --- a/src/cttsmap/cttsmap.cpp +++ b/src/cttsmap/cttsmap.cpp @@ -1,7 +1,7 @@ /*************************************************************************** * cttsmap - TS map calculation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Michael Mayer * + * copyright (C) 2014-2016 by Michael Mayer * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -368,6 +368,11 @@ void cttsmap::run(void) } } + // Optionally publish TS map + if (m_publish) { + publish(); + } + // Return return; } @@ -386,31 +391,60 @@ void cttsmap::save(void) log.header1("Save TS map"); } - // Get output filename - m_outmap = (*this)["outmap"].filename(); - - // Create fits file instance - GFits fitsfile = GFits(); + // Create fits file + GFits fits; // Write the sky maps to the FITS file - m_tsmap.write(fitsfile); + m_tsmap.write(fits); for (int i = 0; i < m_mapnames.size(); i++) { - m_maps[i].write(fitsfile); + m_maps[i].write(fits); } // Set extension name for all maps for (int i = 0; i < m_mapnames.size(); i++) { - fitsfile[i+1]->extname(m_mapnames[i]); + fits[i+1]->extname(m_mapnames[i]); } // Add computation log if not all bins are computed if (m_binmin != -1 || m_binmax != -1) { - m_statusmap.write(fitsfile); - fitsfile[m_mapnames.size()+1]->extname("STATUS MAP"); + m_statusmap.write(fits); + fits[m_mapnames.size()+1]->extname("STATUS MAP"); } // Save FITS file - fitsfile.saveto(m_outmap,true); + fits.saveto(m_outmap, clobber()); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Publish TS map + * + * @param[in] name TS map name. + ***************************************************************************/ +void cttsmap::publish(const std::string& name) +{ + // Write header + if (logTerse()) { + log << std::endl; + log.header1("Publish TS map"); + } + + // Set default name is user name is empty + std::string user_name(name); + if (user_name.empty()) { + user_name = CTTSMAP_NAME; + } + + // Log filename + if (logTerse()) { + log << "Publish \""+user_name+"\" TS map." << std::endl; + } + + // Publish TS map + m_tsmap.publish(user_name); // Return return; @@ -432,6 +466,7 @@ void cttsmap::init_members(void) m_srcname.clear(); m_outmap.clear(); m_apply_edisp = false; + m_publish = false; // Initialise protected members m_obs.clear(); @@ -457,9 +492,10 @@ void cttsmap::init_members(void) void cttsmap::copy_members(const cttsmap& app) { // Copy attributes - m_srcname = app.m_srcname; - m_outmap = app.m_outmap; + m_srcname = app.m_srcname; + m_outmap = app.m_outmap; m_apply_edisp = app.m_apply_edisp; + m_publish = app.m_publish; // Copy protected members m_binmin = app.m_binmin; @@ -568,9 +604,10 @@ void cttsmap::get_parameters(void) m_apply_edisp = (*this)["edisp"].boolean(); // Get optional splitting parameters - m_binmin = (*this)["binmin"].integer(); - m_binmax = (*this)["binmax"].integer(); - m_logL0 = (*this)["logL0"].real(); + m_binmin = (*this)["binmin"].integer(); + m_binmax = (*this)["binmax"].integer(); + m_logL0 = (*this)["logL0"].real(); + m_publish = (*this)["publish"].boolean(); // Optionally read ahead parameters so that they get correctly // dumped into the log file diff --git a/src/cttsmap/cttsmap.hpp b/src/cttsmap/cttsmap.hpp index f2ce58a..49ff6cf 100644 --- a/src/cttsmap/cttsmap.hpp +++ b/src/cttsmap/cttsmap.hpp @@ -1,7 +1,7 @@ /*************************************************************************** * cttsmap - TS map calculation tool * * ----------------------------------------------------------------------- * - * copyright (C) 2014-2015 by Michael Mayer * + * copyright (C) 2014-2016 by Michael Mayer * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -34,7 +34,7 @@ /* __Definitions _________________________________________________________ */ #define CTTSMAP_NAME "cttsmap" -#define CTTSMAP_VERSION "1.0.0" +#define CTTSMAP_VERSION "1.1.0" /***********************************************************************//** @@ -72,6 +72,7 @@ public: void clear(void); void run(void); void save(void); + void publish(const std::string& name = ""); const GObservations& obs(void) const; const GSkyMap& tsmap(void) const; @@ -85,8 +86,9 @@ protected: // User parameters std::string m_srcname; //!< Name of source which is moved around - std::string m_outmap; //!< Output counts map or XML file + GFilename m_outmap; //!< Output TS map file name bool m_apply_edisp; //!< Apply energy dispersion? + bool m_publish; //!< Publish TS map? // Parameters to control speed and job splitting int m_binmin; //!< Map bin number from which computation should start diff --git a/src/cttsmap/cttsmap.par b/src/cttsmap/cttsmap.par index ba60b32..89b784c 100644 --- a/src/cttsmap/cttsmap.par +++ b/src/cttsmap/cttsmap.par @@ -5,7 +5,7 @@ # ------------------------------------------------------------------------- # # # # File: cttsmap.par # -# Version: 1.0.0 # +# Version: 1.1.0 # # # # Author: Michael Mayer # # michael.mayer@desy.de # @@ -50,6 +50,7 @@ logL0, r, h, 0.0,,, "LogLikelihood value of null hypothesis" # # Standard parameters #==================== +publish, b, h, no,,, "Publish Test Statistic map on VO Hub?" chatter, i, h, 2,0,4, "Chattiness of output" clobber, b, h, yes,,, "Overwrite existing output files with new output files?" debug, b, h, no,,, "Debugging mode activated"