#!/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, clobber=True) while th.isAlive(): sleep(10)
# 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')