ctools 2.1.0.dev
Loading...
Searching...
No Matches
cterror.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * cterror - Parameter error calculation tool *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2015-2024 by Florent Forest *
5 * ----------------------------------------------------------------------- *
6 * *
7 * This program is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file cterror.cpp
23 * @brief Parameter error calculation tool interface implementation
24 * @author Florent Forest
25 */
26
27/* __ Includes ___________________________________________________________ */
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31#include <iostream>
32#include "cterror.hpp"
33#include "GTools.hpp"
34#include "GOptimizer.hpp"
35
36/* __ OpenMP section _____________________________________________________ */
37#ifdef _OPENMP
38#include <omp.h>
39#endif
40
41/* __ Method name definitions ____________________________________________ */
42#define G_ERR_BISECTION "cterror::error_bisection(double&, double&)"
43
44/* __ Debug definitions __________________________________________________ */
45
46/* __ Coding definitions _________________________________________________ */
47
48
49/*==========================================================================
50 = =
51 = Constructors/destructors =
52 = =
53 ==========================================================================*/
54
55/***********************************************************************//**
56 * @brief Void constructor
57 *
58 * Constructs an empty cterror tool.
59 ***************************************************************************/
61{
62 // Initialise members
64
65 // Return
66 return;
67}
68
69
70/***********************************************************************//**
71 * @brief Observations constructor
72 *
73 * param[in] obs Observation container.
74 *
75 * Constructs cterror tool from an observations container.
76 ***************************************************************************/
77cterror::cterror(const GObservations& obs) :
78 ctlikelihood(CTERROR_NAME, VERSION, obs)
79{
80 // Initialise members
82
83 // Return
84 return;
85}
86
87
88/***********************************************************************//**
89 * @brief Command line constructor
90 *
91 * @param[in] argc Number of arguments in command line.
92 * @param[in] argv Array of command line arguments.
93 *
94 * Constructs an instance of the cterror tool that will parse user
95 * parameters that are provided as command line arguments.
96 ***************************************************************************/
97cterror::cterror(int argc, char *argv[]) :
98 ctlikelihood(CTERROR_NAME, VERSION, argc, argv)
99{
100 // Initialise members
101 init_members();
102
103 // Return
104 return;
105}
106
107
108/***********************************************************************//**
109 * @brief Copy constructor
110 *
111 * @param[in] app Application.
112 *
113 * Constructs an instance of the cterror tool by copying information from
114 * another ctulimit tool.
115 ***************************************************************************/
117{
118 // Initialise members
119 init_members();
120
121 // Copy members
122 copy_members(app);
123
124 // Return
125 return;
126}
127
128
129/***********************************************************************//**
130 * @brief Destructor
131 *
132 * Destructs the cterror tool.
133 ***************************************************************************/
135{
136 // Free members
137 free_members();
138
139 // Return
140 return;
141}
142
143
144/*==========================================================================
145 = =
146 = Operators =
147 = =
148 ==========================================================================*/
149
150/***********************************************************************//**
151 * @brief Assignment operator
152 *
153 * @param[in] app Application.
154 * @return Application.
155 *
156 * Assigns a cterror tool.
157 ***************************************************************************/
159{
160 // Execute only if object is not identical
161 if (this != &app) {
162
163 // Copy base class members
164 this->ctlikelihood::operator=(app);
165
166 // Free members
167 free_members();
168
169 // Initialise members
170 init_members();
171
172 // Copy members
173 copy_members(app);
174
175 } // endif: object was not identical
176
177 // Return this object
178 return *this;
179}
180
181
182/*==========================================================================
183 = =
184 = Public methods =
185 = =
186 ==========================================================================*/
187
188/***********************************************************************//**
189 * @brief Clear cterror tool
190 *
191 * Clears cterror tool.
192 ***************************************************************************/
194{
195 // Free members
196 free_members();
199 this->ctool::free_members();
200
201 // Clear base class (needed to conserve tool name and version)
202 this->GApplication::clear();
203
204 // Initialise members
205 this->ctool::init_members();
208 init_members();
209
210 // Write header into logger
211 log_header();
212
213 // Return
214 return;
215}
216
217
218/***********************************************************************//**
219 * @brief Compute parameter errors using a likelihood profile method
220 *
221 * Computes the parameter errors using a likelihood profile method.
222 ***************************************************************************/
224{
225 // Get task parameters
227
228 // Set energy dispersion flags of all CTA observations and save old
229 // values in save_edisp vector
230 std::vector<bool> save_edisp = set_edisp(m_obs, m_apply_edisp);
231
232 // Write input observation container into logger
233 log_observations(NORMAL, m_obs, "Input observation");
234
235 // Write header into logger
236 log_header1(TERSE, "Compute best-fit likelihood");
237
238 // Optimize and save best log-likelihood
239 m_obs.optimize(m_opt);
240 m_obs.errors(m_opt);
241 m_best_logL = m_obs.logL();
242
243 // Store optimizer for later recovery
244 GOptimizerLM best_opt = m_opt;
245
246 // Initialise intensity vectors
248
249 // Write optimisation results and models into logger
250 log_string(NORMAL, m_opt.print(m_chatter));
251 log_value(NORMAL, "Maximum log likelihood", gammalib::str(m_best_logL,3));
252 log_string(NORMAL, m_obs.models().print(m_chatter));
253
254 // Save best fitting models
255 GModels models_best = m_obs.models();
256
257 // Get pointer on model
258 GModel* model = models_best[m_srcname];
259
260 // Get number of parameters
261 int npars = model->size();
262
263 // Loop over parameters of sky model
264 for (int i = 0; i < npars; ++i) {
265
266 // Skip parameter if it is fixed
267 if (model->at(i).is_fixed()) {
268 continue;
269 }
270
271 // Initialise with best fitting models
272 m_obs.models(models_best);
273
274 // Get pointer on model parameter
275 GModels& current_models = const_cast<GModels&>(m_obs.models());
276 m_model_par = &(current_models[m_srcname]->at(i));
277
278 // Extract current value
279 m_value = m_model_par->factor_value();
280
281 // Compute parameter bracketing
282 double parmin = std::max(m_model_par->factor_min(),
283 m_value - 10.0*m_model_par->factor_error());
284 double parmax = std::min(m_model_par->factor_max(),
285 m_value + 10.0*m_model_par->factor_error());
286
287 // Write header and initial parameters into logger
288 log_header1(TERSE, "Compute error for source \""+m_srcname+"\""
289 " parameter \""+m_model_par->name()+"\"");
290 log_value(NORMAL, "Confidence level",
291 gammalib::str(m_confidence*100.0)+" %");
292 log_value(NORMAL, "Log-likelihood difference", m_dlogL);
293 log_value(NORMAL, "Initial factor range",
294 "["+gammalib::str(parmin)+", "+gammalib::str(parmax)+"]");
295
296 // Compute lower boundary, store best fitting model, and update intensities
297 double value_lo = error_bisection(parmin, m_value);
298 GModels models_lo = m_obs.models();
300
301 // Compute upper boundaries, store best fitting model, and update intensities
302 double value_hi = error_bisection(m_value, parmax);
303 GModels models_hi = m_obs.models();
305
306 // Compute errors
307 double error = 0.5 * (value_hi - value_lo);
308 double error_neg = m_value - value_lo;
309 double error_pos = value_hi - m_value;
310 double error_value = std::abs(error*m_model_par->scale());
311 double error_value_neg = std::abs(error_neg*m_model_par->scale());
312 double error_value_pos = std::abs(error_pos*m_model_par->scale());
313
314 // Write results into logger
315 std::string unit = " " + m_model_par->unit();
316 log_value(NORMAL, "Lower parameter factor", value_lo);
317 log_value(NORMAL, "Upper parameter factor", value_hi);
318 log_value(NORMAL, "Error from curvature",
319 gammalib::str(m_model_par->error()) + unit);
320 log_value(NORMAL, "Error from profile",
321 gammalib::str(error_value) + unit);
322 log_value(NORMAL, "Negative profile error",
323 gammalib::str(error_value_neg) + unit);
324 log_value(NORMAL, "Positive profile error",
325 gammalib::str(error_value_pos) + unit);
326
327 // Optionally write best lower boundary and upper boundary model
328 // into logger
329 log_header3(NORMAL, "Model at lower parameter value");
330 log_string(NORMAL, models_lo[m_srcname]->print());
331 log_header3(NORMAL, "Model at upper parameter value");
332 log_string(NORMAL, models_hi[m_srcname]->print());
333
334 // Save error result
335 model->at(i).factor_error(error);
336
337 } // endfor: looped over spectral parameters
338
339 // Restore best fitting models (now with new errors computed)
340 m_obs.models(models_best);
341
342 // Recover optimizer
343 m_opt = best_opt;
344
345 // Restore energy dispersion flags of all CTA observations
346 restore_edisp(m_obs, save_edisp);
347
348 // Create FITS table
349 create_fits();
350
351 // Write header into logger
352 log_header1(TERSE, "Butterfly");
353
354 // Show results by converting from MeV to TeV
355 for (int k = 0; k < m_energies.size(); ++k) {
356
357 // Write message
358 std::string key = "Intensity at " +
359 gammalib::str(m_energies[k].TeV()) +
360 " TeV";
361 std::string value = gammalib::str(m_intensities[k]*1.0e6) + " (" +
362 gammalib::str(m_min_intensities[k]*1.0e6) + ", " +
363 gammalib::str(m_max_intensities[k]*1.0e6) +
364 ") ph/cm2/s/TeV";
365
366 // Write results into logger
367 log_value(NORMAL, key, value);
368
369 } // endfor: loop over energy bins
370
371 // Return
372 return;
373}
374
375
376/***********************************************************************//**
377 * @brief Save model
378 *
379 * Saves the model into an XML file.
380 ***************************************************************************/
382{
383 // Write header
384 log_header1(TERSE, "Save results");
385
386 // Save only if filename is valid
387 if ((*this)["outmodel"].is_valid()) {
388
389 // Get output filename
390 GFilename outmodel = (*this)["outmodel"].filename();
391
392 // Log filename
393 log_value(NORMAL, "Model definition file", outmodel.url());
394
395 // Write results out as XML model
396 m_obs.models().save(outmodel.url());
397
398 }
399
400 // ... otherwise signal that file was not saved
401 else {
402 log_value(NORMAL, "Model definition file", "NONE");
403 }
404
405 // Save only if filename is valid
406 if ((*this)["outfile"].is_valid()) {
407
408 // Get output filename
409 GFilename outfile = (*this)["outfile"].filename();
410
411 // Log butterfly diagram file name
412 log_value(NORMAL, "Butterfly file", outfile.url());
413
414 // Save FITS table
415 m_fits.saveto(outfile.url(), clobber());
416
417 }
418
419 // ... otherwise signal that file was not saved
420 else {
421 log_value(NORMAL, "Butterfly file", "NONE");
422 }
423
424 // Return
425 return;
426}
427
428
429/*==========================================================================
430 = =
431 = Private methods =
432 = =
433 ==========================================================================*/
434
435/***********************************************************************//**
436 * @brief Initialise class members
437 ***************************************************************************/
439{
440 // Initialise user parameters
441 m_srcname.clear();
442 m_confidence = 0.68;
443 m_tol = 1.0e-3;
444 m_max_iter = 50;
445 m_apply_edisp = false;
446 m_chatter = static_cast<GChatter>(2);
447
448 // Initialise protected members
449 m_value = 0.0;
450 m_dlogL = 0.0;
451 m_best_logL = 0.0;
452 m_model_par = NULL;
453
454 // Initialise protected members for butterfly
455 m_energies.clear();
456 m_intensities.clear();
457 m_min_intensities.clear();
458 m_max_intensities.clear();
459 m_fits.clear();
460
461 // Return
462 return;
463}
464
465
466/***********************************************************************//**
467 * @brief Copy class members
468 *
469 * @param[in] app Application.
470 ***************************************************************************/
472{
473 // Copy user parameters
474 m_srcname = app.m_srcname;
475 m_confidence = app.m_confidence;
476 m_tol = app.m_tol;
477 m_max_iter = app.m_max_iter;
478 m_apply_edisp = app.m_apply_edisp;
479 m_chatter = app.m_chatter;
480
481 // Copy protected members
482 m_value = app.m_value;
483 m_dlogL = app.m_dlogL;
484 m_best_logL = app.m_best_logL;
485 m_model_par = NULL;
486
487 // Copy protected members for butterfly
488 m_energies = app.m_energies;
489 m_intensities = app.m_intensities;
490 m_min_intensities = app.m_min_intensities;
491 m_max_intensities = app.m_max_intensities;
492 m_fits = app.m_fits;
493
494 // Return
495 return;
496}
497
498
499/***********************************************************************//**
500 * @brief Delete class members
501 ***************************************************************************/
503{
504 // Return
505 return;
506}
507
508
509/***********************************************************************//**
510 * @brief Get application parameters
511 *
512 * Get all task parameters from parameter file.
513 ***************************************************************************/
515{
516 // Setup observations from "inobs" parameter
518
519 // Set observation statistic
520 set_obs_statistic(gammalib::toupper((*this)["statistic"].string()));
521
522 // Setup models from "inmodel" parameter
523 setup_models(m_obs, (*this)["srcname"].string());
524
525 // Get name of test source
526 m_srcname = (*this)["srcname"].string();
527
528 // Read energy dispersion flag
529 m_apply_edisp = (*this)["edisp"].boolean();
530
531 // Get confidence level and transform into log-likelihood difference
532 m_confidence = (*this)["confidence"].real();
533 double sigma = gammalib::erfinv(m_confidence) * gammalib::sqrt_two;
534 m_dlogL = (sigma*sigma) / 2.0;
535
536 // Set optimizer characteristics from user parameters
537 m_opt.eps((*this)["like_accuracy"].real());
538 m_opt.max_iter((*this)["max_iter"].integer());
539
540 // Read other parameters
541 m_tol = (*this)["tol"].real();
542 m_max_iter = (*this)["max_iter"].integer();
543 m_chatter = static_cast<GChatter>((*this)["chatter"].integer());
544
545 // Create energies from user parameters
547
548 // If needed later, query output filename now
549 if (read_ahead()) {
550 (*this)["outmodel"].query();
551 (*this)["outfile"].query();
552 }
553
554 // Set number of OpenMP threads
555 #ifdef _OPENMP
556 int nthreads = (*this)["nthreads"].integer();
557 if (nthreads > 0) {
558 omp_set_num_threads(nthreads);
559 }
560 #endif
561
562 // Write parameters into logger
563 log_parameters(TERSE);
564
565 // Return
566 return;
567}
568
569
570/***********************************************************************//**
571 * @brief Calculate error using a bisection method
572 *
573 * @param[in] min Minimum parameter value
574 * @param[in] max Maximum parameter value
575 *
576 * Calculates the error using a bisection method.
577 ***************************************************************************/
578double cterror::error_bisection(const double& min, const double& max)
579{
580 // Copy values to working values
581 double wrk_min = min;
582 double wrk_max = max;
583
584 // Initialise iteration counter
585 int iter = 1;
586
587 // Initialize mid value
588 double mid = (wrk_min + wrk_max) / 2.0;
589
590 // Loop until breaking condition is reached
591 while (true) {
592
593 // Throw exception if maximum iterations are reached
594 if (iter > m_max_iter) {
595 if (wrk_min - m_model_par->factor_min() < m_tol) {
596 std::string msg = "The \""+m_model_par->name()+"\" parameter "
597 "minimum has been reached during error "
598 "calculation. To obtain accurate errors, "
599 "consider setting the minimum parameter "
600 "value to a lower value, and re-run "
601 "cterror.";
602 log_string(TERSE, msg);
603 break;
604 }
605 else if (m_model_par->factor_max() - wrk_max < m_tol) {
606 std::string msg = "The \""+m_model_par->name()+"\" parameter "
607 "maximum has been reached during error "
608 "calculation. To obtain accurate errors, "
609 "consider setting the maximum parameter "
610 "value to a higher value, and re-run "
611 "cterror.";
612 log_string(TERSE, msg);
613 break;
614 }
615 else {
616 std::string msg = "The maximum number of "+
617 gammalib::str(m_max_iter)+" iterations has "
618 "been reached. Please increase the "
619 "\"max_iter\" parameter, and re-run "
620 "cterror.";
621 throw GException::invalid_value(G_ERR_BISECTION, msg);
622 }
623 }
624
625 // Compute center of boundary
626 mid = (wrk_min + wrk_max) / 2.0;
627
628 // Calculate function value
629 double eval_mid = evaluate(*m_model_par, mid) - (m_best_logL + m_dlogL);
630
631 // Write interval into logger
632 log_value(EXPLICIT, " Iteration "+gammalib::str(iter),
633 "["+gammalib::str(wrk_min)+", "+gammalib::str(wrk_max)+"]");
634
635 // Check for convergence inside tolerance
636 if (std::abs(eval_mid) < m_tol) {
637 break;
638 }
639
640 // Check if interval is smaller than 1.0e-6
641 if (std::abs(wrk_max-wrk_min) < 1.0e-6) {
642 break;
643 }
644
645 // If we are on the crescent side of the parabola ...
646 if (mid > m_value) {
647
648 // Change boundaries for further iteration
649 if (eval_mid > 0.0) {
650 wrk_max = mid;
651 }
652 else if (eval_mid < 0.0) {
653 wrk_min = mid;
654 }
655 }
656
657 // ... otherwise we are on the decrescent side of the parabola
658 else {
659
660 // Change boundaries for further iteration
661 if (eval_mid > 0.0) {
662 wrk_min = mid;
663 }
664 else if (eval_mid < 0.0) {
665 wrk_max = mid;
666 }
667 }
668
669 // Increment counter
670 iter++;
671
672 } // endwhile
673
674 // Return mid value
675 return mid;
676
677}
678
679
680/***********************************************************************//**
681 * @brief Update intensities
682 *
683 * Update the intensities using the current model in the observation
684 * container. If the method is called with empty vectors, intensity vectors
685 * are allocated.
686 ***************************************************************************/
688{
689 // Determine mode
690 bool set = (m_intensities.size() == 0);
691
692 // If spectra are to be set then initialise intensities
693 if (set) {
694 m_intensities.assign(m_energies.size(), 0.0);
695 m_min_intensities.assign(m_energies.size(), 0.0);
696 m_max_intensities.assign(m_energies.size(), 0.0);
697 log_header3(TERSE, "Initialise intensities for butterfly");
698 }
699
700 // Get source model as sky model
701 const GModelSky* skymodel = dynamic_cast<const GModelSky*>(m_obs.models()[m_srcname]);
702
703 // Continue only if model is a sky model
704 if (skymodel != NULL) {
705
706 // Get pointer to spectral model
707 GModelSpectral* spectral = skymodel->spectral();
708
709 // Loop over energies
710 for (int i = 0; i < m_energies.size(); ++i) {
711
712 // Get model value
713 double value = spectral->eval(m_energies[i]);
714
715 // Make sure that model is not negative
716 if (value < 0.0) {
717 value = 0.0;
718 }
719
720 // If intensities are to be set the set all intensity vectors
721 if (set) {
722 m_intensities[i] = value;
723 m_min_intensities[i] = value;
724 m_max_intensities[i] = value;
725 }
726
727 // ... otherwise update intensity vectors
728 else {
729 if (value < m_min_intensities[i]) {
730 m_min_intensities[i] = value;
731 }
732 if (value > m_max_intensities[i]) {
733 m_max_intensities[i] = value;
734 }
735 }
736
737 } // endfor: looped over energies
738
739 } // endif: model was a sky model
740
741 // Return
742 return;
743}
744
745
746/***********************************************************************//**
747 * @brief Set result FITS file
748 *
749 * Set the FITS file with the butterfly results.
750 ***************************************************************************/
752{
753 // Determine the number of energies
754 int nrows = m_energies.size();
755
756 // Allocate FITS table columns
757 GFitsTableDoubleCol col_energy("ENERGY", nrows);
758 GFitsTableDoubleCol col_intensity("INTENSITY", nrows);
759 GFitsTableDoubleCol col_intensity_min("INTENSITY_MIN", nrows);
760 GFitsTableDoubleCol col_intensity_max("INTENSITY_MAX", nrows);
761
762 // Set units of columns
763 col_energy.unit("TeV");
764 col_intensity.unit("ph/cm2/s/TeV");
765 col_intensity_min.unit("ph/cm2/s/TeV");
766 col_intensity_max.unit("ph/cm2/s/TeV");
767
768 // Fill columns and convert MeV units to TeV units
769 for (int i = 0; i < nrows; ++i) {
770 col_energy(i) = m_energies[i].TeV();
771 col_intensity(i) = m_intensities[i] * 1.0e6;
772 col_intensity_min(i) = m_min_intensities[i] * 1.0e6;
773 col_intensity_max(i) = m_max_intensities[i] * 1.0e6;
774 }
775
776 // Create binary table
777 GFitsBinTable table;
778 table.extname("BUTTERFLY");
779
780 // Stamp header
781 stamp(table);
782
783 // Add keywords
784 table.card("INSTRUME", "CTA", "Name of Instrument");
785 table.card("TELESCOP", "CTA", "Name of Telescope");
786
787 // Append columns to table
788 table.append(col_energy);
789 table.append(col_intensity);
790 table.append(col_intensity_min);
791 table.append(col_intensity_max);
792
793 // Create the FITS file
794 m_fits.clear();
795 m_fits.append(table);
796
797 // Return
798 return;
799}
Parameter error calculation tool.
Definition cterror.hpp:42
void clear(void)
Clear cterror tool.
Definition cterror.cpp:193
std::string m_srcname
Name of source.
Definition cterror.hpp:71
void init_members(void)
Initialise class members.
Definition cterror.cpp:438
std::vector< double > m_min_intensities
Minimum intensities.
Definition cterror.hpp:87
virtual ~cterror(void)
Destructor.
Definition cterror.cpp:134
void process(void)
Compute parameter errors using a likelihood profile method.
Definition cterror.cpp:223
double m_value
Parameter value.
Definition cterror.hpp:79
std::vector< double > m_intensities
Model intensity.
Definition cterror.hpp:86
GFits m_fits
FITS file holding butterfly.
Definition cterror.hpp:89
cterror(void)
Void constructor.
Definition cterror.cpp:60
GEnergies m_energies
Energy values.
Definition cterror.hpp:85
double m_best_logL
Best fit log likelihood of given model.
Definition cterror.hpp:82
bool m_apply_edisp
Apply energy dispersion?
Definition cterror.hpp:75
void save(void)
Save model.
Definition cterror.cpp:381
std::vector< double > m_max_intensities
Maximum intensities.
Definition cterror.hpp:88
cterror & operator=(const cterror &app)
Assignment operator.
Definition cterror.cpp:158
void free_members(void)
Delete class members.
Definition cterror.cpp:502
void update_intensities(void)
Update intensities.
Definition cterror.cpp:687
double error_bisection(const double &min, const double &max)
Calculate error using a bisection method.
Definition cterror.cpp:578
GModelPar * m_model_par
Pointer to model parameter.
Definition cterror.hpp:81
double m_dlogL
Likelihood difference for upper limit computation.
Definition cterror.hpp:80
double m_tol
Tolerance for limit determination.
Definition cterror.hpp:73
void get_parameters(void)
Get application parameters.
Definition cterror.cpp:514
int m_max_iter
Maximum number of iterations.
Definition cterror.hpp:74
GChatter m_chatter
Chattiness.
Definition cterror.hpp:76
double m_confidence
Confidence level.
Definition cterror.hpp:72
void copy_members(const cterror &app)
Copy class members.
Definition cterror.cpp:471
void create_fits(void)
Set result FITS file.
Definition cterror.cpp:751
Base class for likelihood tools.
GOptimizerLM m_opt
Optimizer.
ctlikelihood & operator=(const ctlikelihood &app)
Assignment operator.
double evaluate(GModelPar &par, const double &value)
Evaluates the log-likelihood function.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
GObservations m_obs
Observation container.
void init_members(void)
Initialise class members.
void set_obs_statistic(const std::string &statistic)
Set fit statistic for CTA observations.
GEnergies create_energies(void)
Create energies from user parameters.
Definition ctool.cpp:776
void restore_edisp(GObservations &obs, const std::vector< bool > &edisp) const
Restore energy dispersion flags of CTA observations.
Definition ctool.cpp:1689
void setup_models(GObservations &obs, const std::string &name="")
Setup model container.
Definition ctool.cpp:545
void free_members(void)
Delete class members.
Definition ctool.cpp:357
void log_observations(const GChatter &chatter, const GObservations &obs, const std::string &what="Observation")
Log observation container.
Definition ctool.cpp:1251
std::vector< bool > set_edisp(GObservations &obs, const bool &edisp) const
Set energy dispersion to CTA observations.
Definition ctool.cpp:1649
const bool & read_ahead(void) const
Signal whether parameters should be read ahead.
Definition ctool.hpp:177
void log_parameters(const GChatter &chatter)
Log application parameters.
Definition ctool.cpp:1208
void init_members(void)
Initialise class members.
Definition ctool.cpp:321
void setup_observations(GObservations &obs, const bool &response=true, const bool &list=true, const bool &cube=true)
Setup observation container.
Definition ctool.cpp:431
#define G_ERR_BISECTION
Definition cterror.cpp:42
Parameter error calculation tool interface definition.
#define CTERROR_NAME
Definition cterror.hpp:34