Skip to content

Instantly share code, notes, and snippets.

@boada
Created February 9, 2016 17:27
Show Gist options
  • Save boada/0584be63101e18df2ea5 to your computer and use it in GitHub Desktop.
Save boada/0584be63101e18df2ea5 to your computer and use it in GitHub Desktop.
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