{"id":7013,"library":"astroquery","title":"Astroquery","description":"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.","status":"active","version":"0.4.11","language":"en","source_language":"en","source_url":"https://github.com/astropy/astroquery","tags":["astronomy","astrophysics","data access","API client","astropy","research"],"install":[{"cmd":"pip install astroquery","lang":"bash","label":"Install latest stable version"}],"dependencies":[{"reason":"Astroquery is built on Astropy, using its Table, Units, and Coordinates functionalities for data handling and interoperability.","package":"astropy"}],"imports":[{"symbol":"Simbad","correct":"from astroquery.simbad import Simbad"},{"symbol":"Mast","correct":"from astroquery.mast import Mast"},{"symbol":"Gaia","correct":"from astroquery.gaia import Gaia"},{"symbol":"Ned","correct":"from astroquery.ned import Ned"}],"quickstart":{"code":"from astroquery.simbad import Simbad\nimport astropy.units as u\n\n# Query Simbad for a celestial object\nresult_table = Simbad.query_object(\"M1\")\n\nif result_table:\n    print(f\"Object Name: {result_table['MAIN_ID'][0]}\")\n    print(f\"RA: {result_table['RA'][0]}, Dec: {result_table['DEC'][0]}\")\n\n# Example of a cone search around a coordinate\nfrom astropy.coordinates import SkyCoord\ncoord = SkyCoord('10h00m00s +10d00m00s', frame='icrs')\nradius = 5 * u.arcmin\ncone_search_results = Simbad.query_region(coord, radius=radius)\n\nif cone_search_results:\n    print(f\"\\nObjects found near {coord.ra.deg:.2f}, {coord.dec.deg:.2f} (radius {radius.value:.0f} arcmin):\")\n    for row in cone_search_results[:3]: # Print first 3 results\n        print(f\"  - {row['MAIN_ID']} (RA: {row['RA']}, Dec: {row['DEC']})\")\nelse:\n    print(\"\\nNo objects found for the cone search.\")","lang":"python","description":"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."},"warnings":[{"fix":"Use the respective service's login method, e.g., `Mast.login(token=os.environ.get('MAST_API_TOKEN'))` or `Gaia.login()`, before making queries. Tokens are often preferred for scripting.","message":"Many Astroquery services (e.g., MAST, Gaia, ESO) require authentication (login with API tokens or credentials) for full functionality or to bypass rate limits. Failing to authenticate will result in `HTTPError` (e.g., 401 Unauthorized or 403 Forbidden) or limited access.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use parameters like `max_results`, `top`, `limit`, or specific coordinate/time range filters where available. Preview query results (e.g., by checking the size of a preliminary query) before downloading the full data.","message":"Queries can return extremely large datasets, especially for broad searches. This can lead to long download times, high memory consumption, and potential system instability. Always be mindful of the scope of your query.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that any table names passed to `TapPlus.upload_table` do not contain a period. Replace dots with underscores or remove them.","message":"When using the `TapPlus` class, the `upload_table` method no longer allows table names that contain a dot ('.'). This was introduced as a security and consistency measure.","severity":"breaking","affected_versions":">=0.4.8"},{"fix":"Always check the units of table columns (e.g., `table['column_name'].unit`) and use `astropy.units` for any subsequent calculations or conversions to ensure dimensional consistency. Convert to plain numerical values only when needed and safe to do so.","message":"Astroquery results are typically `astropy.table.Table` objects, with columns often carrying `astropy.units`. Mixing or ignoring these units can lead to `astropy.units.UnitsError` or incorrect calculations.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure `astroquery` is installed (`pip install astroquery`). Verify the exact module name for the service you are trying to use (e.g., `astroquery.simbad`, `astroquery.mast`).","cause":"The astroquery library or a specific submodule was not installed, or the import path is incorrect.","error":"ModuleNotFoundError: No module named 'astroquery.<service>'"},{"fix":"Authenticate with the respective service using its `login()` method (e.g., `Mast.login(token='YOUR_API_TOKEN')`). Check documentation for required authentication methods for the specific service.","cause":"The query to a remote service failed due to a lack of proper authentication (missing API key/token or invalid credentials).","error":"requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: ..."},{"fix":"Review your query parameters (object name, coordinates, radius, filters, etc.) for typos or logical errors. Try a broader query first, then narrow it down. Check the service's own web interface to confirm data existence.","cause":"The query parameters provided did not match any data in the remote service, or the service returned an empty set of results.","error":"astroquery.exceptions.RemoteServiceError: No results found for query: ..."},{"fix":"Access rows and columns using square bracket indexing: `table[0]` for the first row, `table['column_name']` for a column. For specific cells, use `table['column_name'][0]`.","cause":"Attempted to access rows or columns of an `astropy.table.Table` object using function-call syntax (e.g., `table(0)` or `table('column')`) instead of indexing syntax.","error":"TypeError: 'Table' object is not callable"}]}