Commit 1567a71a9ebafd925f8ee4c17cc0aca720105f12

Authored by Jürgen Knödlseder
1 parent e68c9cc1

Add unit test for GSkyMap::correlate() method (#3440)

Showing 1 changed file with 16 additions and 1 deletions
test/test_GSky.cpp
1 /*************************************************************************** 1 /***************************************************************************
2 * test_GSky.cpp - Test sky module * 2 * test_GSky.cpp - Test sky module *
3 * ----------------------------------------------------------------------- * 3 * ----------------------------------------------------------------------- *
4 - * copyright (C) 2010-2021 by Juergen Knoedlseder * 4 + * copyright (C) 2010-2022 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 *
@@ -1489,6 +1489,21 @@ void TestGSky::test_GSkyMap(void) @@ -1489,6 +1489,21 @@ void TestGSky::test_GSkyMap(void)
1489 } 1489 }
1490 test_value(sum_smooth2, ref_smooth, "Check GAUSSIAN smoothing"); 1490 test_value(sum_smooth2, ref_smooth, "Check GAUSSIAN smoothing");
1491 1491
  1492 + // Load map for correlation
  1493 + GSkyMap map_correlate(sky_map);
  1494 +
  1495 + // Correlate map using DISK kernel
  1496 + GSkyMap map_correlate1 = map_correlate;
  1497 + map_correlate1.correlate("DISK", 0.2);
  1498 + map_correlate1.save("test_map_correlate_disk.fits", true);
  1499 +
  1500 + // Compute sum of correlated sky map
  1501 + double sum_correlate1 = 0.0;
  1502 + for (int pix = 0; pix < map_correlate1.npix(); ++pix) {
  1503 + sum_correlate1 += map_correlate1(pix);
  1504 + }
  1505 + test_value(sum_correlate1, 322194236.407357, "Check DISK correlation");
  1506 +
1492 // Trim the skymap based on pixels 1507 // Trim the skymap based on pixels
1493 int startx = 2; 1508 int startx = 2;
1494 int stopx = 5; 1509 int stopx = 5;