def getDSSImage(ra,dec,radius=1.0,xsize=800,**kwargs):
"""
Download Digitized Sky Survey images
https://archive.stsci.edu/cgi-bin/dss_form
https://archive.stsci.edu/cgi-bin/dss_search
Image is in celestial orientation (RA increases to the right)
https://archive.stsci.edu/dss/script_usage.html
ra (r) - right ascension
dec (d) - declination
equinox (e) - equinox (B1950 or J2000; default: J2000)
height (h) - height of image (arcminutes; default: 15.0)
width (w) - width of image (arcminutes; default: 15.0)
format (f) - image format (FITS or GIF; default: FITS)
compression (c) - compression (UNIX, GZIP, or NONE; default: NONE; compression
applies to FITS only)
version (v) - Which version of the survey to use:
1 - First Generation survey (garden variety)
2 - Second generation survey (incomplete)
3 - Check the 2nd generation; if no image is available,
then go to the 1st generation.
4 - The Quick V survey (whence came the Guide Stars Catalog;
used mostly for Phase II proposal submission)
save (s) - Save the file to disk instead of trying to display.
(ON (or anything) or not defined; default: not defined.)
"""
import subprocess
import tempfile
url="https://archive.stsci.edu/cgi-bin/dss_search?"
scale = 2.0 * radius * 60.
params=dict(ra='%.3f'%ra,dec='%.3f'%dec,width=scale,height=scale,
format='gif',version=1)
#v='poss2ukstu_red'
query='&'.join("%s=%s"%(k,v) for k,v in params.items())
tmp = tempfile.NamedTemporaryFile(suffix='.gif')
cmd='wget --progress=dot:mega -O %s "%s"'%(tmp.name,url+query)
subprocess.call(cmd,shell=True)
im = pylab.imread(tmp.name)
tmp.close()
if xsize: im = scipy.misc.imresize(im,size=(xsize,xsize))
return im
############################################################
评论列表
文章目录