Commit 0e88bee7bbaf22d502c3321e8f71d303254281da

Authored by Jürgen Knödlseder
1 parent 708e00f9

Add GCOMHkd time() and value() methods, implement unit test and fix pickeling (#4209)

inst/com/Makefile.am
... ... @@ -159,6 +159,7 @@ testdatacom = test/data/obs.xml \
159 159 test/data/m50441_dre.fits.gz \
160 160 test/data/m20039_oad.fits.gz \
161 161 test/data/m20041_oad.fits.gz \
  162 + test/data/m20035_hkd.fits.gz \
162 163 test/data/s10150_10000rows_bvc.fits.gz \
163 164 test/data/irfcache.fits.gz
164 165 testdatacomdir = $(pyexecdir)/gammalib/tests/com/data
... ...
inst/com/include/GCOMHkd.hpp
... ... @@ -70,6 +70,10 @@ public:
70 70 void extend(const GCOMHkd& hkd);
71 71 const std::string& name(void) const;
72 72 void name(const std::string& name);
  73 + const GTime& time(const int& index) const;
  74 + void time(const int& index, const GTime& time);
  75 + const double& value(const int& index) const;
  76 + void value(const int& index, const double& value);
73 77 std::string print(const GChatter& chatter = NORMAL) const;
74 78  
75 79 protected:
... ...
inst/com/include/GCOMObservation.hpp
... ... @@ -86,7 +86,7 @@ public:
86 86 GCOMObservation(const GFilename& evpname,
87 87 const GFilename& timname,
88 88 const std::vector<GFilename>& oadnames,
89   - const std::vector<GFilename>& hkdnames,
  89 + const std::vector<GFilename>& hkdnames = std::vector<GFilename> (),
90 90 const GFilename& bvcname = "");
91 91 GCOMObservation(const GCOMObservation& obs);
92 92 virtual ~GCOMObservation(void);
... ... @@ -122,7 +122,7 @@ public:
122 122 void load(const GFilename& evpname,
123 123 const GFilename& timname,
124 124 const std::vector<GFilename>& oadnames,
125   - const std::vector<GFilename>& hkdnames,
  125 + const std::vector<GFilename>& hkdnames = std::vector<GFilename> (),
126 126 const GFilename& bvcname = "");
127 127 void response(const GCaldb& caldb, const std::string& rspname);
128 128 void response(const GCOMResponse& response);
... ...
inst/com/pyext/GCOMHkd.i
... ... @@ -55,6 +55,10 @@ public:
55 55 void extend(const GCOMHkd& hkd);
56 56 const std::string& name(void) const;
57 57 void name(const std::string& name);
  58 + const GTime& time(const int& index) const;
  59 + void time(const int& index, const GTime& time);
  60 + const double& value(const int& index) const;
  61 + void value(const int& index, const double& value);
58 62 };
59 63  
60 64  
... ... @@ -67,9 +71,15 @@ public:
67 71 }
68 72 %pythoncode {
69 73 def __getstate__(self):
70   - state = ()
  74 + state = {'name' : self.name(),
  75 + 'times' : [self.time(i) for i in range(self.size())],
  76 + 'values': [self.value(i) for i in range(self.size())]}
71 77 return state
72 78 def __setstate__(self, state):
73   - self.__init__()
  79 + self.__init__(state['name'])
  80 + size = len(state['times'])
  81 + self.reserve(size)
  82 + for i in range(size):
  83 + self.append(state['times'][i], state['values'][i])
74 84 }
75 85 };
... ...
inst/com/pyext/GCOMObservation.i
... ... @@ -56,7 +56,7 @@ public:
56 56 GCOMObservation(const GFilename& evpname,
57 57 const GFilename& timname,
58 58 const std::vector<GFilename>& oadnames,
59   - const std::vector<GFilename>& hkdnames,
  59 + const std::vector<GFilename>& hkdnames = std::vector<GFilename> (),
60 60 const GFilename& bvcname = "");
61 61 GCOMObservation(const GCOMObservation& obs);
62 62 virtual ~GCOMObservation(void);
... ... @@ -88,7 +88,7 @@ public:
88 88 void load(const GFilename& evpname,
89 89 const GFilename& timname,
90 90 const std::vector<GFilename>& oadnames,
91   - const std::vector<GFilename>& hkdnames,
  91 + const std::vector<GFilename>& hkdnames = std::vector<GFilename> (),
92 92 const GFilename& bvcname = "");
93 93 void response(const GCaldb& caldb, const std::string& rspname);
94 94 void response(const GCOMResponse& response);
... ...
inst/com/src/GCOMHkd.cpp
... ... @@ -35,6 +35,11 @@
35 35  
36 36 /* __ Method name definitions ____________________________________________ */
37 37 #define G_REMOVE "GCOMHkd::remove(int&)"
  38 +#define G_EXTEND "GCOMHkd::extend(GCOMHkd&)"
  39 +#define G_TIME_GET "GCOMHkd::time(int&)"
  40 +#define G_VALUE_GET "GCOMHkd::value(int&)"
  41 +#define G_TIME_SET "GCOMHkd::time(int&, GTime&)"
  42 +#define G_VALUE_SET "GCOMHkd::value(int&, double&)"
38 43  
39 44 /* __ Macros _____________________________________________________________ */
40 45  
... ... @@ -229,6 +234,9 @@ void GCOMHkd::remove(const int&amp; index)
229 234 *
230 235 * @param[in] hkd Housekeeping Data container.
231 236 *
  237 + * @exception GException::invalid_argument
  238 + * Mismatch between housekeeping parameter names.
  239 + *
232 240 * Extend existing Housekeeping Data container with data found in another
233 241 * container by respecting the time ordering of the data.
234 242 ***************************************************************************/
... ... @@ -237,6 +245,15 @@ void GCOMHkd::extend(const GCOMHkd&amp; hkd)
237 245 // Do nothing if Housekeeping Data container is empty
238 246 if (!hkd.is_empty()) {
239 247  
  248 + // Check that housekeeping parameter name corresponds to expectation
  249 + if (hkd.name() != name()) {
  250 + std::string msg = "Housekeeping parameter name \""+hkd.name()+"\" "
  251 + "does not correspond to expected name \""+
  252 + name()+"\". Please specify a container with "
  253 + "the expected parameter name.";
  254 + throw GException::invalid_argument(G_EXTEND, msg);
  255 + }
  256 +
240 257 // Get current number of housekeeping data
241 258 int num = hkd.size();
242 259  
... ... @@ -273,6 +290,111 @@ void GCOMHkd::extend(const GCOMHkd&amp; hkd)
273 290  
274 291  
275 292 /***********************************************************************//**
  293 + * @brief Return reference to Housekeeping Data time
  294 + *
  295 + * @param[in] index Housekeeping Data index [0,...,size()-1].
  296 + * @return Reference to Housekeeping Data time.
  297 + *
  298 + * @exception GException::out_of_range
  299 + * Housekeeping Data @p index is out of range.
  300 + *
  301 + * Returns a reference to the Housekeeping Data time with the specified
  302 + * @p index.
  303 + ***************************************************************************/
  304 +const GTime& GCOMHkd::time(const int& index) const
  305 +{
  306 + // Raise exception if index is out of range
  307 + if (index < 0 || index >= size()) {
  308 + std::string msg = "Housekeeping Data index";
  309 + throw GException::out_of_range(G_TIME_GET, msg, index, size());
  310 + }
  311 +
  312 + // Return reference to time
  313 + return m_times[index];
  314 +}
  315 +
  316 +
  317 +/***********************************************************************//**
  318 + * @brief Set Housekeeping Data time
  319 + *
  320 + * @param[in] index Housekeeping Data index [0,...,size()-1].
  321 + * @param[in] time Housekeeping Data time.
  322 + *
  323 + * @exception GException::out_of_range
  324 + * Housekeeping Data @p index is out of range.
  325 + *
  326 + * Sets the Housekeeping Data time with the specified @p index.
  327 + ***************************************************************************/
  328 +void GCOMHkd::time(const int& index, const GTime& time)
  329 +{
  330 + // Raise exception if index is out of range
  331 + if (index < 0 || index >= size()) {
  332 + std::string msg = "Housekeeping Data index";
  333 + throw GException::out_of_range(G_TIME_SET, msg, index, size());
  334 + }
  335 +
  336 + // Set time
  337 + m_times[index] = time;
  338 +
  339 + // Return
  340 + return;
  341 +}
  342 +
  343 +
  344 +/***********************************************************************//**
  345 + * @brief Return reference to Housekeeping Data value
  346 + *
  347 + * @param[in] index Housekeeping Data index [0,...,size()-1].
  348 + * @return Reference to Housekeeping Data value.
  349 + *
  350 + * @exception GException::out_of_range
  351 + * Housekeeping Data @p index is out of range.
  352 + *
  353 + * Returns a reference to the Housekeeping Data value with the specified
  354 + * @p index.
  355 + ***************************************************************************/
  356 +const double& GCOMHkd::value(const int& index) const
  357 +{
  358 + // Raise exception if index is out of range
  359 + if (index < 0 || index >= size()) {
  360 + std::string msg = "Housekeeping Data index";
  361 + throw GException::out_of_range(G_VALUE_GET, msg, index, size());
  362 + }
  363 +
  364 + // Return reference to value
  365 + return m_values[index];
  366 +}
  367 +
  368 +
  369 +/***********************************************************************//**
  370 + * @brief Set Housekeeping Data value
  371 + *
  372 + * @param[in] index Housekeeping Data index [0,...,size()-1].
  373 + * @param[in] value Housekeeping Data value.
  374 + *
  375 + * @exception GException::out_of_range
  376 + * Housekeeping Data @p index is out of range.
  377 + *
  378 + * Sets the Housekeeping Data value with the specified @p index.
  379 + ***************************************************************************/
  380 +void GCOMHkd::value(const int& index, const double& value)
  381 +{
  382 + // Raise exception if index is out of range
  383 + if (index < 0 || index >= size()) {
  384 + std::string msg = "Housekeeping Data index";
  385 + throw GException::out_of_range(G_VALUE_SET, msg, index, size());
  386 + }
  387 +
  388 + // Set value
  389 + m_values[index] = value;
  390 +
  391 + // Return
  392 + return;
  393 +}
  394 +
  395 +
  396 +
  397 +/***********************************************************************//**
276 398 * @brief Print Housekeeping Data container
277 399 *
278 400 * @param[in] chatter Chattiness.
... ...
inst/com/test/data/m20035_hkd.fits.gz 0 → 100644
No preview for this file type
inst/com/test/data/obs_unbinned_hkd.xml 0 → 100644
  1 +<?xml version="1.0" standalone="no"?>
  2 +<observation_list title="observation library">
  3 + <observation name="Crab" id="000001" instrument="COM">
  4 + <parameter name="EVP" file="m16992_tjd8393_evp.fits"/>
  5 + <parameter name="TIM" file="m10695_tim.fits"/>
  6 + <parameter name="OAD" file="m20039_oad.fits"/>
  7 + <parameter name="OAD" file="m20041_oad.fits"/>
  8 + <parameter name="HKD" file="m20035_hkd.fits"/>
  9 + </observation>
  10 +</observation_list>
... ...
inst/com/test/test_COM.cpp
... ... @@ -50,10 +50,12 @@ const std::string com_drx = datadir+&quot;/m32171_drx.fits&quot;;
50 50 const std::string com_evp = datadir+"/m16992_tjd8393_evp.fits";
51 51 const std::string com_tim = datadir+"/m10695_tim.fits";
52 52 const std::string com_oad = datadir+"/m20039_oad.fits";
  53 +const std::string com_hkd = datadir+"/m20035_hkd.fits";
53 54 const std::string com_bvc = datadir+"/s10150_10000rows_bvc.fits";
54 55 const std::string com_obs = datadir+"/obs.xml";
55 56 const std::string com_obs_cache = datadir+"/obs_cache.xml";
56 57 const std::string com_obs_unbinned = datadir+"/obs_unbinned.xml";
  58 +const std::string com_obs_unbinned_hkd = datadir+"/obs_unbinned_hkd.xml";
57 59 const std::string com_obs_unbinned_bvc = datadir+"/obs_unbinned_bvc.xml";
58 60 const std::string com_model = datadir+"/crab.xml";
59 61 const std::string com_model_fix = datadir+"/crab_fix.xml";
... ... @@ -76,6 +78,10 @@ void TestGCOM::set(void)
76 78 "GCOMOad: Test COMPTEL Orbit Aspect Data");
77 79 append(static_cast<pfunction>(&TestGCOM::test_oads_class),
78 80 "GCOMOads: Test COMPTEL Orbit Aspect Data container");
  81 + append(static_cast<pfunction>(&TestGCOM::test_hkd_class),
  82 + "GCOMHkd: Test COMPTEL Housekeeping Data");
  83 + append(static_cast<pfunction>(&TestGCOM::test_hkds_class),
  84 + "GCOMHkds: Test COMPTEL Housekeeping Data collection");
79 85 append(static_cast<pfunction>(&TestGCOM::test_bvc_class),
80 86 "GCOMOad: Test COMPTEL Solar System Barycentre Data");
81 87 append(static_cast<pfunction>(&TestGCOM::test_bvcs_class),
... ... @@ -269,6 +275,116 @@ void TestGCOM::test_oads_class(void)
269 275  
270 276  
271 277 /***********************************************************************//**
  278 + * @brief Test GCOMHkd class
  279 + ***************************************************************************/
  280 +void TestGCOM::test_hkd_class(void)
  281 +{
  282 + // Allocate empty GCOMHkd class
  283 + GCOMHkd hkd;
  284 + test_assert(hkd.is_empty(), "Check that empty instance is empty");
  285 + test_value(hkd.size(), 0, "Check that empty instance contains no data");
  286 + test_value(hkd.name(), "", "Check that empty instance has no name");
  287 +
  288 + // Define times
  289 + GTime time1 = gammalib::com_time(8392, 624010000);
  290 + GTime time2 = gammalib::com_time(8406, 542890000);
  291 + GTime time3 = gammalib::com_time(8408, 103460000);
  292 + GTime time4 = gammalib::com_time(8418, 207680000);
  293 +
  294 + // Setup instance
  295 + hkd.name("TEST");
  296 + hkd.append(time1, 3.0);
  297 + hkd.append(time2, 5.0);
  298 + test_assert(!hkd.is_empty(), "Check that setup instance is not empty");
  299 + test_value(hkd.size(), 2, "Check that setup instance contains 2 elements");
  300 + test_value(hkd.name(), "TEST", "Check that setup instance has name \"TEST\"");
  301 + test_value(hkd.time(0).secs(), time1.secs(), "Check first time");
  302 + test_value(hkd.time(1).secs(), time2.secs(), "Check second time");
  303 + test_value(hkd.value(0), 3.0, "Check first value");
  304 + test_value(hkd.value(1), 5.0, "Check second value");
  305 +
  306 + // Remove element
  307 + hkd.remove(0);
  308 + test_assert(!hkd.is_empty(), "Check that instance is still not empty");
  309 + test_value(hkd.size(), 1, "Check that instance now contains 1 element");
  310 + test_value(hkd.time(0).secs(), time2.secs(), "Check first time");
  311 + test_value(hkd.value(0), 5.0, "Check first value");
  312 +
  313 + // Copy instance
  314 + GCOMHkd hkd_cpy = hkd;
  315 + test_assert(!hkd_cpy.is_empty(), "Check that copied instance is still not empty");
  316 + test_value(hkd_cpy.size(), 1, "Check that copied instance contains 1 element");
  317 + test_value(hkd_cpy.name(), "TEST", "Check that copied instance has name \"TEST\"");
  318 + test_value(hkd_cpy.time(0).secs(), time2.secs(), "Check first time of copied instance");
  319 + test_value(hkd_cpy.value(0), 5.0, "Check first value of copied instance");
  320 +
  321 + // Extend instance
  322 + GCOMHkd hkd_ext;
  323 + hkd_ext.append(time3, 30.0);
  324 + hkd_ext.append(time4, 50.0);
  325 + test_try("Test extension with invalid parameter name");
  326 + try {
  327 + hkd.extend(hkd_ext);
  328 + test_try_failure("Invalid parameter name shall throw an exception.");
  329 + }
  330 + catch (GException::invalid_argument &e) {
  331 + test_try_success();
  332 + }
  333 + catch (std::exception &e) {
  334 + test_try_failure(e);
  335 + }
  336 + hkd_ext.name("TEST");
  337 + hkd.extend(hkd_ext);
  338 + test_assert(!hkd.is_empty(), "Check that extended instance is still not empty");
  339 + test_value(hkd.size(), 3, "Check that extended instance contains 3 elements");
  340 + test_value(hkd.name(), "TEST", "Check that extended instance has name \"TEST\"");
  341 + test_value(hkd.time(0).secs(), time2.secs(), "Check first time of extended instance");
  342 + test_value(hkd.value(0), 5.0, "Check first value of extended instance");
  343 + test_value(hkd.time(1).secs(), time3.secs(), "Check second time of extended instance");
  344 + test_value(hkd.value(1), 30.0, "Check second value of extended instance");
  345 + test_value(hkd.time(2).secs(), time4.secs(), "Check third time of extended instance");
  346 + test_value(hkd.value(2), 50.0, "Check third value of extended instance");
  347 +
  348 + // Extend instance in reverse time (tests internal time ordering)
  349 + hkd_ext.extend(hkd_cpy);
  350 + test_assert(!hkd_ext.is_empty(), "Check that reversely extended instance is still not empty");
  351 + test_value(hkd_ext.size(), 3, "Check that reversely extended instance contains 3 elements");
  352 + test_value(hkd_ext.name(), "TEST", "Check that reversely extended instance has name \"TEST\"");
  353 + test_value(hkd_ext.time(0).secs(), time2.secs(), "Check first time of reversely extended instance");
  354 + test_value(hkd_ext.value(0), 5.0, "Check first value of reversely extended instance");
  355 + test_value(hkd_ext.time(1).secs(), time3.secs(), "Check second time of reversely extended instance");
  356 + test_value(hkd_ext.value(1), 30.0, "Check second value of reversely extended instance");
  357 + test_value(hkd_ext.time(2).secs(), time4.secs(), "Check third time of reversely extended instance");
  358 + test_value(hkd_ext.value(2), 50.0, "Check third value of reversely extended instance");
  359 +
  360 + // Return
  361 + return;
  362 +}
  363 +
  364 +
  365 +/***********************************************************************//**
  366 + * @brief Test GCOMHkds class
  367 + ***************************************************************************/
  368 +void TestGCOM::test_hkds_class(void)
  369 +{
  370 + // Allocate empty GCOMHkds class
  371 + GCOMHkds hkds0;
  372 + test_assert(hkds0.is_empty(), "Check that empty instance is empty");
  373 + test_value(hkds0.size(), 0, "Check that empty instance contains no data");
  374 +
  375 + // Load Housekeeping Data from FITS file
  376 + GCOMHkds hkds1(com_hkd);
  377 + test_assert(!hkds1.is_empty(), "Check that loaded instance is not empty");
  378 + test_value(hkds1.size(), 161, "Check that loaded instance contains 161 parameters");
  379 + test_assert(hkds1.contains("SCV2M"), "Check that loaded instance contains \"SCV2M\" parameter");
  380 + test_value(hkds1["SCV2M"].size(), 4626, "Check that loaded instance contains 161 \"SCV2M\" values");
  381 +
  382 + // Return
  383 + return;
  384 +}
  385 +
  386 +
  387 +/***********************************************************************//**
272 388 * @brief Test GCOMBvc class
273 389 ***************************************************************************/
274 390 void TestGCOM::test_bvc_class(void)
... ... @@ -515,6 +631,10 @@ void TestGCOM::test_unbinned_obs(void)
515 631 std::vector<GFilename> oads;
516 632 oads.push_back(com_oad);
517 633  
  634 + // Set HKDs vector
  635 + std::vector<GFilename> hkds;
  636 + hkds.push_back(com_hkd);
  637 +
518 638 // Test filename constructor without BVC
519 639 GCOMObservation obs1(com_evp, com_tim, oads);
520 640 test_assert(obs1.is_unbinned(), "Test if observation is unbinned");
... ... @@ -522,18 +642,20 @@ void TestGCOM::test_unbinned_obs(void)
522 642 test_value(obs1.events()->number(), 81063, "Test number of events");
523 643 test_value(obs1.tim().gti().size(), 162, "Test size of TIM");
524 644 test_value(obs1.oads().size(), 5273, "Test size of OADs");
  645 + test_value(obs1.hkds().size(), 0, "Test size of HKDs");
525 646 test_value(obs1.bvcs().size(), 0, "Test size of BVC");
526 647  
527   - // Test filename constructor with BVC
528   - GCOMObservation obs2(com_evp, com_tim, oads, com_bvc);
  648 + // Test filename constructor with HKD and BVC
  649 + GCOMObservation obs2(com_evp, com_tim, oads, hkds, com_bvc);
529 650 test_assert(obs2.is_unbinned(), "Test if observation is unbinned");
530 651 test_assert(!obs2.is_binned(), "Test if observation is not binned");
531 652 test_value(obs2.events()->number(), 81063, "Test number of events");
532 653 test_value(obs2.tim().gti().size(), 162, "Test size of TIM");
533 654 test_value(obs2.oads().size(), 5273, "Test size of OADs");
  655 + test_value(obs2.hkds().size(), 161, "Test size of HKDs");
534 656 test_value(obs2.bvcs().size(), 10000, "Test size of BVC");
535 657  
536   - // Test XML constructor without BVC dataset
  658 + // Test XML constructor without HKD and BVC dataset
537 659 GObservations obss3(com_obs_unbinned);
538 660 GCOMObservation* obs3 = static_cast<GCOMObservation*>(obss3[0]);
539 661 test_assert(obs3->is_unbinned(), "Test if observation is unbinned");
... ... @@ -541,17 +663,30 @@ void TestGCOM::test_unbinned_obs(void)
541 663 test_value(obs3->events()->number(), 81063, "Test number of events");
542 664 test_value(obs3->tim().gti().size(), 162, "Test size of TIM");
543 665 test_value(obs3->oads().size(), 10545, "Test size of OADs");
  666 + test_value(obs3->hkds().size(), 0, "Test size of HKDs");
544 667 test_value(obs3->bvcs().size(), 0, "Test size of BVC");
545 668  
546   - // Test XML constructor with BVC dataset
547   - GObservations obss4(com_obs_unbinned_bvc);
  669 + // Test XML constructor with HKD dataset
  670 + GObservations obss4(com_obs_unbinned_hkd);
548 671 GCOMObservation* obs4 = static_cast<GCOMObservation*>(obss4[0]);
549 672 test_assert(obs4->is_unbinned(), "Test if observation is unbinned");
550 673 test_assert(!obs4->is_binned(), "Test if observation is not binned");
551 674 test_value(obs4->events()->number(), 81063, "Test number of events");
552 675 test_value(obs4->tim().gti().size(), 162, "Test size of TIM");
553 676 test_value(obs4->oads().size(), 10545, "Test size of OADs");
554   - test_value(obs4->bvcs().size(), 10000, "Test size of BVC");
  677 + test_value(obs4->hkds().size(), 161, "Test size of HKDs");
  678 + test_value(obs4->bvcs().size(), 0, "Test size of BVC");
  679 +
  680 + // Test XML constructor with BVC dataset
  681 + GObservations obss5(com_obs_unbinned_bvc);
  682 + GCOMObservation* obs5 = static_cast<GCOMObservation*>(obss5[0]);
  683 + test_assert(obs5->is_unbinned(), "Test if observation is unbinned");
  684 + test_assert(!obs5->is_binned(), "Test if observation is not binned");
  685 + test_value(obs5->events()->number(), 81063, "Test number of events");
  686 + test_value(obs5->tim().gti().size(), 162, "Test size of TIM");
  687 + test_value(obs5->oads().size(), 10545, "Test size of OADs");
  688 + test_value(obs5->hkds().size(), 0, "Test size of HKDs");
  689 + test_value(obs5->bvcs().size(), 10000, "Test size of BVC");
555 690  
556 691 // Exit test
557 692 return;
... ...
inst/com/test/test_COM.hpp
1 1 /***************************************************************************
2 2 * test_COM.hpp - Test COMPTEL classes *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2022 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2023 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -55,6 +55,8 @@ public:
55 55 void test_tim_class(void);
56 56 void test_oad_class(void);
57 57 void test_oads_class(void);
  58 + void test_hkd_class(void);
  59 + void test_hkds_class(void);
58 60 void test_bvc_class(void);
59 61 void test_bvcs_class(void);
60 62 void test_inst_dir(void);
... ...
inst/com/test/test_COM.py
1 1 # ==========================================================================
2 2 # This module performs unit tests for the GammaLib COMPTEL module.
3 3 #
4   -# Copyright (C) 2012-2022 Juergen Knoedlseder
  4 +# Copyright (C) 2012-2023 Juergen Knoedlseder
5 5 #
6 6 # This program is free software: you can redistribute it and/or modify
7 7 # it under the terms of the GNU General Public License as published by
... ... @@ -64,6 +64,8 @@ class Test(gammalib.GPythonTestSuite):
64 64 test_support.pickeling(self, gammalib.GCOMModelDRM())
65 65 test_support.pickeling(self, gammalib.GCOMOad())
66 66 test_support.pickeling(self, gammalib.GCOMOads())
  67 + test_support.pickeling(self, gammalib.GCOMHkd())
  68 + test_support.pickeling(self, gammalib.GCOMHkds())
67 69 test_support.pickeling(self, gammalib.GCOMBvc())
68 70 test_support.pickeling(self, gammalib.GCOMBvcs())
69 71 test_support.pickeling(self, gammalib.GCOMObservation())
... ... @@ -125,6 +127,11 @@ class Test(gammalib.GPythonTestSuite):
125 127 oad.georad(30.0)
126 128 oads = gammalib.GCOMOads()
127 129 oads.append(oad)
  130 + hkd = gammalib.GCOMHkd()
  131 + hkd.append(gammalib.GTime(1.0,'secs'), 3.0)
  132 + hkd.append(gammalib.GTime(2.0,'secs'), 5.0)
  133 + hkds = gammalib.GCOMHkds()
  134 + hkds.append(hkd)
128 135 bvc = gammalib.GCOMBvc()
129 136 bvc.time(gammalib.GTime(1.0,'secs'))
130 137 bvc.tjd(1000)
... ... @@ -153,6 +160,8 @@ class Test(gammalib.GPythonTestSuite):
153 160 test_support.pickeling(self, gammalib.GCOMModelDRBPhibarNodes(model['Background']))
154 161 test_support.pickeling(self, gammalib.GCOMOad(oad))
155 162 test_support.pickeling(self, gammalib.GCOMOads(oads))
  163 + test_support.pickeling(self, gammalib.GCOMHkd(hkd))
  164 + test_support.pickeling(self, gammalib.GCOMHkds(hkds))
156 165 test_support.pickeling(self, gammalib.GCOMBvc(bvc))
157 166 test_support.pickeling(self, gammalib.GCOMBvcs(bvcs))
158 167 test_support.pickeling(self, gammalib.GCOMObservation(obs[0]))
... ...