# Import all classes from astrogrid module from astrogrid import * # First thing we are going to perform a cone search. # We are going to query NED for all objects around a particular position in sky # First we are going to query the registry for the details of the NED service help(Registry) reg=Registry() items = reg.searchCone('NED') len(items) items[0] items[0]['content']['description'] items[0]['id'] id=items[0]['id'] # Now that we know the id of NED we go and query it cone = ConeSearch(id) help(ConeSearch) cone.execute? votable = cone.execute(180.0, 0.0, 0.5) votable[:2000] # We can do several things with the resultant table. # If we run TOPCAT we can send the table to TOPCAT from astrogrid.utils import broadcast broadcast? broadcast(votable) # The votable is a string which can be converted to e.g. fits # and we work with as a normal fits table in python from astrogrid.utils import read_votable read_votable? fptr = read_votable(votable, ofmt='fits') header = fptr[1].header header.ascardlist() data=fptr[1].data ra=data.field('pos_ra_equ') dec=data.field('pos_dec_equ') plot(ra,dec,'.') # We have seen that we have returned the output from the query to NED to the local computer # through our networ. However we can save the file to MySpace without the file going through # the network. votable = cone.execute(180.0, 0.0, 0.5, saveAs='#test1/ned.vot') votable # By the way doing this again produces and error: votable = cone.execute(180.0, 0.0, 0.5, saveAs='#test1/ned.vot') votable = cone.execute(180.0, 0.0, 0.5, saveAs='#test1/ned.vot', clobber=True) # I can still send the table to TOPCAT broadcast(votable)