You are here: Foswiki>LV_EM Web>TechInfo>SampleSkymap (11 Dec 2015, RoyWilliams2)EditAttach

Reading a LIGO-Virgo skymap with healpy [public]

The following code reads in a FITS/Healpix file, and computes values at three sky points. You can see the skymap here.

To use the code, you will have to install the healpypackage.
# This program reads and interpolates a LIGO-Virgo skymap
# Requires "healpy" installation
# We have used a Bayestar skymap from the mock data challenge, visible here
# http://www.ligo.caltech.edu/~rwilliam/skymapViewer/aladin/index.html#F2Y:938672
# and here http://www.ligo.org/scientists/first2years/#938672
# Questions roy.williams@ligo.org 
# LIGO Caltech, 2015

import healpy, math
radian = 180/math.pi

filename = 'skymap_938672.fits'
map,header = healpy.read_map(filename, h=True)

print "Healpix file has nside = ", healpy.get_nside(map)
#for h in header: print h[0], h[1]

def interp_healpix(map, ra, dec):
    # convert to Healpix coordinates
    # ra: right ascension in degrees
    # dec: declination in degrees
    th = (90-dec)/radian   # codeclination in radians
    ph = ra/radian         # maps 24 hours = 360 degrees to 2*pi

    # interpolate at the given point
    return healpy.pixelfunc.get_interp_val(map, th, ph)

# near peak of largest bump
print "Big peak", interp_healpix(map, 278.335, 60.293) * 1.e6

# near peak of second largest bump
print "Second peak", interp_healpix(map, 258.659, 64.800) * 1.e6

# location of likely galaxy PGC063313 at 56 Mpc
print "Likely galaxy", interp_healpix(map, 292.7929, 54.0924)* 1.e6


-- RoyWilliams? - 17 Apr 2015

  • 938672and3points.png:
    938672and3points.png
Topic attachments
I Attachment Action Size Date Who Comment
938672and3points.pngpng 938672and3points.png manage 772.8 K 17 Apr 2015 - 23:03 RoyWilliams2?  
Topic revision: 11 Dec 2015, RoyWilliams2
No permission to view LV_EM.WebLeftBar

 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback