Data Delivery Service
Gaia Data Delivery lets you retrieve Gaia DR4 products such as epoch spectra, photometry, and images for the sources in a query result. Choose a product and the service prepares a file for the matching source_id values. You can request a download through the Query interface or from a script.
Available data products
The products below are available exclusively through the Data Delivery Service.
- xp_epoch_spectrum
- epoch_image
- epoch_astrometry
- rvs_epoch_spectrum
- epoch_photometry_ccd
- xp_continuous_mean_spectrum
- mcmc_samples_gsp_phot
- epoch_photometry
- rvs_mean_spectrum
- residual_image
- grav_lens_xp_mean_spectrum
Use the Query interface
Run a query with a source_id column for up to 1,000 Gaia DR4 source IDs. Open the Download tab of the completed job and find the Gaia Data Delivery (DR4) card.
- Under Table name, select the data product you want to retrieve. The menu lists only tables with data for at least one source in your query results, so it can show fewer tables than the Available data products list above. The number in parentheses shows how many of your sources have data in that table. For example,
rvs_epoch_spectrum (475)means that 475 of the selected sources have RVS epoch spectra. - Choose an available File format.
- Click Create file and download the output when it is ready.
Most delivery requests finish in under 30 seconds. A request can take a few minutes depending on how busy the service is, how many sources you request, and how widely they are spread across the sky. Sources close together on the sky, as in a cone search, are usually quicker to retrieve.
Scripted access
This example uses a TAP query to select up to 100 Gaia DR4 sources with XP spectra. It passes the TAP job ID to the Data Delivery Service to retrieve their continuous mean spectra. Replace <token> with your Gaia@AIP API token. Python requirements and API token setup
import requests
import pyvo
URL_TAP = "https://gaia.aip.de/tap"
URL_UWS = "https://gaia.aip.de/uws/data-delivery"
TOKEN = "<token>"
session = requests.Session()
session.headers["Authorization"] = f"Token {TOKEN}"
# Run a query job containing 'source_id'
tap_service = pyvo.dal.TAPService(URL_TAP, session=session)
sql = """SELECT TOP 100 source_id
FROM gaiadr4.all_source_flags
WHERE has_xp = True
"""
tap_job = tap_service.submit_job(sql)
_ = tap_job.run()
_ = tap_job.wait()
tap_job.raise_if_error()
# Create UWS job for the Data Delivery Service
response = session.post(
URL_UWS,
data={
"job_id": f"{tap_job.job_id}",
"table_name": "xp_continuous_mean_spectrum",
},
)
response.raise_for_status()
# Manage data delivery job using PyVO
job = pyvo.dal.AsyncTAPJob(response.url, session=session)
job.run()
job.wait()
job.raise_if_error()
# Download result
results = job.fetch_result()
# Preview the fetched data
results.to_table().pprint()
PyVO’s AsyncTAPJob is designed for asynchronous TAP jobs. The example uses it as a shortcut for managing a Data Delivery job. The Data Delivery endpoint follows the same Universal Worker Service (UWS) conventions for starting a job, checking its phase, and retrieving its result.