Archives of Photographic PLates for Astronomical USE

Scripted Access via TAP

This web application is an instance of Daiquiri, which comes with a built-in TAP interface according to the specifications from the International Virtual Observatory Alliance (IVOA).

The Table Access Protocol (TAP) was developed by IVOA is a second generation DAL interface being developed to provide a general access mechanism for tabular data, including but not limited to astronomical catalogs.

The URL for the APPLAUSE TAP service is:
https://www.plate-archive.org/tap

You can find the full TAP documentation on the IVOA documentation website.

How to use TAP in Python

You need to install

    pip install pyvo

Pyvo allows to set a token for authorized access to your user account.

Your Daiquiri token is accessible at https://www.plate-archive.org/accounts/token/, once you’re logged in. You’ll need to replace the token of the examples with your own .

Access Daiquiri’s Token from your profile

This is how your code will look in Python, accessing the DR3 archive table, printing the name of each archive.

import numpy as np
import matplotlib.pyplot as plt
import pyvo as vo

# init tap service
tap_service = vo.dal.TAPService('https://www.plate-archive.org/tap')

# optional: use your API token to use your account instead of XXX
vo.utils.http.session.headers['Authorization'] = 'Token XXXX'

# run a syncronous query
tap_result = tap_service.run_sync('SELECT TOP 5 * FROM applause_dr3.archive')
print(tap_result.to_table())

# run a syncronous query
sql = ('SELECT * FROM applause_dr3.archive limit 5')
job = tap_service.submit_job(sql, language='postgresql', runid='test_pyvo')

job.run().wait()
result = job.fetch_result()
print(result.to_table())

How to use TAP with TOPCAT

Topcat is a Tool for OPerations on Catalogues And Tables.

To use TAP in Topcat, you’ll need to select APPLAUSE as the service provider in Topcat: https://www.plate-archive.org/tap</code/>.

The full documentation how to use TAP in Topcat is located here.

How to use TAP on the command line

TAP can also be used with a HTTP command line client. Here we use HTTPie, but there are a lot of other similar clients (e.g. curl).

# retrieve the job list
http https://www.plate-archive.org/tap/async

# submit an asyncronous job (using PostgreSQL and the 5 minutes queue)
http -f --follow POST https://www.plate-archive.org/tap/async \
    QUERY="SELECT raj2000, dej2000 FROM applause_dr3.source_calib LIMIT 10" \
    LANG="postgresql-9.6" QUEUE="1h" PHASE="RUN"

# get all the information about a job
http https://www.plate-archive.org/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b

# check the status of a job
http https://www.plate-archive.org/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b/phase

# get the results of a job as csv or votable
http https://www.plate-archive.org/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b/results/csv
http https://www.plate-archive.org/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b/results/votable

# archive the job (this deletes the database table and frees up space)
http --follow DELETE https://www.plate-archive.org/tap/async/78d9c528-8cf0-46e3-8a5b-ec151229a30b

As with the Python interface, you can also use your personal token to authenticate with the system to use your personal account (and your personal joblist, quota etc.). To do so, you need to send the token as part of the Authorization header with every HTTP request.

http https://www.plate-archive.org/tap/async Authorization:"Token c1a67d3db8b1c93e55573aa1a8a2133a5e65c301"