Commit f902175634215c4214e3b83863686a861ddc8e85
1 parent
ac13e057
ctselect informs about non-overlapping time interval (#2272)
Showing
4 changed files
with
37 additions
and
19 deletions
ChangeLog
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | Add ctools::time_reference constant and remove ctools::time_reference() method (#2295) |
| 11 | 11 | Correctly strip .gz suffix from output filenames (#2287) |
| 12 | 12 | Support On/Off analysis in cslightcrv and csphasecrv (#2273) |
| 13 | + ctselect informs about non-overlapping time interval (#2272) | |
| 13 | 14 | Add tutorial for classical analysis (#2267) |
| 14 | 15 | Fix chatter level handling in ctpsfcube (#2262) |
| 15 | 16 | Handle On/Off observations by cspull (#2260) | ... | ... |
NEWS
| ... | ... | @@ -113,6 +113,9 @@ ctselect - CTA event selection |
| 113 | 113 | Any .gz suffix is now correctly stripped from the event filenames when creating |
| 114 | 114 | the output filenames (#2287). |
| 115 | 115 | |
| 116 | +ctselect now informs about non-overlapping time interval; before the time interval | |
| 117 | +was set to [0,0] which was disturbing and eventually incorrect (#2272). | |
| 118 | + | |
| 116 | 119 | Use t-type parameters for "tmin" and "tmax" to all specifying times in various |
| 117 | 120 | formats (#1864). |
| 118 | 121 | ... | ... |
doc/source/admin/release_history/1.5.rst
| ... | ... | @@ -35,6 +35,8 @@ Improvements |
| 35 | 35 | Add ``CUSTOM`` background method to :ref:`csphagen` script |
| 36 | 36 | * [`2273 <https://cta-redmine.irap.omp.eu/issues/2273>`_] - |
| 37 | 37 | Support On/Off analysis in :ref:`cslightcrv` and :ref:`csphasecrv` |
| 38 | +* [`2272 <https://cta-redmine.irap.omp.eu/issues/2272>`_] - | |
| 39 | + :ref:`ctselect` informs about non-overlapping time interval | |
| 38 | 40 | * [`2267 <https://cta-redmine.irap.omp.eu/issues/2267>`_] - |
| 39 | 41 | Add tutorial for classical analysis |
| 40 | 42 | * [`2260 <https://cta-redmine.irap.omp.eu/issues/2260>`_] - | ... | ... |
src/ctselect/ctselect.cpp
| ... | ... | @@ -752,25 +752,37 @@ void ctselect::select_events(GCTAObservation* obs, |
| 752 | 752 | // Make time selection |
| 753 | 753 | if (!m_gti.is_empty()) { |
| 754 | 754 | |
| 755 | - // Extract effective time interval in the reference time of the | |
| 756 | - // event list. We get this reference time from gti.reference(). | |
| 757 | - double tmin = gti.tstart().convert(gti.reference()); | |
| 758 | - double tmax = gti.tstop().convert(gti.reference()); | |
| 759 | - | |
| 760 | - // Format time with sufficient accuracy and add to selection string | |
| 761 | - char cmin[80]; | |
| 762 | - char cmax[80]; | |
| 763 | - sprintf(cmin, "%.8f", tmin); | |
| 764 | - sprintf(cmax, "%.8f", tmax); | |
| 765 | - selection = "TIME >= "+std::string(cmin)+" && TIME <= "+std::string(cmax); | |
| 766 | - add = " && "; | |
| 767 | - log_value(NORMAL, "Time range (MJD)", | |
| 768 | - gammalib::str(gti.tstart().mjd())+" - "+ | |
| 769 | - gammalib::str(gti.tstop().mjd())+" days"); | |
| 770 | - log_value(NORMAL, "Time range (UTC)", | |
| 771 | - gti.tstart().utc()+" - "+gti.tstop().utc()); | |
| 772 | - log_value(NORMAL, "Time range (MET)", | |
| 773 | - gammalib::str(tmin)+" - "+gammalib::str(tmax)+" seconds"); | |
| 755 | + // If there are no GTIs then request removal of all events | |
| 756 | + if (list->gti().is_empty()) { | |
| 757 | + remove_all = true; | |
| 758 | + log_value(NORMAL, "Time range", "None. There is no overlap " | |
| 759 | + "between existing and requested time interval."); | |
| 760 | + } | |
| 761 | + | |
| 762 | + // ... otherwise set time interval | |
| 763 | + else { | |
| 764 | + | |
| 765 | + // Extract effective time interval in the reference time of the | |
| 766 | + // event list. We get this reference time from gti.reference(). | |
| 767 | + double tmin = gti.tstart().convert(gti.reference()); | |
| 768 | + double tmax = gti.tstop().convert(gti.reference()); | |
| 769 | + | |
| 770 | + // Format time with sufficient accuracy and add to selection string | |
| 771 | + char cmin[80]; | |
| 772 | + char cmax[80]; | |
| 773 | + sprintf(cmin, "%.8f", tmin); | |
| 774 | + sprintf(cmax, "%.8f", tmax); | |
| 775 | + selection = "TIME >= "+std::string(cmin)+" && TIME <= "+std::string(cmax); | |
| 776 | + add = " && "; | |
| 777 | + log_value(NORMAL, "Time range (MJD)", | |
| 778 | + gammalib::str(gti.tstart().mjd())+" - "+ | |
| 779 | + gammalib::str(gti.tstop().mjd())+" days"); | |
| 780 | + log_value(NORMAL, "Time range (UTC)", | |
| 781 | + gti.tstart().utc()+" - "+gti.tstop().utc()); | |
| 782 | + log_value(NORMAL, "Time range (MET)", | |
| 783 | + gammalib::str(tmin)+" - "+gammalib::str(tmax)+" seconds"); | |
| 784 | + | |
| 785 | + } // endelse: set time interval | |
| 774 | 786 | |
| 775 | 787 | } // endif: made time selection |
| 776 | 788 | ... | ... |