Commit d8b4579bcf469d70a2cd23eecee88d9cbfbf32fa
1 parent
e9704222
Remove GCTAObservation::obs_id() methods (#1836)
The observation identifier is now stored in the generic GObservation::id() attribute.
Showing
7 changed files
with
24 additions
and
46 deletions
ChangeLog
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | Add GSkyMap division operator for Python 3.x (#2122) |
| 39 | 39 | Add time parameter to GApplicationPar class (#1864) |
| 40 | 40 | Add time string constructor and set method to GTime class (#1864) |
| 41 | + Remove GCTAObservation::obs_id() methods (#1836) | |
| 41 | 42 | Use GNdarray to store GSkyMap pixels and add smooth() method (#1729) |
| 42 | 43 | Use XML support functions in all model classes (#1430) |
| 43 | 44 | Add GSkyRegionMap class (#1121) | ... | ... |
NEWS
| ... | ... | @@ -90,7 +90,7 @@ The following methods have been added: |
| 90 | 90 | - GCOMInstDir(GSkyDir&, double&) |
| 91 | 91 | |
| 92 | 92 | The following methods have been removed: |
| 93 | -- n.a. | |
| 93 | +- GCTAObservation::obs_id() | |
| 94 | 94 | |
| 95 | 95 | The following methods have been renamed: |
| 96 | 96 | - GObservation::statistic() was GObservation::statistics() |
| ... | ... | @@ -288,6 +288,10 @@ Redistribution Matrix File (#2210). |
| 288 | 288 | The WSTAT statistics was added to GCTAOnOffObservation for maximum likelihood |
| 289 | 289 | fitting (#2209). |
| 290 | 290 | |
| 291 | +The GCTAObservation::obs_id() methods have been removed since the generic | |
| 292 | +observation identified string, accessed via the GObservation::id() methods, | |
| 293 | +will now be used (#1836). | |
| 294 | + | |
| 291 | 295 | |
| 292 | 296 | 21. COMPTEL interface |
| 293 | 297 | --------------------- | ... | ... |
doc/source/admin/release_history/1.5.rst
| ... | ... | @@ -98,3 +98,5 @@ Clean up |
| 98 | 98 | Changed ``GObservation::statistics()`` to ``GObservation::statistic()`` |
| 99 | 99 | * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] - |
| 100 | 100 | Use ``CSTAT`` and ``CHI2`` instead of ``POISSON`` and ``GAUSSIAN`` for statistic |
| 101 | +* [`1836 <https://cta-redmine.irap.omp.eu/issues/1836>`_] - | |
| 102 | + Remove ``GCTAObservation::obs_id()`` methods | ... | ... |
inst/cta/include/GCTAObservation.hpp
| ... | ... | @@ -134,8 +134,6 @@ public: |
| 134 | 134 | GEbounds ebounds(void) const; |
| 135 | 135 | void object(const std::string& object); |
| 136 | 136 | const std::string& object(void) const; |
| 137 | - void obs_id(const int& id); | |
| 138 | - const int& obs_id(void) const; | |
| 139 | 137 | void ra_obj(const double& ra); |
| 140 | 138 | const double& ra_obj(void) const; |
| 141 | 139 | void dec_obj(const double& dec); |
| ... | ... | @@ -166,7 +164,6 @@ protected: |
| 166 | 164 | GCTAResponse* m_response; //!< Pointer to instrument response functions |
| 167 | 165 | GCTAPointing m_pointing; //!< Pointing direction |
| 168 | 166 | GSkyRegions m_off_regions; //!< Off regions |
| 169 | - int m_obs_id; //!< Observation ID | |
| 170 | 167 | double m_ontime; //!< Ontime (seconds) |
| 171 | 168 | double m_livetime; //!< Livetime (seconds) |
| 172 | 169 | double m_deadc; //!< Deadtime correction (livetime/ontime) |
| ... | ... | @@ -351,31 +348,6 @@ const std::string& GCTAObservation::object(void) const |
| 351 | 348 | |
| 352 | 349 | |
| 353 | 350 | /***********************************************************************//** |
| 354 | - * @brief Set CTA observation identifier | |
| 355 | - * | |
| 356 | - * @param[in] id Observation identifier. | |
| 357 | - ***************************************************************************/ | |
| 358 | -inline | |
| 359 | -void GCTAObservation::obs_id(const int& id) | |
| 360 | -{ | |
| 361 | - m_obs_id = id; | |
| 362 | - return; | |
| 363 | -} | |
| 364 | - | |
| 365 | - | |
| 366 | -/***********************************************************************//** | |
| 367 | - * @brief Return CTA observation identifier | |
| 368 | - * | |
| 369 | - * @return Observation identifier. | |
| 370 | - ***************************************************************************/ | |
| 371 | -inline | |
| 372 | -const int& GCTAObservation::obs_id(void) const | |
| 373 | -{ | |
| 374 | - return m_obs_id; | |
| 375 | -} | |
| 376 | - | |
| 377 | - | |
| 378 | -/***********************************************************************//** | |
| 379 | 351 | * @brief Set CTA object Right Ascension |
| 380 | 352 | * |
| 381 | 353 | * @param[in] ra Object Right Ascension. | ... | ... |
inst/cta/pyext/GCTAObservation.i
| ... | ... | @@ -101,8 +101,6 @@ public: |
| 101 | 101 | GEbounds ebounds(void) const; |
| 102 | 102 | void object(const std::string& object); |
| 103 | 103 | const std::string& object(void) const; |
| 104 | - void obs_id(const int& id); | |
| 105 | - const int& obs_id(void) const; | |
| 106 | 104 | void ra_obj(const double& ra); |
| 107 | 105 | const double& ra_obj(void) const; |
| 108 | 106 | void dec_obj(const double& dec); | ... | ... |
inst/cta/src/GCTAObservation.cpp
| ... | ... | @@ -1532,7 +1532,6 @@ void GCTAObservation::init_members(void) |
| 1532 | 1532 | m_response = NULL; |
| 1533 | 1533 | m_pointing.clear(); |
| 1534 | 1534 | m_off_regions.clear(); |
| 1535 | - m_obs_id = 0; | |
| 1536 | 1535 | m_ontime = 0.0; |
| 1537 | 1536 | m_livetime = 0.0; |
| 1538 | 1537 | m_deadc = 1.0; |
| ... | ... | @@ -1561,7 +1560,6 @@ void GCTAObservation::copy_members(const GCTAObservation& obs) |
| 1561 | 1560 | m_bgdfile = obs.m_bgdfile; |
| 1562 | 1561 | m_pointing = obs.m_pointing; |
| 1563 | 1562 | m_off_regions = obs.m_off_regions; |
| 1564 | - m_obs_id = obs.m_obs_id; | |
| 1565 | 1563 | m_ontime = obs.m_ontime; |
| 1566 | 1564 | m_livetime = obs.m_livetime; |
| 1567 | 1565 | m_deadc = obs.m_deadc; |
| ... | ... | @@ -1635,15 +1633,18 @@ void GCTAObservation::read_attributes(const GFitsHDU& hdu) |
| 1635 | 1633 | m_livetime = (hdu.has_card("LIVETIME")) ? hdu.real("LIVETIME") : 0.0; |
| 1636 | 1634 | |
| 1637 | 1635 | // Read optional attributes |
| 1638 | - m_object = (hdu.has_card("OBJECT")) ? hdu.string("OBJECT") : "unknown"; | |
| 1639 | - m_deadc = (hdu.has_card("DEADC")) ? hdu.real("DEADC") : 0.0; | |
| 1640 | - m_ra_obj = (hdu.has_card("RA_OBJ")) ? hdu.real("RA_OBJ") : 0.0; | |
| 1641 | - m_dec_obj = (hdu.has_card("DEC_OBJ")) ? hdu.real("DEC_OBJ") : 0.0; | |
| 1642 | - m_obs_id = (hdu.has_card("OBS_ID")) ? hdu.integer("OBS_ID") : 0; | |
| 1643 | - double alt = (hdu.has_card("ALT_PNT")) ? hdu.real("ALT_PNT") : 0.0; | |
| 1644 | - double az = (hdu.has_card("AZ_PNT")) ? hdu.real("AZ_PNT") : 0.0; | |
| 1645 | - m_instrument = (hdu.has_card("TELESCOP")) ? hdu.string("TELESCOP") : "CTA"; | |
| 1646 | - m_n_tels = (hdu.has_card("N_TELS")) ? hdu.integer("N_TELS") : 0; | |
| 1636 | + m_object = (hdu.has_card("OBJECT")) ? hdu.string("OBJECT") : "unknown"; | |
| 1637 | + m_deadc = (hdu.has_card("DEADC")) ? hdu.real("DEADC") : 0.0; | |
| 1638 | + m_ra_obj = (hdu.has_card("RA_OBJ")) ? hdu.real("RA_OBJ") : 0.0; | |
| 1639 | + m_dec_obj = (hdu.has_card("DEC_OBJ")) ? hdu.real("DEC_OBJ") : 0.0; | |
| 1640 | + std::string id = (hdu.has_card("OBS_ID")) ? hdu.string("OBS_ID") : ""; | |
| 1641 | + double alt = (hdu.has_card("ALT_PNT")) ? hdu.real("ALT_PNT") : 0.0; | |
| 1642 | + double az = (hdu.has_card("AZ_PNT")) ? hdu.real("AZ_PNT") : 0.0; | |
| 1643 | + m_instrument = (hdu.has_card("TELESCOP")) ? hdu.string("TELESCOP") : "CTA"; | |
| 1644 | + m_n_tels = (hdu.has_card("N_TELS")) ? hdu.integer("N_TELS") : 0; | |
| 1645 | + | |
| 1646 | + // Set attributes | |
| 1647 | + this->id(id); | |
| 1647 | 1648 | |
| 1648 | 1649 | // Kluge: compute DEADC from livetime and ontime instead of using the |
| 1649 | 1650 | // keyword value as the original event lists had this values badly |
| ... | ... | @@ -1698,7 +1699,7 @@ void GCTAObservation::write_attributes(GFitsHDU& hdu) const |
| 1698 | 1699 | // Set observation information |
| 1699 | 1700 | hdu.card("CREATOR", "GammaLib", "Program which created the file"); |
| 1700 | 1701 | hdu.card("TELESCOP", instrument(), "Telescope"); |
| 1701 | - hdu.card("OBS_ID", obs_id(), "Observation identifier"); | |
| 1702 | + hdu.card("OBS_ID", id(), "Observation identifier"); | |
| 1702 | 1703 | hdu.card("DATE-OBS", date_obs, "Observation start date"); |
| 1703 | 1704 | hdu.card("TIME-OBS", time_obs, "Observation start time"); |
| 1704 | 1705 | hdu.card("DATE-END", date_end, "Observation end date"); | ... | ... |
inst/cta/test/test_CTA.cpp
| ... | ... | @@ -1778,7 +1778,7 @@ void TestGCTAObservation::test_unbinned_obs(void) |
| 1778 | 1778 | test_value(run.deadc(), 0.95); |
| 1779 | 1779 | test_value(run.ra_obj(), 0.0); |
| 1780 | 1780 | test_value(run.dec_obj(), 0.0); |
| 1781 | - test_value(run.obs_id(), 0); | |
| 1781 | + test_value(run.id(), "0"); | |
| 1782 | 1782 | test_value(run.pointing().dir().ra_deg(), 83.63); |
| 1783 | 1783 | test_value(run.pointing().dir().dec_deg(), 22.01); |
| 1784 | 1784 | test_try_success(); |
| ... | ... | @@ -1804,7 +1804,7 @@ void TestGCTAObservation::test_unbinned_obs(void) |
| 1804 | 1804 | test_value(run.deadc(), 0.95); |
| 1805 | 1805 | test_value(run.ra_obj(), 0.0); |
| 1806 | 1806 | test_value(run.dec_obj(), 0.0); |
| 1807 | - test_value(run.obs_id(), 0); | |
| 1807 | + test_value(run.id(), "0"); | |
| 1808 | 1808 | test_value(run.pointing().dir().ra_deg(), 83.63); |
| 1809 | 1809 | test_value(run.pointing().dir().dec_deg(), 22.01); |
| 1810 | 1810 | test_try_success(); |
| ... | ... | @@ -1852,7 +1852,7 @@ void TestGCTAObservation::test_unbinned_obs(void) |
| 1852 | 1852 | test_value(run->deadc(), 0.95); |
| 1853 | 1853 | test_value(run->ra_obj(), 0.0); |
| 1854 | 1854 | test_value(run->dec_obj(), 0.0); |
| 1855 | - test_value(run->obs_id(), 0); | |
| 1855 | + test_value(run->id(), "00001"); | |
| 1856 | 1856 | test_value(run->pointing().dir().ra_deg(), 83.63); |
| 1857 | 1857 | test_value(run->pointing().dir().dec_deg(), 22.01); |
| 1858 | 1858 | test_try_success(); | ... | ... |