Commit f54b67a746728a4250f37aed0950a294649b4f72

Authored by Jürgen Knödlseder
1 parent 342c1007

Add GCTAEventList::ipix() and GCTAEventList::ieng() setter methods (#2171)

ChangeLog
1 -2017-07-25 1 +2017-07-27
2 2
3 * Version 1.4.0 released 3 * Version 1.4.0 released
4 ========================= 4 =========================
5 5
  6 + Add GCTAEventBin::ipix() and ieng() setter methods (#2171)
6 Write response information into simulated observation definition file (#2170) 7 Write response information into simulated observation definition file (#2170)
7 Normalise phase curves by default (#2154) 8 Normalise phase curves by default (#2154)
8 Support Python list slicing for container classes (#2128) 9 Support Python list slicing for container classes (#2128)
1 New Features and Important Changes in GammaLib 1.4.0 1 New Features and Important Changes in GammaLib 1.4.0
2 2
3 -25 July 2017 3 +27 July 2017
4 4
5 5
6 1. Introduction 6 1. Introduction
@@ -29,6 +29,8 @@ The following methods have been added: @@ -29,6 +29,8 @@ The following methods have been added:
29 - GModelTemporalPhaseCurve::normalize() 29 - GModelTemporalPhaseCurve::normalize()
30 - GModelTemporalPhaseCurve::value(double&) 30 - GModelTemporalPhaseCurve::value(double&)
31 - GOptimizerPars::append(GOptimizerPar&) 31 - GOptimizerPars::append(GOptimizerPar&)
  32 +- GCTAEventList::ipix(int&)
  33 +- GCTAEventList::ieng(int&)
32 - GLATEventList::append(GLATEventAtom&) 34 - GLATEventList::append(GLATEventAtom&)
33 - GLATEventList::reserve(int&) 35 - GLATEventList::reserve(int&)
34 - GLATEventList::remove(int&,int&) 36 - GLATEventList::remove(int&,int&)
@@ -153,6 +155,9 @@ The response information is now always written in the observation definition @@ -153,6 +155,9 @@ The response information is now always written in the observation definition
153 XML file if it is available, and not only if it has been read in previously 155 XML file if it is available, and not only if it has been read in previously
154 from another XML file (#2170). 156 from another XML file (#2170).
155 157
  158 +Add GCTAEventList::ipix() and GCTAEventList::ieng() setter methods (#2171).
  159 +
  160 +
156 161
157 21. COMPTEL interface 162 21. COMPTEL interface
158 --------------------- 163 ---------------------
doc/source/admin/release_history/1.4.rst
@@ -20,6 +20,8 @@ Bug fixes @@ -20,6 +20,8 @@ Bug fixes
20 Improvements 20 Improvements
21 ------------ 21 ------------
22 22
  23 +* [`2171 <https://cta-redmine.irap.omp.eu/issues/2171>`_] -
  24 + Add ``GCTAEventList::ipix()`` and ``GCTAEventList::ieng()`` setter methods
23 * [`2170 <https://cta-redmine.irap.omp.eu/issues/2170>`_] - 25 * [`2170 <https://cta-redmine.irap.omp.eu/issues/2170>`_] -
24 Write response information into simulated observation definition file 26 Write response information into simulated observation definition file
25 * [`2154 <https://cta-redmine.irap.omp.eu/issues/2154>`_] - 27 * [`2154 <https://cta-redmine.irap.omp.eu/issues/2154>`_] -
inst/cta/include/GCTAEventBin.hpp
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAEventBin.hpp - CTA event bin class * 2 * GCTAEventBin.hpp - CTA event bin class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -86,6 +86,8 @@ public: @@ -86,6 +86,8 @@ public:
86 void dir(const GCTAInstDir& dir); 86 void dir(const GCTAInstDir& dir);
87 void energy(const GEnergy& energy); 87 void energy(const GEnergy& energy);
88 void time(const GTime& time); 88 void time(const GTime& time);
  89 + void ipix(const int& ipix);
  90 + void ieng(const int& ieng);
89 void solidangle(const double& solidangle); 91 void solidangle(const double& solidangle);
90 void ewidth(const GEnergy& ewidth); 92 void ewidth(const GEnergy& ewidth);
91 void ontime(const double& ontime); 93 void ontime(const double& ontime);
@@ -140,6 +142,21 @@ const int&amp; GCTAEventBin::ipix(void) const @@ -140,6 +142,21 @@ const int&amp; GCTAEventBin::ipix(void) const
140 142
141 143
142 /***********************************************************************//** 144 /***********************************************************************//**
  145 + * @brief Set the spatial pixel index
  146 + *
  147 + * @param[in] ipix Spatial pixel index.
  148 + *
  149 + * Sets the spatial index of the event bin in the event cube.
  150 + ***************************************************************************/
  151 +inline
  152 +void GCTAEventBin::ipix(const int& ipix)
  153 +{
  154 + m_ipix = ipix;
  155 + return;
  156 +}
  157 +
  158 +
  159 +/***********************************************************************//**
143 * @brief Return the energy layer index 160 * @brief Return the energy layer index
144 * 161 *
145 * @return Energy layer index. 162 * @return Energy layer index.
@@ -153,4 +170,19 @@ const int&amp; GCTAEventBin::ieng(void) const @@ -153,4 +170,19 @@ const int&amp; GCTAEventBin::ieng(void) const
153 return (m_ieng); 170 return (m_ieng);
154 } 171 }
155 172
  173 +
  174 +/***********************************************************************//**
  175 + * @brief Set the energy layer index
  176 + *
  177 + * @param[in] ieng Energy layer index.
  178 + *
  179 + * Sets the energy layer of the event bin in the event cube.
  180 + ***************************************************************************/
  181 +inline
  182 +void GCTAEventBin::ieng(const int& ieng)
  183 +{
  184 + m_ieng = ieng;
  185 + return;
  186 +}
  187 +
156 #endif /* GCTAEVENTBIN_HPP */ 188 #endif /* GCTAEVENTBIN_HPP */
inst/cta/pyext/GCTAEventBin.i
1 /*************************************************************************** 1 /***************************************************************************
2 * GCTAEventBin.i - CTA event bin class * 2 * GCTAEventBin.i - CTA event bin class *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2011-2016 by Juergen Knoedlseder * 4 + * copyright (C) 2011-2017 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- * 5 * ----------------------------------------------------------------------- *
6 * * 6 * *
7 * This program is free software: you can redistribute it and/or modify * 7 * This program is free software: you can redistribute it and/or modify *
@@ -67,6 +67,8 @@ public: @@ -67,6 +67,8 @@ public:
67 void dir(const GCTAInstDir& dir); 67 void dir(const GCTAInstDir& dir);
68 void energy(const GEnergy& energy); 68 void energy(const GEnergy& energy);
69 void time(const GTime& time); 69 void time(const GTime& time);
  70 + void ipix(const int& ipix);
  71 + void ieng(const int& ieng);
70 void solidangle(const double& solidangle); 72 void solidangle(const double& solidangle);
71 void ewidth(const GEnergy& ewidth); 73 void ewidth(const GEnergy& ewidth);
72 void ontime(const double& ontime); 74 void ontime(const double& ontime);
inst/cta/test/test_CTA.cpp
@@ -1479,6 +1479,8 @@ void TestGCTAObservation::test_event_bin(void) @@ -1479,6 +1479,8 @@ void TestGCTAObservation::test_event_bin(void)
1479 bin.energy(GEnergy(2.0, "TeV")); 1479 bin.energy(GEnergy(2.0, "TeV"));
1480 bin.time(GTime(87.3)); 1480 bin.time(GTime(87.3));
1481 bin.counts(4.0); 1481 bin.counts(4.0);
  1482 + bin.ipix(5);
  1483 + bin.ieng(7);
1482 bin.solidangle(3.14); 1484 bin.solidangle(3.14);
1483 bin.ewidth(GEnergy(7.0, "GeV")); 1485 bin.ewidth(GEnergy(7.0, "GeV"));
1484 bin.ontime(101.0); 1486 bin.ontime(101.0);
@@ -1502,8 +1504,8 @@ void TestGCTAObservation::test_event_bin(void) @@ -1502,8 +1504,8 @@ void TestGCTAObservation::test_event_bin(void)
1502 test_value(bin.time().secs(), 87.3, 1.0e-10, "Check time() for filled bin"); 1504 test_value(bin.time().secs(), 87.3, 1.0e-10, "Check time() for filled bin");
1503 test_value(bin.counts(), 4.0, 1.0e-10, "Check counts() for filled bin"); 1505 test_value(bin.counts(), 4.0, 1.0e-10, "Check counts() for filled bin");
1504 test_value(bin.error(), 2.0, 1.0e-10, "Check error() for filled bin"); 1506 test_value(bin.error(), 2.0, 1.0e-10, "Check error() for filled bin");
1505 - test_value(bin.ipix(), -1, "Check ipix() for filled bin");  
1506 - test_value(bin.ieng(), -1, "Check ieng() for filled bin"); 1507 + test_value(bin.ipix(), 5, "Check ipix() for filled bin");
  1508 + test_value(bin.ieng(), 7, "Check ieng() for filled bin");
1507 test_value(bin.solidangle(), 3.14, 1.0e-10, 1509 test_value(bin.solidangle(), 3.14, 1.0e-10,
1508 "Check solidangle() for filled bin"); 1510 "Check solidangle() for filled bin");
1509 test_value(bin.ewidth().GeV(), 7.0, 1.0e-10, 1511 test_value(bin.ewidth().GeV(), 7.0, 1.0e-10,
@@ -1528,8 +1530,8 @@ void TestGCTAObservation::test_event_bin(void) @@ -1528,8 +1530,8 @@ void TestGCTAObservation::test_event_bin(void)
1528 test_value(bin2.time().secs(), 87.3, 1.0e-10, "Check time() for copied bin"); 1530 test_value(bin2.time().secs(), 87.3, 1.0e-10, "Check time() for copied bin");
1529 test_value(bin2.counts(), 4.0, 1.0e-10, "Check counts() for copied bin"); 1531 test_value(bin2.counts(), 4.0, 1.0e-10, "Check counts() for copied bin");
1530 test_value(bin2.error(), 2.0, 1.0e-10, "Check error() for copied bin"); 1532 test_value(bin2.error(), 2.0, 1.0e-10, "Check error() for copied bin");
1531 - test_value(bin2.ipix(), -1, "Check ipix() for copied bin");  
1532 - test_value(bin2.ieng(), -1, "Check ieng() for copied bin"); 1533 + test_value(bin2.ipix(), 5, "Check ipix() for copied bin");
  1534 + test_value(bin2.ieng(), 7, "Check ieng() for copied bin");
1533 test_value(bin2.solidangle(), 3.14, 1.0e-10, 1535 test_value(bin2.solidangle(), 3.14, 1.0e-10,
1534 "Check solidangle() for copied bin"); 1536 "Check solidangle() for copied bin");
1535 test_value(bin2.ewidth().GeV(), 7.0, 1.0e-10, 1537 test_value(bin2.ewidth().GeV(), 7.0, 1.0e-10,
@@ -1555,8 +1557,8 @@ void TestGCTAObservation::test_event_bin(void) @@ -1555,8 +1557,8 @@ void TestGCTAObservation::test_event_bin(void)
1555 "Check time() for assigned bin"); 1557 "Check time() for assigned bin");
1556 test_value(bin3.counts(), 4.0, 1.0e-10, "Check counts() for assigned bin"); 1558 test_value(bin3.counts(), 4.0, 1.0e-10, "Check counts() for assigned bin");
1557 test_value(bin3.error(), 2.0, 1.0e-10, "Check error() for assigned bin"); 1559 test_value(bin3.error(), 2.0, 1.0e-10, "Check error() for assigned bin");
1558 - test_value(bin3.ipix(), -1, "Check ipix() for assigned bin");  
1559 - test_value(bin3.ieng(), -1, "Check ieng() for assigned bin"); 1560 + test_value(bin3.ipix(), 5, "Check ipix() for assigned bin");
  1561 + test_value(bin3.ieng(), 7, "Check ieng() for assigned bin");
1560 test_value(bin3.solidangle(), 3.14, 1.0e-10, 1562 test_value(bin3.solidangle(), 3.14, 1.0e-10,
1561 "Check solidangle() for assigned bin"); 1563 "Check solidangle() for assigned bin");
1562 test_value(bin3.ewidth().GeV(), 7.0, 1.0e-10, 1564 test_value(bin3.ewidth().GeV(), 7.0, 1.0e-10,
@@ -1582,8 +1584,8 @@ void TestGCTAObservation::test_event_bin(void) @@ -1582,8 +1584,8 @@ void TestGCTAObservation::test_event_bin(void)
1582 "Check time() for cloned bin"); 1584 "Check time() for cloned bin");
1583 test_value(bin4->counts(), 4.0, 1.0e-10, "Check counts() for cloned bin"); 1585 test_value(bin4->counts(), 4.0, 1.0e-10, "Check counts() for cloned bin");
1584 test_value(bin4->error(), 2.0, 1.0e-10, "Check error() for cloned bin"); 1586 test_value(bin4->error(), 2.0, 1.0e-10, "Check error() for cloned bin");
1585 - test_value(bin4->ipix(), -1, "Check ipix() for cloned bin");  
1586 - test_value(bin4->ieng(), -1, "Check ieng() for cloned bin"); 1587 + test_value(bin4->ipix(), 5, "Check ipix() for cloned bin");
  1588 + test_value(bin4->ieng(), 7, "Check ieng() for cloned bin");
1587 test_value(bin4->solidangle(), 3.14, 1.0e-10, 1589 test_value(bin4->solidangle(), 3.14, 1.0e-10,
1588 "Check solidangle() for cloned bin"); 1590 "Check solidangle() for cloned bin");
1589 test_value(bin4->ewidth().GeV(), 7.0, 1.0e-10, 1591 test_value(bin4->ewidth().GeV(), 7.0, 1.0e-10,