Skip to content

Instantly share code, notes, and snippets.

@boada
Last active October 13, 2015 21:25
Show Gist options
  • Save boada/ab8abde12c07faf411ea to your computer and use it in GitHub Desktop.
Save boada/ab8abde12c07faf411ea to your computer and use it in GitHub Desktop.
mk_thumbs
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