Created
January 17, 2014 13:54
-
-
Save ellisowen/8473696 to your computer and use it in GitHub Desktop.
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
# Make sky maps with pixel solid angle as value | |
# (for debugging) | |
import numpy as np | |
import gammalib | |
projection = 'AIT' | |
x, y = 0, 0 | |
dx, dy = 1, 1 | |
nx, ny = 360, 180 | |
nmaps = 1 | |
image = gammalib.GSkymap(projection, "CEL", x, y, | |
-dx, dy, nx, ny, nmaps) | |
# Fill the sky map with the model image | |
for pix in range(image.npix()): | |
try: | |
STERADIAN_TO_DEG2 = np.degrees(1) ** 2 | |
image[pix] = STERADIAN_TO_DEG2 * image.solidangle(pix) | |
except RuntimeError: | |
pass | |
#import IPython; IPython.embed() | |
# Save the image to a FITS file | |
filename = 'test_{0}.fits'.format(projection) | |
print('Writing {0}'.format(filename)) | |
image.save(filename, True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment