diff --git a/ChangeLog b/ChangeLog index a4838f6..0565fb6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Version 1.6.0 released ======================== + Avoid ctselect error in case that RoI radius is unchanged (#2682) Add "use_irf_bkg" parameter to cslightcrv Add "like_accuracy" parameter to likelihood tools and scripts (#2662) Do not skip bins with zero counts in csspec (#2671) diff --git a/NEWS b/NEWS index 4278d6b..c3cf327 100755 --- a/NEWS +++ b/NEWS @@ -131,6 +131,9 @@ None ctselect - CTA event selection ------------------------------ +Avoid an error in case that the RoI radius is identical to the existing RoI +radius (#2682). + Interpret MET specified by "tmin" and "tmax" parameters in the time reference of the input observations (#2054). diff --git a/doc/source/admin/release_history/1.6.rst b/doc/source/admin/release_history/1.6.rst index aa86a10..9e9057d 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 --------- +* [`2682 `_] - + Avoid :ref:`ctselect` error in case that RoI radius is unchanged * [`2652 `_] - Defer import of ``ROOT`` module in :ref:`csroot2caldb` to run method * [`2456 `_] - diff --git a/doc/source/users/reference_manual/ctselect.rst b/doc/source/users/reference_manual/ctselect.rst index 6d60809..01e4e71 100755 --- a/doc/source/users/reference_manual/ctselect.rst +++ b/doc/source/users/reference_manual/ctselect.rst @@ -11,8 +11,10 @@ Synopsis This tool selects events from one or several event lists. Event selection is based on a circular acceptance region, a time interval and an energy -interval. In addition, any expression following the cfitsio syntax can be -used for event selection. +interval. If any of these default selections are to be skipped, the +user should set the relative parameters to ``INDEF`` (or ``NONE``, +``UNDEF``, ``UNDEFINED``). In addition, any expression following the cfitsio +syntax can be used for event selection. The circular acceptance region is centred by default at the pointing direction of each observation, but the user can specify a custom direction. To obtain in @@ -35,7 +37,7 @@ of ``prefix`` prepended to the file name that contains only the selected events. In addition, a new observation definition file will be written that references the new FITS files. -For each event file, the event selection parameters will be writted as data +For each event file, the event selection parameters will be written as data selection keywords to the FITS header. These keywords are mandatory for any unbinned maximum likelihood analysis of the event data. diff --git a/doc/source/users/tutorials/quickstart/selecting.rst b/doc/source/users/tutorials/quickstart/selecting.rst index 24f98ca..ba8a0d1 100755 --- a/doc/source/users/tutorials/quickstart/selecting.rst +++ b/doc/source/users/tutorials/quickstart/selecting.rst @@ -74,14 +74,15 @@ From the 202210 events in the input event list 21974 events were selected. .. note:: Event selection by :ref:`ctselect` in a given dimension can be avoided by specifying ``NONE`` (or ``INDEF``, ``UNDEF`` or ``UNDEFINED``) for - one of the selection parameters. The following run for example only + one of the selection parameters. This is recommended rather than + specifying the same selection previosuly applied to the data. The following run for example only performs a selection by time but no selection by ROI or energy: .. code-block:: bash $ ctselect Input event list or observation definition XML file [events.fits] - RA for ROI centre (degrees) (0-360) [83.63] NONE + Radius of ROI around pointing or specified RA/DEC (degrees) (0-180.) [3.] NONE Start time (UTC string, JD, MJD or time in seconds) [2020-01-01T00:10:00] Stop time (UTC string, JD, MJD or time in seconds) [2020-01-01T00:40:00] Lower energy limit (TeV) [0.1] NONE diff --git a/src/ctselect/ctselect.cpp b/src/ctselect/ctselect.cpp index a5a690b..f8b4937 100755 --- a/src/ctselect/ctselect.cpp +++ b/src/ctselect/ctselect.cpp @@ -928,17 +928,19 @@ void ctselect::select_events(GCTAObservation* obs, double distance = centre.dist_deg(roi_centre); // If the requested RoI and selected RoI are centred at the same - // position and the requested RoI is bigger then the original - // keep original radius + // position and the requested RoI is bigger or same size as + // the original keep original radius // RoIs same centre = distance < 1.e-4 // to cope with numerical precision limitations - if ((distance < 1.e-4) && (rad > roi_radius)) { + if ((distance < 1.e-4) && (rad >= roi_radius)) { rad = roi_radius; } // ... otherwise, check if requested RoI is enclosed within // original RoI - else if ((distance + rad) > roi_radius) { + // enclosed = distance + rad - roi_radius > 1.e-4 + // to cope with numerical precision limitations + else if ((distance + rad - roi_radius) > 1.e-4) { // If selection is enforced log warning and store if (m_forcesel) {