Commit 63c90a885082ee58c02a4574e664ea722f5a5e17

Authored by Jürgen Knödlseder
1 parent fe52f67e

Add publish parameter to ctools so that they can publish sky maps on a VO Hub.

The publish parameter has been added to the following tools:
- ctbin
- ctbkgcube
- ctcubemask
- ctexpcube
- ctmodel
- ctskymap
- cttsmap
ChangeLog
1   -2016-02-22 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
  1 +2016-02-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2  
3 3 * Version 1.1.0 released
4 4 ========================
5 5  
  6 + Add publish() methods to tools producing images (#1231)
6 7 Read ahead output filename in cterror (#1700)
7 8 Subdivide simulation energy range in ctobssim (#1673)
8 9 Delete existing events before simulation in ctobssim (#1663)
... ...
... ... @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.1.0
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -22 February 2016
  5 +24 February 2016
6 6  
7 7  
8 8 1. Introduction
... ... @@ -81,7 +81,8 @@ Intervals) extensions.
81 81  
82 82 7. ctbin - CTA event binning
83 83 ----------------------------
84   -None
  84 +Add publish() method to publish the counts cube via a SAMP Hub to Virtual
  85 +Observatory interoperable tools (e.g. Aladin).
85 86  
86 87  
87 88 8. ctlike - Maximum likelihood fitting
... ... @@ -89,24 +90,28 @@ None
89 90 None
90 91  
91 92  
92   -9. cttsmap - Generation of Test Statistics map
93   -----------------------------------------------
94   -None
  93 +9. cttsmap - Generation of Test Statistic map
  94 +---------------------------------------------
  95 +Add publish() method to publish the Test Statistic map via a SAMP Hub to
  96 +Virtual Observatory interoperable tools (e.g. Aladin).
95 97  
96 98  
97 99 10. ctskymap - CTA sky mapping
98 100 ------------------------------
99   -None
  101 +Add publish() method to publish the sky map via a SAMP Hub to Virtual
  102 +Observatory interoperable tools (e.g. Aladin).
100 103  
101 104  
102 105 11. ctmodel - CTA counts cube modelling
103 106 ---------------------------------------
104   -None
  107 +Add publish() method to publish the model cube via a SAMP Hub to Virtual
  108 +Observatory interoperable tools (e.g. Aladin).
105 109  
106 110  
107 111 12. ctexpcube - CTA exposure cube generation
108 112 --------------------------------------------
109   -None
  113 +Add publish() method to publish the exposure cube via a SAMP Hub to
  114 +Virtual Observatory interoperable tools (e.g. Aladin).
110 115  
111 116  
112 117 13. ctpsfcube - CTA point spread function cube generation
... ... @@ -116,12 +121,14 @@ None
116 121  
117 122 14. ctbkgcube - CTA background cube generation
118 123 ----------------------------------------------
119   -None
  124 +Add publish() method to publish the background cube via a SAMP Hub to
  125 +Virtual Observatory interoperable tools (e.g. Aladin).
120 126  
121 127  
122 128 15. ctcubemask - CTA cube filtering
123 129 -----------------------------------
124   -None
  130 +Add publish() method to publish the masked counts cube via a SAMP Hub
  131 +to Virtual Observatory interoperable tools (e.g. Aladin).
125 132  
126 133  
127 134 16. ctbutterfly - Generate butterfly diagrams
... ...
doc/source/reference_manual/ctbin.rst
... ... @@ -78,6 +78,9 @@ General parameters
78 78 Standard parameters
79 79 -------------------
80 80  
  81 +``(publish = no) [boolean]``
  82 + Specifies whether the counts cube should be published on VO Hub.
  83 +
81 84 ``(chatter = 2) [integer]``
82 85 Verbosity of the executable:
83 86 chatter = 0: no information will be logged
... ... @@ -91,7 +94,7 @@ Standard parameters
91 94 chatter = 4: detailed report about the task execution
92 95  
93 96 ``(clobber = yes) [boolean]``
94   - Specifies whether an existing output counts cube should be overwritten.
  97 + Specifies whether an existing output counts cube file should be overwritten.
95 98  
96 99 ``(debug = no) [boolean]``
97 100 Enables debug mode. In debug mode the executable will dump any log file output to the console.
... ...
doc/source/reference_manual/ctbkgcube.rst
... ... @@ -111,6 +111,9 @@ General parameters
111 111 Standard parameters
112 112 -------------------
113 113  
  114 +``(publish = no) [boolean]``
  115 + Specifies whether the background cube should be published on VO Hub.
  116 +
114 117 ``(chatter = 2) [integer]``
115 118 Verbosity of the executable:
116 119 chatter = 0: no information will be logged
... ... @@ -124,7 +127,7 @@ Standard parameters
124 127 chatter = 4: detailed report about the task execution
125 128  
126 129 ``(clobber = yes) [boolean]``
127   - Specifies whether an existing output background cube should be overwritten.
  130 + Specifies whether an existing output background cube file should be overwritten.
128 131  
129 132 ``(debug = no) [boolean]``
130 133 Enables debug mode. In debug mode the executable will dump any log file output to the console.
... ...
doc/source/reference_manual/ctcubemask.rst
... ... @@ -69,6 +69,9 @@ General parameters
69 69 Standard parameters
70 70 -------------------
71 71  
  72 +``(publish = no) [boolean]``
  73 + Specifies whether the counts cube should be published on VO Hub.
  74 +
72 75 ``(chatter = 2) [integer]``
73 76 Verbosity of the executable:
74 77 chatter = 0: no information will be logged
... ... @@ -82,7 +85,7 @@ Standard parameters
82 85 chatter = 4: detailed report about the task execution
83 86  
84 87 ``(clobber = yes) [boolean]``
85   - Specifies whether an existing output counts cube should be overwritten.
  88 + Specifies whether an existing output counts cube file should be overwritten.
86 89  
87 90 ``(debug = no) [boolean]``
88 91 Enables debug mode. In debug mode the executable will dump any log file output to the console.
... ...
doc/source/reference_manual/ctexpcube.rst
... ... @@ -105,6 +105,9 @@ General parameters
105 105 Standard parameters
106 106 -------------------
107 107  
  108 +``(publish = no) [boolean]``
  109 + Specifies whether the exposure cube should be published on VO Hub.
  110 +
108 111 ``(chatter = 2) [integer]``
109 112 Verbosity of the executable:
110 113 chatter = 0: no information will be logged
... ... @@ -118,7 +121,7 @@ Standard parameters
118 121 chatter = 4: detailed report about the task execution
119 122  
120 123 ``(clobber = yes) [boolean]``
121   - Specifies whether an existing output exposure cube should be overwritten.
  124 + Specifies whether an existing output exposure cube file should be overwritten.
122 125  
123 126 ``(debug = no) [boolean]``
124 127 Enables debug mode. In debug mode the executable will dump any log file output to the console.
... ...
doc/source/reference_manual/ctmodel.rst
... ... @@ -138,6 +138,9 @@ General parameters
138 138 Standard parameters
139 139 -------------------
140 140  
  141 +``(publish = no) [boolean]``
  142 + Specifies whether the model cube should be published on VO Hub.
  143 +
141 144 ``(chatter = 2) [integer]``
142 145 Verbosity of the executable:
143 146 chatter = 0: no information will be logged
... ...
doc/source/reference_manual/ctskymap.rst
... ... @@ -60,6 +60,9 @@ General parameters
60 60 Standard parameters
61 61 -------------------
62 62  
  63 +``(publish = no) [boolean]``
  64 + Specifies whether the sky map should be published on VO Hub.
  65 +
63 66 ``(chatter = 2) [integer]``
64 67 Verbosity of the executable:
65 68 chatter = 0: no information will be logged
... ... @@ -73,7 +76,7 @@ Standard parameters
73 76 chatter = 4: detailed report about the task execution
74 77  
75 78 ``(clobber = yes) [boolean]``
76   - Specifies whether an existing output counts cube should be overwritten.
  79 + Specifies whether an existing output sky map file should be overwritten.
77 80  
78 81 ``(debug = no) [boolean]``
79 82 Enables debug mode. In debug mode the executable will dump any log file output to the console.
... ...
doc/source/reference_manual/cttsmap.rst
... ... @@ -94,6 +94,9 @@ General parameters
94 94 Standard parameters
95 95 -------------------
96 96  
  97 +``(publish = no) [boolean]``
  98 + Specifies whether the TS map should be published on VO Hub.
  99 +
97 100 ``(chatter = 2) [integer]``
98 101 Verbosity of the executable:
99 102 chatter = 0: no information will be logged
... ... @@ -107,7 +110,7 @@ Standard parameters
107 110 chatter = 4: detailed report about the task execution
108 111  
109 112 ``(clobber = yes) [boolean]``
110   - Specifies whether an existing output counts cube should be overwritten.
  113 + Specifies whether an existing output TS map file should be overwritten.
111 114  
112 115 ``(debug = no) [boolean]``
113 116 Enables debug mode. In debug mode the executable will dump any log file output to the console.
... ...
pyext/ctbin.i
1 1 /***************************************************************************
2 2 * ctbin - Event binning tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ public:
47 47 void clear(void);
48 48 void run(void);
49 49 void save(void);
  50 + void publish(const std::string& name = "");
50 51 const GObservations& obs(void) const;
51 52 GCTAEventCube cube(void) const;
52 53 };
... ...
pyext/ctbkgcube.i
1 1 /***************************************************************************
2 2 * ctbkgcube - Background cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ public:
47 47 void clear(void);
48 48 void run(void);
49 49 void save(void);
  50 + void publish(const std::string& name = "");
50 51 const GCTACubeBackground& bkgcube(void) const;
51 52 const GModels& models(void) const;
52 53 };
... ...
pyext/ctcubemask.i
1 1 /***************************************************************************
2 2 * ctcubemask - Cube filter tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014 Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ public:
47 47 void clear(void);
48 48 void run(void);
49 49 void save(void);
  50 + void publish(const std::string& name = "");
50 51 const GObservations& obs(void) const;
51 52 };
52 53  
... ...
pyext/ctexpcube.i
1 1 /***************************************************************************
2 2 * ctexpcube - Exposure cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ public:
47 47 void clear(void);
48 48 void run(void);
49 49 void save(void);
  50 + void publish(const std::string& name = "");
50 51 const GCTACubeExposure& expcube(void) const;
51 52 };
52 53  
... ...
pyext/ctmodel.i
1 1 /***************************************************************************
2 2 * ctmodel - Model cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ public:
47 47 void clear(void);
48 48 void run(void);
49 49 void save(void);
  50 + void publish(const std::string& name = "");
50 51 const GObservations& obs(void) const;
51 52 const GCTAEventCube& cube(void) const;
52 53 void cube(const GCTAEventCube& cube);
... ...
pyext/ctskymap.i
1 1 /***************************************************************************
2 2 * ctskymap - Sky mapping tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ public:
47 47 void clear(void);
48 48 void run(void);
49 49 void save(void);
  50 + void publish(const std::string& name = "");
50 51 const GSkyMap& map(void) const;
51 52 };
52 53  
... ...
pyext/cttsmap.i
1 1 /***************************************************************************
2 2 * cttsmap - TS map calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Michael Mayer *
  4 + * copyright (C) 2014-2016 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -47,6 +47,7 @@ public:
47 47 void clear(void);
48 48 void run(void);
49 49 void save(void);
  50 + void publish(const std::string& name = "");
50 51 const GObservations& obs(void) const;
51 52 const GSkyMap& tsmap(void) const;
52 53 };
... ...
src/ctbin/ctbin.cpp
1 1 /***************************************************************************
2 2 * ctbin - Event binning tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -302,6 +302,11 @@ void ctbin::run(void)
302 302 log << m_obs << std::endl;
303 303 }
304 304  
  305 + // Optionally publish counts cube
  306 + if (m_publish) {
  307 + publish();
  308 + }
  309 +
305 310 // Return
306 311 return;
307 312 }
... ... @@ -310,26 +315,18 @@ void ctbin::run(void)
310 315 /***********************************************************************//**
311 316 * @brief Save counts cube
312 317 *
313   - * This method saves the counts cube into a FITS file.
  318 + * Saves the counts cube into a FITS file.
314 319 ***************************************************************************/
315 320 void ctbin::save(void)
316 321 {
317 322 // Write header
318 323 if (logTerse()) {
319 324 log << std::endl;
320   - if (m_obs.size() > 1) {
321   - log.header1("Save observations");
322   - }
323   - else {
324   - log.header1("Save observation");
325   - }
  325 + log.header1("Save counts cube");
326 326 }
327 327  
328   - // Get output filename
329   - m_outcube = (*this)["outcube"].filename();
330   -
331 328 // Save only if filename is non-empty
332   - if (m_outcube.length() > 0) {
  329 + if (!m_outcube.is_empty()) {
333 330  
334 331 // Get CTA observation from observation container
335 332 GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
... ... @@ -337,9 +334,9 @@ void ctbin::save(void)
337 334 // Save only if observation is valid
338 335 if (obs != NULL) {
339 336  
340   - // Dump filename
  337 + // Log filename
341 338 if (logTerse()) {
342   - log << "Save \""+m_outcube+"\"" << std::endl;
  339 + log << "Save \""+m_outcube+"\"." << std::endl;
343 340 }
344 341  
345 342 // Save cube
... ... @@ -354,6 +351,38 @@ void ctbin::save(void)
354 351 }
355 352  
356 353  
  354 +/***********************************************************************//**
  355 + * @brief Publish counts cube
  356 + *
  357 + * @param[in] name Counts cube name.
  358 + ***************************************************************************/
  359 +void ctbin::publish(const std::string& name)
  360 +{
  361 + // Write header
  362 + if (logTerse()) {
  363 + log << std::endl;
  364 + log.header1("Publish counts cube");
  365 + }
  366 +
  367 + // Set default name is user name is empty
  368 + std::string user_name(name);
  369 + if (user_name.empty()) {
  370 + user_name = CTBIN_NAME;
  371 + }
  372 +
  373 + // Log filename
  374 + if (logTerse()) {
  375 + log << "Publish \""+user_name+"\" counts cube." << std::endl;
  376 + }
  377 +
  378 + // Publish counts cube
  379 + m_cube.publish(user_name);
  380 +
  381 + // Return
  382 + return;
  383 +}
  384 +
  385 +
357 386 /*==========================================================================
358 387 = =
359 388 = Private methods =
... ... @@ -367,7 +396,8 @@ void ctbin::init_members(void)
367 396 {
368 397 // Initialise members
369 398 m_outcube.clear();
370   - m_usepnt = false;
  399 + m_usepnt = false;
  400 + m_publish = false;
371 401  
372 402 // Initialise protected members
373 403 m_obs.clear();
... ... @@ -392,6 +422,7 @@ void ctbin::copy_members(const ctbin&amp; app)
392 422 // Copy attributes
393 423 m_outcube = app.m_outcube;
394 424 m_usepnt = app.m_usepnt;
  425 + m_publish = app.m_publish;
395 426  
396 427 // Copy protected members
397 428 m_obs = app.m_obs;
... ... @@ -452,6 +483,9 @@ void ctbin::get_parameters(void)
452 483 // Get energy boundaries
453 484 m_ebounds = cube.ebounds();
454 485  
  486 + // Get remaining parameters
  487 + m_publish = (*this)["publish"].boolean();
  488 +
455 489 // Optionally read ahead parameters so that they get correctly
456 490 // dumped into the log file
457 491 if (read_ahead()) {
... ...
src/ctbin/ctbin.hpp
1 1 /***************************************************************************
2 2 * ctbin - Event binning tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -34,7 +34,7 @@
34 34  
35 35 /* __Definitions _________________________________________________________ */
36 36 #define CTBIN_NAME "ctbin"
37   -#define CTBIN_VERSION "1.0.0"
  37 +#define CTBIN_VERSION "1.1.0"
38 38  
39 39  
40 40 /***********************************************************************//**
... ... @@ -78,6 +78,7 @@ public:
78 78 void clear(void);
79 79 void run(void);
80 80 void save(void);
  81 + void publish(const std::string& name = "");
81 82 const GObservations& obs(void) const;
82 83 GCTAEventCube cube(void) const;
83 84  
... ... @@ -91,8 +92,9 @@ protected:
91 92 void obs_cube(void);
92 93  
93 94 // User parameters
94   - std::string m_outcube; //!< Output counts map file
  95 + GFilename m_outcube; //!< Output counts map file name
95 96 bool m_usepnt; //!< Use pointing instead of xref/yref parameters
  97 + bool m_publish; //!< Publish counts cube?
96 98  
97 99 // Protected members
98 100 GObservations m_obs; //!< Observation container
... ...
src/ctbin/ctbin.par
... ... @@ -5,7 +5,7 @@
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # File: ctbin.par #
8   -# Version: 1.0.0 #
  8 +# Version: 1.1.0 #
9 9 # #
10 10 # Author: Jurgen Knodlseder #
11 11 # Jurgen.Knodlseder@irap.omp.eu #
... ... @@ -44,6 +44,7 @@ proj, s, a, &quot;CAR&quot;,AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
44 44 #
45 45 # Standard parameters
46 46 #====================
  47 +publish, b, h, no,,, "Publish counts cube on VO Hub?"
47 48 chatter, i, h, 2,0,4, "Chattiness of output"
48 49 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
49 50 debug, b, h, no,,, "Debugging mode activated"
... ...
src/ctbkgcube/ctbkgcube.cpp
1 1 /***************************************************************************
2 2 * ctbkgcube - Background cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -340,6 +340,11 @@ void ctbkgcube::run(void)
340 340 // Recover original models
341 341 m_obs.models(models_orig);
342 342  
  343 + // Optionally publish background cube
  344 + if (m_publish) {
  345 + publish();
  346 + }
  347 +
343 348 // Return
344 349 return;
345 350 }
... ... @@ -348,7 +353,8 @@ void ctbkgcube::run(void)
348 353 /***********************************************************************//**
349 354 * @brief Save background cube
350 355 *
351   - * Save the background cube into the file specified by the outfile parameter.
  356 + * Save the background cube into a FITS file and the output model into an
  357 + * XML file.
352 358 ***************************************************************************/
353 359 void ctbkgcube::save(void)
354 360 {
... ... @@ -358,18 +364,30 @@ void ctbkgcube::save(void)
358 364 log.header1("Save background cube");
359 365 }
360 366  
361   - // Get output filenames
362   - std::string outfile = (*this)["outcube"].filename();
363   - std::string outmodel = (*this)["outmodel"].filename();
  367 + // Save only if filename is non-empty
  368 + if (!m_outcube.is_empty()) {
  369 +
  370 + // Log filename
  371 + if (logTerse()) {
  372 + log << "Save \""+m_outcube+"\"." << std::endl;
  373 + }
364 374  
365   - // Save background cube
366   - m_background.save(outfile, clobber());
  375 + // Save background cube
  376 + m_background.save(m_outcube, clobber());
  377 +
  378 + }
367 379  
368 380 // Write output models if filename is valid
369   - if ((outmodel.length() > 0) && (gammalib::tolower(outmodel) != "none")) {
  381 + if ((!m_outmodel.is_empty()) &&
  382 + (gammalib::tolower(m_outmodel.url()) != "none")) {
  383 +
  384 + // Log filename
  385 + if (logTerse()) {
  386 + log << "Save \""+m_outmodel.url()+"\"." << std::endl;
  387 + }
370 388  
371   - // Save output model for binned analyses
372   - m_outmdl.save(outmodel);
  389 + // Save output model for stacked analyses
  390 + m_outmdl.save(m_outmodel.url());
373 391  
374 392 }
375 393  
... ... @@ -378,6 +396,38 @@ void ctbkgcube::save(void)
378 396 }
379 397  
380 398  
  399 +/***********************************************************************//**
  400 + * @brief Publish background cube
  401 + *
  402 + * @param[in] name Background cube name.
  403 + ***************************************************************************/
  404 +void ctbkgcube::publish(const std::string& name)
  405 +{
  406 + // Write header
  407 + if (logTerse()) {
  408 + log << std::endl;
  409 + log.header1("Publish background cube");
  410 + }
  411 +
  412 + // Set default name is user name is empty
  413 + std::string user_name(name);
  414 + if (user_name.empty()) {
  415 + user_name = CTBKGCUBE_NAME;
  416 + }
  417 +
  418 + // Log filename
  419 + if (logTerse()) {
  420 + log << "Publish \""+user_name+"\" background cube." << std::endl;
  421 + }
  422 +
  423 + // Publish exposure cube
  424 + m_background.cube().publish(user_name);
  425 +
  426 + // Return
  427 + return;
  428 +}
  429 +
  430 +
381 431 /*==========================================================================
382 432 = =
383 433 = Private methods =
... ... @@ -392,6 +442,7 @@ void ctbkgcube::init_members(void)
392 442 // Initialise members
393 443 m_outcube.clear();
394 444 m_outmodel.clear();
  445 + m_publish = false;
395 446 m_obs.clear();
396 447 m_background.clear();
397 448 m_bkgmdl.clear();
... ... @@ -412,6 +463,7 @@ void ctbkgcube::copy_members(const ctbkgcube&amp; app)
412 463 // Copy members
413 464 m_outmodel = app.m_outmodel;
414 465 m_outcube = app.m_outcube;
  466 + m_publish = app.m_publish;
415 467 m_obs = app.m_obs;
416 468 m_background = app.m_background;
417 469 m_bkgmdl = app.m_bkgmdl;
... ... @@ -499,6 +551,9 @@ void ctbkgcube::get_parameters(void)
499 551 m_obs.models(models);
500 552 }
501 553  
  554 + // Get remaining parameters
  555 + m_publish = (*this)["publish"].boolean();
  556 +
502 557 // Read output filenames (if needed)
503 558 if (read_ahead()) {
504 559 m_outcube = (*this)["outcube"].filename();
... ...
src/ctbkgcube/ctbkgcube.hpp
1 1 /***************************************************************************
2 2 * ctbkgcube - Background cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -34,7 +34,7 @@
34 34  
35 35 /* __Definitions _________________________________________________________ */
36 36 #define CTBKGCUBE_NAME "ctbkgcube"
37   -#define CTBKGCUBE_VERSION "1.0.0"
  37 +#define CTBKGCUBE_VERSION "1.1.0"
38 38  
39 39  
40 40 /***********************************************************************//**
... ... @@ -59,6 +59,7 @@ public:
59 59 void clear(void);
60 60 void run(void);
61 61 void save(void);
  62 + void publish(const std::string& name = "");
62 63 const GCTACubeBackground& bkgcube(void) const;
63 64 const GModels& models(void) const;
64 65  
... ... @@ -70,11 +71,14 @@ protected:
70 71 void get_parameters(void);
71 72 void fill_cube(GCTAObservation* obs);
72 73  
  74 + // User parameters
  75 + GFilename m_outcube; //!< Filename of output cube
  76 + GFilename m_outmodel; //!< Filename of output XML model
  77 + bool m_publish; //!< Publish background cube?
  78 +
73 79 // Protected members
74   - std::string m_outcube; //!< Filename of output cube
75   - std::string m_outmodel; //!< Filename of output XML model
76 80 GObservations m_obs; //!< Observation container
77   - GCTACubeBackground m_background; //!< Background cube response
  81 + GCTACubeBackground m_background; //!< Background cube
78 82 GModels m_bkgmdl; //!< CTA background models
79 83 GModels m_outmdl; //!< Output models
80 84 };
... ...
src/ctbkgcube/ctbkgcube.par
... ... @@ -5,7 +5,7 @@
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # File: ctbkgcube.par #
8   -# Version: 1.0.0 #
  8 +# Version: 1.1.0 #
9 9 # #
10 10 # Author: Chia-Chun Lu #
11 11 # c.lu@mpi-hd.mpg.de #
... ... @@ -49,6 +49,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
49 49 #
50 50 # Standard parameters
51 51 #====================
  52 +publish, b, h, no,,, "Publish sky map on VO Hub?"
52 53 chatter, i, h, 2,0,4, "Chattiness of output"
53 54 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
54 55 debug, b, h, no,,, "Debugging mode activated"
... ...
src/ctcubemask/ctcubemask.cpp
1 1 /***************************************************************************
2 2 * ctcubemask - Cube filter tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -282,6 +282,11 @@ void ctcubemask::run(void)
282 282 log << m_obs << std::endl;
283 283 }
284 284  
  285 + // Optionally publish counts cube
  286 + if (m_publish) {
  287 + publish();
  288 + }
  289 +
285 290 // Return
286 291 return;
287 292 }
... ... @@ -312,10 +317,10 @@ void ctcubemask::save(void)
312 317 if (logTerse()) {
313 318 log << std::endl;
314 319 if (m_obs.size() > 1) {
315   - log.header1("Save observations");
  320 + log.header1("Save counts cubes");
316 321 }
317 322 else {
318   - log.header1("Save observation");
  323 + log.header1("Save counts cube");
319 324 }
320 325 }
321 326  
... ... @@ -335,6 +340,52 @@ void ctcubemask::save(void)
335 340  
336 341  
337 342 /***********************************************************************//**
  343 + * @brief Publish counts cube
  344 + *
  345 + * @param[in] name Counts cube name.
  346 + *
  347 + * Publishes the first counts cube in the observation container on the VO
  348 + * Hub.
  349 + ***************************************************************************/
  350 +void ctcubemask::publish(const std::string& name)
  351 +{
  352 + // Write header
  353 + if (logTerse()) {
  354 + log << std::endl;
  355 + log.header1("Publish counts cube");
  356 + }
  357 +
  358 + // Set default name is user name is empty
  359 + std::string user_name(name);
  360 + if (user_name.empty()) {
  361 + user_name = CTCUBEMASK_NAME;
  362 + }
  363 +
  364 + // Get first CTA observation from observation container
  365 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
  366 + if (obs != NULL) {
  367 +
  368 + // Get counts cube
  369 + GCTAEventCube* cube = dynamic_cast<GCTAEventCube*>(obs->events());
  370 + if (cube != NULL) {
  371 +
  372 + // Log filename
  373 + if (logTerse()) {
  374 + log << "Publish \""+user_name+"\" counts cube." << std::endl;
  375 + }
  376 +
  377 + // Publish counts cube
  378 + cube->map().publish(user_name);
  379 +
  380 + }
  381 + }
  382 +
  383 + // Return
  384 + return;
  385 +}
  386 +
  387 +
  388 +/***********************************************************************//**
338 389 * @brief Get application parameters
339 390 *
340 391 * @exception GException::invalid_value
... ... @@ -402,10 +453,14 @@ void ctcubemask::get_parameters(void)
402 453 m_select_energy = false;
403 454 }
404 455  
  456 + // Get remaining parameters
  457 + m_publish = (*this)["publish"].boolean();
  458 +
405 459 // Optionally read ahead parameters so that they get correctly
406 460 // dumped into the log file
407 461 if (read_ahead()) {
408 462 m_outcube = (*this)["outcube"].filename();
  463 + m_prefix = (*this)["prefix"].string();
409 464 }
410 465  
411 466 // Return
... ... @@ -586,12 +641,13 @@ void ctcubemask::init_members(void)
586 641 m_regfile.clear();
587 642 m_outcube.clear();
588 643 m_prefix.clear();
589   - m_usepnt = false;
590   - m_ra = 0.0;
591   - m_dec = 0.0;
592   - m_rad = 0.0;
593   - m_emin = 0.0;
594   - m_emax = 0.0;
  644 + m_usepnt = false;
  645 + m_ra = 0.0;
  646 + m_dec = 0.0;
  647 + m_rad = 0.0;
  648 + m_emin = 0.0;
  649 + m_emax = 0.0;
  650 + m_publish = false;
595 651  
596 652 // Initialise protected members
597 653 m_obs.clear();
... ... @@ -621,6 +677,7 @@ void ctcubemask::copy_members(const ctcubemask&amp; app)
621 677 m_rad = app.m_rad;
622 678 m_emin = app.m_emin;
623 679 m_emax = app.m_emax;
  680 + m_publish = app.m_publish;
624 681  
625 682 // Copy protected members
626 683 m_obs = app.m_obs;
... ... @@ -705,14 +762,21 @@ std::string ctcubemask::set_outfile_name(const std::string&amp; filename) const
705 762 ***************************************************************************/
706 763 void ctcubemask::save_fits(void)
707 764 {
708   - // Get output filename
709   - m_outcube = (*this)["outcube"].filename();
  765 + // Save only if filename is non-empty
  766 + if (!m_outcube.is_empty()) {
710 767  
711   - // Get CTA observation from observation container
712   - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
  768 + // Get CTA observation from observation container
  769 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[0]);
713 770  
714   - // Save event list
715   - save_counts_map(obs, m_outcube);
  771 + // Log filename
  772 + if (logTerse()) {
  773 + log << "Save \""+m_outcube+"\"." << std::endl;
  774 + }
  775 +
  776 + // Save event list
  777 + save_counts_map(obs, m_outcube);
  778 +
  779 + }
716 780  
717 781 // Return
718 782 return;
... ... @@ -732,12 +796,8 @@ void ctcubemask::save_fits(void)
732 796 ***************************************************************************/
733 797 void ctcubemask::save_xml(void)
734 798 {
735   - // Get output filename and prefix
736   - m_outcube = (*this)["m_outcube"].filename();
737   - m_prefix = (*this)["prefix"].string();
738   -
739 799 // Issue warning if output filename has no .xml suffix
740   - std::string suffix = gammalib::tolower(m_outcube.substr(m_outcube.length()-4,4));
  800 + std::string suffix = gammalib::tolower(m_outcube.url().substr(m_outcube.length()-4,4));
741 801 if (suffix != ".xml") {
742 802 log << "*** WARNING: Name of observation definition output file \""+
743 803 m_outcube+"\"" << std::endl;
... ... @@ -763,6 +823,11 @@ void ctcubemask::save_xml(void)
763 823 // Store output file name in observation
764 824 obs->eventfile(outfile);
765 825  
  826 + // Log filename
  827 + if (logTerse()) {
  828 + log << "Save \""+outfile+"\"." << std::endl;
  829 + }
  830 +
766 831 // Save event list
767 832 save_counts_map(obs, outfile);
768 833  
... ...
src/ctcubemask/ctcubemask.hpp
1 1 /***************************************************************************
2 2 * ctcubemask - Cube filter tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Chia-Chun Lu *
  4 + * copyright (C) 2014-2016 by Chia-Chun Lu *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -36,7 +36,7 @@
36 36  
37 37 /* __Definitions _________________________________________________________ */
38 38 #define CTCUBEMASK_NAME "ctcubemask"
39   -#define CTCUBEMASK_VERSION "1.0.0"
  39 +#define CTCUBEMASK_VERSION "1.1.0"
40 40  
41 41  
42 42 /***********************************************************************//**
... ... @@ -61,6 +61,7 @@ public:
61 61 void clear(void);
62 62 void run(void);
63 63 void save(void);
  64 + void publish(const std::string& name = "");
64 65 const GObservations& obs(void) const;
65 66  
66 67 protected:
... ... @@ -78,9 +79,8 @@ protected:
78 79 const std::string& outfile) const;
79 80  
80 81 // User parameters
81   - //std::string m_infile; //!< Input event list or XML file
82   - std::string m_regfile; //!< ds9 region file
83   - std::string m_outcube; //!< Output event list or XML file
  82 + GFilename m_regfile; //!< ds9 region file
  83 + GFilename m_outcube; //!< Output event list or XML file
84 84 std::string m_prefix; //!< Prefix for multiple counts maps
85 85 bool m_usepnt; //!< Use pointing instead of RA/DEC parameters
86 86 double m_ra; //!< RA of ROI centre
... ... @@ -88,6 +88,7 @@ protected:
88 88 double m_rad; //!< ROI radius
89 89 double m_emin; //!< Lower energy
90 90 double m_emax; //!< Upper energy
  91 + bool m_publish; //!< Publish counts cube?
91 92  
92 93 // Protected members
93 94 GObservations m_obs; //!< Observations container
... ...
src/ctcubemask/ctcubemask.par
... ... @@ -5,7 +5,7 @@
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # File: ctcubemask.par #
8   -# Version: 1.0.0 #
  8 +# Version: 1.1.0 #
9 9 # #
10 10 # Author: Chia-Chun Lu #
11 11 # c.lu@mpi-hd.mpg.de #
... ... @@ -17,7 +17,7 @@
17 17 #
18 18 # General parameters
19 19 #===================
20   -inobs, f, a, "cntmap.fits",,, "Input counts cube or observation definition XML file"
  20 +inobs, f, a, "cntcube.fits",,, "Input counts cube or observation definition XML file"
21 21 outcube, f, a, "filtered_cube.fits",,, "Output counts cube or observation definition XML file"
22 22 prefix, s, h, "filtered_",,, "Prefix for counts cube in observation definition XML file"
23 23  
... ... @@ -35,7 +35,9 @@ emax, r, a, 100.0,,, &quot;Upper energy limit (TeV)&quot;
35 35 #
36 36 # Standard parameters
37 37 #====================
  38 +publish, b, h, no,,, "Publish counts cube on VO Hub?"
38 39 chatter, i, h, 2,0,4, "Chattiness of output"
39 40 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
40 41 debug, b, h, no,,, "Debugging mode activated"
41 42 mode, s, h, "ql",,, "Mode of automatic parameters"
  43 +logfile, f, h, "ctcubemask.par.log",,, "Log filename"
... ...
src/ctexpcube/ctexpcube.cpp
1 1 /***************************************************************************
2 2 * ctexpcube - Exposure cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -258,6 +258,11 @@ void ctexpcube::run(void)
258 258 }
259 259 }
260 260  
  261 + // Optionally publish exposure cube
  262 + if (m_publish) {
  263 + publish();
  264 + }
  265 +
261 266 // Return
262 267 return;
263 268 }
... ... @@ -265,6 +270,8 @@ void ctexpcube::run(void)
265 270  
266 271 /***********************************************************************//**
267 272 * @brief Save exposure cube
  273 + *
  274 + * Saves the exposure cube into a FITS file.
268 275 ***************************************************************************/
269 276 void ctexpcube::save(void)
270 277 {
... ... @@ -274,11 +281,50 @@ void ctexpcube::save(void)
274 281 log.header1("Save exposure cube");
275 282 }
276 283  
277   - // Get output filename
278   - m_outcube = (*this)["outcube"].filename();
  284 + // Save only if filename is non-empty
  285 + if (!m_outcube.is_empty()) {
  286 +
  287 + // Log filename
  288 + if (logTerse()) {
  289 + log << "Save \""+m_outcube+"\"." << std::endl;
  290 + }
  291 +
  292 + // Save exposure cube
  293 + m_expcube.save(m_outcube, clobber());
  294 +
  295 + }
  296 +
  297 + // Return
  298 + return;
  299 +}
  300 +
  301 +
  302 +/***********************************************************************//**
  303 + * @brief Publish exposure cube
  304 + *
  305 + * @param[in] name Exposure cube name.
  306 + ***************************************************************************/
  307 +void ctexpcube::publish(const std::string& name)
  308 +{
  309 + // Write header
  310 + if (logTerse()) {
  311 + log << std::endl;
  312 + log.header1("Publish exposure cube");
  313 + }
  314 +
  315 + // Set default name is user name is empty
  316 + std::string user_name(name);
  317 + if (user_name.empty()) {
  318 + user_name = CTEXPCUBE_NAME;
  319 + }
279 320  
280   - // Save exposure cube
281   - m_expcube.save(m_outcube, clobber());
  321 + // Log filename
  322 + if (logTerse()) {
  323 + log << "Publish \""+user_name+"\" exposure cube." << std::endl;
  324 + }
  325 +
  326 + // Publish exposure cube
  327 + m_expcube.cube().publish(user_name);
282 328  
283 329 // Return
284 330 return;
... ... @@ -299,6 +345,7 @@ void ctexpcube::init_members(void)
299 345 // Initialise members
300 346 m_outcube.clear();
301 347 m_apply_edisp = false;
  348 + m_publish = false;
302 349  
303 350 // Initialise protected members
304 351 m_obs.clear();
... ... @@ -319,6 +366,7 @@ void ctexpcube::copy_members(const ctexpcube&amp; app)
319 366 // Copy attributes
320 367 m_outcube = app.m_outcube;
321 368 m_apply_edisp = app.m_apply_edisp;
  369 + m_publish = app.m_publish;
322 370  
323 371 // Copy protected members
324 372 m_obs = app.m_obs;
... ... @@ -390,6 +438,9 @@ void ctexpcube::get_parameters(void)
390 438  
391 439 } // endelse: cube loaded from file
392 440  
  441 + // Get remaining parameters
  442 + m_publish = (*this)["publish"].boolean();
  443 +
393 444 // Read output filename (if needed)
394 445 if (read_ahead()) {
395 446 m_outcube = (*this)["outcube"].filename();
... ...
src/ctexpcube/ctexpcube.hpp
1 1 /***************************************************************************
2 2 * ctexpcube - Exposure cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2014-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -34,7 +34,7 @@
34 34  
35 35 /* __Definitions _________________________________________________________ */
36 36 #define CTEXPCUBE_NAME "ctexpcube"
37   -#define CTEXPCUBE_VERSION "1.0.0"
  37 +#define CTEXPCUBE_VERSION "1.1.0"
38 38  
39 39  
40 40 /***********************************************************************//**
... ... @@ -59,6 +59,7 @@ public:
59 59 void clear(void);
60 60 void run(void);
61 61 void save(void);
  62 + void publish(const std::string& name = "");
62 63 const GCTACubeExposure& expcube(void) const;
63 64  
64 65 protected:
... ... @@ -69,8 +70,9 @@ protected:
69 70 void get_parameters(void);
70 71  
71 72 // User parameters
72   - std::string m_outcube; //!< Output exposure cube file
73   - bool m_apply_edisp; //!< Apply energy dispersion?
  73 + GFilename m_outcube; //!< Output exposure cube file
  74 + bool m_apply_edisp; //!< Apply energy dispersion?
  75 + bool m_publish; //!< Publish exposure cube?
74 76  
75 77 // Protected members
76 78 GObservations m_obs; //!< Observation container
... ...
src/ctexpcube/ctexpcube.par
... ... @@ -5,7 +5,7 @@
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # File: ctexpcube.par #
8   -# Version: 1.0.0 #
  8 +# Version: 1.1.0 #
9 9 # #
10 10 # Author: Juergen Knoedlseder #
11 11 # Jurgen.Knodlseder@irap.omp.eu #
... ... @@ -48,6 +48,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
48 48 #
49 49 # Standard parameters
50 50 #====================
  51 +publish, b, h, no,,, "Publish sky map on VO Hub?"
51 52 chatter, i, h, 2,0,4, "Chattiness of output"
52 53 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
53 54 debug, b, h, no,,, "Debugging mode activated"
... ...
src/ctmodel/ctmodel.cpp
... ... @@ -324,6 +324,11 @@ void ctmodel::run(void)
324 324 }
325 325 }
326 326  
  327 + // Optionally publish model cube
  328 + if (m_publish) {
  329 + publish();
  330 + }
  331 +
327 332 // Return
328 333 return;
329 334 }
... ... @@ -343,15 +348,12 @@ void ctmodel::save(void)
343 348 log.header1("Save cube");
344 349 }
345 350  
346   - // Make sure we have the FITS filename
347   - m_outcube = (*this)["outcube"].filename();
348   -
349 351 // Save only if filename is non-empty
350   - if (m_outcube.length() > 0) {
  352 + if (!m_outcube.is_empty()) {
351 353  
352 354 // Dump filename
353 355 if (logTerse()) {
354   - log << "Save \""+m_outcube+"\"" << std::endl;
  356 + log << "Save \""+m_outcube+"\"." << std::endl;
355 357 }
356 358  
357 359 // Save model cube into FITS file
... ... @@ -365,6 +367,38 @@ void ctmodel::save(void)
365 367  
366 368  
367 369 /***********************************************************************//**
  370 + * @brief Publish model cube
  371 + *
  372 + * @param[in] name Model cube name.
  373 + ***************************************************************************/
  374 +void ctmodel::publish(const std::string& name)
  375 +{
  376 + // Write header
  377 + if (logTerse()) {
  378 + log << std::endl;
  379 + log.header1("Publish model cube");
  380 + }
  381 +
  382 + // Set default name is user name is empty
  383 + std::string user_name(name);
  384 + if (user_name.empty()) {
  385 + user_name = CTMODEL_NAME;
  386 + }
  387 +
  388 + // Log filename
  389 + if (logTerse()) {
  390 + log << "Publish \""+user_name+"\" model cube." << std::endl;
  391 + }
  392 +
  393 + // Publish model cube
  394 + m_cube.map().publish(user_name);
  395 +
  396 + // Return
  397 + return;
  398 +}
  399 +
  400 +
  401 +/***********************************************************************//**
368 402 * @brief Set model cube
369 403 *
370 404 * @param[in] cube Model cube.
... ... @@ -403,6 +437,7 @@ void ctmodel::init_members(void)
403 437 // Initialise members
404 438 m_outcube.clear();
405 439 m_apply_edisp = false;
  440 + m_publish = false;
406 441  
407 442 // Initialise protected members
408 443 m_obs.clear();
... ... @@ -427,6 +462,7 @@ void ctmodel::copy_members(const ctmodel&amp; app)
427 462 // Copy attributes
428 463 m_outcube = app.m_outcube;
429 464 m_apply_edisp = app.m_apply_edisp;
  465 + m_publish = app.m_publish;
430 466  
431 467 // Copy protected members
432 468 m_obs = app.m_obs;
... ... @@ -550,6 +586,9 @@ void ctmodel::get_parameters(void)
550 586  
551 587 } // endif: we had no cube yet
552 588  
  589 + // Get remaining parameters
  590 + m_publish = (*this)["publish"].boolean();
  591 +
553 592 // Read optionally output cube filenames
554 593 if (read_ahead()) {
555 594 m_outcube = (*this)["outcube"].filename();
... ...
src/ctmodel/ctmodel.hpp
1 1 /***************************************************************************
2 2 * ctmodel - Model cube generation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -34,7 +34,7 @@
34 34  
35 35 /* __Definitions _________________________________________________________ */
36 36 #define CTMODEL_NAME "ctmodel"
37   -#define CTMODEL_VERSION "1.0.1"
  37 +#define CTMODEL_VERSION "1.1.0"
38 38  
39 39  
40 40 /***********************************************************************//**
... ... @@ -68,6 +68,7 @@ public:
68 68 void clear(void);
69 69 void run(void);
70 70 void save(void);
  71 + void publish(const std::string& name = "");
71 72 const GObservations& obs(void) const;
72 73 const GCTAEventCube& cube(void) const;
73 74 void cube(const GCTAEventCube& cube);
... ... @@ -84,8 +85,9 @@ protected:
84 85 bool has_cube(void) const;
85 86  
86 87 // User parameters
87   - std::string m_outcube; //!< Output model cube
88   - bool m_apply_edisp; //!< Apply energy dispersion?
  88 + GFilename m_outcube; //!< Output model cube
  89 + bool m_apply_edisp; //!< Apply energy dispersion?
  90 + bool m_publish; //!< Publish model cube?
89 91  
90 92 // Protected members
91 93 GObservations m_obs; //!< Observation container
... ...
src/ctmodel/ctmodel.par
... ... @@ -5,7 +5,7 @@
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # File: ctmodel.par #
8   -# Version: 1.0.1 #
  8 +# Version: 1.1.0 #
9 9 # #
10 10 # Author: Juergen Knoedlseder #
11 11 # Jurgen.Knodlseder@irap.omp.eu #
... ... @@ -62,6 +62,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
62 62 #
63 63 # Standard parameters
64 64 #====================
  65 +publish, b, h, no,,, "Publish model cube on VO Hub?"
65 66 chatter, i, h, 2,0,4, "Chattiness of output"
66 67 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
67 68 debug, b, h, no,,, "Debugging mode activated"
... ...
src/ctskymap/ctskymap.cpp
... ... @@ -290,15 +290,21 @@ void ctskymap::run(void)
290 290  
291 291 } // endfor: looped over observations
292 292  
  293 + // Optionally publish sky map
  294 + if (m_publish) {
  295 + publish();
  296 + }
  297 +
293 298 // Return
294 299 return;
295 300 }
296 301  
297 302  
298 303 /***********************************************************************//**
299   - * @brief Save observation
  304 + * @brief Save sky map
300 305 *
301   - * This method saves the counts map(s) into (a) FITS file(s).
  306 + * Saves the sky map into a FITS file. The FITS file name is specified by the
  307 + * @p outname parameter.
302 308 ***************************************************************************/
303 309 void ctskymap::save(void)
304 310 {
... ... @@ -308,15 +314,12 @@ void ctskymap::save(void)
308 314 log.header1("Save sky map");
309 315 }
310 316  
311   - // Get output filename
312   - m_outmap = (*this)["outmap"].filename();
313   -
314 317 // Save only if filename is non-empty
315   - if (m_outmap.length() > 0) {
  318 + if (!m_outmap.is_empty()) {
316 319  
317   - // Dump filename
  320 + // Log filename
318 321 if (logTerse()) {
319   - log << "Save \""+m_outmap+"\"" << std::endl;
  322 + log << "Save \""+m_outmap+"\"." << std::endl;
320 323 }
321 324  
322 325 // Save sky map
... ... @@ -330,6 +333,38 @@ void ctskymap::save(void)
330 333  
331 334  
332 335 /***********************************************************************//**
  336 + * @brief Publish sky map
  337 + *
  338 + * @param[in] name Sky map name.
  339 + ***************************************************************************/
  340 +void ctskymap::publish(const std::string& name)
  341 +{
  342 + // Write header
  343 + if (logTerse()) {
  344 + log << std::endl;
  345 + log.header1("Publish sky map");
  346 + }
  347 +
  348 + // Set default name is user name is empty
  349 + std::string user_name(name);
  350 + if (user_name.empty()) {
  351 + user_name = CTSKYMAP_NAME;
  352 + }
  353 +
  354 + // Log filename
  355 + if (logTerse()) {
  356 + log << "Publish \""+user_name+"\" sky map." << std::endl;
  357 + }
  358 +
  359 + // Publish sky map
  360 + m_skymap.publish(user_name);
  361 +
  362 + // Return
  363 + return;
  364 +}
  365 +
  366 +
  367 +/***********************************************************************//**
333 368 * @brief Get application parameters
334 369 *
335 370 * Get all task parameters from parameter file or (if required) by querying
... ... @@ -359,12 +394,13 @@ void ctskymap::get_parameters(void)
359 394 m_skymap = create_map(m_obs);
360 395  
361 396 // Get remaining parameters
362   - m_emin = (*this)["emin"].real();
363   - m_emax = (*this)["emax"].real();
  397 + m_emin = (*this)["emin"].real();
  398 + m_emax = (*this)["emax"].real();
  399 + m_publish = (*this)["publish"].boolean();
364 400  
365 401 // Read ahead parameters
366 402 if (read_ahead()) {
367   - m_outmap = (*this)["outmap"].filename();
  403 + m_outmap = (*this)["outmap"].filename();
368 404 }
369 405  
370 406 // Return
... ... @@ -478,8 +514,9 @@ void ctskymap::init_members(void)
478 514 // Initialise members
479 515 m_obs.clear();
480 516 m_skymap.clear();
481   - m_emin = 0.0;
482   - m_emax = 0.0;
  517 + m_emin = 0.0;
  518 + m_emax = 0.0;
  519 + m_publish = false;
483 520  
484 521 // Return
485 522 return;
... ... @@ -494,10 +531,11 @@ void ctskymap::init_members(void)
494 531 void ctskymap::copy_members(const ctskymap& app)
495 532 {
496 533 // Copy attributes
497   - m_obs = app.m_obs;
498   - m_skymap = app.m_skymap;
499   - m_emin = app.m_emin;
500   - m_emax = app.m_emax;
  534 + m_obs = app.m_obs;
  535 + m_skymap = app.m_skymap;
  536 + m_emin = app.m_emin;
  537 + m_emax = app.m_emax;
  538 + m_publish = app.m_publish;
501 539  
502 540 // Return
503 541 return;
... ...
src/ctskymap/ctskymap.hpp
1 1 /***************************************************************************
2 2 * ctskymap - Sky mapping tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2015 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2016 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -34,7 +34,7 @@
34 34  
35 35 /* __Definitions _________________________________________________________ */
36 36 #define CTSKYMAP_NAME "ctskymap"
37   -#define CTSKYMAP_VERSION "1.0.0"
  37 +#define CTSKYMAP_VERSION "1.1.0"
38 38  
39 39  
40 40 /***********************************************************************//**
... ... @@ -61,6 +61,7 @@ public:
61 61 void clear(void);
62 62 void run(void);
63 63 void save(void);
  64 + void publish(const std::string& name = "");
64 65 const GSkyMap& map(void) const;
65 66  
66 67 protected:
... ... @@ -72,10 +73,10 @@ protected:
72 73 void map_events(GCTAObservation* obs);
73 74  
74 75 // User parameters
75   - std::string m_outmap; //!< Output counts map
  76 + GFilename m_outmap; //!< Output file name
76 77 double m_emin; //!< Minimum energy (TeV)
77 78 double m_emax; //!< Maximum energy (TeV)
78   -
  79 + bool m_publish; //!< Publish sky map?
79 80  
80 81 // Protected members
81 82 GObservations m_obs; //!< Observation container
... ...
src/ctskymap/ctskymap.par
... ... @@ -5,7 +5,7 @@
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # File: ctskymap.par #
8   -# Version: 1.0.0 #
  8 +# Version: 1.1.0 #
9 9 # #
10 10 # Author: Jurgen Knodlseder #
11 11 # knodlseder@cesr.fr #
... ... @@ -41,6 +41,7 @@ proj, s, a, &quot;CAR&quot;, AIT|AZP|CAR|MER|MOL|STG|TAN,, &quot;Projection method&quot;
41 41 #
42 42 # Standard parameters
43 43 #====================
  44 +publish, b, h, no,,, "Publish sky map on VO Hub?"
44 45 chatter, i, h, 2,0,4, "Chattiness of output"
45 46 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
46 47 debug, b, h, no,,, "Debugging mode activated"
... ...
src/cttsmap/cttsmap.cpp
1 1 /***************************************************************************
2 2 * cttsmap - TS map calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Michael Mayer *
  4 + * copyright (C) 2014-2016 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -368,6 +368,11 @@ void cttsmap::run(void)
368 368 }
369 369 }
370 370  
  371 + // Optionally publish TS map
  372 + if (m_publish) {
  373 + publish();
  374 + }
  375 +
371 376 // Return
372 377 return;
373 378 }
... ... @@ -386,31 +391,60 @@ void cttsmap::save(void)
386 391 log.header1("Save TS map");
387 392 }
388 393  
389   - // Get output filename
390   - m_outmap = (*this)["outmap"].filename();
391   -
392   - // Create fits file instance
393   - GFits fitsfile = GFits();
  394 + // Create fits file
  395 + GFits fits;
394 396  
395 397 // Write the sky maps to the FITS file
396   - m_tsmap.write(fitsfile);
  398 + m_tsmap.write(fits);
397 399 for (int i = 0; i < m_mapnames.size(); i++) {
398   - m_maps[i].write(fitsfile);
  400 + m_maps[i].write(fits);
399 401 }
400 402  
401 403 // Set extension name for all maps
402 404 for (int i = 0; i < m_mapnames.size(); i++) {
403   - fitsfile[i+1]->extname(m_mapnames[i]);
  405 + fits[i+1]->extname(m_mapnames[i]);
404 406 }
405 407  
406 408 // Add computation log if not all bins are computed
407 409 if (m_binmin != -1 || m_binmax != -1) {
408   - m_statusmap.write(fitsfile);
409   - fitsfile[m_mapnames.size()+1]->extname("STATUS MAP");
  410 + m_statusmap.write(fits);
  411 + fits[m_mapnames.size()+1]->extname("STATUS MAP");
410 412 }
411 413  
412 414 // Save FITS file
413   - fitsfile.saveto(m_outmap,true);
  415 + fits.saveto(m_outmap, clobber());
  416 +
  417 + // Return
  418 + return;
  419 +}
  420 +
  421 +
  422 +/***********************************************************************//**
  423 + * @brief Publish TS map
  424 + *
  425 + * @param[in] name TS map name.
  426 + ***************************************************************************/
  427 +void cttsmap::publish(const std::string& name)
  428 +{
  429 + // Write header
  430 + if (logTerse()) {
  431 + log << std::endl;
  432 + log.header1("Publish TS map");
  433 + }
  434 +
  435 + // Set default name is user name is empty
  436 + std::string user_name(name);
  437 + if (user_name.empty()) {
  438 + user_name = CTTSMAP_NAME;
  439 + }
  440 +
  441 + // Log filename
  442 + if (logTerse()) {
  443 + log << "Publish \""+user_name+"\" TS map." << std::endl;
  444 + }
  445 +
  446 + // Publish TS map
  447 + m_tsmap.publish(user_name);
414 448  
415 449 // Return
416 450 return;
... ... @@ -432,6 +466,7 @@ void cttsmap::init_members(void)
432 466 m_srcname.clear();
433 467 m_outmap.clear();
434 468 m_apply_edisp = false;
  469 + m_publish = false;
435 470  
436 471 // Initialise protected members
437 472 m_obs.clear();
... ... @@ -457,9 +492,10 @@ void cttsmap::init_members(void)
457 492 void cttsmap::copy_members(const cttsmap& app)
458 493 {
459 494 // Copy attributes
460   - m_srcname = app.m_srcname;
461   - m_outmap = app.m_outmap;
  495 + m_srcname = app.m_srcname;
  496 + m_outmap = app.m_outmap;
462 497 m_apply_edisp = app.m_apply_edisp;
  498 + m_publish = app.m_publish;
463 499  
464 500 // Copy protected members
465 501 m_binmin = app.m_binmin;
... ... @@ -568,9 +604,10 @@ void cttsmap::get_parameters(void)
568 604 m_apply_edisp = (*this)["edisp"].boolean();
569 605  
570 606 // Get optional splitting parameters
571   - m_binmin = (*this)["binmin"].integer();
572   - m_binmax = (*this)["binmax"].integer();
573   - m_logL0 = (*this)["logL0"].real();
  607 + m_binmin = (*this)["binmin"].integer();
  608 + m_binmax = (*this)["binmax"].integer();
  609 + m_logL0 = (*this)["logL0"].real();
  610 + m_publish = (*this)["publish"].boolean();
574 611  
575 612 // Optionally read ahead parameters so that they get correctly
576 613 // dumped into the log file
... ...
src/cttsmap/cttsmap.hpp
1 1 /***************************************************************************
2 2 * cttsmap - TS map calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2015 by Michael Mayer *
  4 + * copyright (C) 2014-2016 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -34,7 +34,7 @@
34 34  
35 35 /* __Definitions _________________________________________________________ */
36 36 #define CTTSMAP_NAME "cttsmap"
37   -#define CTTSMAP_VERSION "1.0.0"
  37 +#define CTTSMAP_VERSION "1.1.0"
38 38  
39 39  
40 40 /***********************************************************************//**
... ... @@ -72,6 +72,7 @@ public:
72 72 void clear(void);
73 73 void run(void);
74 74 void save(void);
  75 + void publish(const std::string& name = "");
75 76 const GObservations& obs(void) const;
76 77 const GSkyMap& tsmap(void) const;
77 78  
... ... @@ -85,8 +86,9 @@ protected:
85 86  
86 87 // User parameters
87 88 std::string m_srcname; //!< Name of source which is moved around
88   - std::string m_outmap; //!< Output counts map or XML file
  89 + GFilename m_outmap; //!< Output TS map file name
89 90 bool m_apply_edisp; //!< Apply energy dispersion?
  91 + bool m_publish; //!< Publish TS map?
90 92  
91 93 // Parameters to control speed and job splitting
92 94 int m_binmin; //!< Map bin number from which computation should start
... ...
src/cttsmap/cttsmap.par
... ... @@ -5,7 +5,7 @@
5 5 # ------------------------------------------------------------------------- #
6 6 # #
7 7 # File: cttsmap.par #
8   -# Version: 1.0.0 #
  8 +# Version: 1.1.0 #
9 9 # #
10 10 # Author: Michael Mayer #
11 11 # michael.mayer@desy.de #
... ... @@ -50,6 +50,7 @@ logL0, r, h, 0.0,,, &quot;LogLikelihood value of null hypothesis&quot;
50 50 #
51 51 # Standard parameters
52 52 #====================
  53 +publish, b, h, no,,, "Publish Test Statistic map on VO Hub?"
53 54 chatter, i, h, 2,0,4, "Chattiness of output"
54 55 clobber, b, h, yes,,, "Overwrite existing output files with new output files?"
55 56 debug, b, h, no,,, "Debugging mode activated"
... ...