Commit da4abc7c2e139cc945e4df8fb9fba015e1500d70

Authored by Jürgen Knödlseder
2 parents d47013b1 d9d22559

Merge branch 'pull-request-1863-covmat' into integration

doc/source/users/reference_manual/ctlike.rst
... ... @@ -48,13 +48,13 @@ the spatial model parameters can be kept fixed during that computation
48 48 ctlike generates an output model XML file that contains the values of the
49 49 best fitting model parameters. For all free parameters, an ``error`` attribute
50 50 is added that provides the statistical uncertainty in the parameter estimate.
51   -In addition, the entire output of the covariance matrix to a separate FITS file
52   -can be queried (parameter ``outcovmat``). The parameter order given in the file
53   -corresponds to the arrangement of the covariance matrix entries. If computation
54   -of the Test Statistics has been requested for a model component, a ``ts``
55   -attribute providing the Test Statistics value is added. The output model can be
56   -used as an input model for other ctools.
  51 +If computation of the Test Statistics has been requested for a model component,
  52 +a ``ts`` attribute providing the Test Statistics value is added. The output model
  53 +can be used as an input model for other ctools.
57 54  
  55 +In addition, the covariance matrix can be saved into a file by specifying a
  56 +file name for the ``outcovmat`` parameter. If the file name ends with ``.fits``
  57 +or ``.fit`` a FITS file is written, otherwise a CSV file is written.
58 58  
59 59  
60 60 General parameters
... ... @@ -89,7 +89,7 @@ General parameters
89 89 the maximum likelihood fit.
90 90  
91 91 ``(outcovmat = NONE) [string]``
92   - Output FITS file to store covariance matrix.
  92 + Output FITS or CSV file to store covariance matrix.
93 93  
94 94 ``(stat = POISSON) [string]``
95 95 Fitting statistics (POISSON or GAUSSIAN; only affects binned analysis).
... ...
src/ctlike/ctlike.cpp
1 1 /***************************************************************************
2 2 * ctlike - Maximum likelihood fitting tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -321,8 +321,13 @@ void ctlike::run(void)
321 321 /***********************************************************************//**
322 322 * @brief Save results
323 323 *
324   - * This method saves the fit results into a XML file and a FITS file. If
325   - * the filename parameters are "NONE", the files are not saved.
  324 + * This method saves the fit results and the covariance matrix. The fit
  325 + * results are written into a XML file while the covariance matrix is written
  326 + * into either a FITS or a CSV file, depending on the file type extension
  327 + * (an extension of `.fits` or `.fit` produce a FITS file, any other
  328 + * extension produces a CSV file).
  329 + *
  330 + * If the filenames are `NONE` no information is saved.
326 331 ***************************************************************************/
327 332 void ctlike::save(void)
328 333 {
... ...
src/ctlike/ctlike.hpp
1 1 /***************************************************************************
2 2 * ctlike - Maximum likelihood fitting tool *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2016 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -67,17 +67,17 @@ protected:
67 67 double reoptimize_lm(void);
68 68  
69 69 // User parameters
70   - bool m_refit; //!< Refitting
71   - GFilename m_outmodel; //!< Source model output XML file name
72   - GFilename m_outcovmat; //!< Covariance matrix output FITS file name
73   - bool m_apply_edisp; //!< Apply energy dispersion?
74   - bool m_fix_spat_for_ts; //!< Fix spatial parameters for TS computation?
75   - GChatter m_chatter; //!< Chattiness
  70 + bool m_refit; //!< Refitting
  71 + GFilename m_outmodel; //!< Source model output XML file name
  72 + GFilename m_outcovmat; //!< Covariance matrix output file name
  73 + bool m_apply_edisp; //!< Apply energy dispersion?
  74 + bool m_fix_spat_for_ts; //!< Fix spatial parameters for TS computation?
  75 + GChatter m_chatter; //!< Chattiness
76 76  
77 77 // Members
78   - int m_max_iter; //!< Maximum number of iterations
79   - int m_max_stall; //!< Maximum number of stalls
80   - double m_logL; //!< Maximum log likelihood
  78 + int m_max_iter; //!< Maximum number of iterations
  79 + int m_max_stall; //!< Maximum number of stalls
  80 + double m_logL; //!< Maximum log likelihood
81 81 };
82 82  
83 83 #endif /* CTLIKE_HPP */
... ...