Functions and classes to access online astronomical data resources
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Services provided by the Infrared Processing and Analysis Center (IPAC) including infrared surveys, extragalactic databases, exoplanet archives, and specialized astronomical catalogs. IPAC services are essential for infrared astronomy and extragalactic research.
IRSA provides access to infrared and submillimeter astronomical surveys and catalogs, including 2MASS, WISE, Spitzer, and other infrared missions.
from astroquery.ipac.irsa import Irsa
def query_region(coordinates: Union[SkyCoord, str], catalog: str = None,
spatial: str = "Cone", radius: Union[Quantity, str] = None,
width: Union[Quantity, str] = None, height: Union[Quantity, str] = None) -> Table:
"""
Query IRSA catalogs in a sky region.
Parameters:
- coordinates: Center coordinates as SkyCoord or string
- catalog: Catalog name (e.g., '2mass_psc', 'wise_allsky')
- spatial: Spatial constraint type ('Cone', 'Box', 'Polygon')
- radius: Search radius for cone searches
- width: Width for box searches
- height: Height for box searches
Returns:
Table with catalog sources in the specified region
"""
def query_object(object_name: str, catalog: str = None,
radius: Union[Quantity, str] = None) -> Table:
"""
Query IRSA catalogs around a named object.
Parameters:
- object_name: Name of the astronomical object
- catalog: Specific catalog to search
- radius: Search radius around object
Returns:
Table with catalog entries around the object
"""
def list_catalogs() -> Table:
"""
List available IRSA catalogs.
Returns:
Table with catalog names and descriptions
"""
def get_images(coordinates: Union[SkyCoord, str], mission: str,
size: Union[Quantity, str] = None) -> List:
"""
Download infrared images from IRSA missions.
Parameters:
- coordinates: Target coordinates
- mission: Mission name ('2mass', 'wise', 'spitzer')
- size: Image size
Returns:
List of HDUList objects with image data
"""
# Configuration
from astroquery.ipac.irsa import conf
conf.server: str # IRSA server URL
conf.timeout: int = 60 # Connection timeoutUsage examples:
from astroquery.ipac.irsa import Irsa
import astropy.units as u
from astropy.coordinates import SkyCoord
# Query 2MASS point source catalog
coords = SkyCoord('12h30m43s', '+12d23m28s', frame='icrs')
result = Irsa.query_region(coords, catalog='2mass_psc', radius=2*u.arcmin)
print(f"Found {len(result)} 2MASS sources")
print(result['designation', 'j_m', 'h_m', 'k_m'])
# Query WISE all-sky catalog
wise_sources = Irsa.query_object('NGC 1068', catalog='wise_allsky',
radius=30*u.arcsec)
print(f"Found {len(wise_sources)} WISE sources")
# List available catalogs
catalogs = Irsa.list_catalogs()
infrared_cats = catalogs[catalogs['title'].str.contains('infrared', case=False)]
# Get 2MASS images
images = Irsa.get_images(coords, mission='2mass', size=5*u.arcmin)
for img in images:
print(f"Image shape: {img[0].data.shape}")NED provides comprehensive information about extragalactic objects including galaxies, quasars, and other extragalactic sources, with cross-identifications, photometry, and bibliographic references.
from astroquery.ipac.ned import Ned
def query_object(object_name: str, get_query_payload: bool = False) -> Table:
"""
Query NED for information about an extragalactic object.
Parameters:
- object_name: Name of the extragalactic object
- get_query_payload: Return query parameters instead of executing
Returns:
Table with NED object information
"""
def query_region(coordinates: Union[SkyCoord, str], radius: Union[Quantity, str] = None,
equinox: str = "J2000.0") -> Table:
"""
Query NED for extragalactic objects in a sky region.
Parameters:
- coordinates: Center coordinates
- radius: Search radius (default: 1 arcmin)
- equinox: Coordinate equinox
Returns:
Table with extragalactic objects in the region
"""
def get_table(object_name: str, table: str = "photometry") -> Table:
"""
Get specific data tables for an extragalactic object.
Parameters:
- object_name: Name of the object
- table: Table type ('photometry', 'redshifts', 'classifications', etc.)
Returns:
Table with requested data
"""
def query_refcode(refcode: str) -> Table:
"""
Query NED by bibliographic reference code.
Parameters:
- refcode: NED reference code
Returns:
Table with objects from the specified reference
"""
def get_image_list(object_name: str) -> Table:
"""
Get list of available images for an object.
Parameters:
- object_name: Name of the object
Returns:
Table with available image information
"""
# Configuration
from astroquery.ipac.ned import conf
conf.server: str # NED server URL
conf.timeout: int = 60 # Connection timeoutUsage examples:
from astroquery.ipac.ned import Ned
import astropy.units as u
from astropy.coordinates import SkyCoord
# Query basic object information
result = Ned.query_object('NGC 1068')
print(result['Object Name', 'RA', 'DEC', 'Type', 'Redshift'])
# Get photometric data
photometry = Ned.get_table('NGC 1068', table='photometry')
print(f"Found {len(photometry)} photometric measurements")
# Region query for nearby galaxies
coords = SkyCoord('02h42m40.7s', '-00d00m48s', frame='icrs')
nearby = Ned.query_region(coords, radius=10*u.arcmin)
print(f"Found {len(nearby)} extragalactic objects")
# Get redshift measurements
redshifts = Ned.get_table('M87', table='redshifts')
print(redshifts['Published Velocity', 'Uncertainty', 'Reference'])The NASA Exoplanet Archive provides access to confirmed exoplanet data, planetary system parameters, and stellar host information from various detection methods and surveys.
from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
def query_object(object_name: str, table: str = "pscomppars",
get_query_payload: bool = False) -> Table:
"""
Query NASA Exoplanet Archive for information about a specific object.
Parameters:
- object_name: Name of the star or planetary system
- table: Archive table to query ('pscomppars', 'ps', 'cumulative', etc.)
- get_query_payload: Return query parameters instead of executing
Returns:
Table with exoplanet/stellar data
"""
def query_criteria(table: str = "pscomppars", **criteria) -> Table:
"""
Query the archive with specific selection criteria.
Parameters:
- table: Archive table to query
- **criteria: Selection criteria (pl_bmassj='<1', pl_orbper='>365', etc.)
Returns:
Table with objects matching the criteria
"""
def query_aliases(object_name: str) -> Table:
"""
Get all known aliases for a stellar/planetary system.
Parameters:
- object_name: Name of the object
Returns:
Table with alternative names and identifiers
"""
def get_target_list(coordinates: Union[SkyCoord, str], radius: Union[Quantity, str] = None) -> Table:
"""
Get exoplanet targets in a sky region.
Parameters:
- coordinates: Center coordinates
- radius: Search radius
Returns:
Table with exoplanet systems in the region
"""
# Configuration
from astroquery.ipac.nexsci.nasa_exoplanet_archive import conf
conf.server: str # Archive server URL
conf.timeout: int = 60 # Connection timeoutUsage examples:
from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
import astropy.units as u
from astropy.coordinates import SkyCoord
# Query confirmed planets around a star
kepler_planets = NasaExoplanetArchive.query_object('Kepler-452',
table='pscomppars')
print(f"Found {len(kepler_planets)} confirmed planets")
print(kepler_planets['pl_name', 'pl_bmassj', 'pl_orbper'])
# Query for Jupiter-like planets
jupiter_analogs = NasaExoplanetArchive.query_criteria(
table='pscomppars',
where="pl_bmassj>0.5 and pl_bmassj<2.0 and pl_orbper>300"
)
print(f"Found {len(jupiter_analogs)} Jupiter analogs")
# Query for habitable zone planets
hab_zone = NasaExoplanetArchive.query_criteria(
table='pscomppars',
where="pl_eqt>200 and pl_eqt<320" # Equilibrium temperature
)
print(f"Found {len(hab_zone)} potentially habitable planets")
# Get aliases for a system
aliases = NasaExoplanetArchive.query_aliases('HD 209458')
print(aliases['pl_name'])Service for querying Galactic dust extinction values along lines of sight, essential for correcting astronomical observations for interstellar extinction.
from astroquery.ipac.irsa_dust import IrsaDust
def get_extinction_table(coordinates: Union[SkyCoord, str, List],
radius: Union[Quantity, str] = None) -> Table:
"""
Get dust extinction values for sky positions.
Parameters:
- coordinates: Target coordinates (single position or list)
- radius: Search radius for extended sources
Returns:
Table with extinction values and dust maps information
"""
def get_query_table(coordinates: Union[SkyCoord, str, List]) -> Table:
"""
Get detailed dust extinction information.
Parameters:
- coordinates: Target coordinates
Returns:
Table with comprehensive dust extinction data
"""
# Configuration
from astroquery.ipac.irsa_dust import conf
conf.server: str # IRSA dust service URL
conf.timeout: int = 60 # Connection timeoutUsage examples:
from astroquery.ipac.irsa_dust import IrsaDust
from astropy.coordinates import SkyCoord
# Get extinction for a single position
coords = SkyCoord('12h30m43s', '+12d23m28s', frame='icrs')
extinction = IrsaDust.get_extinction_table(coords)
print(f"A_V = {extinction['A_V'][0]:.3f} mag")
# Get extinction for multiple positions
coord_list = [SkyCoord('12h30m43s', '+12d23m28s', frame='icrs'),
SkyCoord('18h30m00s', '-29d00m00s', frame='icrs')]
extinctions = IrsaDust.get_extinction_table(coord_list)
print(extinctions['A_V', 'A_B', 'A_R'])from astropy.table import Table
from astropy.coordinates import SkyCoord
from astropy.units import Quantity
from astropy.io.fits import HDUList
from typing import Union, List, Optional
# Input types
coordinates: Union[SkyCoord, str] # Sky coordinates
object_name: str # Astronomical object name
radius: Union[Quantity, str, None] # Search radius
catalog: str # Catalog name/identifier
# Query parameters
spatial: str = "Cone" # Spatial constraint type
table: str # Archive table name
mission: str # Mission/survey name
equinox: str = "J2000.0" # Coordinate equinox
# Search criteria
width: Union[Quantity, str, None] # Box width
height: Union[Quantity, str, None] # Box height
size: Union[Quantity, str, None] # Image size
# Return types
Table # Query results
List[HDUList] # Image dataInstall with Tessl CLI
npx tessl i tessl/pypi-astroquery