コード例 #1
0
# Query IPHAS
iphas = DSA('ivo://uk.ac.cam.ast/iphas-dsa-catalog/IDR/ceaApplication')
job2 = iphas.query('select * from PhotoObjBest as x where x.ra between %s and %s and x."dec" between %s and %s' % (ra1, ra2, dec1, dec2),
                     saveAs='%s/iphas.vot' % output_dir)

while job2.status() in ['INITIALIZING', 'RUNNING', 'UNKNOWN']:
	time.sleep(10)
	
if job2.status() == 'ERROR':
	print 'Error querying IPHAS database'
	print job2.results()[0]
	sys.exit()
	
print 'IPHAS Query: ',job1.status()

m = MySpace()

# Perform Xmatch using 1.5 arcsec radius

# this uses the TopCat STILTS library to perform the cross match

app = Applications('ivo://uk.ac.starlink/stilts', 'tmatch2')
app.inputs['tmatch2_in1']['value'] = '%s/iphas.vot' % output_dir
app.inputs['tmatch2_in2']['value'] = '%s/twomass.vot' % output_dir
app.inputs['tmatch2_values1']['value'] = 'ra dec'
app.inputs['tmatch2_values2']['value'] = 'ra dec'
app.inputs['tmatch2_params']['value'] = '1.5'
app.inputs['tmatch2_ifmt1']['value'] = '(auto)'
app.inputs['tmatch2_ifmt2']['value'] = '(auto)'
app.inputs['tmatch2_ofmt']['value'] = 'vot'
コード例 #2
0
ファイル: test.py プロジェクト: astar/diplomaWork
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')
コード例 #3
0
ファイル: xmatch.py プロジェクト: astar/diplomaWork
# .. 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]
	
	
コード例 #4
0
#!/usr/bin/python

import sys
from astrogrid import acr
from astrogrid import MySpace

idir='#siap/'+sys.argv[1]
print 'Reading images from %s' % idir

m = MySpace()
for filename in [f[2] for f in m.ls(idir) if f[2][-4:]=='fits']:
	print 'Loading %s' % filename
	acr.plastic.broadcast(idir+'/'+filename, 'Aladin')
	
	
	
コード例 #5
0
ファイル: sdss_adql.py プロジェクト: astar/diplomaWork
#!/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
コード例 #6
0
ファイル: sextractor.py プロジェクト: astar/diplomaWork
MAG_ISO
MAGERR_ISO
MAG_AUTO
MAGERR_AUTO
CLASS_STAR
"""

filter="""CONV NORM
# 3x3 ``all-ground'' convolution mask with FWHM = 2 pixels.
1 2 1
2 4 2
1 2 1
"""

# We write the image to MySpace
m = MySpace()
m.savefile(image, '#sextractor/image.fits')

# Application ID. This is the name of the application we are going to run.
# It can be obtained from a registry search.
id = 'ivo://org.astrogrid/SExtractor'

# We fill in the application parameters
app = Applications(id)

app.inputs['ANALYSIS_THRESH']['value']=1.5
app.inputs['IMAGE_BAND']['value']='R'
app.inputs['MAG_ZEROPOINT']['value']=25.0
app.inputs['SEEING_FWHM']['value']=1.2

app.inputs['PARAMETERS_NAME']['value']=params
コード例 #7
0
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]
	
	
コード例 #8
0
ファイル: wsa_gps.py プロジェクト: astar/diplomaWork
          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]