Commit 9389a5930f01cb830bf8f67ae752ea781f9b5f1f

Authored by Jürgen Knödlseder
1 parent 6bb98362

Add "POINT" model to GSPIModelDataSpace (#745)

inst/spi/src/GSPIModelDataSpace.cpp
... ... @@ -1107,7 +1107,14 @@ void GSPIModelDataSpace::setup_point(GSPIEventCube* cube,
1107 1107 std::vector<int>* indices,
1108 1108 std::vector<std::string>* names)
1109 1109 {
1110   - // TODO: implement "point" method
  1110 + // Get number of detectors
  1111 + int npt = indices->size();
  1112 +
  1113 + // Setup index vector
  1114 + for (int ipt = 0; ipt < npt; ++ipt) {
  1115 + (*indices)[ipt] = ipt;
  1116 + names->push_back("P" + gammalib::str(ipt, "%6.6d"));
  1117 + }
1111 1118  
1112 1119 // Return
1113 1120 return;
... ... @@ -1155,7 +1162,7 @@ void GSPIModelDataSpace::setup_orbit(GSPIEventCube* cube,
1155 1162 if (index == -1) {
1156 1163 index = orbits.size();
1157 1164 orbits.push_back(orbit);
1158   - names->push_back("Rev" + orbit);
  1165 + names->push_back("O" + orbit);
1159 1166 }
1160 1167  
1161 1168 // Store index
... ...
inst/spi/test/test_SPI.cpp
... ... @@ -29,7 +29,6 @@
29 29 #include <config.h>
30 30 #endif
31 31 #include <cstdlib> // getenv
32   -#include "GTools.hpp"
33 32 #include "test_SPI.hpp"
34 33  
35 34 /* __ Namespaces _________________________________________________________ */
... ... @@ -245,7 +244,7 @@ void TestGSPI::test_modeldataspace(void)
245 244 test_value(model2.size(), 1, "ORBIT instance size");
246 245 test_value(model2.instruments(), "SPI", "ORBIT instance instruments");
247 246 test_value(model2.name(), "GEDSAT", "ORBIT instance name");
248   - test_value(model2[0].name(), "GEDSAT Rev0044", "ORBIT instance parameter");
  247 + test_value(model2[0].name(), "GEDSAT O0044", "ORBIT instance parameter");
249 248 xml.clear();
250 249 model2.write(xml);
251 250  
... ... @@ -255,19 +254,22 @@ void TestGSPI::test_modeldataspace(void)
255 254 test_value(model3.size(), 1, "XML constructed ORBIT instance size");
256 255 test_value(model3.instruments(), "SPI", "XML constructed ORBIT instance instruments");
257 256 test_value(model3.name(), "GEDSAT", "ORBIT instance name");
258   - test_value(model3[0].name(), "GEDSAT Rev0044", "XML constructed ORBIT instance parameter");
  257 + test_value(model3[0].name(), "GEDSAT O0044", "XML constructed ORBIT instance parameter");
259 258  
260 259 // Construct "orbit,dete" model from OG
261 260 GSPIModelDataSpace model4(obs, "GEDSAT", "orbit,dete", 0);
262   - test_value(model4.type(), "DataSpace", "ORBIT,DETE instance type");
263 261 test_value(model4.size(), 19, "ORBIT,DETE instance size");
264   - test_value(model4[1].name(), "GEDSAT D001 Rev0044", "ORBIT,DETE instance parameter");
  262 + test_value(model4[1].name(), "GEDSAT D001 O0044", "ORBIT,DETE instance parameter");
265 263  
266 264 // Construct "orbit,dete,ebin" model from OG
267 265 GSPIModelDataSpace model5(obs, "GEDSAT", "orbit,dete,ebin", 0);
268   - test_value(model5.type(), "DataSpace", "ORBIT,DETE,EBIN instance type");
269 266 test_value(model5.size(), 190, "ORBIT,DETE,EBIN instance size");
270   - test_value(model5[35].name(), "GEDSAT E005 D003 Rev0044", "ORBIT,DETE,EBIN instance parameter");
  267 + test_value(model5[35].name(), "GEDSAT E005 D003 O0044", "ORBIT,DETE,EBIN instance parameter");
  268 +
  269 + // Construct "point" model from OG
  270 + GSPIModelDataSpace model6(obs, "GEDSAT", "point", 0);
  271 + test_value(model6.size(), 88, "POINT instance size");
  272 + test_value(model6[35].name(), "GEDSAT P000035", "POINT instance parameter");
271 273  
272 274 // Return
273 275 return;
... ...