Commit 020801083274ce91c9bca0bd7dbab3567bb98227

Authored by Jürgen Knödlseder
1 parent 9cd0c01e

Add kludge to handle incomplete Fermi-LAT source maps (#2850)

ChangeLog
1   -2019-03-06
  1 +2019-03-21
2 2  
3 3 * Version 1.6.0 released
4 4 ========================
5 5  
  6 + Add kludge to handle incomplete Fermi-LAT source maps (#2850)
6 7 Correct Nbgd computation in GCTAOnOffObservation for Non=0 (#2838)
7 8 Improve OpenMP handling in GWcs::dir2pix (#2770)
8 9 Add support for Fermi/LAT P8V3 response functions
... ...
1 1 New Features and Important Changes in GammaLib 1.6.0
2 2  
3   -6 March 2019
  3 +21 March 2019
4 4  
5 5  
6 6 1. Introduction
... ... @@ -313,7 +313,11 @@ None
313 313  
314 314  
315 315 19. Fermi-LAT interface
316   -----------------------
  316 +-----------------------
  317 +Add kludge that allows handling of source maps that do not have WCS information
  318 +in the diffuse model maps. Such source maps are produced by the fermitools
  319 +version 1.0 (#2850).
  320 +
317 321 The P8V3 Fermi/LAT response functions are now included in the package and
318 322 unit tests for that response functions were added.
319 323  
... ...
doc/source/admin/release_history/1.6.rst
... ... @@ -51,6 +51,8 @@ Bug fixes
51 51 Improvements
52 52 ------------
53 53  
  54 +* [`2850 <https://cta-redmine.irap.omp.eu/issues/2850>`_] -
  55 + Add kludge to handle incomplete Fermi-LAT source maps
54 56 * [`2770 <https://cta-redmine.irap.omp.eu/issues/2770>`_] -
55 57 Improve OpenMP handling in ``GWcs::dir2pix``
56 58 * Add support for Fermi/LAT P8V3 response functions
... ...
inst/lat/src/GLATEventCube.cpp
1 1 /***************************************************************************
2 2 * GLATEventCube.cpp - Fermi/LAT event cube class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2009-2018 by Juergen Knoedlseder *
  4 + * copyright (C) 2009-2019 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -48,6 +48,7 @@
48 48 /* __ Macros _____________________________________________________________ */
49 49  
50 50 /* __ Coding definitions _________________________________________________ */
  51 +#define G_MISSING_WCS_KLUDGE //!< Handle source maps with missing WCS
51 52  
52 53 /* __ Debug definitions __________________________________________________ */
53 54  
... ... @@ -380,11 +381,35 @@ void GLATEventCube::read(const GFits&amp; fits)
380 381  
381 382 // Load additional source maps
382 383 for (int i = 1; i < fits.size(); ++i) {
  384 +
  385 + // Only consider image extensions
383 386 if (fits.at(i)->exttype() == GFitsHDU::HT_IMAGE) {
  387 +
  388 + // Get FITS image
384 389 const GFitsImage& hdu_srcmap = *fits.image(i);
  390 +
  391 + // Handle files that do not have WCS in their additional
  392 + // source map extensions
  393 + #if defined(G_MISSING_WCS_KLUDGE)
  394 + std::string keys[] = {"CTYPE1", "CTYPE2", "CTYPE3",
  395 + "CRPIX1", "CRPIX2", "CRPIX3",
  396 + "CRVAL1", "CRVAL2", "CRVAL3",
  397 + "CDELT1", "CDELT2", "CDELT3",
  398 + "CUNIT1", "CUNIT2", "CUNIT3",
  399 + "CROTA2"};
  400 + for (int i = 0; i < 16; ++i) {
  401 + if (!hdu_srcmap.has_card(keys[i])) {
  402 + const_cast<GFitsImage&>(hdu_srcmap).card(hdu_cntmap.card(keys[i]));
  403 + }
  404 + }
  405 + #endif
  406 +
  407 + // Read source map
385 408 read_srcmap(hdu_srcmap);
386   - }
387   - }
  409 +
  410 + } // endif: extension is an image
  411 +
  412 + } // endfor: looped over additional source maps
388 413  
389 414 // Return
390 415 return;
... ...