Astroquery

0.4.11 · active · verified Thu Apr 16

Astroquery provides a uniform interface to query astronomical web services and archives, making it easier to access online astronomical data resources. It is part of the Astropy Project and integrates seamlessly with Astropy's data structures. The current version is 0.4.11, and it maintains an active development cycle with frequent releases to add new services and fix issues.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to query the Simbad database for an object by name and perform a cone search around specific coordinates. It shows basic data retrieval and interaction with Astropy's units and coordinates.

from astroquery.simbad import Simbad
import astropy.units as u

# Query Simbad for a celestial object
result_table = Simbad.query_object("M1")

if result_table:
    print(f"Object Name: {result_table['MAIN_ID'][0]}")
    print(f"RA: {result_table['RA'][0]}, Dec: {result_table['DEC'][0]}")

# Example of a cone search around a coordinate
from astropy.coordinates import SkyCoord
coord = SkyCoord('10h00m00s +10d00m00s', frame='icrs')
radius = 5 * u.arcmin
cone_search_results = Simbad.query_region(coord, radius=radius)

if cone_search_results:
    print(f"\nObjects found near {coord.ra.deg:.2f}, {coord.dec.deg:.2f} (radius {radius.value:.0f} arcmin):")
    for row in cone_search_results[:3]: # Print first 3 results
        print(f"  - {row['MAIN_ID']} (RA: {row['RA']}, Dec: {row['DEC']})")
else:
    print("\nNo objects found for the cone search.")

view raw JSON →