zoglauer / megalib

MEGAlib - the Medium-Energy Gamma-ray Astronomy library
http://megalibtoolkit.com
Other
41 stars 32 forks source link

HEALPix support for imaging response #73

Closed israelmcmc closed 1 year ago

israelmcmc commented 1 year ago

The imaging response mode of responsecreator now supports the options anglebinmode=healpix and anglebinmodeelectron=healpix. Instead of FISBEL, it will use a HEALPix grid of an appropriate order (the pixels will have an area equal or smaller than anglebinwidth^2 and anglebinwidthelectron^2, respectively). The defaults didn't change.

I created an abstract MBinnerSpherical class. Both MBinnerFISBEL and the new MBinnerHEALPix inherit from it. MResponseMatrixAxisSpheric now has a pointer to a MBinnerSpherical object that is initiated appropriately depending on the user inputs.

To test run e.g.

responsecreator -g sftp/ComptonSphere.geo.setup -f sftp/FlatContinuumIsotropic.inc1.id1.sim -r new -m ib -s 100 -i 100 -c sftp/Revan.cfg -b sftp/Mimrec.cfg -o anglebinmode=healpix:anglebinmodeelectron=healpix -h

Should result in axes like this one:

# Axis name
AN "#nu [deg]" "#lambda [deg]"
# Axis type
AT 2D HEALPix
# Axis data
AD 4  RING

responsemanipulator knows how to handle this axis type.

Caveats and things that might still need to change:

  1. @zoglauer you might had have something cleaner in mine for the Makefile. I added the HEACFLAGS/HEALPIXCFLAGS and HEALIBS/HEALPIXLIBS to CXXFLAGS and LIBS, respectively. I tried to just add them exactly where they are needed but other things fail to link because CommonMisc is every where. Maybe I missed something
  2. Should setup.sh try to install healpix if it is not found? I'm actually confused about this one @zoglauer, I though you had done this already but I couldn't find where it happens.
  3. There are other response types for which we would want to make this change --e.g. polarization. Let's see first if this one works though.