Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Galactic healpix files
- Loading branch information
Chris Beaumont
committed
Mar 18, 2014
1 parent
5898d5e
commit 7ec4821
Showing
5 changed files
with
63 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Resample test.hpx into Galactic coordinates, and create test_gal.hpx | ||
""" | ||
import numpy as np | ||
import healpy as hp | ||
from astropy.coordinates import Galactic, FK5 | ||
import astropy.units as u | ||
|
||
nest = True | ||
map = hp.read_map('test.hpx', nest=nest) | ||
|
||
theta, phi = hp.pix2ang(64, np.arange(map.size), nest) | ||
l, b = phi, np.pi / 2 - theta | ||
|
||
g = Galactic(l, b, unit=(u.rad, u.rad)) | ||
f = g.transform_to(FK5) | ||
ra, dec = f.ra.rad, f.dec.rad | ||
|
||
map = hp.get_interp_val(map, np.pi / 2 - dec, ra, nest) | ||
|
||
hp.write_map('test_gal.hpx', map, nest=nest, coord='G', | ||
fits_IDL=False) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters