#!/usr/bin/python """ Convert a file from one format to another using STILTS. """ import time, urllib from astrogrid import acr from astrogrid import Applications, MySpace, ConeSearch acr.login() # Perform a cone search to NED to obtain a VOTable cone = ConeSearch("ivo://ned.ipac/Basic_Data_Near_Position") vot = cone.execute(242.811, 54.596, 0.1, saveAs='#cones/ned.vot') # Use tcopy (STILTS) to do the conversion app = Applications('ivo://uk.ac.starlink/stilts','tcopy') app.inputs['tcopy_in']['value']='#cones/ned.vot' app.inputs['tcopy_ifmt']['value']='VOTABLE' app.inputs['tcopy_ofmt']['value']="FITS" app.outputs['tcopy_out']['value']='#cones/ned.fits' res=app.submit()
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' 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()
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 app.inputs['FILTER_NAME']['value']=filter app.inputs['config_file']['value']=config app.inputs['DetectionImage']['value'] = '#sextractor/image.fits' app.inputs['PhotoImage']['value'] = '#sextractor/image.fits' app.outputs['CATALOG_NAME']['value'] = '#sextractor/image_cat.fits' # and submit the application task=app.submit() # Wait until completed time.sleep(10) while task.status() <> 'COMPLETED': time.sleep(10) print 'Status: ', task.status() print task.status() print task.results() print 'Catalogue written to\n%s' % task.results() # Now with Aladin running we can send the image and catalogue acr.startplastic() acr.plastic.broadcast('#sextractor/image.fits') acr.plastic.broadcast('#sextractor/image_cat.fits')