Commit e83dad16e18db35644708a6d76c87c2329cf6098
1 parent
ed7efb06
Make sure that GCTAEdisp2D energy dispersion is never negative
Showing
1 changed file
with
5 additions
and
0 deletions
inst/cta/src/GCTAEdisp2D.cpp
| @@ -206,6 +206,11 @@ double GCTAEdisp2D::operator()(const double& logEobs, | @@ -206,6 +206,11 @@ double GCTAEdisp2D::operator()(const double& logEobs, | ||
| 206 | // Compute edisp | 206 | // Compute edisp |
| 207 | edisp = m_edisp(m_inx_matrix, arg[0], arg[1], arg[2]); | 207 | edisp = m_edisp(m_inx_matrix, arg[0], arg[1], arg[2]); |
| 208 | 208 | ||
| 209 | + // Make sure that energy dispersion is non-negative | ||
| 210 | + if (edisp < 0.0) { | ||
| 211 | + edisp = 0.0; | ||
| 212 | + } | ||
| 213 | + | ||
| 209 | // Return | 214 | // Return |
| 210 | return edisp; | 215 | return edisp; |
| 211 | } | 216 | } |