threeML / hawc_hal

HAWC Accelerated Likelihood - python-only framework for HAWC data analysis
BSD 3-Clause "New" or "Revised" License
11 stars 22 forks source link

Arbitrary ROIs defined as Healpix maps #11

Closed henrikef closed 5 years ago

henrikef commented 5 years ago

I added a new HealpixMapROI class which supports arbitrarily shaped ROIs via healpix maps. The maps can be read in from a fits file or created in the analysis script and passed as a list.

The user still has to supply a center position and radius for the model map, as for HealpixConeROI. A warning is printed if the ROI is not fully contained in the model 'cone'.

In case the user-specified healpix map has a different NSIDE than the data maps, hp.pixelfunc.ud_grade is used to re-sample the ROI map to the same NSIDE as the data map.

Some tests have been added to verify that the same pixels are selected by a cone ROI and by a map ROI with the same circular active region.

Non-circular ROIs are useful for example to cut out bright nearby sources or galactic diffuse emission.

codecov[bot] commented 5 years ago

Codecov Report

Merging #11 into master will decrease coverage by 0.56%. The diff coverage is 81.15%.

@@            Coverage Diff             @@
##           master      #11      +/-   ##
==========================================
- Coverage    93.6%   93.03%   -0.57%     
==========================================
  Files          38       39       +1     
  Lines        1454     1522      +68     
==========================================
+ Hits         1361     1416      +55     
- Misses         93      106      +13
giacomov commented 5 years ago

This is awesome, thanks!

Please take care of at least the major problems found by Scrutinizer though. They are easy fixes (names of variables to change, and so on).

henrikef commented 5 years ago

Done (I think).