Commit d8b4579bcf469d70a2cd23eecee88d9cbfbf32fa

Authored by Jürgen Knödlseder
1 parent e9704222

Remove GCTAObservation::obs_id() methods (#1836)

The observation identifier is now stored in the generic GObservation::id() attribute.
ChangeLog
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
38 Add GSkyMap division operator for Python 3.x (#2122) 38 Add GSkyMap division operator for Python 3.x (#2122)
39 Add time parameter to GApplicationPar class (#1864) 39 Add time parameter to GApplicationPar class (#1864)
40 Add time string constructor and set method to GTime class (#1864) 40 Add time string constructor and set method to GTime class (#1864)
  41 + Remove GCTAObservation::obs_id() methods (#1836)
41 Use GNdarray to store GSkyMap pixels and add smooth() method (#1729) 42 Use GNdarray to store GSkyMap pixels and add smooth() method (#1729)
42 Use XML support functions in all model classes (#1430) 43 Use XML support functions in all model classes (#1430)
43 Add GSkyRegionMap class (#1121) 44 Add GSkyRegionMap class (#1121)
@@ -90,7 +90,7 @@ The following methods have been added: @@ -90,7 +90,7 @@ The following methods have been added:
90 - GCOMInstDir(GSkyDir&, double&) 90 - GCOMInstDir(GSkyDir&, double&)
91 91
92 The following methods have been removed: 92 The following methods have been removed:
93 -- n.a. 93 +- GCTAObservation::obs_id()
94 94
95 The following methods have been renamed: 95 The following methods have been renamed:
96 - GObservation::statistic() was GObservation::statistics() 96 - GObservation::statistic() was GObservation::statistics()
@@ -288,6 +288,10 @@ Redistribution Matrix File (#2210). @@ -288,6 +288,10 @@ Redistribution Matrix File (#2210).
288 The WSTAT statistics was added to GCTAOnOffObservation for maximum likelihood 288 The WSTAT statistics was added to GCTAOnOffObservation for maximum likelihood
289 fitting (#2209). 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 21. COMPTEL interface 296 21. COMPTEL interface
293 --------------------- 297 ---------------------
doc/source/admin/release_history/1.5.rst
@@ -98,3 +98,5 @@ Clean up @@ -98,3 +98,5 @@ Clean up
98 Changed ``GObservation::statistics()`` to ``GObservation::statistic()`` 98 Changed ``GObservation::statistics()`` to ``GObservation::statistic()``
99 * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] - 99 * [`2237 <https://cta-redmine.irap.omp.eu/issues/2237>`_] -
100 Use ``CSTAT`` and ``CHI2`` instead of ``POISSON`` and ``GAUSSIAN`` for statistic 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,8 +134,6 @@ public:
134 GEbounds ebounds(void) const; 134 GEbounds ebounds(void) const;
135 void object(const std::string& object); 135 void object(const std::string& object);
136 const std::string& object(void) const; 136 const std::string& object(void) const;
137 - void obs_id(const int& id);  
138 - const int& obs_id(void) const;  
139 void ra_obj(const double& ra); 137 void ra_obj(const double& ra);
140 const double& ra_obj(void) const; 138 const double& ra_obj(void) const;
141 void dec_obj(const double& dec); 139 void dec_obj(const double& dec);
@@ -166,7 +164,6 @@ protected: @@ -166,7 +164,6 @@ protected:
166 GCTAResponse* m_response; //!< Pointer to instrument response functions 164 GCTAResponse* m_response; //!< Pointer to instrument response functions
167 GCTAPointing m_pointing; //!< Pointing direction 165 GCTAPointing m_pointing; //!< Pointing direction
168 GSkyRegions m_off_regions; //!< Off regions 166 GSkyRegions m_off_regions; //!< Off regions
169 - int m_obs_id; //!< Observation ID  
170 double m_ontime; //!< Ontime (seconds) 167 double m_ontime; //!< Ontime (seconds)
171 double m_livetime; //!< Livetime (seconds) 168 double m_livetime; //!< Livetime (seconds)
172 double m_deadc; //!< Deadtime correction (livetime/ontime) 169 double m_deadc; //!< Deadtime correction (livetime/ontime)
@@ -351,31 +348,6 @@ const std::string&amp; GCTAObservation::object(void) const @@ -351,31 +348,6 @@ const std::string&amp; 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 * @brief Set CTA object Right Ascension 351 * @brief Set CTA object Right Ascension
380 * 352 *
381 * @param[in] ra Object Right Ascension. 353 * @param[in] ra Object Right Ascension.
inst/cta/pyext/GCTAObservation.i
@@ -101,8 +101,6 @@ public: @@ -101,8 +101,6 @@ public:
101 GEbounds ebounds(void) const; 101 GEbounds ebounds(void) const;
102 void object(const std::string& object); 102 void object(const std::string& object);
103 const std::string& object(void) const; 103 const std::string& object(void) const;
104 - void obs_id(const int& id);  
105 - const int& obs_id(void) const;  
106 void ra_obj(const double& ra); 104 void ra_obj(const double& ra);
107 const double& ra_obj(void) const; 105 const double& ra_obj(void) const;
108 void dec_obj(const double& dec); 106 void dec_obj(const double& dec);
inst/cta/src/GCTAObservation.cpp
@@ -1532,7 +1532,6 @@ void GCTAObservation::init_members(void) @@ -1532,7 +1532,6 @@ void GCTAObservation::init_members(void)
1532 m_response = NULL; 1532 m_response = NULL;
1533 m_pointing.clear(); 1533 m_pointing.clear();
1534 m_off_regions.clear(); 1534 m_off_regions.clear();
1535 - m_obs_id = 0;  
1536 m_ontime = 0.0; 1535 m_ontime = 0.0;
1537 m_livetime = 0.0; 1536 m_livetime = 0.0;
1538 m_deadc = 1.0; 1537 m_deadc = 1.0;
@@ -1561,7 +1560,6 @@ void GCTAObservation::copy_members(const GCTAObservation&amp; obs) @@ -1561,7 +1560,6 @@ void GCTAObservation::copy_members(const GCTAObservation&amp; obs)
1561 m_bgdfile = obs.m_bgdfile; 1560 m_bgdfile = obs.m_bgdfile;
1562 m_pointing = obs.m_pointing; 1561 m_pointing = obs.m_pointing;
1563 m_off_regions = obs.m_off_regions; 1562 m_off_regions = obs.m_off_regions;
1564 - m_obs_id = obs.m_obs_id;  
1565 m_ontime = obs.m_ontime; 1563 m_ontime = obs.m_ontime;
1566 m_livetime = obs.m_livetime; 1564 m_livetime = obs.m_livetime;
1567 m_deadc = obs.m_deadc; 1565 m_deadc = obs.m_deadc;
@@ -1635,15 +1633,18 @@ void GCTAObservation::read_attributes(const GFitsHDU&amp; hdu) @@ -1635,15 +1633,18 @@ void GCTAObservation::read_attributes(const GFitsHDU&amp; hdu)
1635 m_livetime = (hdu.has_card("LIVETIME")) ? hdu.real("LIVETIME") : 0.0; 1633 m_livetime = (hdu.has_card("LIVETIME")) ? hdu.real("LIVETIME") : 0.0;
1636 1634
1637 // Read optional attributes 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 // Kluge: compute DEADC from livetime and ontime instead of using the 1649 // Kluge: compute DEADC from livetime and ontime instead of using the
1649 // keyword value as the original event lists had this values badly 1650 // keyword value as the original event lists had this values badly
@@ -1698,7 +1699,7 @@ void GCTAObservation::write_attributes(GFitsHDU&amp; hdu) const @@ -1698,7 +1699,7 @@ void GCTAObservation::write_attributes(GFitsHDU&amp; hdu) const
1698 // Set observation information 1699 // Set observation information
1699 hdu.card("CREATOR", "GammaLib", "Program which created the file"); 1700 hdu.card("CREATOR", "GammaLib", "Program which created the file");
1700 hdu.card("TELESCOP", instrument(), "Telescope"); 1701 hdu.card("TELESCOP", instrument(), "Telescope");
1701 - hdu.card("OBS_ID", obs_id(), "Observation identifier"); 1702 + hdu.card("OBS_ID", id(), "Observation identifier");
1702 hdu.card("DATE-OBS", date_obs, "Observation start date"); 1703 hdu.card("DATE-OBS", date_obs, "Observation start date");
1703 hdu.card("TIME-OBS", time_obs, "Observation start time"); 1704 hdu.card("TIME-OBS", time_obs, "Observation start time");
1704 hdu.card("DATE-END", date_end, "Observation end date"); 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,7 +1778,7 @@ void TestGCTAObservation::test_unbinned_obs(void)
1778 test_value(run.deadc(), 0.95); 1778 test_value(run.deadc(), 0.95);
1779 test_value(run.ra_obj(), 0.0); 1779 test_value(run.ra_obj(), 0.0);
1780 test_value(run.dec_obj(), 0.0); 1780 test_value(run.dec_obj(), 0.0);
1781 - test_value(run.obs_id(), 0); 1781 + test_value(run.id(), "0");
1782 test_value(run.pointing().dir().ra_deg(), 83.63); 1782 test_value(run.pointing().dir().ra_deg(), 83.63);
1783 test_value(run.pointing().dir().dec_deg(), 22.01); 1783 test_value(run.pointing().dir().dec_deg(), 22.01);
1784 test_try_success(); 1784 test_try_success();
@@ -1804,7 +1804,7 @@ void TestGCTAObservation::test_unbinned_obs(void) @@ -1804,7 +1804,7 @@ void TestGCTAObservation::test_unbinned_obs(void)
1804 test_value(run.deadc(), 0.95); 1804 test_value(run.deadc(), 0.95);
1805 test_value(run.ra_obj(), 0.0); 1805 test_value(run.ra_obj(), 0.0);
1806 test_value(run.dec_obj(), 0.0); 1806 test_value(run.dec_obj(), 0.0);
1807 - test_value(run.obs_id(), 0); 1807 + test_value(run.id(), "0");
1808 test_value(run.pointing().dir().ra_deg(), 83.63); 1808 test_value(run.pointing().dir().ra_deg(), 83.63);
1809 test_value(run.pointing().dir().dec_deg(), 22.01); 1809 test_value(run.pointing().dir().dec_deg(), 22.01);
1810 test_try_success(); 1810 test_try_success();
@@ -1852,7 +1852,7 @@ void TestGCTAObservation::test_unbinned_obs(void) @@ -1852,7 +1852,7 @@ void TestGCTAObservation::test_unbinned_obs(void)
1852 test_value(run->deadc(), 0.95); 1852 test_value(run->deadc(), 0.95);
1853 test_value(run->ra_obj(), 0.0); 1853 test_value(run->ra_obj(), 0.0);
1854 test_value(run->dec_obj(), 0.0); 1854 test_value(run->dec_obj(), 0.0);
1855 - test_value(run->obs_id(), 0); 1855 + test_value(run->id(), "00001");
1856 test_value(run->pointing().dir().ra_deg(), 83.63); 1856 test_value(run->pointing().dir().ra_deg(), 83.63);
1857 test_value(run->pointing().dir().dec_deg(), 22.01); 1857 test_value(run->pointing().dir().dec_deg(), 22.01);
1858 test_try_success(); 1858 test_try_success();