Commit 2d80fdb138ccc8ecdfdcfe30d44fd71608cf3f20

Authored by Jürgen Knödlseder
2 parents 13844fca 53181887

Merge branch 'pull-request-1862_butterfly' into integration

# Conflicts:
#	ChangeLog
#	NEWS
ChangeLog
1   -2017-04-06
  1 +2017-04-10
2 2  
3 3 * Version 1.3.0 released
4 4 ========================
5 5  
6 6 Use correct ROOT histograms in csroot2caldb
7 7 Implement regression scheme in cssens and remove num_avg parameter (#1989)
  8 + Implement Gaussian error propagation in ctbutterfly (#1862)
8 9 Copy cscripts into bin directory instead of creating a symbolic links (#1987)
9 10 If code originates from Git, always compile the Python bindings (#1985)
10 11 Raise exception instead of exiting with return code in Python tests (#1983)
... ...
1 1 New Features and Important Changes in ctools 1.3.0.dev1
2 2  
3   -6 April 2017
  3 +10 April 2017
4 4  
5 5  
6 6 Introduction
... ... @@ -113,7 +113,11 @@ None
113 113  
114 114 ctbutterfly - Generate butterfly diagrams
115 115 -----------------------------------------
116   -None
  116 +The tool now uses Gaussian error propagation as the standard method for the
  117 +computation of the butterfly diagram. The envelope method that existed before
  118 +is still available for power law spectral models as an option. The "method"
  119 +parameter has been added to allow the selection of the computation method
  120 +(#1862).
117 121  
118 122  
119 123 ctulimit - Compute upper limit
... ...
doc/source/users/reference_manual/ctbutterfly.rst
... ... @@ -3,21 +3,25 @@
3 3 ctbutterfly
4 4 ===========
5 5  
6   -Computes butterfly diagram for a power law model.
  6 +Computes butterfly diagram for a given spectral model.
7 7  
8 8  
9 9 Synopsis
10 10 --------
11 11  
12   -This tool calculates a butterfly diagram for a specific source with power law
13   -spectral model. The butterfly diagram is the envelope of all power law models
14   -that are within a given confidence limit compatible with the data. By default
15   -a confidence level of 68% is used, but the level can be adjusted using the
16   -hidden ``confidence`` parameter. ctbutterfly computes this envelope by
17   -evaluating for each energy the minimum and maximum intensity of all power law
18   -models that fall within the error ellipse of the prefactor and index parameters.
19   -The error ellipse is derived from the covariance matrix of a maximum likelihood
20   -fit.
  12 +This tool calculates a butterfly diagram for a specific source according to
  13 +its spectral model. The butterfly diagram is the envelope of all spectral
  14 +models that are within a given confidence limit compatible with the data.
  15 +The default method used for the calculation is Gaussian error propagation
  16 +using the covariance matrix from a maximum likelihood fit. By default a
  17 +confidence level of 68% is used, but the level can be adjusted using the
  18 +hidden ``confidence`` parameter. For power law models, an alternative
  19 +calculation method can be specified by setting the hidden parameter
  20 +``method=ENVELOPE``. By using this method, the envelope is computed by
  21 +evaluating for each energy the minimum and maximum intensity of all power
  22 +law models that fall within the error ellipse of the prefactor and index
  23 +parameters. The error ellipse is derived from the covariance matrix of a
  24 +maximum likelihood fit.
21 25  
22 26 ctbutterfly assumes that the input model (parameter ``inmodel``) has been
23 27 adjusted using :doc:`ctlike` to the data, but if this is not the case you
... ... @@ -68,11 +72,14 @@ General parameters
68 72  
69 73 ``outfile [file]``
70 74 Output butterfly ASCII file name.
71   -
  75 +
72 76 ``(fit = no) [boolean]``
73 77 Performs maximum likelihood fitting of input model ignoring any provided
74 78 covariance matrix.
75   -
  79 +
  80 +``(method = "GAUSSIAN") <GAUSSIAN|ENVELOPE> [string]``
  81 + Computation method.
  82 +
76 83 ``(confidence = 0.68) [real]``
77 84 Confidence level for error computation.
78 85  
... ...
src/ctbin/ctbin.cpp
... ... @@ -55,7 +55,7 @@
55 55 *
56 56 * Constructs an empty event binning tool.
57 57 ***************************************************************************/
58   -ctbin::ctbin(void) : ctobservation(CTBIN_NAME, CTBIN_VERSION)
  58 +ctbin::ctbin(void) : ctobservation(CTBIN_NAME, VERSION)
59 59 {
60 60 // Initialise members
61 61 init_members();
... ... @@ -73,7 +73,7 @@ ctbin::ctbin(void) : ctobservation(CTBIN_NAME, CTBIN_VERSION)
73 73 * Constructs event binning tool from an observation container.
74 74 ***************************************************************************/
75 75 ctbin::ctbin(const GObservations& obs) :
76   - ctobservation(CTBIN_NAME, CTBIN_VERSION, obs)
  76 + ctobservation(CTBIN_NAME, VERSION, obs)
77 77 {
78 78 // Initialise members
79 79 init_members();
... ... @@ -94,7 +94,7 @@ ctbin::ctbin(const GObservations&amp; obs) :
94 94 * parameter setting.
95 95 ***************************************************************************/
96 96 ctbin::ctbin(int argc, char *argv[]) :
97   - ctobservation(CTBIN_NAME, CTBIN_VERSION, argc, argv)
  97 + ctobservation(CTBIN_NAME, VERSION, argc, argv)
98 98 {
99 99 // Initialise members
100 100 init_members();
... ...
src/ctbin/ctbin.hpp
... ... @@ -31,8 +31,7 @@
31 31 #include "ctobservation.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define CTBIN_NAME "ctbin"
35   -#define CTBIN_VERSION "1.2.0"
  34 +#define CTBIN_NAME "ctbin"
36 35  
37 36  
38 37 /***********************************************************************//**
... ...
src/ctbkgcube/ctbkgcube.cpp
... ... @@ -50,7 +50,7 @@
50 50 /***********************************************************************//**
51 51 * @brief Void constructor
52 52 ***************************************************************************/
53   -ctbkgcube::ctbkgcube(void) : ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION)
  53 +ctbkgcube::ctbkgcube(void) : ctobservation(CTBKGCUBE_NAME, VERSION)
54 54 {
55 55 // Initialise members
56 56 init_members();
... ... @@ -69,7 +69,7 @@ ctbkgcube::ctbkgcube(void) : ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION)
69 69 * observations container.
70 70 ***************************************************************************/
71 71 ctbkgcube::ctbkgcube(const GObservations& obs) :
72   - ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION, obs)
  72 + ctobservation(CTBKGCUBE_NAME, VERSION, obs)
73 73 {
74 74 // Initialise members
75 75 init_members();
... ... @@ -87,7 +87,7 @@ ctbkgcube::ctbkgcube(const GObservations&amp; obs) :
87 87 * @param[in] argv Array of command line arguments.
88 88 ***************************************************************************/
89 89 ctbkgcube::ctbkgcube(int argc, char *argv[]) :
90   - ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION, argc, argv)
  90 + ctobservation(CTBKGCUBE_NAME, VERSION, argc, argv)
91 91 {
92 92 // Initialise members
93 93 init_members();
... ...
src/ctbkgcube/ctbkgcube.hpp
... ... @@ -33,8 +33,7 @@
33 33 #include "ctobservation.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTBKGCUBE_NAME "ctbkgcube"
37   -#define CTBKGCUBE_VERSION "1.1.0"
  36 +#define CTBKGCUBE_NAME "ctbkgcube"
38 37  
39 38  
40 39 /***********************************************************************//**
... ...
src/ctbutterfly/ctbutterfly.cpp
1 1 /***************************************************************************
2 2 * ctbutterfly - butterfly calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2016 by Michael Mayer *
  4 + * copyright (C) 2014-2017 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -52,7 +52,7 @@
52 52 /***********************************************************************//**
53 53 * @brief Void constructor
54 54 ***************************************************************************/
55   -ctbutterfly::ctbutterfly(void) : ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION)
  55 +ctbutterfly::ctbutterfly(void) : ctlikelihood(CTBUTTERFLY_NAME, VERSION)
56 56 {
57 57 // Initialise members
58 58 init_members();
... ... @@ -71,7 +71,7 @@ ctbutterfly::ctbutterfly(void) : ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERS
71 71 * observations container.
72 72 ***************************************************************************/
73 73 ctbutterfly::ctbutterfly(const GObservations& obs) :
74   - ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION, obs)
  74 + ctlikelihood(CTBUTTERFLY_NAME, VERSION, obs)
75 75 {
76 76 // Initialise members
77 77 init_members();
... ... @@ -89,7 +89,7 @@ ctbutterfly::ctbutterfly(const GObservations&amp; obs) :
89 89 * @param[in] argv Array of command line arguments.
90 90 ***************************************************************************/
91 91 ctbutterfly::ctbutterfly(int argc, char *argv[]) :
92   - ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION, argc, argv)
  92 + ctlikelihood(CTBUTTERFLY_NAME, VERSION, argc, argv)
93 93 {
94 94 // Initialise members
95 95 init_members();
... ... @@ -243,11 +243,14 @@ void ctbutterfly::run(void)
243 243 m_obs.optimize(m_opt);
244 244 m_obs.errors(m_opt);
245 245  
246   - // Get covariance matrix by inverting the curvature matrix. Note that
247   - // the curvature matrix is for the unscaled parameters, hence we have
248   - // to scale them before we can proceed.
  246 + // Get covariance matrix.
249 247 GObservations::likelihood likelihood = m_obs.function();
250   - m_covariance = likelihood.curvature()->invert();
  248 + if (m_method == "GAUSSIAN") {
  249 + m_covariance = likelihood.curvature()->invert();
  250 + }
  251 + else {
  252 + m_covariance = likelihood.covariance();
  253 + }
251 254  
252 255 // Write optimizer, optimised model and covariance matrix into logger
253 256 log_string(NORMAL, m_opt.print(m_chatter));
... ... @@ -271,157 +274,26 @@ void ctbutterfly::run(void)
271 274 GObservations::likelihood likelihood = m_obs.function();
272 275 likelihood.eval(pars);
273 276  
274   - // Get covariance matrix by inverting the curvature matrix. Note that
275   - // the curvature matrix is for the unscaled parameters, hence we have
276   - // to scale them before we can proceed.
277   - m_covariance = likelihood.curvature()->invert();
  277 + // Get covariance matrix.
  278 + if (m_method == "GAUSSIAN") {
  279 + m_covariance = likelihood.curvature()->invert();
  280 + }
  281 + else {
  282 + m_covariance = likelihood.covariance();
  283 + }
278 284  
279 285 // Write covariance matrix into logger
280 286 log_string(EXPLICIT, m_covariance.print(m_chatter));
281 287  
282 288 } // endif: covariance computation needed
283 289  
284   - // Write header into logger
285   - log_header1(TERSE, "Prepare butterfly computation");
286   -
287   - // Find parameter indices. We do this by the memory location of the
288   - // model parameters.
289   - GModelSky* skymodel = dynamic_cast<GModelSky*>(models[m_srcname]);
290   - GModelPar* par_prefactor = &(*skymodel)["Prefactor"];
291   - GModelPar* par_index = &(*skymodel)["Index"];
292   - int inx_prefactor = -1;
293   - int inx_index = -1;
294   - for (int i = 0; i < models.npars(); ++i) {
295   - if (models.pars()[i] == par_prefactor) {
296   - inx_prefactor = i;
297   - }
298   - if (models.pars()[i] == par_index) {
299   - inx_index = i;
300   - }
  290 + // Compute butterfly depending on selected method
  291 + if (m_method == "GAUSSIAN") {
  292 + gaussian_error_propagation(models);
  293 + }
  294 + else {
  295 + ellipsoid_boundary(models);
301 296 }
302   -
303   - // Store model values and scales
304   - double prefactor_mean = (*skymodel)["Prefactor"].value();
305   - double index_mean = (*skymodel)["Index"].value();
306   - double pivot_mean = (*skymodel)["PivotEnergy"].value();
307   - double prefactor_scale = (*skymodel)["Prefactor"].scale();
308   - double index_scale = (*skymodel)["Index"].scale();
309   - GEnergy pivot(pivot_mean, "MeV");
310   -
311   - // Write parameter indices into logger
312   - log_value(NORMAL, "Prefactor", gammalib::str(prefactor_mean)+
313   - " ph/cm2/s/MeV ("+gammalib::str(inx_prefactor)+")");
314   - log_value(NORMAL, "Index", gammalib::str(index_mean)+
315   - " ("+gammalib::str(inx_index)+")");
316   - log_value(NORMAL, "Pivot energy", pivot.print());
317   -
318   - // Extract covariance elements
319   - double cov_pp = m_covariance(inx_prefactor,inx_prefactor);
320   - double cov_pg = m_covariance(inx_prefactor,inx_index);
321   - double cov_gg = m_covariance(inx_index,inx_index);
322   -
323   - // Compute eigenvectors and eigenvalues
324   - double lambda1;
325   - double lambda2;
326   - GVector vector1(2);
327   - GVector vector2(2);
328   - eigenvectors(cov_pp, cov_pg, cov_pg, cov_gg,
329   - &lambda1, &lambda2, &vector1, &vector2);
330   -
331   - // Write eigenvectors and eigenvalues into logger
332   - log_value(NORMAL, "Eigenvalue 1", lambda1);
333   - log_value(NORMAL, "Eigenvalue 2", lambda2);
334   - log_value(NORMAL, "Eigenvector 1", vector1.print());
335   - log_value(NORMAL, "Eigenvector 2", vector2.print());
336   -
337   - // Confidence scaling
338   - double sigma = gammalib::erfinv(m_confidence) * gammalib::sqrt_two;
339   - double scale = (sigma*sigma);
340   -
341   - // Write confidence level information into logger
342   - log_value(NORMAL, "Confidence level", m_confidence);
343   - log_value(NORMAL, "Corresponding scaling", scale);
344   -
345   - // Compute minor and major axes of error ellipse
346   - double major = scale*std::sqrt(lambda1);
347   - double minor = scale*std::sqrt(lambda2);
348   -
349   - // Write header into logger
350   - log_header1(TERSE, "Generate butterfly");
351   -
352   - // Initialise result arrays
353   - m_energies.assign(m_ebounds.size(), 0.0);
354   - m_intensities.assign(m_ebounds.size(), 0.0);
355   - m_min_intensities.assign(m_ebounds.size(), 1e30);
356   - m_max_intensities.assign(m_ebounds.size(), 0.0);
357   -
358   - // Walk around the error ellipse
359   - int nt = 360;
360   - double dt = gammalib::twopi/double(nt);
361   - double t = 0.0;
362   - for (int i = 0; i < nt; ++i, t += dt) {
363   -
364   - // Pre-compute sin and cosine
365   - double sin_t = std::sin(t);
366   - double cos_t = std::cos(t);
367   -
368   - // Compute prefactor and index
369   - double prefactor = (major * cos_t * vector1[0] +
370   - minor * sin_t * vector2[0]) * prefactor_scale +
371   - prefactor_mean;
372   - double index = (major * cos_t * vector1[1] +
373   - minor * sin_t * vector2[1]) * index_scale +
374   - index_mean;
375   -
376   - // Write prefactor and index into logger
377   - log_value(EXPLICIT, "Angle "+gammalib::str(t*gammalib::rad2deg),
378   - gammalib::str(prefactor)+" ph/cm2/s/MeV; "+
379   - gammalib::str(index));
380   -
381   - // Setup power law model
382   - GModelSpectralPlaw plaw(prefactor, index, pivot);
383   -
384   - // Evaluate power law at each energy and extract minimum and
385   - // maximum intensity
386   - for (int k = 0; k < m_ebounds.size(); ++k) {
387   -
388   - // Get the energy of current bin
389   - GTime time;
390   - GEnergy energy = m_ebounds.elogmean(k);
391   -
392   - // Evaluate power law
393   - double intensity = plaw.eval(energy, time);
394   -
395   - // Get extremes
396   - if (intensity < m_min_intensities[k]) {
397   - m_min_intensities[k] = intensity;
398   - }
399   - if (intensity > m_max_intensities[k]) {
400   - m_max_intensities[k] = intensity;
401   - }
402   -
403   - } // endfor: looped over all energies
404   -
405   - } // endfor: looped over all angles
406   -
407   - // Setup power law model for mean prefactor and index
408   - GModelSpectralPlaw plaw(prefactor_mean, index_mean, pivot);
409   -
410   - // Compute energy and intensity vectors for mean power law
411   - for (int k = 0; k < m_ebounds.size(); ++k) {
412   -
413   - // Get the energy of current bin
414   - GTime time;
415   - GEnergy energy = m_ebounds.elogmean(k);
416   -
417   - // Evaluate power law
418   - double intensity = plaw.eval(energy, time);
419   -
420   - // Store results
421   - m_energies[k] = energy.MeV();
422   - m_intensities[k] = intensity;
423   -
424   - } // endfor: looped over energies
425 297  
426 298 // Write header into logger
427 299 log_header1(TERSE, "Results");
... ... @@ -431,11 +303,11 @@ void ctbutterfly::run(void)
431 303  
432 304 // Write results into logger
433 305 log_value(NORMAL, "Intensity at "+gammalib::str(m_energies[k])+" MeV",
434   - gammalib::str(m_intensities[k])+" ("+
435   - gammalib::str(m_min_intensities[k])+", "+
436   - gammalib::str(m_max_intensities[k])+") ph/cm2/s/MeV");
  306 + gammalib::str(m_intensities[k])+" ("+
  307 + gammalib::str(m_min_intensities[k])+", "+
  308 + gammalib::str(m_max_intensities[k])+") ph/cm2/s/MeV");
437 309  
438   - } // endfor: looped over energies
  310 + } //endfor: loop over energy bin
439 311  
440 312 // Restore energy dispersion flag for all CTA observations
441 313 for (int i = 0; i < m_obs.size(); ++i) {
... ... @@ -504,6 +376,7 @@ void ctbutterfly::init_members(void)
504 376 {
505 377 // Initialise members
506 378 m_srcname.clear();
  379 + m_method.clear();
507 380 m_confidence = 0.68;
508 381 m_max_iter = 50;
509 382 m_apply_edisp = false;
... ... @@ -537,6 +410,7 @@ void ctbutterfly::copy_members(const ctbutterfly&amp; app)
537 410 {
538 411 // Copy attributes
539 412 m_srcname = app.m_srcname;
  413 + m_method = app.m_method;
540 414 m_confidence = app.m_confidence;
541 415 m_max_iter = app.m_max_iter;
542 416 m_apply_edisp = app.m_apply_edisp;
... ... @@ -544,7 +418,7 @@ void ctbutterfly::copy_members(const ctbutterfly&amp; app)
544 418 m_chatter = app.m_chatter;
545 419 m_ebounds = app.m_ebounds;
546 420 m_outfile = app.m_outfile;
547   -
  421 +
548 422 // Copy protected members
549 423 m_covariance = app.m_covariance;
550 424 m_energies = app.m_energies;
... ... @@ -583,16 +457,13 @@ void ctbutterfly::get_parameters(void)
583 457 {
584 458 // Setup observations from "inobs" parameter
585 459 setup_observations(m_obs);
586   -
  460 +
587 461 // Setup models from "inmodel" parameter
588 462 setup_models(m_obs, (*this)["srcname"].string());
589 463  
590 464 // Get name of test source
591 465 m_srcname = (*this)["srcname"].string();
592 466  
593   - // Check model name and type
594   - check_model();
595   -
596 467 // Create energy boundaries from user parameters
597 468 m_ebounds = create_ebounds();
598 469  
... ... @@ -600,18 +471,22 @@ void ctbutterfly::get_parameters(void)
600 471 std::string matrixfilename = (*this)["matrix"].filename();
601 472 if (matrixfilename != "NONE") {
602 473 std::string msg = "Loading of matrix from file not implemented yet. "
603   - "Use filename = \"NONE\" to induce a recomputation of "
604   - "the matrix internally.";
  474 + "Use filename = \"NONE\" to induce a recomputation of "
  475 + "the matrix internally.";
605 476 throw GException::feature_not_implemented(G_GET_PARAMETERS, msg);
606 477 // m_covariance.load(matrixfilename);
607 478 }
608 479  
609 480 // Get remaining parameters
610 481 m_apply_edisp = (*this)["edisp"].boolean();
  482 + m_method = (*this)["method"].string();
611 483 m_confidence = (*this)["confidence"].real();
612 484 m_fit = (*this)["fit"].boolean();
613 485 m_chatter = static_cast<GChatter>((*this)["chatter"].integer());
614 486  
  487 + // Check model name and type
  488 + check_model();
  489 +
615 490 // Optionally read ahead parameters so that they get correctly
616 491 // dumped into the log file
617 492 if (read_ahead()) {
... ... @@ -627,6 +502,273 @@ void ctbutterfly::get_parameters(void)
627 502  
628 503  
629 504 /***********************************************************************//**
  505 + * @brief Compute butterfly using the ellipsoid boundary method
  506 + ***************************************************************************/
  507 +void ctbutterfly::ellipsoid_boundary(GModels& models)
  508 +{
  509 + // Write header into logger
  510 + log_header1(TERSE, "Prepare butterfly computation");
  511 +
  512 + // Find parameter indices. We do this by the memory location of the
  513 + // model parameters.
  514 + GModelSky* skymodel = dynamic_cast<GModelSky*>(models[m_srcname]);
  515 + GModelPar* par_prefactor = &(*skymodel)["Prefactor"];
  516 + GModelPar* par_index = &(*skymodel)["Index"];
  517 + int inx_prefactor = -1;
  518 + int inx_index = -1;
  519 + for (int i = 0; i < models.npars(); ++i) {
  520 + if (models.pars()[i] == par_prefactor) {
  521 + inx_prefactor = i;
  522 + }
  523 + if (models.pars()[i] == par_index) {
  524 + inx_index = i;
  525 + }
  526 + }
  527 +
  528 + // Store model values
  529 + double prefactor_mean = (*skymodel)["Prefactor"].value();
  530 + double index_mean = (*skymodel)["Index"].value();
  531 + double pivot_mean = (*skymodel)["PivotEnergy"].value();
  532 + double prefactor_scale = (*skymodel)["Prefactor"].scale();
  533 + double index_scale = (*skymodel)["Index"].scale();
  534 + GEnergy pivot(pivot_mean, "MeV");
  535 +
  536 + // Write parameter indices into logger
  537 + log_value(NORMAL, "Prefactor", gammalib::str(prefactor_mean)+
  538 + " ph/cm2/s/MeV ("+
  539 + gammalib::str(inx_prefactor)+")");
  540 + log_value(NORMAL, "Index", gammalib::str(index_mean)+
  541 + " ("+gammalib::str(inx_index)+")");
  542 + log_value(NORMAL, "Pivot energy", pivot.print());
  543 +
  544 + // Extract covariance elements
  545 + double cov_pp = m_covariance(inx_prefactor,inx_prefactor);
  546 + double cov_pg = m_covariance(inx_prefactor,inx_index);
  547 + double cov_gg = m_covariance(inx_index,inx_index);
  548 +
  549 + // Compute eigenvectors and eigenvalues
  550 + double lambda1;
  551 + double lambda2;
  552 + GVector vector1(2);
  553 + GVector vector2(2);
  554 + eigenvectors(cov_pp, cov_pg, cov_pg, cov_gg,
  555 + &lambda1, &lambda2, &vector1, &vector2);
  556 +
  557 + // Write eigenvectors and eigenvalues into logger
  558 + log_value(NORMAL, "Eigenvalue 1", lambda1);
  559 + log_value(NORMAL, "Eigenvalue 2", lambda2);
  560 + log_value(NORMAL, "Eigenvector 1", vector1.print());
  561 + log_value(NORMAL, "Eigenvector 2", vector2.print());
  562 +
  563 + // Confidence scaling, calculated from a Chi-Sqr.
  564 + // distribution with 2 dof
  565 + double scale = std::sqrt( -2. * std::log(1.-m_confidence) );
  566 +
  567 + // Write confidence level information into logger
  568 + log_value(NORMAL, "Confidence level", m_confidence);
  569 + log_value(NORMAL, "Corresponding scaling", scale);
  570 +
  571 + // Compute minor and major axes of error ellipse
  572 + double major = scale*std::sqrt(lambda1);
  573 + double minor = scale*std::sqrt(lambda2);
  574 +
  575 + // Write header into logger
  576 + log_header1(TERSE, "Generate butterfly");
  577 +
  578 + // Initialise result arrays
  579 + m_energies.assign(m_ebounds.size(), 0.0);
  580 + m_intensities.assign(m_ebounds.size(), 0.0);
  581 + m_min_intensities.assign(m_ebounds.size(), 1e30);
  582 + m_max_intensities.assign(m_ebounds.size(), 0.0);
  583 +
  584 + // Walk around the error ellipse
  585 + int nt = 360;
  586 + double dt = gammalib::twopi/double(nt);
  587 + double t = 0.0;
  588 + for (int i = 0; i < nt; ++i, t += dt) {
  589 +
  590 + // Pre-compute sin and cosine
  591 + double sin_t = std::sin(t);
  592 + double cos_t = std::cos(t);
  593 +
  594 + // Compute prefactor and index
  595 + double prefactor = (major * cos_t * vector1[0] +
  596 + minor * sin_t * vector2[0]) * prefactor_scale +
  597 + prefactor_mean;
  598 + double index = (major * cos_t * vector1[1] +
  599 + minor * sin_t * vector2[1]) * index_scale +
  600 + index_mean;
  601 +
  602 + // Write prefactor and index into logger
  603 + log_value(EXPLICIT, "Angle "+gammalib::str(t*gammalib::rad2deg),
  604 + gammalib::str(prefactor)+" ph/cm2/s/MeV; "+
  605 + gammalib::str(index));
  606 +
  607 + // Setup power law model
  608 + GModelSpectralPlaw plaw(prefactor, index, pivot);
  609 +
  610 + // Evaluate power law at each energy and extract minimum and
  611 + // maximum intensity
  612 + for (int k = 0; k < m_ebounds.size(); ++k) {
  613 +
  614 + // Get the energy of current bin
  615 + GTime time;
  616 + GEnergy energy = m_ebounds.elogmean(k);
  617 +
  618 + // Evaluate power law
  619 + double intensity = plaw.eval(energy, time);
  620 +
  621 + // Get extremes
  622 + if (intensity < m_min_intensities[k]) {
  623 + m_min_intensities[k] = intensity;
  624 + }
  625 + if (intensity > m_max_intensities[k]) {
  626 + m_max_intensities[k] = intensity;
  627 + }
  628 +
  629 + } // endfor: looped over all energies
  630 +
  631 + } // endfor: looped over all angles
  632 +
  633 + // Setup power law model for mean prefactor and index
  634 + GModelSpectralPlaw plaw(prefactor_mean, index_mean, pivot);
  635 +
  636 + // Compute energy and intensity vectors for mean power law
  637 + for (int k = 0; k < m_ebounds.size(); ++k) {
  638 +
  639 + // Get the energy of current bin
  640 + GTime time;
  641 + GEnergy energy = m_ebounds.elogmean(k);
  642 +
  643 + // Evaluate power law
  644 + double intensity = plaw.eval(energy, time);
  645 +
  646 + // Store results
  647 + m_energies[k] = energy.MeV();
  648 + m_intensities[k] = intensity;
  649 +
  650 + } // endfor: looped over energies
  651 +
  652 + // Return
  653 + return;
  654 +}
  655 +
  656 +
  657 +/***********************************************************************//**
  658 + * @brief Compute butterfly using Gaussian error propagation
  659 + *
  660 + * Computes the butterfly diagram using Gaussian error propagation. This
  661 + * works for any kind of model.
  662 + ***************************************************************************/
  663 +void ctbutterfly::gaussian_error_propagation(GModels& models)
  664 +{
  665 + // Write header into logger
  666 + log_header1(TERSE, "Prepare butterfly computation");
  667 +
  668 + // Confidence scaling
  669 + double scale = gammalib::erfinv(m_confidence) * gammalib::sqrt_two;
  670 +
  671 + // Write confidence level information into logger
  672 + log_value(NORMAL, "Confidence level", m_confidence);
  673 + log_value(NORMAL, "Corresponding scaling", scale);
  674 +
  675 + // Write header into logger
  676 + log_header1(TERSE, "Generate butterfly");
  677 +
  678 + // Initialise dummy time to evaluate spectral model
  679 + GTime time = GTime();
  680 +
  681 + // Initialise vector of gradients
  682 + GVector grad = GVector(m_obs.models().npars());
  683 +
  684 + // Loop over energy bins
  685 + for (int i = 0; i < m_ebounds.size(); ++i) {
  686 +
  687 + // Initialise number of gradients
  688 + int num_gradient = 0;
  689 +
  690 + // Get the mean logarithmic energy of current bin
  691 + GEnergy energy = m_ebounds.elogmean(i);
  692 +
  693 + // Initialise model flux value
  694 + double model_flux = 0.0;
  695 +
  696 + // Loop over models
  697 + for (int j = 0; j < models.size(); ++j) {
  698 +
  699 + // Check wether model is a skymodel
  700 + GModelSky* skymodel = dynamic_cast<GModelSky*>(models[j]);
  701 +
  702 + // Yes ...
  703 + if (skymodel != NULL) {
  704 +
  705 + // Set flux value of source of interest, evaluate gradients
  706 + if (skymodel->name() == m_srcname) {
  707 +
  708 + // Get spectral component of model
  709 + GModelSpectral *spectral = skymodel->spectral();
  710 +
  711 + // Get model flux
  712 + model_flux = spectral->eval(energy, time, true);
  713 +
  714 + // Loop over all model parameters
  715 + for (int k = 0; k < skymodel->size(); ++k) {
  716 +
  717 + // Set gradient if we deal with spectral component
  718 + bool parIsSpectral = false;
  719 + for (int l = 0; l < spectral->size(); ++l) {
  720 + if ((&((*spectral)[l])) == (&((*skymodel)[k]))) {
  721 + grad[num_gradient] = (*spectral)[l].gradient();
  722 + num_gradient++;
  723 + parIsSpectral = true;
  724 + break;
  725 + }
  726 + } // endfor: looped over spectral parameters
  727 +
  728 + // If parameter is spatial or temporal, count up
  729 + if (!parIsSpectral) {
  730 + num_gradient++;
  731 + }
  732 +
  733 + } // endfor: looped over all model parameters
  734 +
  735 + } // endif: model was source of interest
  736 + else {
  737 + num_gradient += skymodel->size();
  738 + }
  739 +
  740 + } // endif: model was sky model
  741 +
  742 + // Skip other models (e.g. GModelData instances)
  743 + else {
  744 + num_gradient += models[j]->size();
  745 + }
  746 +
  747 + } // endfor: Looped over models
  748 +
  749 + // Multiply covariance to the gradient vector
  750 + GVector vector = m_covariance * grad;
  751 +
  752 + // Get the error from the scalar product
  753 + double error = std::sqrt(grad * vector);
  754 +
  755 + // Multiply with confidence scaling
  756 + error *= scale;
  757 +
  758 + // Store flux, value and energy for saving
  759 + m_intensities.push_back(model_flux);
  760 + m_energies.push_back(energy.MeV());
  761 + m_min_intensities.push_back(model_flux-error);
  762 + m_max_intensities.push_back(model_flux+error);
  763 +
  764 + } // endfor: Looped over energy bins
  765 +
  766 + // Return
  767 + return;
  768 +}
  769 +
  770 +
  771 +/***********************************************************************//**
630 772 * @brief Check if sky model is valid
631 773 *
632 774 * @exception GException::invalid_value
... ... @@ -645,17 +787,22 @@ void ctbutterfly::check_model(void)
645 787 GModelSky* model = dynamic_cast<GModelSky*>(models[m_srcname]);
646 788 if (model == NULL) {
647 789 std::string msg = "Source \""+m_srcname+"\" is not a sky model. "
648   - "Please specify the name of a sky model for "
649   - "butterfly computation.";
  790 + "Please specify the name of a sky model for "
  791 + "butterfly computation.";
650 792 throw GException::invalid_value(G_CHECK_MODEL, msg);
651 793 }
652 794  
653   - // Check that the spectral model is a power law
654   - if (model->spectral()->type() != "PowerLaw") {
655   - std::string msg = "\""+model->spectral()->type()+"\" cannot be "
656   - "used as spectral model for an butterfly "
657   - "computation. Please specify a power law model.";
658   - throw GException::invalid_value(G_CHECK_MODEL, msg);
  795 + // Check that the spectral model is a power law for the "ENVELOPE"
  796 + // method
  797 + if (m_method == "ENVELOPE") {
  798 + if (model->spectral()->type() != "PowerLaw") {
  799 + std::string msg = "\""+model->spectral()->type()+"\" cannot be "
  800 + "used as spectral model for an butterfly "
  801 + "computation with method=ENVELOPE. Please "
  802 + "specify a power law model or switch to "
  803 + "method=GAUSSIAN.";
  804 + throw GException::invalid_value(G_CHECK_MODEL, msg);
  805 + }
659 806 }
660 807  
661 808 } // endif: source model existed
... ... @@ -663,8 +810,8 @@ void ctbutterfly::check_model(void)
663 810 // Otherwise throw an exception
664 811 else {
665 812 std::string msg = "Source \""+m_srcname+"\" not found in model "
666   - "container. Please add a source with that name "
667   - "or check for possible typos.";
  813 + "container. Please add a source with that name "
  814 + "or check for possible typos.";
668 815 throw GException::invalid_value(G_CHECK_MODEL, msg);
669 816 }
670 817  
... ... @@ -689,13 +836,13 @@ void ctbutterfly::check_model(void)
689 836 * http://www.math.harvard.edu/archive/21b_fall_04/exhibits/2dmatrices/index.html
690 837 ***************************************************************************/
691 838 void ctbutterfly::eigenvectors(const double& a,
692   - const double& b,
693   - const double& c,
694   - const double& d,
695   - double* lambda1,
696   - double* lambda2,
697   - GVector* vector1,
698   - GVector* vector2)
  839 + const double& b,
  840 + const double& c,
  841 + const double& d,
  842 + double* lambda1,
  843 + double* lambda2,
  844 + GVector* vector1,
  845 + GVector* vector2)
699 846 {
700 847 // Compute trace and determinant
701 848 double trace = a + d;
... ... @@ -730,7 +877,7 @@ void ctbutterfly::eigenvectors(const double&amp; a,
730 877 // Normalize eigenvectors
731 878 *vector1 /= norm(*vector1);
732 879 *vector2 /= norm(*vector2);
733   -
  880 +
734 881 // Return
735 882 return;
736 883 }
... ...
src/ctbutterfly/ctbutterfly.hpp
1 1 /***************************************************************************
2 2 * ctbutterfly - butterfly calculation tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2014-2016 by Michael Mayer *
  4 + * copyright (C) 2014-2017 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -33,8 +33,7 @@
33 33 #include "ctlikelihood.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTBUTTERFLY_NAME "ctbutterfly"
37   -#define CTBUTTERFLY_VERSION "1.1.0"
  36 +#define CTBUTTERFLY_NAME "ctbutterfly"
38 37  
39 38  
40 39 /***********************************************************************//**
... ... @@ -77,6 +76,10 @@ protected:
77 76 void copy_members(const ctbutterfly& app);
78 77 void free_members(void);
79 78 void get_parameters(void);
  79 + void gaussian_error_propagation(GModels& models);
  80 + void ellipsoid_boundary(GModels& models);
  81 +
  82 +
80 83 void check_model(void);
81 84 void eigenvectors(const double& a,
82 85 const double& b,
... ... @@ -89,6 +92,7 @@ protected:
89 92  
90 93 // User parameters
91 94 std::string m_srcname; //!< Name of source to compute butterfly
  95 + std::string m_method; //!< Computation method
92 96 double m_confidence; //!< Confidence level
93 97 int m_max_iter; //!< Maximum number of iterations
94 98 bool m_apply_edisp; //!< Apply energy dispersion?
... ...
src/ctbutterfly/ctbutterfly.par
... ... @@ -27,6 +27,7 @@ caldb, s, a, &quot;prod2&quot;,,, &quot;Calibration database&quot;
27 27 irf, s, a, "South_0.5h",,, "Instrument response function"
28 28 edisp, b, h, no,,, "Apply energy dispersion?"
29 29 outfile, f, a, "butterfly.txt",,, "Output ASCII file"
  30 +method, s, h, GAUSSIAN, GAUSSIAN|ENVELOPE,,"Butterfly computation method"
30 31  
31 32 #
32 33 # Butterfly parameters
... ...
src/ctcubemask/ctcubemask.cpp
... ... @@ -51,7 +51,7 @@
51 51 /***********************************************************************//**
52 52 * @brief Void constructor
53 53 ***************************************************************************/
54   -ctcubemask::ctcubemask(void) : ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION)
  54 +ctcubemask::ctcubemask(void) : ctobservation(CTCUBEMASK_NAME, VERSION)
55 55 {
56 56 // Initialise members
57 57 init_members();
... ... @@ -70,7 +70,7 @@ ctcubemask::ctcubemask(void) : ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION
70 70 * an observation container.
71 71 ***************************************************************************/
72 72 ctcubemask::ctcubemask(const GObservations& obs) :
73   - ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION, obs)
  73 + ctobservation(CTCUBEMASK_NAME, VERSION, obs)
74 74 {
75 75 // Initialise members
76 76 init_members();
... ... @@ -89,7 +89,7 @@ ctcubemask::ctcubemask(const GObservations&amp; obs) :
89 89 * @param[in] argv Array of command line arguments.
90 90 ***************************************************************************/
91 91 ctcubemask::ctcubemask(int argc, char *argv[]) :
92   - ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION, argc, argv)
  92 + ctobservation(CTCUBEMASK_NAME, VERSION, argc, argv)
93 93 {
94 94 // Initialise members
95 95 init_members();
... ...
src/ctcubemask/ctcubemask.hpp
... ... @@ -35,8 +35,7 @@
35 35 #include "ctobservation.hpp"
36 36  
37 37 /* __Definitions _________________________________________________________ */
38   -#define CTCUBEMASK_NAME "ctcubemask"
39   -#define CTCUBEMASK_VERSION "1.2.0"
  38 +#define CTCUBEMASK_NAME "ctcubemask"
40 39  
41 40  
42 41 /***********************************************************************//**
... ...
src/ctedispcube/ctedispcube.cpp
... ... @@ -52,7 +52,7 @@
52 52 *
53 53 * Constructs an empty energy dispersion tool.
54 54 ***************************************************************************/
55   -ctedispcube::ctedispcube(void) : ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION)
  55 +ctedispcube::ctedispcube(void) : ctobservation(CTEDISPCUBE_NAME, VERSION)
56 56 {
57 57 // Initialise members
58 58 init_members();
... ... @@ -71,7 +71,7 @@ ctedispcube::ctedispcube(void) : ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VER
71 71 * in an observation container @p obs.
72 72 ***************************************************************************/
73 73 ctedispcube::ctedispcube(const GObservations& obs) :
74   - ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION, obs)
  74 + ctobservation(CTEDISPCUBE_NAME, VERSION, obs)
75 75 {
76 76 // Initialise members
77 77 init_members();
... ... @@ -92,7 +92,7 @@ ctedispcube::ctedispcube(const GObservations&amp; obs) :
92 92 * on the command line.
93 93 ***************************************************************************/
94 94 ctedispcube::ctedispcube(int argc, char *argv[]) :
95   - ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION, argc, argv)
  95 + ctobservation(CTEDISPCUBE_NAME, VERSION, argc, argv)
96 96 {
97 97 // Initialise members
98 98 init_members();
... ...
src/ctedispcube/ctedispcube.hpp
... ... @@ -33,8 +33,7 @@
33 33 #include "ctobservation.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTEDISPCUBE_NAME "ctedispcube"
37   -#define CTEDISPCUBE_VERSION "1.1.0"
  36 +#define CTEDISPCUBE_NAME "ctedispcube"
38 37  
39 38  
40 39 /***********************************************************************//**
... ...
src/cterror/cterror.cpp
... ... @@ -52,7 +52,7 @@
52 52 *
53 53 * Constructs an empty cterror tool.
54 54 ***************************************************************************/
55   -cterror::cterror(void) : ctlikelihood(CTERROR_NAME, CTERROR_VERSION)
  55 +cterror::cterror(void) : ctlikelihood(CTERROR_NAME, VERSION)
56 56 {
57 57 // Initialise members
58 58 init_members();
... ... @@ -70,7 +70,7 @@ cterror::cterror(void) : ctlikelihood(CTERROR_NAME, CTERROR_VERSION)
70 70 * Constructs cterror tool from an observations container.
71 71 ***************************************************************************/
72 72 cterror::cterror(const GObservations& obs) :
73   - ctlikelihood(CTERROR_NAME, CTERROR_VERSION, obs)
  73 + ctlikelihood(CTERROR_NAME, VERSION, obs)
74 74 {
75 75 // Initialise members
76 76 init_members();
... ... @@ -90,7 +90,7 @@ cterror::cterror(const GObservations&amp; obs) :
90 90 * parameters that are provided as command line arguments.
91 91 ***************************************************************************/
92 92 cterror::cterror(int argc, char *argv[]) :
93   - ctlikelihood(CTERROR_NAME, CTERROR_VERSION, argc, argv)
  93 + ctlikelihood(CTERROR_NAME, VERSION, argc, argv)
94 94 {
95 95 // Initialise members
96 96 init_members();
... ...
src/cterror/cterror.hpp
... ... @@ -31,8 +31,7 @@
31 31 #include "ctlikelihood.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define CTERROR_NAME "cterror"
35   -#define CTERROR_VERSION "1.2.0"
  34 +#define CTERROR_NAME "cterror"
36 35  
37 36  
38 37 /***********************************************************************//**
... ...
src/ctexpcube/ctexpcube.cpp
... ... @@ -50,7 +50,7 @@
50 50 /***********************************************************************//**
51 51 * @brief Void constructor
52 52 ***************************************************************************/
53   -ctexpcube::ctexpcube(void) : ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION)
  53 +ctexpcube::ctexpcube(void) : ctobservation(CTEXPCUBE_NAME, VERSION)
54 54 {
55 55 // Initialise members
56 56 init_members();
... ... @@ -69,7 +69,7 @@ ctexpcube::ctexpcube(void) : ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION)
69 69 * observations container.
70 70 ***************************************************************************/
71 71 ctexpcube::ctexpcube(const GObservations& obs) :
72   - ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION, obs)
  72 + ctobservation(CTEXPCUBE_NAME, VERSION, obs)
73 73 {
74 74 // Initialise members
75 75 init_members();
... ... @@ -87,7 +87,7 @@ ctexpcube::ctexpcube(const GObservations&amp; obs) :
87 87 * @param[in] argv Array of command line arguments.
88 88 ***************************************************************************/
89 89 ctexpcube::ctexpcube(int argc, char *argv[]) :
90   - ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION, argc, argv)
  90 + ctobservation(CTEXPCUBE_NAME, VERSION, argc, argv)
91 91 {
92 92 // Initialise members
93 93 init_members();
... ...
src/ctexpcube/ctexpcube.hpp
... ... @@ -33,8 +33,7 @@
33 33 #include "ctobservation.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTEXPCUBE_NAME "ctexpcube"
37   -#define CTEXPCUBE_VERSION "1.1.0"
  36 +#define CTEXPCUBE_NAME "ctexpcube"
38 37  
39 38  
40 39 /***********************************************************************//**
... ...
src/ctlike/ctlike.cpp
... ... @@ -48,7 +48,7 @@
48 48 /***********************************************************************//**
49 49 * @brief Void constructor
50 50 ***************************************************************************/
51   -ctlike::ctlike(void) : ctlikelihood(CTLIKE_NAME, CTLIKE_VERSION)
  51 +ctlike::ctlike(void) : ctlikelihood(CTLIKE_NAME, VERSION)
52 52 {
53 53 // Initialise members
54 54 init_members();
... ... @@ -66,7 +66,7 @@ ctlike::ctlike(void) : ctlikelihood(CTLIKE_NAME, CTLIKE_VERSION)
66 66 * Constructs ctlike tool from an observations container.
67 67 ***************************************************************************/
68 68 ctlike::ctlike(const GObservations& obs) :
69   - ctlikelihood(CTLIKE_NAME, CTLIKE_VERSION, obs)
  69 + ctlikelihood(CTLIKE_NAME, VERSION, obs)
70 70 {
71 71 // Initialise members
72 72 init_members();
... ... @@ -86,7 +86,7 @@ ctlike::ctlike(const GObservations&amp; obs) :
86 86 * that are provided as command line arguments.
87 87 ***************************************************************************/
88 88 ctlike::ctlike(int argc, char *argv[]) :
89   - ctlikelihood(CTLIKE_NAME, CTLIKE_VERSION, argc, argv)
  89 + ctlikelihood(CTLIKE_NAME, VERSION, argc, argv)
90 90 {
91 91 // Initialise members
92 92 init_members();
... ...
src/ctlike/ctlike.hpp
... ... @@ -31,8 +31,7 @@
31 31 #include "ctlikelihood.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define CTLIKE_NAME "ctlike"
35   -#define CTLIKE_VERSION "1.2.0"
  34 +#define CTLIKE_NAME "ctlike"
36 35  
37 36  
38 37 /***********************************************************************//**
... ...
src/ctmapcube/ctmapcube.cpp
... ... @@ -50,7 +50,7 @@
50 50 /***********************************************************************//**
51 51 * @brief Void constructor
52 52 ***************************************************************************/
53   -ctmapcube::ctmapcube(void) : ctool(CTMAPCUBE_NAME, CTMAPCUBE_VERSION)
  53 +ctmapcube::ctmapcube(void) : ctool(CTMAPCUBE_NAME, VERSION)
54 54 {
55 55 // Initialise members
56 56 init_members();
... ... @@ -67,7 +67,7 @@ ctmapcube::ctmapcube(void) : ctool(CTMAPCUBE_NAME, CTMAPCUBE_VERSION)
67 67 * @param[in] argv Array of command line arguments.
68 68 ***************************************************************************/
69 69 ctmapcube::ctmapcube(int argc, char *argv[]) :
70   - ctool(CTMAPCUBE_NAME, CTMAPCUBE_VERSION, argc, argv)
  70 + ctool(CTMAPCUBE_NAME, VERSION, argc, argv)
71 71 {
72 72 // Initialise members
73 73 init_members();
... ...
src/ctmapcube/ctmapcube.hpp
... ... @@ -33,8 +33,7 @@
33 33 #include "ctool.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTMAPCUBE_NAME "ctmapcube"
37   -#define CTMAPCUBE_VERSION "1.3.0"
  36 +#define CTMAPCUBE_NAME "ctmapcube"
38 37  
39 38  
40 39 /***********************************************************************//**
... ...
src/ctmodel/ctmodel.cpp
... ... @@ -53,7 +53,7 @@ const GEnergy g_energy_margin(1.0e-12, &quot;TeV&quot;);
53 53 /***********************************************************************//**
54 54 * @brief Void constructor
55 55 ***************************************************************************/
56   -ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION)
  56 +ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, VERSION)
57 57 {
58 58 // Initialise members
59 59 init_members();
... ... @@ -72,7 +72,7 @@ ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION)
72 72 * observations container.
73 73 ***************************************************************************/
74 74 ctmodel::ctmodel(const GObservations& obs) :
75   - ctobservation(CTMODEL_NAME, CTMODEL_VERSION, obs)
  75 + ctobservation(CTMODEL_NAME, VERSION, obs)
76 76 {
77 77 // Initialise members
78 78 init_members();
... ... @@ -90,7 +90,7 @@ ctmodel::ctmodel(const GObservations&amp; obs) :
90 90 * @param[in] argv Array of command line arguments.
91 91 ***************************************************************************/
92 92 ctmodel::ctmodel(int argc, char *argv[]) :
93   - ctobservation(CTMODEL_NAME, CTMODEL_VERSION, argc, argv)
  93 + ctobservation(CTMODEL_NAME, VERSION, argc, argv)
94 94 {
95 95 // Initialise members
96 96 init_members();
... ...
src/ctmodel/ctmodel.hpp
... ... @@ -33,8 +33,7 @@
33 33 #include "ctobservation.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTMODEL_NAME "ctmodel"
37   -#define CTMODEL_VERSION "1.1.0"
  36 +#define CTMODEL_NAME "ctmodel"
38 37  
39 38  
40 39 /***********************************************************************//**
... ...
src/ctobssim/ctobssim.cpp
... ... @@ -67,7 +67,7 @@ const double g_roi_margin = 0.5; //!&lt; Simulation radius margin (degrees)
67 67 *
68 68 * Constructs an empty ctobssim tool.
69 69 ***************************************************************************/
70   -ctobssim::ctobssim(void) : ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION)
  70 +ctobssim::ctobssim(void) : ctobservation(CTOBSSIM_NAME, VERSION)
71 71 {
72 72 // Initialise members
73 73 init_members();
... ... @@ -85,7 +85,7 @@ ctobssim::ctobssim(void) : ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION)
85 85 * Constructs ctobssim tool from an observation container.
86 86 ***************************************************************************/
87 87 ctobssim::ctobssim(const GObservations& obs) :
88   - ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION, obs)
  88 + ctobservation(CTOBSSIM_NAME, VERSION, obs)
89 89 {
90 90 // Initialise members
91 91 init_members();
... ... @@ -105,7 +105,7 @@ ctobssim::ctobssim(const GObservations&amp; obs) :
105 105 * setting.
106 106 ***************************************************************************/
107 107 ctobssim::ctobssim(int argc, char *argv[]) :
108   - ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION, argc, argv)
  108 + ctobservation(CTOBSSIM_NAME, VERSION, argc, argv)
109 109 {
110 110 // Initialise members
111 111 init_members();
... ...
src/ctobssim/ctobssim.hpp
... ... @@ -33,8 +33,7 @@
33 33 #include "ctobservation.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTOBSSIM_NAME "ctobssim"
37   -#define CTOBSSIM_VERSION "1.2.0"
  36 +#define CTOBSSIM_NAME "ctobssim"
38 37  
39 38  
40 39 /***********************************************************************//**
... ...
src/ctpsfcube/ctpsfcube.cpp
... ... @@ -49,7 +49,7 @@
49 49 /***********************************************************************//**
50 50 * @brief Void constructor
51 51 ***************************************************************************/
52   -ctpsfcube::ctpsfcube(void) : ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION)
  52 +ctpsfcube::ctpsfcube(void) : ctobservation(CTPSFCUBE_NAME, VERSION)
53 53 {
54 54 // Initialise members
55 55 init_members();
... ... @@ -68,7 +68,7 @@ ctpsfcube::ctpsfcube(void) : ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION)
68 68 * observations container.
69 69 ***************************************************************************/
70 70 ctpsfcube::ctpsfcube(const GObservations& obs) :
71   - ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION, obs)
  71 + ctobservation(CTPSFCUBE_NAME, VERSION, obs)
72 72 {
73 73 // Initialise members
74 74 init_members();
... ... @@ -86,7 +86,7 @@ ctpsfcube::ctpsfcube(const GObservations&amp; obs) :
86 86 * @param[in] argv Array of command line arguments.
87 87 ***************************************************************************/
88 88 ctpsfcube::ctpsfcube(int argc, char *argv[]) :
89   - ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION, argc, argv)
  89 + ctobservation(CTPSFCUBE_NAME, VERSION, argc, argv)
90 90 {
91 91 // Initialise members
92 92 init_members();
... ...
src/ctpsfcube/ctpsfcube.hpp
... ... @@ -33,8 +33,7 @@
33 33 #include "ctobservation.hpp"
34 34  
35 35 /* __Definitions _________________________________________________________ */
36   -#define CTPSFCUBE_NAME "ctpsfcube"
37   -#define CTPSFCUBE_VERSION "1.1.0"
  36 +#define CTPSFCUBE_NAME "ctpsfcube"
38 37  
39 38  
40 39 /***********************************************************************//**
... ...
src/ctselect/ctselect.cpp
... ... @@ -53,7 +53,7 @@
53 53 /***********************************************************************//**
54 54 * @brief Void constructor
55 55 ***************************************************************************/
56   -ctselect::ctselect(void) : ctobservation(CTSELECT_NAME, CTSELECT_VERSION)
  56 +ctselect::ctselect(void) : ctobservation(CTSELECT_NAME, VERSION)
57 57 {
58 58 // Initialise members
59 59 init_members();
... ... @@ -72,7 +72,7 @@ ctselect::ctselect(void) : ctobservation(CTSELECT_NAME, CTSELECT_VERSION)
72 72 * provided in an observation container.
73 73 ***************************************************************************/
74 74 ctselect::ctselect(const GObservations& obs) :
75   - ctobservation(CTSELECT_NAME, CTSELECT_VERSION, obs)
  75 + ctobservation(CTSELECT_NAME, VERSION, obs)
76 76 {
77 77 // Initialise members
78 78 init_members();
... ... @@ -91,7 +91,7 @@ ctselect::ctselect(const GObservations&amp; obs) :
91 91 * @param[in] argv Array of command line arguments.
92 92 ***************************************************************************/
93 93 ctselect::ctselect(int argc, char *argv[]) :
94   - ctobservation(CTSELECT_NAME, CTSELECT_VERSION, argc, argv)
  94 + ctobservation(CTSELECT_NAME, VERSION, argc, argv)
95 95 {
96 96 // Initialise members
97 97 init_members();
... ...
src/ctselect/ctselect.hpp
... ... @@ -35,8 +35,7 @@
35 35 #include "ctobservation.hpp"
36 36  
37 37 /* __Definitions _________________________________________________________ */
38   -#define CTSELECT_NAME "ctselect"
39   -#define CTSELECT_VERSION "1.2.0"
  38 +#define CTSELECT_NAME "ctselect"
40 39  
41 40  
42 41 /***********************************************************************//**
... ...
src/ctskymap/ctskymap.cpp
... ... @@ -52,7 +52,7 @@
52 52 *
53 53 * Constructs an empty sky mapping tool.
54 54 ***************************************************************************/
55   -ctskymap::ctskymap(void) : ctobservation(CTSKYMAP_NAME, CTSKYMAP_VERSION)
  55 +ctskymap::ctskymap(void) : ctobservation(CTSKYMAP_NAME, VERSION)
56 56 {
57 57 // Initialise members
58 58 init_members();
... ... @@ -70,7 +70,7 @@ ctskymap::ctskymap(void) : ctobservation(CTSKYMAP_NAME, CTSKYMAP_VERSION)
70 70 * Constructs sky mapping tool from an observation container.
71 71 ***************************************************************************/
72 72 ctskymap::ctskymap(const GObservations& obs) :
73   - ctobservation(CTSKYMAP_NAME, CTSKYMAP_VERSION, obs)
  73 + ctobservation(CTSKYMAP_NAME, VERSION, obs)
74 74 {
75 75 // Initialise members
76 76 init_members();
... ... @@ -91,7 +91,7 @@ ctskymap::ctskymap(const GObservations&amp; obs) :
91 91 * parameter setting.
92 92 ***************************************************************************/
93 93 ctskymap::ctskymap(int argc, char *argv[]) :
94   - ctobservation(CTSKYMAP_NAME, CTSKYMAP_VERSION, argc, argv)
  94 + ctobservation(CTSKYMAP_NAME, VERSION, argc, argv)
95 95 {
96 96 // Initialise members
97 97 init_members();
... ...
src/ctskymap/ctskymap.hpp
... ... @@ -32,8 +32,7 @@
32 32 #include "ctobservation.hpp"
33 33  
34 34 /* __Definitions _________________________________________________________ */
35   -#define CTSKYMAP_NAME "ctskymap"
36   -#define CTSKYMAP_VERSION "1.3.0"
  35 +#define CTSKYMAP_NAME "ctskymap"
37 36  
38 37  
39 38 /***********************************************************************//**
... ...
src/cttsmap/cttsmap.cpp
... ... @@ -51,7 +51,7 @@
51 51 *
52 52 * Constructs an empty cttsmap tool.
53 53 ***************************************************************************/
54   -cttsmap::cttsmap(void) : ctlikelihood(CTTSMAP_NAME, CTTSMAP_VERSION)
  54 +cttsmap::cttsmap(void) : ctlikelihood(CTTSMAP_NAME, VERSION)
55 55 {
56 56 // Initialise members
57 57 init_members();
... ... @@ -69,7 +69,7 @@ cttsmap::cttsmap(void) : ctlikelihood(CTTSMAP_NAME, CTTSMAP_VERSION)
69 69 * Constructs cttsmap tool from an observations container.
70 70 ***************************************************************************/
71 71 cttsmap::cttsmap(const GObservations& obs) :
72   - ctlikelihood(CTTSMAP_NAME, CTTSMAP_VERSION, obs)
  72 + ctlikelihood(CTTSMAP_NAME, VERSION, obs)
73 73 {
74 74 // Initialise members
75 75 init_members();
... ... @@ -89,7 +89,7 @@ cttsmap::cttsmap(const GObservations&amp; obs) :
89 89 * that are provided as command line arguments.
90 90 ***************************************************************************/
91 91 cttsmap::cttsmap(int argc, char *argv[]) :
92   - ctlikelihood(CTTSMAP_NAME, CTTSMAP_VERSION, argc, argv)
  92 + ctlikelihood(CTTSMAP_NAME, VERSION, argc, argv)
93 93 {
94 94 // Initialise members
95 95 init_members();
... ...
src/cttsmap/cttsmap.hpp
... ... @@ -31,8 +31,7 @@
31 31 #include "ctlikelihood.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define CTTSMAP_NAME "cttsmap"
35   -#define CTTSMAP_VERSION "1.2.0"
  34 +#define CTTSMAP_NAME "cttsmap"
36 35  
37 36  
38 37 /***********************************************************************//**
... ...
src/ctulimit/ctulimit.cpp
... ... @@ -53,7 +53,7 @@
53 53 *
54 54 * Constructs an empty ctulimit tool.
55 55 ***************************************************************************/
56   -ctulimit::ctulimit(void) : ctlikelihood(CTULIMIT_NAME, CTULIMIT_VERSION)
  56 +ctulimit::ctulimit(void) : ctlikelihood(CTULIMIT_NAME, VERSION)
57 57 {
58 58 // Initialise members
59 59 init_members();
... ... @@ -71,7 +71,7 @@ ctulimit::ctulimit(void) : ctlikelihood(CTULIMIT_NAME, CTULIMIT_VERSION)
71 71 * Constructs ctulimit tool from an observations container.
72 72 ***************************************************************************/
73 73 ctulimit::ctulimit(const GObservations& obs) :
74   - ctlikelihood(CTULIMIT_NAME, CTULIMIT_VERSION, obs)
  74 + ctlikelihood(CTULIMIT_NAME, VERSION, obs)
75 75 {
76 76 // Initialise members
77 77 init_members();
... ... @@ -92,7 +92,7 @@ ctulimit::ctulimit(const GObservations&amp; obs) :
92 92 * parameters that are provided as command line arguments.
93 93 ***************************************************************************/
94 94 ctulimit::ctulimit(int argc, char *argv[]) :
95   - ctlikelihood(CTULIMIT_NAME, CTULIMIT_VERSION, argc, argv)
  95 + ctlikelihood(CTULIMIT_NAME, VERSION, argc, argv)
96 96 {
97 97 // Initialise members
98 98 init_members();
... ...
src/ctulimit/ctulimit.hpp
... ... @@ -31,8 +31,7 @@
31 31 #include "ctlikelihood.hpp"
32 32  
33 33 /* __Definitions _________________________________________________________ */
34   -#define CTULIMIT_NAME "ctulimit"
35   -#define CTULIMIT_VERSION "1.2.0"
  34 +#define CTULIMIT_NAME "ctulimit"
36 35  
37 36  
38 37 /***********************************************************************//**
... ...