Commit bf5e37cd578ed2a6a7b1e6e41ec5f243db13466b

Authored by Jürgen Knödlseder
1 parent 1f77c70d

Add Pass 8 unit tests.

inst/lat/test/test_LAT.cpp
... ... @@ -43,6 +43,7 @@
43 43 const std::string lat_caldb = PACKAGE_SOURCE"/inst/lat/caldb";
44 44 const std::string dirPass6 = PACKAGE_SOURCE"/inst/lat/test/data/p6v3";
45 45 const std::string dirPass7 = PACKAGE_SOURCE"/inst/lat/test/data/p7v6";
  46 +const std::string dirPass8 = PACKAGE_SOURCE"/inst/lat/test/data/p8v2";
46 47  
47 48  
48 49 /***********************************************************************//**
... ... @@ -71,6 +72,7 @@ void TestGLATResponse::set(void)
71 72 // Append tests to test suite
72 73 append(static_cast<pfunction>(&TestGLATResponse::test_response_p6), "Test P6 response");
73 74 append(static_cast<pfunction>(&TestGLATResponse::test_response_p7), "Test P7 response");
  75 + append(static_cast<pfunction>(&TestGLATResponse::test_response_p8), "Test P8 response");
74 76  
75 77 // Return
76 78 return;
... ... @@ -100,6 +102,7 @@ void TestGLATLtCube::set(void)
100 102 // Append tests to test suite
101 103 append(static_cast<pfunction>(&TestGLATLtCube::test_ltcube_p6), "Test P6 livetime cube");
102 104 append(static_cast<pfunction>(&TestGLATLtCube::test_ltcube_p7), "Test P7 livetime cube");
  105 + append(static_cast<pfunction>(&TestGLATLtCube::test_ltcube_p8), "Test P8 livetime cube");
103 106  
104 107 // Return
105 108 return;
... ... @@ -129,8 +132,10 @@ void TestGLATObservation::set(void)
129 132 // Append tests to test suite
130 133 append(static_cast<pfunction>(&TestGLATObservation::test_unbinned_obs_p6), "Test P6 unbinned observation");
131 134 append(static_cast<pfunction>(&TestGLATObservation::test_unbinned_obs_p7), "Test P7 unbinned observation");
  135 + append(static_cast<pfunction>(&TestGLATObservation::test_unbinned_obs_p8), "Test P8 unbinned observation");
132 136 append(static_cast<pfunction>(&TestGLATObservation::test_binned_obs_p6), "Test P6 binned observation");
133 137 append(static_cast<pfunction>(&TestGLATObservation::test_binned_obs_p7), "Test P7 binned observation");
  138 + append(static_cast<pfunction>(&TestGLATObservation::test_binned_obs_p8), "Test P8 binned observation");
134 139  
135 140 // Return
136 141 return;
... ... @@ -160,6 +165,7 @@ void TestGLATOptimize::set(void)
160 165 // Append tests to test suite
161 166 append(static_cast<pfunction>(&TestGLATOptimize::test_binned_optimizer_p6), "Test P6 binned optimizer");
162 167 append(static_cast<pfunction>(&TestGLATOptimize::test_binned_optimizer_p7), "Test P7 binned optimizer");
  168 + append(static_cast<pfunction>(&TestGLATOptimize::test_binned_optimizer_p8), "Test P8 binned optimizer");
163 169  
164 170 // Return
165 171 return;
... ... @@ -205,6 +211,19 @@ void TestGLATResponse::test_response_p7(void)
205 211  
206 212  
207 213 /***********************************************************************//**
  214 + * @brief Test Fermi/LAT Pass 8 response handling
  215 + ***************************************************************************/
  216 +void TestGLATResponse::test_response_p8(void)
  217 +{
  218 + // Test Pass 8 IRFs
  219 + test_one_response("P8R2_SOURCE_V6");
  220 +
  221 + // Return
  222 + return;
  223 +}
  224 +
  225 +
  226 +/***********************************************************************//**
208 227 * @brief Test one specific response
209 228 *
210 229 * @param[in] irf Instrument response function.
... ... @@ -225,11 +244,8 @@ void TestGLATResponse::test_one_response(const std::string&amp; irf)
225 244 try {
226 245 GLATResponse rsp;
227 246 rsp.caldb(lat_caldb);
228   - std::cout << ".";
229 247 rsp.load(irf+"::front");
230   - std::cout << ".";
231 248 rsp.load(irf+"::back");
232   - std::cout << ".";
233 249 rsp.load(irf);
234 250 test_try_success();
235 251 }
... ... @@ -286,6 +302,21 @@ void TestGLATLtCube::test_ltcube_p7(void)
286 302  
287 303  
288 304 /***********************************************************************//**
  305 + * @brief Test livetime cube handling
  306 + *
  307 + * Verifies handling of Fermi/LAT Pass 8 livetime cube.
  308 + ***************************************************************************/
  309 +void TestGLATLtCube::test_ltcube_p8(void)
  310 +{
  311 + // Test various datasets
  312 + test_one_ltcube(dirPass8, 31911.50386047);
  313 +
  314 + // Exit test
  315 + return;
  316 +}
  317 +
  318 +
  319 +/***********************************************************************//**
289 320 * @brief Test livetime cube handling for a specific dataset
290 321 *
291 322 * @param[in] datadir Directory of test data.
... ... @@ -398,6 +429,21 @@ void TestGLATObservation::test_unbinned_obs_p7(void)
398 429  
399 430  
400 431 /***********************************************************************//**
  432 + * @brief Test unbinned observation handling
  433 + *
  434 + * Verifies handling of Pass 8 unbinned data.
  435 + ***************************************************************************/
  436 +void TestGLATObservation::test_unbinned_obs_p8(void)
  437 +{
  438 + // Test various datasets
  439 + test_one_unbinned_obs(dirPass8);
  440 +
  441 + // Exit test
  442 + return;
  443 +}
  444 +
  445 +
  446 +/***********************************************************************//**
401 447 * @brief Test binned observation handling
402 448 *
403 449 * Verifies the ability to handle Pass 6 binned Fermi/LAT data.
... ... @@ -430,6 +476,22 @@ void TestGLATObservation::test_binned_obs_p7(void)
430 476  
431 477  
432 478 /***********************************************************************//**
  479 + * @brief Test binned observation handling
  480 + *
  481 + * Verifies the ability to handle Pass 8 binned Fermi/LAT data.
  482 + ***************************************************************************/
  483 +void TestGLATObservation::test_binned_obs_p8(void)
  484 +{
  485 + // Test various datasets
  486 + test_one_binned_obs(dirPass8, "P8R2_SOURCE_V6");
  487 +
  488 + // Exit test
  489 + return;
  490 +
  491 +}
  492 +
  493 +
  494 +/***********************************************************************//**
433 495 * @brief Test unbinned observation handling for a specific dataset
434 496 *
435 497 * @param[in] datadir Directory of test data.
... ... @@ -680,6 +742,37 @@ void TestGLATOptimize::test_binned_optimizer_p7(void)
680 742  
681 743  
682 744 /***********************************************************************//**
  745 + * @brief Test binned optimizer handling
  746 + *
  747 + * Verifies the ability to handle binned Pass 8 Fermi/LAT optimization.
  748 + ***************************************************************************/
  749 +void TestGLATOptimize::test_binned_optimizer_p8(void)
  750 +{
  751 + // Set expected fit results
  752 + double fit_results[] = {1, 0,
  753 + 2.37468, 0.4548979,
  754 + 1, 0,
  755 + 1, 0,
  756 + 0.8419824722, 0.06340531926,
  757 + 1, 0,
  758 + 83.6331, 0,
  759 + 22.0145, 0,
  760 + 1.922525774e-06, 1.209507237e-07,
  761 + -2.12421, 0.0493105484,
  762 + 100, 0,
  763 + 500000, 0,
  764 + 1, 0};
  765 +
  766 + // Test various datasets
  767 + test_one_binned_optimizer(dirPass8, "P8R2_SOURCE_V6", fit_results);
  768 +
  769 + // Exit test
  770 + return;
  771 +
  772 +}
  773 +
  774 +
  775 +/***********************************************************************//**
683 776 * @brief Test binned optimizer
684 777 *
685 778 * @param[in] datadir Directory of test data.
... ...
inst/lat/test/test_LAT.hpp
1 1 /***************************************************************************
2 2 * test_LAT.hpp - Test LAT classes *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2014 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2015 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -50,6 +50,7 @@ public:
50 50 virtual std::string classname(void) const { return "TestGLATResponse"; }
51 51 void test_response_p6(void);
52 52 void test_response_p7(void);
  53 + void test_response_p8(void);
53 54 void test_one_response(const std::string& irf);
54 55 };
55 56  
... ... @@ -71,6 +72,7 @@ public:
71 72 virtual std::string classname(void) const { return "TestGLATLtCube"; }
72 73 void test_ltcube_p6(void);
73 74 void test_ltcube_p7(void);
  75 + void test_ltcube_p8(void);
74 76 void test_one_ltcube(const std::string& datadir, const double& reference);
75 77 };
76 78  
... ... @@ -94,8 +96,10 @@ public:
94 96 virtual std::string classname(void) const { return "TestGLATObservation"; }
95 97 void test_unbinned_obs_p6(void);
96 98 void test_unbinned_obs_p7(void);
  99 + void test_unbinned_obs_p8(void);
97 100 void test_binned_obs_p6(void);
98 101 void test_binned_obs_p7(void);
  102 + void test_binned_obs_p8(void);
99 103 void test_one_unbinned_obs(const std::string& datadir);
100 104 void test_one_binned_obs(const std::string& datadir, const std::string& irf);
101 105 };
... ... @@ -121,6 +125,7 @@ public:
121 125 virtual std::string classname(void) const { return "TestGLATOptimize"; }
122 126 void test_binned_optimizer_p6(void);
123 127 void test_binned_optimizer_p7(void);
  128 + void test_binned_optimizer_p8(void);
124 129 void test_one_binned_optimizer(const std::string& datadir,
125 130 const std::string& irf,
126 131 const double* fit_results);
... ...