diff --git a/ChangeLog b/ChangeLog index 0f49e1a..baa09b2 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,9 @@ -2018-09-22 +2018-10-17 * Version 1.6.0 released ======================== + Compute DETX and DETY in ctmodel if they are not available (#2694) Do no longer set missing boundaries in ctool::get_observations and ctool::setup_observations (#2686) Unnormalize background cube values in ctbkgcube (#2685) diff --git a/NEWS b/NEWS index f25c008..51168a4 100755 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in ctools 1.6.0 -22 September 2018 +17 October 2018 Introduction @@ -112,6 +112,10 @@ None ctmodel - CTA counts cube modelling ----------------------------------- +The tools now computes DETX and DETY for every event bin if they are not +available so that model that rely on the existence of these parameters can +be handled (#2694). + Add hidden "nthreads" parameter to control parallel computations (#2421). diff --git a/doc/source/admin/release_history/1.6.rst b/doc/source/admin/release_history/1.6.rst index 972b70c..ca63f7b 100644 --- a/doc/source/admin/release_history/1.6.rst +++ b/doc/source/admin/release_history/1.6.rst @@ -19,6 +19,8 @@ In particular, this release provides: Bug fixes --------- +* [`2694 `_] - + Compute ``DETX`` and ``DETY`` in :ref:`ctmodel` if they are not available * [`2686 `_] - Do no longer set missing boundaries in ``ctool::get_observations`` and ``ctool::setup_observations`` diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index 674caca..b45dad5 100755 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -852,6 +852,10 @@ void ctmodel::fill_cube(const GCTAObservation* obs, GModels& models) int npix = m_cube.npix(); int nebins = m_cube.ebins(); + // Get reference to the pointing for DETX and DETY computation, if + // required + const GCTAPointing& pnt = obs->pointing(); + // Get references to GTI and energy boundaries for the event list const GGti& gti = obs->events()->gti(); const GEbounds& obs_ebounds = obs->ebounds(); @@ -898,8 +902,15 @@ void ctmodel::fill_cube(const GCTAObservation* obs, GModels& models) continue; } + // Get instrument direction for spatial pixel. Compute DETX and DETY + // if they are not provided + GCTAInstDir dir = m_dir[i]; + if (!dir.has_detx() || !dir.has_dety()) { + dir = pnt.instdir(dir.dir()); + } + // Set instrument direction, solid angle and pixel index of bin - bin.dir(m_dir[i]); + bin.dir(dir); bin.solidangle(m_solidangle[i]); bin.ipix(i);