Commit 07960418bc16f87a3afe30ef1c4b7e2a0e3d4e67
1 parent
67d88e3e
Use CSTAT and CHI2 instead of POISSON and GAUSSIAN for statistic (#2237)
Showing
6 changed files
with
17 additions
and
12 deletions
ChangeLog
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | ========================= |
| 5 | 5 | |
| 6 | 6 | CTA observations handle "statistic" attribute in XML file (#2238) |
| 7 | + Use CSTAT and CHI2 instead of POISSON and GAUSSIAN for statistic (#2237) | |
| 7 | 8 | Changed GObservation::statistics() to statistic() (#2238) |
| 8 | 9 | Prevent negative response values for COMPTEL IRF (#2234) |
| 9 | 10 | Add GCTAOnOffObservation PHA, ARF and RMF constructor (#2231) | ... | ... |
NEWS
| ... | ... | @@ -141,6 +141,10 @@ None |
| 141 | 141 | |
| 142 | 142 | 10. Observation module |
| 143 | 143 | ---------------------- |
| 144 | +The statistic were renamed. POISSON is now called CSTAT and GAUSSIAN is called | |
| 145 | +CHI2. The code still accepts POISSON and GAUSSIAN, but it is recommended to use | |
| 146 | +CSTAT and CHI2 instead (#2237). | |
| 147 | + | |
| 144 | 148 | The GResponse::eval_prob() method was speed up by avoiding computation for the |
| 145 | 149 | case that the spatial response is non-positive. In that case the spectral |
| 146 | 150 | response is no longer evaluated. | ... | ... |
doc/source/admin/release_history/1.5.rst
| ... | ... | @@ -82,4 +82,6 @@ Clean up |
| 82 | 82 | |
| 83 | 83 | * [`2238 <https://cta-redmine.irap.omp.eu/issues/2238>`_] - |
| 84 | 84 | Changed ``GObservation::statistics()`` to ``GObservation::statistic()`` |
| 85 | +* [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] - | |
| 86 | + Use ``CSTAT`` and ``CHI2`` instead of ``POISSON`` and ``GAUSSIAN`` for statistic | |
| 85 | 87 | ... | ... |
include/GObservation.hpp
| ... | ... | @@ -209,7 +209,7 @@ protected: |
| 209 | 209 | // Protected data area |
| 210 | 210 | std::string m_name; //!< Observation name |
| 211 | 211 | std::string m_id; //!< Observation identifier |
| 212 | - std::string m_statistic; //!< Optimizer statistic (default=Poisson) | |
| 212 | + std::string m_statistic; //!< Optimizer statistic | |
| 213 | 213 | GEvents* m_events; //!< Pointer to event container |
| 214 | 214 | }; |
| 215 | 215 | ... | ... |
inst/cta/src/GCTAOnOffObservation.cpp
src/obs/GObservation.cpp
| ... | ... | @@ -188,7 +188,7 @@ double GObservation::likelihood(const GModels& models, |
| 188 | 188 | if (dynamic_cast<const GEventList*>(events()) != NULL) { |
| 189 | 189 | |
| 190 | 190 | // Poisson statistic |
| 191 | - if (statistic == "POISSON") { | |
| 191 | + if ((statistic == "POISSON") || (statistic == "CSTAT")) { | |
| 192 | 192 | |
| 193 | 193 | // Update the log-likelihood |
| 194 | 194 | value = likelihood_poisson_unbinned(models, |
| ... | ... | @@ -201,7 +201,8 @@ double GObservation::likelihood(const GModels& models, |
| 201 | 201 | // ... otherwise throw an exception |
| 202 | 202 | else { |
| 203 | 203 | std::string msg = "Invalid statistic \""+statistic+"\". Unbinned " |
| 204 | - "optimization requires \"POISSON\" statistic."; | |
| 204 | + "optimization requires \"POISSON\" or \"CSTAT\" " | |
| 205 | + "statistic."; | |
| 205 | 206 | throw GException::invalid_value(G_LIKELIHOOD, msg); |
| 206 | 207 | } |
| 207 | 208 | |
| ... | ... | @@ -211,7 +212,7 @@ double GObservation::likelihood(const GModels& models, |
| 211 | 212 | else { |
| 212 | 213 | |
| 213 | 214 | // Poisson statistic |
| 214 | - if (statistic == "POISSON") { | |
| 215 | + if ((statistic == "POISSON") || (statistic == "CSTAT")) { | |
| 215 | 216 | value = likelihood_poisson_binned(models, |
| 216 | 217 | gradient, |
| 217 | 218 | curvature, |
| ... | ... | @@ -219,7 +220,7 @@ double GObservation::likelihood(const GModels& models, |
| 219 | 220 | } |
| 220 | 221 | |
| 221 | 222 | // ... or Gaussian statistic |
| 222 | - else if (statistic == "GAUSSIAN") { | |
| 223 | + else if ((statistic == "GAUSSIAN") || (statistic == "CHI2")) { | |
| 223 | 224 | value = likelihood_gaussian_binned(models, |
| 224 | 225 | gradient, |
| 225 | 226 | curvature, |
| ... | ... | @@ -228,9 +229,9 @@ double GObservation::likelihood(const GModels& models, |
| 228 | 229 | |
| 229 | 230 | // ... or unsupported |
| 230 | 231 | else { |
| 231 | - std::string msg = "Invalid statistic \""+statistic+"\". Unbinned " | |
| 232 | - "optimization requires \"POISSON\" or " | |
| 233 | - "\"GAUSSIAN\" statistic."; | |
| 232 | + std::string msg = "Invalid statistic \""+statistic+"\". Binned " | |
| 233 | + "optimization requires \"POISSON\", \"CSTAT\", " | |
| 234 | + "\"GAUSSIAN\" or \"CHI2\" statistic."; | |
| 234 | 235 | throw GException::invalid_value(G_LIKELIHOOD, msg); |
| 235 | 236 | } |
| 236 | 237 | |
| ... | ... | @@ -835,7 +836,7 @@ void GObservation::init_members(void) |
| 835 | 836 | // Initialise members |
| 836 | 837 | m_name.clear(); |
| 837 | 838 | m_id.clear(); |
| 838 | - m_statistic = "Poisson"; | |
| 839 | + m_statistic = "cstat"; | |
| 839 | 840 | m_events = NULL; |
| 840 | 841 | |
| 841 | 842 | // Return | ... | ... |