Commit 531818873d4d195e7ecc565af04a1aa3574cd824
1 parent
f3c1b389
Integrate improvement of ctbutterfly (#1862) and remove tool specific version strings
Showing
35 changed files
with
365 additions
and
354 deletions
ChangeLog
| 1 | -2017-04-05 | 1 | +2017-04-10 |
| 2 | 2 | ||
| 3 | * Version 1.3.0 released | 3 | * Version 1.3.0 released |
| 4 | ======================== | 4 | ======================== |
| 5 | 5 | ||
| 6 | + Implement Gaussian error propagation in ctbutterfly (#1862) | ||
| 6 | Copy cscripts into bin directory instead of creating a symbolic links (#1987) | 7 | Copy cscripts into bin directory instead of creating a symbolic links (#1987) |
| 7 | If code originates from Git, always compile the Python bindings (#1985) | 8 | If code originates from Git, always compile the Python bindings (#1985) |
| 8 | Raise exception instead of exiting with return code in Python tests (#1983) | 9 | Raise exception instead of exiting with return code in Python tests (#1983) |
NEWS
| 1 | New Features and Important Changes in ctools 1.3.0.dev1 | 1 | New Features and Important Changes in ctools 1.3.0.dev1 |
| 2 | 2 | ||
| 3 | -5 April 2017 | 3 | +10 April 2017 |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | Introduction | 6 | Introduction |
| @@ -113,7 +113,11 @@ None | @@ -113,7 +113,11 @@ None | ||
| 113 | 113 | ||
| 114 | ctbutterfly - Generate butterfly diagrams | 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 | ctulimit - Compute upper limit | 123 | ctulimit - Compute upper limit |
doc/source/users/reference_manual/ctbutterfly.rst
| @@ -10,7 +10,7 @@ Synopsis | @@ -10,7 +10,7 @@ Synopsis | ||
| 10 | -------- | 10 | -------- |
| 11 | 11 | ||
| 12 | This tool calculates a butterfly diagram for a specific source according to | 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 power law | 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. | 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 | 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 | 16 | using the covariance matrix from a maximum likelihood fit. By default a |
| @@ -77,7 +77,7 @@ General parameters | @@ -77,7 +77,7 @@ General parameters | ||
| 77 | Performs maximum likelihood fitting of input model ignoring any provided | 77 | Performs maximum likelihood fitting of input model ignoring any provided |
| 78 | covariance matrix. | 78 | covariance matrix. |
| 79 | 79 | ||
| 80 | -``(method = GAUSSIAN|ENVELOPE) [string]`` | 80 | +``(method = "GAUSSIAN") <GAUSSIAN|ENVELOPE> [string]`` |
| 81 | Computation method. | 81 | Computation method. |
| 82 | 82 | ||
| 83 | ``(confidence = 0.68) [real]`` | 83 | ``(confidence = 0.68) [real]`` |
src/ctbin/ctbin.cpp
| @@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
| 55 | * | 55 | * |
| 56 | * Constructs an empty event binning tool. | 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 | // Initialise members | 60 | // Initialise members |
| 61 | init_members(); | 61 | init_members(); |
| @@ -73,7 +73,7 @@ ctbin::ctbin(void) : ctobservation(CTBIN_NAME, CTBIN_VERSION) | @@ -73,7 +73,7 @@ ctbin::ctbin(void) : ctobservation(CTBIN_NAME, CTBIN_VERSION) | ||
| 73 | * Constructs event binning tool from an observation container. | 73 | * Constructs event binning tool from an observation container. |
| 74 | ***************************************************************************/ | 74 | ***************************************************************************/ |
| 75 | ctbin::ctbin(const GObservations& obs) : | 75 | ctbin::ctbin(const GObservations& obs) : |
| 76 | - ctobservation(CTBIN_NAME, CTBIN_VERSION, obs) | 76 | + ctobservation(CTBIN_NAME, VERSION, obs) |
| 77 | { | 77 | { |
| 78 | // Initialise members | 78 | // Initialise members |
| 79 | init_members(); | 79 | init_members(); |
| @@ -94,7 +94,7 @@ ctbin::ctbin(const GObservations& obs) : | @@ -94,7 +94,7 @@ ctbin::ctbin(const GObservations& obs) : | ||
| 94 | * parameter setting. | 94 | * parameter setting. |
| 95 | ***************************************************************************/ | 95 | ***************************************************************************/ |
| 96 | ctbin::ctbin(int argc, char *argv[]) : | 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 | // Initialise members | 99 | // Initialise members |
| 100 | init_members(); | 100 | init_members(); |
src/ctbin/ctbin.hpp
| @@ -31,8 +31,7 @@ | @@ -31,8 +31,7 @@ | ||
| 31 | #include "ctobservation.hpp" | 31 | #include "ctobservation.hpp" |
| 32 | 32 | ||
| 33 | /* __Definitions _________________________________________________________ */ | 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,7 +50,7 @@ | ||
| 50 | /***********************************************************************//** | 50 | /***********************************************************************//** |
| 51 | * @brief Void constructor | 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 | // Initialise members | 55 | // Initialise members |
| 56 | init_members(); | 56 | init_members(); |
| @@ -69,7 +69,7 @@ ctbkgcube::ctbkgcube(void) : ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) | @@ -69,7 +69,7 @@ ctbkgcube::ctbkgcube(void) : ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION) | ||
| 69 | * observations container. | 69 | * observations container. |
| 70 | ***************************************************************************/ | 70 | ***************************************************************************/ |
| 71 | ctbkgcube::ctbkgcube(const GObservations& obs) : | 71 | ctbkgcube::ctbkgcube(const GObservations& obs) : |
| 72 | - ctobservation(CTBKGCUBE_NAME, CTBKGCUBE_VERSION, obs) | 72 | + ctobservation(CTBKGCUBE_NAME, VERSION, obs) |
| 73 | { | 73 | { |
| 74 | // Initialise members | 74 | // Initialise members |
| 75 | init_members(); | 75 | init_members(); |
| @@ -87,7 +87,7 @@ ctbkgcube::ctbkgcube(const GObservations& obs) : | @@ -87,7 +87,7 @@ ctbkgcube::ctbkgcube(const GObservations& obs) : | ||
| 87 | * @param[in] argv Array of command line arguments. | 87 | * @param[in] argv Array of command line arguments. |
| 88 | ***************************************************************************/ | 88 | ***************************************************************************/ |
| 89 | ctbkgcube::ctbkgcube(int argc, char *argv[]) : | 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 | // Initialise members | 92 | // Initialise members |
| 93 | init_members(); | 93 | init_members(); |
src/ctbkgcube/ctbkgcube.hpp
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctobservation.hpp" | 33 | #include "ctobservation.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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 | * ctbutterfly - butterfly calculation tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | /***********************************************************************//** | 52 | /***********************************************************************//** |
| 53 | * @brief Void constructor | 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 | // Initialise members | 57 | // Initialise members |
| 58 | init_members(); | 58 | init_members(); |
| @@ -71,7 +71,7 @@ ctbutterfly::ctbutterfly(void) : ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERS | @@ -71,7 +71,7 @@ ctbutterfly::ctbutterfly(void) : ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERS | ||
| 71 | * observations container. | 71 | * observations container. |
| 72 | ***************************************************************************/ | 72 | ***************************************************************************/ |
| 73 | ctbutterfly::ctbutterfly(const GObservations& obs) : | 73 | ctbutterfly::ctbutterfly(const GObservations& obs) : |
| 74 | - ctlikelihood(CTBUTTERFLY_NAME, CTBUTTERFLY_VERSION, obs) | 74 | + ctlikelihood(CTBUTTERFLY_NAME, VERSION, obs) |
| 75 | { | 75 | { |
| 76 | // Initialise members | 76 | // Initialise members |
| 77 | init_members(); | 77 | init_members(); |
| @@ -89,7 +89,7 @@ ctbutterfly::ctbutterfly(const GObservations& obs) : | @@ -89,7 +89,7 @@ ctbutterfly::ctbutterfly(const GObservations& obs) : | ||
| 89 | * @param[in] argv Array of command line arguments. | 89 | * @param[in] argv Array of command line arguments. |
| 90 | ***************************************************************************/ | 90 | ***************************************************************************/ |
| 91 | ctbutterfly::ctbutterfly(int argc, char *argv[]) : | 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 | // Initialise members | 94 | // Initialise members |
| 95 | init_members(); | 95 | init_members(); |
| @@ -245,7 +245,7 @@ void ctbutterfly::run(void) | @@ -245,7 +245,7 @@ void ctbutterfly::run(void) | ||
| 245 | 245 | ||
| 246 | // Get covariance matrix. | 246 | // Get covariance matrix. |
| 247 | GObservations::likelihood likelihood = m_obs.function(); | 247 | GObservations::likelihood likelihood = m_obs.function(); |
| 248 | - if(!m_gepmode) { | 248 | + if (m_method == "GAUSSIAN") { |
| 249 | m_covariance = likelihood.curvature()->invert(); | 249 | m_covariance = likelihood.curvature()->invert(); |
| 250 | } | 250 | } |
| 251 | else { | 251 | else { |
| @@ -275,7 +275,7 @@ void ctbutterfly::run(void) | @@ -275,7 +275,7 @@ void ctbutterfly::run(void) | ||
| 275 | likelihood.eval(pars); | 275 | likelihood.eval(pars); |
| 276 | 276 | ||
| 277 | // Get covariance matrix. | 277 | // Get covariance matrix. |
| 278 | - if(!m_gepmode) { | 278 | + if (m_method == "GAUSSIAN") { |
| 279 | m_covariance = likelihood.curvature()->invert(); | 279 | m_covariance = likelihood.curvature()->invert(); |
| 280 | } | 280 | } |
| 281 | else { | 281 | else { |
| @@ -287,262 +287,13 @@ void ctbutterfly::run(void) | @@ -287,262 +287,13 @@ void ctbutterfly::run(void) | ||
| 287 | 287 | ||
| 288 | } // endif: covariance computation needed | 288 | } // endif: covariance computation needed |
| 289 | 289 | ||
| 290 | - // Write header into logger | ||
| 291 | - log_header1(TERSE, "Prepare butterfly computation"); | ||
| 292 | - | ||
| 293 | - if (!m_gepmode) { | ||
| 294 | - | ||
| 295 | - // Find parameter indices. We do this by the memory location of the | ||
| 296 | - // model parameters. | ||
| 297 | - GModelSky* skymodel = dynamic_cast<GModelSky*>(models[m_srcname]); | ||
| 298 | - GModelPar* par_prefactor = &(*skymodel)["Prefactor"]; | ||
| 299 | - GModelPar* par_index = &(*skymodel)["Index"]; | ||
| 300 | - int inx_prefactor = -1; | ||
| 301 | - int inx_index = -1; | ||
| 302 | - for (int i = 0; i < models.npars(); ++i) { | ||
| 303 | - if (models.pars()[i] == par_prefactor) { | ||
| 304 | - inx_prefactor = i; | ||
| 305 | - } | ||
| 306 | - if (models.pars()[i] == par_index) { | ||
| 307 | - inx_index = i; | ||
| 308 | - } | ||
| 309 | - } | ||
| 310 | - | ||
| 311 | - // Store model values | ||
| 312 | - double prefactor_mean = (*skymodel)["Prefactor"].value(); | ||
| 313 | - double index_mean = (*skymodel)["Index"].value(); | ||
| 314 | - double pivot_mean = (*skymodel)["PivotEnergy"].value(); | ||
| 315 | - double prefactor_scale = (*skymodel)["Prefactor"].scale(); | ||
| 316 | - double index_scale = (*skymodel)["Index"].scale(); | ||
| 317 | - GEnergy pivot(pivot_mean, "MeV"); | ||
| 318 | - | ||
| 319 | - // Write parameter indices into logger | ||
| 320 | - log_value(NORMAL, "Prefactor", gammalib::str(prefactor_mean)+ | ||
| 321 | - " ph/cm2/s/MeV ("+gammalib::str(inx_prefactor)+")"); | ||
| 322 | - log_value(NORMAL, "Index", gammalib::str(index_mean)+ | ||
| 323 | - " ("+gammalib::str(inx_index)+")"); | ||
| 324 | - log_value(NORMAL, "Pivot energy", pivot.print()); | ||
| 325 | - | ||
| 326 | - // Extract covariance elements | ||
| 327 | - double cov_pp = m_covariance(inx_prefactor,inx_prefactor); | ||
| 328 | - double cov_pg = m_covariance(inx_prefactor,inx_index); | ||
| 329 | - double cov_gg = m_covariance(inx_index,inx_index); | ||
| 330 | - | ||
| 331 | - // Compute eigenvectors and eigenvalues | ||
| 332 | - double lambda1; | ||
| 333 | - double lambda2; | ||
| 334 | - GVector vector1(2); | ||
| 335 | - GVector vector2(2); | ||
| 336 | - eigenvectors(cov_pp, cov_pg, cov_pg, cov_gg, | ||
| 337 | - &lambda1, &lambda2, &vector1, &vector2); | ||
| 338 | - | ||
| 339 | - // Write eigenvectors and eigenvalues into logger | ||
| 340 | - log_value(NORMAL, "Eigenvalue 1", lambda1); | ||
| 341 | - log_value(NORMAL, "Eigenvalue 2", lambda2); | ||
| 342 | - log_value(NORMAL, "Eigenvector 1", vector1.print()); | ||
| 343 | - log_value(NORMAL, "Eigenvector 2", vector2.print()); | ||
| 344 | - | ||
| 345 | - // Confidence scaling, calculated from a Chi-Sqr. | ||
| 346 | - // distribution with 2 dof | ||
| 347 | - double scale = std::sqrt( -2. * std::log(1.-m_confidence) ); | ||
| 348 | - | ||
| 349 | - // Write confidence level information into logger | ||
| 350 | - log_value(NORMAL, "Confidence level", m_confidence); | ||
| 351 | - log_value(NORMAL, "Corresponding scaling", scale); | ||
| 352 | - | ||
| 353 | - // Compute minor and major axes of error ellipse | ||
| 354 | - double major = scale*std::sqrt(lambda1); | ||
| 355 | - double minor = scale*std::sqrt(lambda2); | ||
| 356 | - | ||
| 357 | - // Write header into logger | ||
| 358 | - log_header1(TERSE, "Generate butterfly"); | ||
| 359 | - | ||
| 360 | - // Initialise result arrays | ||
| 361 | - m_energies.assign(m_ebounds.size(), 0.0); | ||
| 362 | - m_intensities.assign(m_ebounds.size(), 0.0); | ||
| 363 | - m_min_intensities.assign(m_ebounds.size(), 1e30); | ||
| 364 | - m_max_intensities.assign(m_ebounds.size(), 0.0); | ||
| 365 | - | ||
| 366 | - // Walk around the error ellipse | ||
| 367 | - int nt = 360; | ||
| 368 | - double dt = gammalib::twopi/double(nt); | ||
| 369 | - double t = 0.0; | ||
| 370 | - for (int i = 0; i < nt; ++i, t += dt) { | ||
| 371 | - | ||
| 372 | - // Pre-compute sin and cosine | ||
| 373 | - double sin_t = std::sin(t); | ||
| 374 | - double cos_t = std::cos(t); | ||
| 375 | - | ||
| 376 | - // Compute prefactor and index | ||
| 377 | - double prefactor = (major * cos_t * vector1[0] + | ||
| 378 | - minor * sin_t * vector2[0]) * prefactor_scale + | ||
| 379 | - prefactor_mean; | ||
| 380 | - double index = (major * cos_t * vector1[1] + | ||
| 381 | - minor * sin_t * vector2[1]) * index_scale + | ||
| 382 | - index_mean; | ||
| 383 | - | ||
| 384 | - // Write prefactor and index into logger | ||
| 385 | - log_value(EXPLICIT, "Angle "+gammalib::str(t*gammalib::rad2deg), | ||
| 386 | - gammalib::str(prefactor)+" ph/cm2/s/MeV; "+ | ||
| 387 | - gammalib::str(index)); | ||
| 388 | - | ||
| 389 | - // Setup power law model | ||
| 390 | - GModelSpectralPlaw plaw(prefactor, index, pivot); | ||
| 391 | - | ||
| 392 | - // Evaluate power law at each energy and extract minimum and | ||
| 393 | - // maximum intensity | ||
| 394 | - for (int k = 0; k < m_ebounds.size(); ++k) { | ||
| 395 | - | ||
| 396 | - // Get the energy of current bin | ||
| 397 | - GTime time; | ||
| 398 | - GEnergy energy = m_ebounds.elogmean(k); | ||
| 399 | - | ||
| 400 | - // Evaluate power law | ||
| 401 | - double intensity = plaw.eval(energy, time); | ||
| 402 | - | ||
| 403 | - // Get extremes | ||
| 404 | - if (intensity < m_min_intensities[k]) { | ||
| 405 | - m_min_intensities[k] = intensity; | ||
| 406 | - } | ||
| 407 | - if (intensity > m_max_intensities[k]) { | ||
| 408 | - m_max_intensities[k] = intensity; | ||
| 409 | - } | ||
| 410 | - | ||
| 411 | - } // endfor: looped over all energies | ||
| 412 | - | ||
| 413 | - } // endfor: looped over all angles | ||
| 414 | - | ||
| 415 | - // Setup power law model for mean prefactor and index | ||
| 416 | - GModelSpectralPlaw plaw(prefactor_mean, index_mean, pivot); | ||
| 417 | - | ||
| 418 | - // Compute energy and intensity vectors for mean power law | ||
| 419 | - for (int k = 0; k < m_ebounds.size(); ++k) { | ||
| 420 | - | ||
| 421 | - // Get the energy of current bin | ||
| 422 | - GTime time; | ||
| 423 | - GEnergy energy = m_ebounds.elogmean(k); | ||
| 424 | - | ||
| 425 | - // Evaluate power law | ||
| 426 | - double intensity = plaw.eval(energy, time); | ||
| 427 | - | ||
| 428 | - // Store results | ||
| 429 | - m_energies[k] = energy.MeV(); | ||
| 430 | - m_intensities[k] = intensity; | ||
| 431 | - | ||
| 432 | - } // endfor: looped over energies | ||
| 433 | - | ||
| 434 | - } //endif: use butterfly envelope for computation | ||
| 435 | - | 290 | + // Compute butterfly depending on selected method |
| 291 | + if (m_method == "GAUSSIAN") { | ||
| 292 | + gaussian_error_propagation(models); | ||
| 293 | + } | ||
| 436 | else { | 294 | else { |
| 437 | - | ||
| 438 | - // Use gaussian error propagation scheme to calculate | ||
| 439 | - // the butterfly | ||
| 440 | - | ||
| 441 | - // Confidence scaling | ||
| 442 | - double scale = gammalib::erfinv(m_confidence) * gammalib::sqrt_two; | ||
| 443 | - | ||
| 444 | - // Write confidence level information into logger | ||
| 445 | - log_value(NORMAL, "Confidence level", m_confidence); | ||
| 446 | - log_value(NORMAL, "Corresponding scaling", scale); | ||
| 447 | - | ||
| 448 | - // Write header into logger | ||
| 449 | - log_header1(TERSE, "Generate butterfly"); | ||
| 450 | - | ||
| 451 | - // Initialise dummy time to evaluate spectral model | ||
| 452 | - GTime time = GTime(); | ||
| 453 | - | ||
| 454 | - // Initialise vector of gradients | ||
| 455 | - GVector grad = GVector(m_obs.models().npars()); | ||
| 456 | - | ||
| 457 | - // Loop over energy bins positions | ||
| 458 | - for (int i = 0; i < m_ebounds.size(); ++i) { | ||
| 459 | - | ||
| 460 | - // Initialise number of gradients | ||
| 461 | - int num_gradient = 0; | ||
| 462 | - | ||
| 463 | - // Get the energy of current bin | ||
| 464 | - GEnergy energy = m_ebounds.elogmean(i); | ||
| 465 | - | ||
| 466 | - // Initialise model flux value | ||
| 467 | - double model_flux = 0.0; | ||
| 468 | - | ||
| 469 | - // Loop over models | ||
| 470 | - for (int j = 0; j < models.size(); ++j) { | ||
| 471 | - | ||
| 472 | - // Check wether model is a skymodel | ||
| 473 | - GModelSky* skymodel = dynamic_cast<GModelSky*>(models[j]); | ||
| 474 | - | ||
| 475 | - // Yes ... | ||
| 476 | - if (skymodel != NULL) { | ||
| 477 | - | ||
| 478 | - // Set flux value of source of interest, evaluate gradients | ||
| 479 | - if (skymodel->name() == m_srcname) { | ||
| 480 | - | ||
| 481 | - // Get spectral component of model | ||
| 482 | - GModelSpectral *spectral = skymodel->spectral(); | ||
| 483 | - | ||
| 484 | - model_flux = spectral->eval(energy, time, true); | ||
| 485 | - | ||
| 486 | - // Loop over all model parameters | ||
| 487 | - for (int k = 0; k < skymodel->size(); ++k) { | ||
| 488 | - | ||
| 489 | - // set gradient if we deal with spectral component | ||
| 490 | - bool parIsSpectral = false; | ||
| 491 | - | ||
| 492 | - for (int l = 0; l < spectral->size(); ++l) { | ||
| 493 | - | ||
| 494 | - if ((&((*spectral)[l])) == (&((*skymodel)[k]))) { | ||
| 495 | - grad[num_gradient] = (*spectral)[l].gradient(); | ||
| 496 | - num_gradient++; | ||
| 497 | - parIsSpectral = true; | ||
| 498 | - break; | ||
| 499 | - } | ||
| 500 | - } // endfor: looped over spectral parameters | ||
| 501 | - | ||
| 502 | - | ||
| 503 | - if (!parIsSpectral) { | ||
| 504 | - // If parameter is spatial or temporal, count up | ||
| 505 | - num_gradient++; | ||
| 506 | - } | ||
| 507 | - | ||
| 508 | - } // endfor: looped over all model parameters | ||
| 509 | - | ||
| 510 | - | ||
| 511 | - | ||
| 512 | - } // endif: model was source of interest | ||
| 513 | - else { | ||
| 514 | - num_gradient += skymodel->size(); | ||
| 515 | - } | ||
| 516 | - | ||
| 517 | - } // endif: model was sky model | ||
| 518 | - | ||
| 519 | - else { | ||
| 520 | - // Skip other models (e.g. GModelData instances) | ||
| 521 | - num_gradient += models[j]->size(); | ||
| 522 | - | ||
| 523 | - } // endelse: Model was not GModelSky | ||
| 524 | - | ||
| 525 | - } // endfor: Looped over models | ||
| 526 | - | ||
| 527 | - // Multiply covariance to the gradient vector | ||
| 528 | - GVector vector = m_covariance * grad; | ||
| 529 | - | ||
| 530 | - // Get the error from the scalar product | ||
| 531 | - double error = std::sqrt(grad * vector); | ||
| 532 | - | ||
| 533 | - // Multiply with confidence scaling | ||
| 534 | - error *= scale; | ||
| 535 | - | ||
| 536 | - // Store flux, value and energy for saving | ||
| 537 | - m_intensities.push_back(model_flux); | ||
| 538 | - m_energies.push_back(energy.MeV()); | ||
| 539 | - m_min_intensities.push_back(model_flux-error); | ||
| 540 | - m_max_intensities.push_back(model_flux+error); | ||
| 541 | - | ||
| 542 | - } //endfor: loop over energy bin | ||
| 543 | - | ||
| 544 | - } //endelse: use gaussian error propagation | ||
| 545 | - | 295 | + ellipsoid_boundary(models); |
| 296 | + } | ||
| 546 | 297 | ||
| 547 | // Write header into logger | 298 | // Write header into logger |
| 548 | log_header1(TERSE, "Results"); | 299 | log_header1(TERSE, "Results"); |
| @@ -558,8 +309,6 @@ void ctbutterfly::run(void) | @@ -558,8 +309,6 @@ void ctbutterfly::run(void) | ||
| 558 | 309 | ||
| 559 | } //endfor: loop over energy bin | 310 | } //endfor: loop over energy bin |
| 560 | 311 | ||
| 561 | - | ||
| 562 | - | ||
| 563 | // Restore energy dispersion flag for all CTA observations | 312 | // Restore energy dispersion flag for all CTA observations |
| 564 | for (int i = 0; i < m_obs.size(); ++i) { | 313 | for (int i = 0; i < m_obs.size(); ++i) { |
| 565 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); | 314 | GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs[i]); |
| @@ -627,10 +376,10 @@ void ctbutterfly::init_members(void) | @@ -627,10 +376,10 @@ void ctbutterfly::init_members(void) | ||
| 627 | { | 376 | { |
| 628 | // Initialise members | 377 | // Initialise members |
| 629 | m_srcname.clear(); | 378 | m_srcname.clear(); |
| 379 | + m_method.clear(); | ||
| 630 | m_confidence = 0.68; | 380 | m_confidence = 0.68; |
| 631 | m_max_iter = 50; | 381 | m_max_iter = 50; |
| 632 | m_apply_edisp = false; | 382 | m_apply_edisp = false; |
| 633 | - m_gepmode = false; | ||
| 634 | m_fit = false; | 383 | m_fit = false; |
| 635 | m_chatter = static_cast<GChatter>(2); | 384 | m_chatter = static_cast<GChatter>(2); |
| 636 | m_ebounds.clear(); | 385 | m_ebounds.clear(); |
| @@ -661,10 +410,10 @@ void ctbutterfly::copy_members(const ctbutterfly& app) | @@ -661,10 +410,10 @@ void ctbutterfly::copy_members(const ctbutterfly& app) | ||
| 661 | { | 410 | { |
| 662 | // Copy attributes | 411 | // Copy attributes |
| 663 | m_srcname = app.m_srcname; | 412 | m_srcname = app.m_srcname; |
| 413 | + m_method = app.m_method; | ||
| 664 | m_confidence = app.m_confidence; | 414 | m_confidence = app.m_confidence; |
| 665 | m_max_iter = app.m_max_iter; | 415 | m_max_iter = app.m_max_iter; |
| 666 | m_apply_edisp = app.m_apply_edisp; | 416 | m_apply_edisp = app.m_apply_edisp; |
| 667 | - m_gepmode = app.m_gepmode; | ||
| 668 | m_fit = app.m_fit; | 417 | m_fit = app.m_fit; |
| 669 | m_chatter = app.m_chatter; | 418 | m_chatter = app.m_chatter; |
| 670 | m_ebounds = app.m_ebounds; | 419 | m_ebounds = app.m_ebounds; |
| @@ -730,7 +479,7 @@ void ctbutterfly::get_parameters(void) | @@ -730,7 +479,7 @@ void ctbutterfly::get_parameters(void) | ||
| 730 | 479 | ||
| 731 | // Get remaining parameters | 480 | // Get remaining parameters |
| 732 | m_apply_edisp = (*this)["edisp"].boolean(); | 481 | m_apply_edisp = (*this)["edisp"].boolean(); |
| 733 | - m_gepmode = (*this)["method"].string() == std::string("GAUSSIAN"); | 482 | + m_method = (*this)["method"].string(); |
| 734 | m_confidence = (*this)["confidence"].real(); | 483 | m_confidence = (*this)["confidence"].real(); |
| 735 | m_fit = (*this)["fit"].boolean(); | 484 | m_fit = (*this)["fit"].boolean(); |
| 736 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); | 485 | m_chatter = static_cast<GChatter>((*this)["chatter"].integer()); |
| @@ -753,6 +502,273 @@ void ctbutterfly::get_parameters(void) | @@ -753,6 +502,273 @@ void ctbutterfly::get_parameters(void) | ||
| 753 | 502 | ||
| 754 | 503 | ||
| 755 | /***********************************************************************//** | 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 | +/***********************************************************************//** | ||
| 756 | * @brief Check if sky model is valid | 772 | * @brief Check if sky model is valid |
| 757 | * | 773 | * |
| 758 | * @exception GException::invalid_value | 774 | * @exception GException::invalid_value |
| @@ -776,13 +792,15 @@ void ctbutterfly::check_model(void) | @@ -776,13 +792,15 @@ void ctbutterfly::check_model(void) | ||
| 776 | throw GException::invalid_value(G_CHECK_MODEL, msg); | 792 | throw GException::invalid_value(G_CHECK_MODEL, msg); |
| 777 | } | 793 | } |
| 778 | 794 | ||
| 779 | - // Check that the spectral model is a power law for default mode | ||
| 780 | - if(!m_gepmode){ | 795 | + // Check that the spectral model is a power law for the "ENVELOPE" |
| 796 | + // method | ||
| 797 | + if (m_method == "ENVELOPE") { | ||
| 781 | if (model->spectral()->type() != "PowerLaw") { | 798 | if (model->spectral()->type() != "PowerLaw") { |
| 782 | std::string msg = "\""+model->spectral()->type()+"\" cannot be " | 799 | std::string msg = "\""+model->spectral()->type()+"\" cannot be " |
| 783 | - "used as spectral model for an butterfly " | ||
| 784 | - "computation with method=ENVELOPE. Please specify a " | ||
| 785 | - "power law model or switch to method GAUSSIAN."; | 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."; | ||
| 786 | throw GException::invalid_value(G_CHECK_MODEL, msg); | 804 | throw GException::invalid_value(G_CHECK_MODEL, msg); |
| 787 | } | 805 | } |
| 788 | } | 806 | } |
src/ctbutterfly/ctbutterfly.hpp
| 1 | /*************************************************************************** | 1 | /*************************************************************************** |
| 2 | * ctbutterfly - butterfly calculation tool * | 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 | * This program is free software: you can redistribute it and/or modify * | 7 | * This program is free software: you can redistribute it and/or modify * |
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctlikelihood.hpp" | 33 | #include "ctlikelihood.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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,6 +76,10 @@ protected: | ||
| 77 | void copy_members(const ctbutterfly& app); | 76 | void copy_members(const ctbutterfly& app); |
| 78 | void free_members(void); | 77 | void free_members(void); |
| 79 | void get_parameters(void); | 78 | void get_parameters(void); |
| 79 | + void gaussian_error_propagation(GModels& models); | ||
| 80 | + void ellipsoid_boundary(GModels& models); | ||
| 81 | + | ||
| 82 | + | ||
| 80 | void check_model(void); | 83 | void check_model(void); |
| 81 | void eigenvectors(const double& a, | 84 | void eigenvectors(const double& a, |
| 82 | const double& b, | 85 | const double& b, |
| @@ -89,10 +92,10 @@ protected: | @@ -89,10 +92,10 @@ protected: | ||
| 89 | 92 | ||
| 90 | // User parameters | 93 | // User parameters |
| 91 | std::string m_srcname; //!< Name of source to compute butterfly | 94 | std::string m_srcname; //!< Name of source to compute butterfly |
| 95 | + std::string m_method; //!< Computation method | ||
| 92 | double m_confidence; //!< Confidence level | 96 | double m_confidence; //!< Confidence level |
| 93 | int m_max_iter; //!< Maximum number of iterations | 97 | int m_max_iter; //!< Maximum number of iterations |
| 94 | bool m_apply_edisp; //!< Apply energy dispersion? | 98 | bool m_apply_edisp; //!< Apply energy dispersion? |
| 95 | - bool m_gepmode; //!< Switch to gaussian error propagation scheme | ||
| 96 | bool m_fit; //!< Do fit? | 99 | bool m_fit; //!< Do fit? |
| 97 | GEbounds m_ebounds; //!< Energy binning definition | 100 | GEbounds m_ebounds; //!< Energy binning definition |
| 98 | GFilename m_outfile; //!< Output ASCII file name | 101 | GFilename m_outfile; //!< Output ASCII file name |
src/ctcubemask/ctcubemask.cpp
| @@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
| 51 | /***********************************************************************//** | 51 | /***********************************************************************//** |
| 52 | * @brief Void constructor | 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 | // Initialise members | 56 | // Initialise members |
| 57 | init_members(); | 57 | init_members(); |
| @@ -70,7 +70,7 @@ ctcubemask::ctcubemask(void) : ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION | @@ -70,7 +70,7 @@ ctcubemask::ctcubemask(void) : ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION | ||
| 70 | * an observation container. | 70 | * an observation container. |
| 71 | ***************************************************************************/ | 71 | ***************************************************************************/ |
| 72 | ctcubemask::ctcubemask(const GObservations& obs) : | 72 | ctcubemask::ctcubemask(const GObservations& obs) : |
| 73 | - ctobservation(CTCUBEMASK_NAME, CTCUBEMASK_VERSION, obs) | 73 | + ctobservation(CTCUBEMASK_NAME, VERSION, obs) |
| 74 | { | 74 | { |
| 75 | // Initialise members | 75 | // Initialise members |
| 76 | init_members(); | 76 | init_members(); |
| @@ -89,7 +89,7 @@ ctcubemask::ctcubemask(const GObservations& obs) : | @@ -89,7 +89,7 @@ ctcubemask::ctcubemask(const GObservations& obs) : | ||
| 89 | * @param[in] argv Array of command line arguments. | 89 | * @param[in] argv Array of command line arguments. |
| 90 | ***************************************************************************/ | 90 | ***************************************************************************/ |
| 91 | ctcubemask::ctcubemask(int argc, char *argv[]) : | 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 | // Initialise members | 94 | // Initialise members |
| 95 | init_members(); | 95 | init_members(); |
src/ctcubemask/ctcubemask.hpp
| @@ -35,8 +35,7 @@ | @@ -35,8 +35,7 @@ | ||
| 35 | #include "ctobservation.hpp" | 35 | #include "ctobservation.hpp" |
| 36 | 36 | ||
| 37 | /* __Definitions _________________________________________________________ */ | 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,7 +52,7 @@ | ||
| 52 | * | 52 | * |
| 53 | * Constructs an empty energy dispersion tool. | 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 | // Initialise members | 57 | // Initialise members |
| 58 | init_members(); | 58 | init_members(); |
| @@ -71,7 +71,7 @@ ctedispcube::ctedispcube(void) : ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VER | @@ -71,7 +71,7 @@ ctedispcube::ctedispcube(void) : ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VER | ||
| 71 | * in an observation container @p obs. | 71 | * in an observation container @p obs. |
| 72 | ***************************************************************************/ | 72 | ***************************************************************************/ |
| 73 | ctedispcube::ctedispcube(const GObservations& obs) : | 73 | ctedispcube::ctedispcube(const GObservations& obs) : |
| 74 | - ctobservation(CTEDISPCUBE_NAME, CTEDISPCUBE_VERSION, obs) | 74 | + ctobservation(CTEDISPCUBE_NAME, VERSION, obs) |
| 75 | { | 75 | { |
| 76 | // Initialise members | 76 | // Initialise members |
| 77 | init_members(); | 77 | init_members(); |
| @@ -92,7 +92,7 @@ ctedispcube::ctedispcube(const GObservations& obs) : | @@ -92,7 +92,7 @@ ctedispcube::ctedispcube(const GObservations& obs) : | ||
| 92 | * on the command line. | 92 | * on the command line. |
| 93 | ***************************************************************************/ | 93 | ***************************************************************************/ |
| 94 | ctedispcube::ctedispcube(int argc, char *argv[]) : | 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 | // Initialise members | 97 | // Initialise members |
| 98 | init_members(); | 98 | init_members(); |
src/ctedispcube/ctedispcube.hpp
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctobservation.hpp" | 33 | #include "ctobservation.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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,7 +52,7 @@ | ||
| 52 | * | 52 | * |
| 53 | * Constructs an empty cterror tool. | 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 | // Initialise members | 57 | // Initialise members |
| 58 | init_members(); | 58 | init_members(); |
| @@ -70,7 +70,7 @@ cterror::cterror(void) : ctlikelihood(CTERROR_NAME, CTERROR_VERSION) | @@ -70,7 +70,7 @@ cterror::cterror(void) : ctlikelihood(CTERROR_NAME, CTERROR_VERSION) | ||
| 70 | * Constructs cterror tool from an observations container. | 70 | * Constructs cterror tool from an observations container. |
| 71 | ***************************************************************************/ | 71 | ***************************************************************************/ |
| 72 | cterror::cterror(const GObservations& obs) : | 72 | cterror::cterror(const GObservations& obs) : |
| 73 | - ctlikelihood(CTERROR_NAME, CTERROR_VERSION, obs) | 73 | + ctlikelihood(CTERROR_NAME, VERSION, obs) |
| 74 | { | 74 | { |
| 75 | // Initialise members | 75 | // Initialise members |
| 76 | init_members(); | 76 | init_members(); |
| @@ -90,7 +90,7 @@ cterror::cterror(const GObservations& obs) : | @@ -90,7 +90,7 @@ cterror::cterror(const GObservations& obs) : | ||
| 90 | * parameters that are provided as command line arguments. | 90 | * parameters that are provided as command line arguments. |
| 91 | ***************************************************************************/ | 91 | ***************************************************************************/ |
| 92 | cterror::cterror(int argc, char *argv[]) : | 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 | // Initialise members | 95 | // Initialise members |
| 96 | init_members(); | 96 | init_members(); |
src/cterror/cterror.hpp
| @@ -31,8 +31,7 @@ | @@ -31,8 +31,7 @@ | ||
| 31 | #include "ctlikelihood.hpp" | 31 | #include "ctlikelihood.hpp" |
| 32 | 32 | ||
| 33 | /* __Definitions _________________________________________________________ */ | 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,7 +50,7 @@ | ||
| 50 | /***********************************************************************//** | 50 | /***********************************************************************//** |
| 51 | * @brief Void constructor | 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 | // Initialise members | 55 | // Initialise members |
| 56 | init_members(); | 56 | init_members(); |
| @@ -69,7 +69,7 @@ ctexpcube::ctexpcube(void) : ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION) | @@ -69,7 +69,7 @@ ctexpcube::ctexpcube(void) : ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION) | ||
| 69 | * observations container. | 69 | * observations container. |
| 70 | ***************************************************************************/ | 70 | ***************************************************************************/ |
| 71 | ctexpcube::ctexpcube(const GObservations& obs) : | 71 | ctexpcube::ctexpcube(const GObservations& obs) : |
| 72 | - ctobservation(CTEXPCUBE_NAME, CTEXPCUBE_VERSION, obs) | 72 | + ctobservation(CTEXPCUBE_NAME, VERSION, obs) |
| 73 | { | 73 | { |
| 74 | // Initialise members | 74 | // Initialise members |
| 75 | init_members(); | 75 | init_members(); |
| @@ -87,7 +87,7 @@ ctexpcube::ctexpcube(const GObservations& obs) : | @@ -87,7 +87,7 @@ ctexpcube::ctexpcube(const GObservations& obs) : | ||
| 87 | * @param[in] argv Array of command line arguments. | 87 | * @param[in] argv Array of command line arguments. |
| 88 | ***************************************************************************/ | 88 | ***************************************************************************/ |
| 89 | ctexpcube::ctexpcube(int argc, char *argv[]) : | 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 | // Initialise members | 92 | // Initialise members |
| 93 | init_members(); | 93 | init_members(); |
src/ctexpcube/ctexpcube.hpp
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctobservation.hpp" | 33 | #include "ctobservation.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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,7 +48,7 @@ | ||
| 48 | /***********************************************************************//** | 48 | /***********************************************************************//** |
| 49 | * @brief Void constructor | 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 | // Initialise members | 53 | // Initialise members |
| 54 | init_members(); | 54 | init_members(); |
| @@ -66,7 +66,7 @@ ctlike::ctlike(void) : ctlikelihood(CTLIKE_NAME, CTLIKE_VERSION) | @@ -66,7 +66,7 @@ ctlike::ctlike(void) : ctlikelihood(CTLIKE_NAME, CTLIKE_VERSION) | ||
| 66 | * Constructs ctlike tool from an observations container. | 66 | * Constructs ctlike tool from an observations container. |
| 67 | ***************************************************************************/ | 67 | ***************************************************************************/ |
| 68 | ctlike::ctlike(const GObservations& obs) : | 68 | ctlike::ctlike(const GObservations& obs) : |
| 69 | - ctlikelihood(CTLIKE_NAME, CTLIKE_VERSION, obs) | 69 | + ctlikelihood(CTLIKE_NAME, VERSION, obs) |
| 70 | { | 70 | { |
| 71 | // Initialise members | 71 | // Initialise members |
| 72 | init_members(); | 72 | init_members(); |
| @@ -86,7 +86,7 @@ ctlike::ctlike(const GObservations& obs) : | @@ -86,7 +86,7 @@ ctlike::ctlike(const GObservations& obs) : | ||
| 86 | * that are provided as command line arguments. | 86 | * that are provided as command line arguments. |
| 87 | ***************************************************************************/ | 87 | ***************************************************************************/ |
| 88 | ctlike::ctlike(int argc, char *argv[]) : | 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 | // Initialise members | 91 | // Initialise members |
| 92 | init_members(); | 92 | init_members(); |
src/ctlike/ctlike.hpp
| @@ -31,8 +31,7 @@ | @@ -31,8 +31,7 @@ | ||
| 31 | #include "ctlikelihood.hpp" | 31 | #include "ctlikelihood.hpp" |
| 32 | 32 | ||
| 33 | /* __Definitions _________________________________________________________ */ | 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,7 +50,7 @@ | ||
| 50 | /***********************************************************************//** | 50 | /***********************************************************************//** |
| 51 | * @brief Void constructor | 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 | // Initialise members | 55 | // Initialise members |
| 56 | init_members(); | 56 | init_members(); |
| @@ -67,7 +67,7 @@ ctmapcube::ctmapcube(void) : ctool(CTMAPCUBE_NAME, CTMAPCUBE_VERSION) | @@ -67,7 +67,7 @@ ctmapcube::ctmapcube(void) : ctool(CTMAPCUBE_NAME, CTMAPCUBE_VERSION) | ||
| 67 | * @param[in] argv Array of command line arguments. | 67 | * @param[in] argv Array of command line arguments. |
| 68 | ***************************************************************************/ | 68 | ***************************************************************************/ |
| 69 | ctmapcube::ctmapcube(int argc, char *argv[]) : | 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 | // Initialise members | 72 | // Initialise members |
| 73 | init_members(); | 73 | init_members(); |
src/ctmapcube/ctmapcube.hpp
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctool.hpp" | 33 | #include "ctool.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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, "TeV"); | @@ -53,7 +53,7 @@ const GEnergy g_energy_margin(1.0e-12, "TeV"); | ||
| 53 | /***********************************************************************//** | 53 | /***********************************************************************//** |
| 54 | * @brief Void constructor | 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 | // Initialise members | 58 | // Initialise members |
| 59 | init_members(); | 59 | init_members(); |
| @@ -72,7 +72,7 @@ ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION) | @@ -72,7 +72,7 @@ ctmodel::ctmodel(void) : ctobservation(CTMODEL_NAME, CTMODEL_VERSION) | ||
| 72 | * observations container. | 72 | * observations container. |
| 73 | ***************************************************************************/ | 73 | ***************************************************************************/ |
| 74 | ctmodel::ctmodel(const GObservations& obs) : | 74 | ctmodel::ctmodel(const GObservations& obs) : |
| 75 | - ctobservation(CTMODEL_NAME, CTMODEL_VERSION, obs) | 75 | + ctobservation(CTMODEL_NAME, VERSION, obs) |
| 76 | { | 76 | { |
| 77 | // Initialise members | 77 | // Initialise members |
| 78 | init_members(); | 78 | init_members(); |
| @@ -90,7 +90,7 @@ ctmodel::ctmodel(const GObservations& obs) : | @@ -90,7 +90,7 @@ ctmodel::ctmodel(const GObservations& obs) : | ||
| 90 | * @param[in] argv Array of command line arguments. | 90 | * @param[in] argv Array of command line arguments. |
| 91 | ***************************************************************************/ | 91 | ***************************************************************************/ |
| 92 | ctmodel::ctmodel(int argc, char *argv[]) : | 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 | // Initialise members | 95 | // Initialise members |
| 96 | init_members(); | 96 | init_members(); |
src/ctmodel/ctmodel.hpp
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctobservation.hpp" | 33 | #include "ctobservation.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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; //!< Simulation radius margin (degrees) | @@ -67,7 +67,7 @@ const double g_roi_margin = 0.5; //!< Simulation radius margin (degrees) | ||
| 67 | * | 67 | * |
| 68 | * Constructs an empty ctobssim tool. | 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 | // Initialise members | 72 | // Initialise members |
| 73 | init_members(); | 73 | init_members(); |
| @@ -85,7 +85,7 @@ ctobssim::ctobssim(void) : ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION) | @@ -85,7 +85,7 @@ ctobssim::ctobssim(void) : ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION) | ||
| 85 | * Constructs ctobssim tool from an observation container. | 85 | * Constructs ctobssim tool from an observation container. |
| 86 | ***************************************************************************/ | 86 | ***************************************************************************/ |
| 87 | ctobssim::ctobssim(const GObservations& obs) : | 87 | ctobssim::ctobssim(const GObservations& obs) : |
| 88 | - ctobservation(CTOBSSIM_NAME, CTOBSSIM_VERSION, obs) | 88 | + ctobservation(CTOBSSIM_NAME, VERSION, obs) |
| 89 | { | 89 | { |
| 90 | // Initialise members | 90 | // Initialise members |
| 91 | init_members(); | 91 | init_members(); |
| @@ -105,7 +105,7 @@ ctobssim::ctobssim(const GObservations& obs) : | @@ -105,7 +105,7 @@ ctobssim::ctobssim(const GObservations& obs) : | ||
| 105 | * setting. | 105 | * setting. |
| 106 | ***************************************************************************/ | 106 | ***************************************************************************/ |
| 107 | ctobssim::ctobssim(int argc, char *argv[]) : | 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 | // Initialise members | 110 | // Initialise members |
| 111 | init_members(); | 111 | init_members(); |
src/ctobssim/ctobssim.hpp
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctobservation.hpp" | 33 | #include "ctobservation.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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,7 +49,7 @@ | ||
| 49 | /***********************************************************************//** | 49 | /***********************************************************************//** |
| 50 | * @brief Void constructor | 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 | // Initialise members | 54 | // Initialise members |
| 55 | init_members(); | 55 | init_members(); |
| @@ -68,7 +68,7 @@ ctpsfcube::ctpsfcube(void) : ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION) | @@ -68,7 +68,7 @@ ctpsfcube::ctpsfcube(void) : ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION) | ||
| 68 | * observations container. | 68 | * observations container. |
| 69 | ***************************************************************************/ | 69 | ***************************************************************************/ |
| 70 | ctpsfcube::ctpsfcube(const GObservations& obs) : | 70 | ctpsfcube::ctpsfcube(const GObservations& obs) : |
| 71 | - ctobservation(CTPSFCUBE_NAME, CTPSFCUBE_VERSION, obs) | 71 | + ctobservation(CTPSFCUBE_NAME, VERSION, obs) |
| 72 | { | 72 | { |
| 73 | // Initialise members | 73 | // Initialise members |
| 74 | init_members(); | 74 | init_members(); |
| @@ -86,7 +86,7 @@ ctpsfcube::ctpsfcube(const GObservations& obs) : | @@ -86,7 +86,7 @@ ctpsfcube::ctpsfcube(const GObservations& obs) : | ||
| 86 | * @param[in] argv Array of command line arguments. | 86 | * @param[in] argv Array of command line arguments. |
| 87 | ***************************************************************************/ | 87 | ***************************************************************************/ |
| 88 | ctpsfcube::ctpsfcube(int argc, char *argv[]) : | 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 | // Initialise members | 91 | // Initialise members |
| 92 | init_members(); | 92 | init_members(); |
src/ctpsfcube/ctpsfcube.hpp
| @@ -33,8 +33,7 @@ | @@ -33,8 +33,7 @@ | ||
| 33 | #include "ctobservation.hpp" | 33 | #include "ctobservation.hpp" |
| 34 | 34 | ||
| 35 | /* __Definitions _________________________________________________________ */ | 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,7 +53,7 @@ | ||
| 53 | /***********************************************************************//** | 53 | /***********************************************************************//** |
| 54 | * @brief Void constructor | 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 | // Initialise members | 58 | // Initialise members |
| 59 | init_members(); | 59 | init_members(); |
| @@ -72,7 +72,7 @@ ctselect::ctselect(void) : ctobservation(CTSELECT_NAME, CTSELECT_VERSION) | @@ -72,7 +72,7 @@ ctselect::ctselect(void) : ctobservation(CTSELECT_NAME, CTSELECT_VERSION) | ||
| 72 | * provided in an observation container. | 72 | * provided in an observation container. |
| 73 | ***************************************************************************/ | 73 | ***************************************************************************/ |
| 74 | ctselect::ctselect(const GObservations& obs) : | 74 | ctselect::ctselect(const GObservations& obs) : |
| 75 | - ctobservation(CTSELECT_NAME, CTSELECT_VERSION, obs) | 75 | + ctobservation(CTSELECT_NAME, VERSION, obs) |
| 76 | { | 76 | { |
| 77 | // Initialise members | 77 | // Initialise members |
| 78 | init_members(); | 78 | init_members(); |
| @@ -91,7 +91,7 @@ ctselect::ctselect(const GObservations& obs) : | @@ -91,7 +91,7 @@ ctselect::ctselect(const GObservations& obs) : | ||
| 91 | * @param[in] argv Array of command line arguments. | 91 | * @param[in] argv Array of command line arguments. |
| 92 | ***************************************************************************/ | 92 | ***************************************************************************/ |
| 93 | ctselect::ctselect(int argc, char *argv[]) : | 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 | // Initialise members | 96 | // Initialise members |
| 97 | init_members(); | 97 | init_members(); |
src/ctselect/ctselect.hpp
| @@ -35,8 +35,7 @@ | @@ -35,8 +35,7 @@ | ||
| 35 | #include "ctobservation.hpp" | 35 | #include "ctobservation.hpp" |
| 36 | 36 | ||
| 37 | /* __Definitions _________________________________________________________ */ | 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,7 +52,7 @@ | ||
| 52 | * | 52 | * |
| 53 | * Constructs an empty sky mapping tool. | 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 | // Initialise members | 57 | // Initialise members |
| 58 | init_members(); | 58 | init_members(); |
| @@ -70,7 +70,7 @@ ctskymap::ctskymap(void) : ctobservation(CTSKYMAP_NAME, CTSKYMAP_VERSION) | @@ -70,7 +70,7 @@ ctskymap::ctskymap(void) : ctobservation(CTSKYMAP_NAME, CTSKYMAP_VERSION) | ||
| 70 | * Constructs sky mapping tool from an observation container. | 70 | * Constructs sky mapping tool from an observation container. |
| 71 | ***************************************************************************/ | 71 | ***************************************************************************/ |
| 72 | ctskymap::ctskymap(const GObservations& obs) : | 72 | ctskymap::ctskymap(const GObservations& obs) : |
| 73 | - ctobservation(CTSKYMAP_NAME, CTSKYMAP_VERSION, obs) | 73 | + ctobservation(CTSKYMAP_NAME, VERSION, obs) |
| 74 | { | 74 | { |
| 75 | // Initialise members | 75 | // Initialise members |
| 76 | init_members(); | 76 | init_members(); |
| @@ -91,7 +91,7 @@ ctskymap::ctskymap(const GObservations& obs) : | @@ -91,7 +91,7 @@ ctskymap::ctskymap(const GObservations& obs) : | ||
| 91 | * parameter setting. | 91 | * parameter setting. |
| 92 | ***************************************************************************/ | 92 | ***************************************************************************/ |
| 93 | ctskymap::ctskymap(int argc, char *argv[]) : | 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 | // Initialise members | 96 | // Initialise members |
| 97 | init_members(); | 97 | init_members(); |
src/ctskymap/ctskymap.hpp
| @@ -32,8 +32,7 @@ | @@ -32,8 +32,7 @@ | ||
| 32 | #include "ctobservation.hpp" | 32 | #include "ctobservation.hpp" |
| 33 | 33 | ||
| 34 | /* __Definitions _________________________________________________________ */ | 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,7 +51,7 @@ | ||
| 51 | * | 51 | * |
| 52 | * Constructs an empty cttsmap tool. | 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 | // Initialise members | 56 | // Initialise members |
| 57 | init_members(); | 57 | init_members(); |
| @@ -69,7 +69,7 @@ cttsmap::cttsmap(void) : ctlikelihood(CTTSMAP_NAME, CTTSMAP_VERSION) | @@ -69,7 +69,7 @@ cttsmap::cttsmap(void) : ctlikelihood(CTTSMAP_NAME, CTTSMAP_VERSION) | ||
| 69 | * Constructs cttsmap tool from an observations container. | 69 | * Constructs cttsmap tool from an observations container. |
| 70 | ***************************************************************************/ | 70 | ***************************************************************************/ |
| 71 | cttsmap::cttsmap(const GObservations& obs) : | 71 | cttsmap::cttsmap(const GObservations& obs) : |
| 72 | - ctlikelihood(CTTSMAP_NAME, CTTSMAP_VERSION, obs) | 72 | + ctlikelihood(CTTSMAP_NAME, VERSION, obs) |
| 73 | { | 73 | { |
| 74 | // Initialise members | 74 | // Initialise members |
| 75 | init_members(); | 75 | init_members(); |
| @@ -89,7 +89,7 @@ cttsmap::cttsmap(const GObservations& obs) : | @@ -89,7 +89,7 @@ cttsmap::cttsmap(const GObservations& obs) : | ||
| 89 | * that are provided as command line arguments. | 89 | * that are provided as command line arguments. |
| 90 | ***************************************************************************/ | 90 | ***************************************************************************/ |
| 91 | cttsmap::cttsmap(int argc, char *argv[]) : | 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 | // Initialise members | 94 | // Initialise members |
| 95 | init_members(); | 95 | init_members(); |
src/cttsmap/cttsmap.hpp
| @@ -31,8 +31,7 @@ | @@ -31,8 +31,7 @@ | ||
| 31 | #include "ctlikelihood.hpp" | 31 | #include "ctlikelihood.hpp" |
| 32 | 32 | ||
| 33 | /* __Definitions _________________________________________________________ */ | 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,7 +53,7 @@ | ||
| 53 | * | 53 | * |
| 54 | * Constructs an empty ctulimit tool. | 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 | // Initialise members | 58 | // Initialise members |
| 59 | init_members(); | 59 | init_members(); |
| @@ -71,7 +71,7 @@ ctulimit::ctulimit(void) : ctlikelihood(CTULIMIT_NAME, CTULIMIT_VERSION) | @@ -71,7 +71,7 @@ ctulimit::ctulimit(void) : ctlikelihood(CTULIMIT_NAME, CTULIMIT_VERSION) | ||
| 71 | * Constructs ctulimit tool from an observations container. | 71 | * Constructs ctulimit tool from an observations container. |
| 72 | ***************************************************************************/ | 72 | ***************************************************************************/ |
| 73 | ctulimit::ctulimit(const GObservations& obs) : | 73 | ctulimit::ctulimit(const GObservations& obs) : |
| 74 | - ctlikelihood(CTULIMIT_NAME, CTULIMIT_VERSION, obs) | 74 | + ctlikelihood(CTULIMIT_NAME, VERSION, obs) |
| 75 | { | 75 | { |
| 76 | // Initialise members | 76 | // Initialise members |
| 77 | init_members(); | 77 | init_members(); |
| @@ -92,7 +92,7 @@ ctulimit::ctulimit(const GObservations& obs) : | @@ -92,7 +92,7 @@ ctulimit::ctulimit(const GObservations& obs) : | ||
| 92 | * parameters that are provided as command line arguments. | 92 | * parameters that are provided as command line arguments. |
| 93 | ***************************************************************************/ | 93 | ***************************************************************************/ |
| 94 | ctulimit::ctulimit(int argc, char *argv[]) : | 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 | // Initialise members | 97 | // Initialise members |
| 98 | init_members(); | 98 | init_members(); |
src/ctulimit/ctulimit.hpp
| @@ -31,8 +31,7 @@ | @@ -31,8 +31,7 @@ | ||
| 31 | #include "ctlikelihood.hpp" | 31 | #include "ctlikelihood.hpp" |
| 32 | 32 | ||
| 33 | /* __Definitions _________________________________________________________ */ | 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 | /***********************************************************************//** |