acr.login('leicester') # Coords for IC 5070 ra, dec = 312.75, 44.37 # Output directory output_dir = '#iphas' # Define box bounding box ra1 = ra - 0.25 / cos(radians(ra)) dec1 = dec - 0.25 ra2 = ra + 0.25 / cos(radians(ra)) dec2 = dec + 0.25 # Query 2MASS twomass = DSA('ivo://wfau.roe.ac.uk/twomass-dsa/wsa/ceaApplication') job1 = twomass.query('select * from twomass_psc as x where x.ra between %s and %s and x."dec" between %s and %s' % (ra1, ra2, dec1, dec2), saveAs='%s/twomass.vot' % output_dir) while job1.status() in ['INITIALIZING', 'RUNNING', 'UNKNOWN']: time.sleep(10) if job1.status() == 'ERROR': print 'Error querying 2MASS database' print job1.results()[0] sys.exit() print '2MASS Query: ',job1.status() # Query IPHAS
#!/usr/bin/python import time, urllib from astrogrid import acr, DSA, MySpace # Login in Leicester account acr.login() m = MySpace() # Define the service to query dsa=DSA('ivo://wfau.roe.ac.uk/sdssdr5-dsa/dsa/ceaApplication') # Construct the SQL tsql = """SELECT a.ra, a."dec", a.psfMag_g, a.psfMag_r FROM PhotoTag AS a """ tsql += """WHERE a.ra>110 AND a.ra<230 AND a."dec">%s AND a."dec"<=%s AND (a.psfMag_g-a.psfMag_r <0.4 ) AND """ tsql += """a.psfMag_r>20.0 AND a.psfMag_g>0 AND a.mode=1 AND a.probPSF=1""" # Looop for range of declinations for i in range(0, 60, 2): sql = tsql % (i, i+2) r = dsa.query(sql, saveAs='#cam/ndec%02d-%02d.vot' % (i,i+2)) # Wait until completed time.sleep(10) while r.status() not in ['COMPLETED' , 'ERROR']: print r.status() time.sleep(10) print r.status() # If completed extract the URL of the saved file and save it to local disk
from astrogrid import acr, DSA, MySpace acr.login() db = DSA('ivo://uk.ac.cam.ast/iphas-dsa-catalog/IDR') app = db.query('Select Top 100 * From PhotoObjBest', saveAs = '#test.vot') url = app.results()[0] m = MySpace() m.readfile(url,ofile='test.vot')
# more than 10 arcsec away from the chip edges are returned in a search box sql="""SELECT TOP 10000 s.sourceID, s.ra, s."dec", s.jmhPnt, s.pStar, s.pGalaxy, s.pNoise, s.pSaturated, s.jAperMag3, s.jAperMag3Err, s.jClass, s.hAperMag3, s.hAperMag3Err, s.hClass, s.k_1AperMag3, s.k_1AperMag3Err, s.k_1Class, d.x, d.y, m.xSize, m.ySize, c.xPixSize, c.yPixSize FROM gpsSource AS s, gpsDetection AS d, MultiframeDetector AS m, CurrentAstrometry AS c WHERE s.k_1ObjId = d.objID AND d.multiframeID = m.multiframeID AND d.extNum = m.extNum AND d.multiframeID = c.multiframeID AND d.extNum = c.extNum AND d.x*c.xPixSize>10 AND d.y*c.yPixSize>10 AND (m.xSize-d.x)*c.xPixSize>10 AND (m.ySize-d.y)*c.yPixSize>10""" # Define the enpoint service dsa=DSA('ivo://wfau.roe.ac.uk/ukidssDR1-dsa/wsa/ceaApplication') # Write all the SQL in one line sql = ' '.join(sql.split()) # Submit query and save result to VOSpace r=dsa.query(sql, saveAs='#dsa/wsa_gps.vot') # Wait until query status is completed while r.status()<>'COMPLETED': sleep(10) # If completed ok the retrieve the result. Print the error message otherwise. if r.status()=='COMPLETED': url = r.results()[0] m = MySpace()