PyVO

Introduction

This is the documentation for PyVO, an affiliated package for the astropy package.

PyVO lets you find and retrieve astronomical data available from archives that support standard IVOA virtual observatory service protocols.

Note

If you need to access data which is not available via the Virtual Observatory standards, try the astropy affiliated package astroquery (and, of course, ask the data providers to do the right thing and use the proper standards for their publication).

Installation

PyVO is installable via pip.

pip install pyvo

Source Installation

git clone http://github.com/pyvirtobs/pyvo
cd pyvo
python setup.py install

Requirements

  • numpy

  • astropy

  • requests

Getting started

Data Access

Most of the interesting functionality of pyVO is through the various data access service interfaces (SCS for catalogs, SIA for images, SSAP for spectra, TAP for tables). All of these behave in a similar way.

First, there is a class describing a specific type of service:

>>> import pyvo as vo
>>> service = vo.dal.TAPService("http://dc.g-vo.org/tap")

Once you have a service object, you can run queries with parameters specific to the service type. In this example, a database query is enough:

>>> resultset = service.search("SELECT TOP 1 * FROM ivoa.obscore")
>>> resultset
<DALResultsTable length=1>
dataproduct_type dataproduct_subtype ... source_table
                                     ...
     object             object       ...    object
---------------- ------------------- ... ------------
           image                     ... ppakm31.maps

What is returned by the search method is a to get a resultset object, which essentially works like a numpy record array. It can be processed either by columns:

>>> row = resultset[0]
>>> column = resultset["dataproduct_type"]

or by rows.

>>> for row in resultset:
...   calib_level = row["calib_level"]

For more details on how to use data access services see Data Access (pyvo.dal)

Using pyvo