app.inputs.pop('tmatch2_icmd1') app.inputs.pop('tmatch2_icmd2') app.inputs.pop('tmatch2_ocmd') app.outputs['tmatch2_out']['value'] = '%s/iphas_twomass.vot' % output_dir job = app.submit() while job.status() in ['INITIALIZING', 'RUNNING', 'UNKNOWN']: time.sleep(10) if job.status() == 'ERROR': print 'Error running xmatch' sys.exit() print 'Xmatch: ', job.status() # If completed ok the retrieve the result. Print the error message otherwise. if job.status()=='COMPLETED': url = job.results()[0] m = MySpace() m.readfile(url, ofile='iphas2mass-xmatch.vot') else: print job.results()[0]
# .. inputs app.inputs['tmatch2_in1']['value']=vot1 app.inputs['tmatch2_in2']['value']=vot2 app.inputs['tmatch2_params']['value']="2" app.inputs['tmatch2_values1']['value']="$3 $4" app.inputs['tmatch2_values2']['value']="ra dec" app.inputs['tmatch2_ofmt']['value'] = 'votable-tabledata' # .. outputs app.outputs['tmatch2_out']['value']='#cones/ned2mass-xmatch.vot' # .. remove unncessary (optional) parameters app.inputs.pop('tmatch2_icmd1') app.inputs.pop('tmatch2_icmd2') app.inputs.pop('tmatch2_ocmd') # Submit the application to the system and wait for completion job = app.submit() while job.status() not in ['COMPLETED', 'ERROR']: time.sleep(10) # If completed ok the retrieve the result. Print the error message otherwise. if job.status()=='COMPLETED': url = job.results()[0] m = MySpace() m.readfile(url, ofile='ned2mass-xmatch.vot') else: print job.results()[0]
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')
# 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 # Note: this can change slightly in the next beta release if r.status() == 'COMPLETED': url = r.results()[0] m.readfile(url, ofile='ndec%02d-%02d.vot' % (i,i+2)) print 'ndec%02d-%02d.vot' % (i,i+2)
app.inputs['tmatch2_in1']['value']=vot1 app.inputs['tmatch2_in2']['value']=vot2 app.inputs['tmatch2_params']['value']="1.0" app.inputs['tmatch2_values1']['value']="ra dec" app.inputs['tmatch2_values2']['value']="ra dec" app.inputs['tmatch2_ofmt']['value'] = 'votable-tabledata' # .. outputs app.outputs['tmatch2_out']['value']='#cones/lassdss-xmatch.vot' # .. remove unncessary (optional) parameters app.inputs.pop('tmatch2_icmd1') app.inputs.pop('tmatch2_icmd2') app.inputs.pop('tmatch2_ocmd') # Submit the application to the system and wait for completion job = app.submit() while job.status() not in ['COMPLETED', 'ERROR']: time.sleep(10) # If completed ok the retrieve the result. Print the error message otherwise. if job.status()=='COMPLETED': url = job.results()[0] m = MySpace() m.readfile(url, ofile='lassdss-xmatch.vot') else: print job.results()[0]
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() m.readfile(url, ofile='wsa-gps.vot') else: print job.results()[0]