Search for images for particular objects
The following script searches the HST archive for images that cover particular objects. For each object a table containing the list of images is returned (see below for an example returning images)
#!/usr/bin/python """ Given a list of object names perform a SIAP search to the HST archive and retrieve the list of images (Note: not the images) """ import os, time from optparse import OptionParser from astrogrid import acr, sesame from astrogrid import SiapSearch # Read command line arguments parser = OptionParser() parser.add_option("-b", "--broadcast", action='store_true', default=False) (options, args) = parser.parse_args() # If we are going to send the tables to TOPCAT then start the plastic hub if options.broadcast: acr.startplastic() time.sleep(2) # Define list of objects objects=['HH111', 'HH30', 'HH211', 'HH47', 'M16', 'Trifid', 'HH524', 'Sigma Orionis', 'DG Tau', 'HL Tau', 'M16', 'IRAS 04302+2247'] # Define the name resolver service s = sesame() # Define the endpoint of the search service siap = SiapSearch('ivo://cadc.nrc.ca/siap/hst') # Create output directory if it does not exist if not os.path.isdir('hst'): os.mkdir('hst') # Loop for each object for obj in objects: coords, ra, dec = s.resolve(obj) ofile = 'hst/%s.vot' % obj.replace(' ','_').replace('+','p') if not os.access(ofile, os.F_OK): res = siap.execute(ra, dec, 30.0/3600.0) open(ofile,'w').write(res) print obj, ofile if options.broadcast: acr.plastic.broadcast(ofile, 'TOPCAT')
The following script performs a SIAP search to the SDSS image archive and saves the images to VOspace:
#!/usr/bin/python
"""
Given a list of RA and Dec positions perform a SIAP search saving the
resultant VOTables and images to MySpace.
"""
import os
from time import sleep
from astrogrid import acr
from astrogrid import SiapSearch
acr.login()
# List of ra and dec. These can be read from a file.
ra = [180.0, 181.0]
dec = [0.0, 0.1]
# Initialize siap service search and name resolver
siap = SiapSearch('ivo://nasa.heasarc/skyview/sdss')
# Loop for each object of the list, query Vizier to get coordinates and execute
# the SIAP search.
for i in range(len(ra)):
odir = '#siap/sdss/obj%02d' % (i+1)
out, th = siap.execute(ra[i], dec[i], 30.0/3600.0, saveAs=odir+'/sdss.vot', saveDatasets=odir)
while th.isAlive():
sleep(10)
