Last active
October 13, 2015 21:25
-
-
Save boada/ab8abde12c07faf411ea to your computer and use it in GitHub Desktop.
mk_thumbs
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
from astLib import astImages | |
from astLib import astWCS | |
def mk_thumb_wcs(header,data,ra,dec,window,output): | |
try: | |
wcs = astWCS.WCS(header,mode='pyfits') | |
except: | |
wcs = astWCS.WCS(header,mode='pyfits',extensionName='SCI') | |
imdict = astImages.clipImageSectionWCS(data, wcs, ra, dec, | |
window, returnWCS=True) | |
thumb = imdict['data'] #data array | |
newwcs = imdict['wcs'] #wcs info | |
astImages.saveFITS(output, thumb, imageWCS=newwcs) | |
return thumb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment