### Full Example: Query, Cutout, and Plot Image Source: https://github.com/astropy/astroquery/blob/main/docs/ipac/irsa/irsa.rst A comprehensive example demonstrating the entire workflow: querying IRSA for images, downloading, creating a cutout, and plotting it. This includes all necessary imports and setup. ```python from astroquery.ipac.irsa import Irsa from astropy.coordinates import SkyCoord from astropy import units as u from astropy.io import fits from astropy.nddata import Cutout2D from astropy.wcs import WCS import matplotlib.pyplot as plt from astropy.visualization import ImageNormalize, ZScaleInterval coord = SkyCoord('150.01d 2.2d', frame='icrs') spitzer_images = Irsa.query_sia(pos=(coord, 1 * u.arcmin), collection='spitzer_seip') science_image = spitzer_images[spitzer_images['dataproduct_subtype'] == 'science'][0] with fits.open(science_image['access_url'], use_fsspec=True) as hdul: cutout = Cutout2D(hdul[0].section, position=coord, size=2 * u.arcmin, wcs=WCS(hdul[0].header)) ``` -------------------------------- ### Install Astroquery from Source Source: https://github.com/astropy/astroquery/blob/main/README.rst Clone the astroquery repository from GitHub and install it locally using pip. Ensure you are in the astroquery directory. ```bash git clone git@github.com:astropy/astroquery.git # or git clone https://github.com/astropy/astroquery.git cd astroquery python -m pip install . ``` -------------------------------- ### Install Vamdclib from Personal Fork Source: https://github.com/astropy/astroquery/blob/main/docs/index.rst Installs the vamdc-lib package from a personal fork, which may be necessary for the ~astroquery.vamdc module. ```bash python -m pip install git+https://github.com/keflavich/vamdclib-1.git ``` -------------------------------- ### Install Astroquery with All Dependencies Source: https://github.com/astropy/astroquery/blob/main/README.rst Install astroquery along with all mandatory and optional dependencies using the '[all]' identifier with pip. ```bash python -m pip install -U --pre astroquery[all] ``` -------------------------------- ### Install Astroquery (Pre-release) Source: https://github.com/astropy/astroquery/blob/main/README.rst Install the latest version of astroquery, including pre-release versions, using pip. Use -U for upgrade. ```bash python -m pip install -U --pre astroquery ``` -------------------------------- ### Install Astroquery from Git Repository Source: https://github.com/astropy/astroquery/blob/main/README.rst Install the bleeding-edge version of astroquery directly from its GitHub repository using pip. ```bash python -m pip install git+https://github.com/astropy/astroquery.git ``` -------------------------------- ### Create an Empty VO Database Source: https://github.com/astropy/astroquery/blob/main/docs/vo_conesearch/client.rst Initialize an empty VO database. This serves as a starting point for adding catalogs. ```python from astroquery.vo_conesearch.vos_catalog import VOSDatabase my_db = VOSDatabase.create_empty() print(my_db.dumps()) ``` -------------------------------- ### Asynchronous Query Example Source: https://github.com/astropy/astroquery/blob/main/docs/api.rst This snippet demonstrates how to perform an asynchronous query, useful for services that require data staging. ```python result = Service.query_region_async(coordinates) data = result.get_data() # this will periodically check whether the data is available at the specified URL ``` -------------------------------- ### Login to TAP+ using GUI Source: https://github.com/astropy/astroquery/blob/main/docs/utils/tap.rst Initiates a graphical login process for TAP+ services. Requires Tkinter to be installed. ```python >>> from astroquery.utils.tap.core import TapPlus >>> gaia = TapPlus(url="https://gea.esac.esa.int/tap-server/tap") >>> gaia.login_gui() ``` -------------------------------- ### Get ephemeris for an asteroid Source: https://github.com/astropy/astroquery/blob/main/docs/mpc/mpc.rst Use `get_ephemeris` to generate ephemeris data for a given object. This example retrieves the ephemeris for asteroid '24' starting today with default settings. ```python >>> from astroquery.mpc import MPC >>> eph = MPC.get_ephemeris('24') >>> print(eph) # doctest: +IGNORE_OUTPUT ``` -------------------------------- ### Download JWST Files from Program Source: https://github.com/astropy/astroquery/blob/main/docs/esa/jwst/jwst.rst Downloads preview products for a given proposal ID. Ensure the proposal ID and product type are correctly specified. ```python from astroquery.esa.jwst import Jwst observation_list = Jwst.download_files_from_program(proposal_id='6651', product_type='preview') # doctest: +IGNORE_OUTPUT ``` ```python print(observation_list) # doctest: +IGNORE_OUTPUT ``` -------------------------------- ### Query specific fields for an asteroid Source: https://github.com/astropy/astroquery/blob/main/docs/mpc/mpc.rst Use `return_fields` to specify which columns to retrieve. This example gets only the 'name' and 'number' for Ceres. ```python >>> result = MPC.query_object('asteroid', name="ceres", return_fields="name,number") >>> print(result) ``` -------------------------------- ### Get Observations with Column Selection Source: https://github.com/astropy/astroquery/blob/main/docs/esa/emds/emds.rst Fetches observations and selects specific columns. This is a basic usage example for retrieving a subset of available data fields. ```python emds.get_observations( columns=["dataproduct_type", "obs_collection", "target_name", "obs_id", "s_ra", "s_dec", "instrument_name"] ) # doctest: +IGNORE_OUTPUT ``` -------------------------------- ### Get Observations with Combined Filters Source: https://github.com/astropy/astroquery/blob/main/docs/esa/emds/emds.rst Fetches observations using multiple keyword filters, which are combined using the AND operator in the underlying ADQL query. This example combines collection and instrument filters. ```python emds.get_observations( columns=["dataproduct_type", "obs_collection", "target_name", "obs_id", "s_ra", "s_dec", "instrument_name"], obs_collection="EPSA", ``` -------------------------------- ### Get Observations with String Wildcard Source: https://github.com/astropy/astroquery/blob/main/docs/esa/emds/emds.rst Fetches observations for a target name using a wildcard pattern. This example shows how to use LIKE operator for partial string matching in ADQL queries. ```python emds.get_observations( columns=["obs_id", "target_name"], target_name="V1589 Cyg", ) # doctest: +IGNORE_OUTPUT ``` -------------------------------- ### Perform a Cone Search with Custom Settings Source: https://github.com/astropy/astroquery/blob/main/docs/esa/euclid/euclid.rst This example shows how to perform a cone search without a row limit, specifying a target table, and using a target name recognized by Simbad. It also demonstrates how to select specific columns for the search results. ```python radius = u.Quantity(0.2, u.deg) Euclid.ROW_LIMIT = -1 job = Euclid.cone_search(coordinate='NGC 6505', radius=radius, table_name="sedm.calibrated_frame", ra_column_name="ra", dec_column_name="dec", async_job=True, columns = ['ra', 'dec', 'datalabs_path', 'file_path', 'file_name', 'observation_id', 'instrument_name']) res = job.get_results() print(f"* Found {len(res)} results") print(res) ``` -------------------------------- ### Instantiate MastMissions and check defaults Source: https://github.com/astropy/astroquery/blob/main/docs/mast/mast_missions.rst Instantiate the MastMissions class with default settings and check the default mission and service. This is useful for starting a new query session. ```python from astroquery.mast import MastMissions missions = MastMissions() missions.mission missions.service ``` -------------------------------- ### Get Ephemeris with Location as Coordinates Source: https://github.com/astropy/astroquery/blob/main/docs/mpc/mpc.rst Retrieves ephemeris data for a celestial body, specifying the observer's location using longitude, latitude, and altitude. This example demonstrates calculating parallax between two locations. ```python >>> from astropy.table import Table >>> from astropy.coordinates import SkyCoord >>> eph = MPC.get_ephemeris('2P', location='586', start='2003-11-01') >>> mko = SkyCoord.guess_from_table(eph) >>> eph = MPC.get_ephemeris('2P', location=('24d', '-22d', '1000m'), start='2003-11-01') >>> bw = SkyCoord.guess_from_table(eph) >>> mu = mko.separation(bw) >>> tab = Table(data=(eph['Date'], mu), names=('Date', 'Parallax')) >>> print(tab) # doctest: +IGNORE_OUTPUT Date Parallax deg ----------------------- --------------------- 2003-11-01 00:00:00.000 0.005050002777840046 2003-11-02 00:00:00.000 0.005439170027971742 2003-11-03 00:00:00.000 0.005202581443927997 2003-11-04 00:00:00.000 0.005302672506812041 ... ... 2003-11-18 00:00:00.000 0.006954051057362872 2003-11-19 00:00:00.000 0.007231766703916716 2003-11-20 00:00:00.000 0.007537846117097956 2003-11-21 00:00:00.000 0.0075389478267517745 Length = 21 rows ``` -------------------------------- ### Create a VO Catalog Source: https://github.com/astropy/astroquery/blob/main/docs/vo_conesearch/client.rst Create a VO catalog from scratch by providing its title, access URL, and optional metadata. This is useful for defining your own VO services. ```python from astroquery.vo_conesearch.vos_catalog import VOSCatalog my_cat = VOSCatalog.create( 'My Own', 'http://ex.org/cgi-bin/cs.pl?', description='My first VO service.', creator='J. Doe', year=2013) ``` -------------------------------- ### Query Region and Get Image List with Astroquery CADC Source: https://github.com/astropy/astroquery/blob/main/docs/cadc/cadc.rst Query a region for astronomical data and retrieve a list of image URLs. This example demonstrates filtering results by exposure time and using the `get_image_list` function. Requires remote data access. ```python from astroquery.cadc import Cadc from astropy import units as u cadc = Cadc() coords = '01h45m07.5s +23d18m00s' results = cadc.query_region(coords, radius=0.1*u.deg, collection='CFHT') filtered_results = results[results['time_exposure'] > 120.0] image_list = cadc.get_image_list(filtered_results, coords, radius) # doctest: +IGNORE_WARNINGS print(image_list) # doctest: +IGNORE_OUTPUT ``` -------------------------------- ### Instantiate CosmoSim Object Source: https://github.com/astropy/astroquery/blob/main/docs/cosmosim/cosmosim.rst Instantiate the CosmoSim object to begin interacting with the databases. Requires 'requests', 'keyring', 'getpass', and 'bs4' packages. ```python from astroquery.cosmosim import CosmoSim CS = CosmoSim() ``` -------------------------------- ### Generate Frontpage Source: https://github.com/astropy/astroquery/wiki/Making-a-release Navigate to the frontpage directory and execute the script to generate the project's frontpage. Ensure you return to the original directory afterwards. ```bash cd frontpage/ && sh make_frontpage.sh && cd - ``` -------------------------------- ### Listing Available Tables in SIMBAD Source: https://github.com/astropy/astroquery/blob/main/docs/simbad/query_tap.rst Shows how to use the `~astroquery.simbad.SimbadClass.list_tables` method to retrieve a list of all available tables in the SIMBAD database along with their descriptions. ```Python from astroquery.simbad import Simbad Simbad.list_tables() ``` -------------------------------- ### Load Data with Parameters Source: https://github.com/astropy/astroquery/blob/main/docs/utils/tap.rst Loads data from a TAP+ service using a dictionary of parameters and saves it to a file. Requires prior login. ```python >>> from astroquery.utils.tap.core import TapPlus >>> gaia = TapPlus(url="https://gea.esac.esa.int/tap-server/tap") >>> params_dict = {} >>> params_dict['VALID_DATA'] = "true" >>> params_dict['ID'] = "1000103304040175360" >>> params_dict['FORMAT'] = "votable" >>> params_dict['RETRIEVAL_TYPE'] = "epoch_photometry" >>> gaia.load_data(params_dict=params_dict, output_file="results.vot") ``` -------------------------------- ### Install Astroquery using Conda Source: https://github.com/astropy/astroquery/blob/main/docs/index.rst Installs the regular, tagged version of astroquery from the conda-forge channel. This version does not require the --pre option. ```bash conda install -c conda-forge astroquery ``` -------------------------------- ### Install Astroquery in Editable Mode with All Dependencies Source: https://github.com/astropy/astroquery/blob/main/docs/index.rst Installs astroquery in editable mode, allowing changes to the source code without re-installation. Includes dependencies for testing and documentation. ```bash python -m pip install -e .[all,test,docs] ``` -------------------------------- ### Fetch Ephemeris with Custom Start Date and Step Source: https://github.com/astropy/astroquery/blob/main/docs/mpc/mpc.rst Retrieves a specified number of ephemeris entries starting from a custom date with a weekly time step. Uses Astropy Time for date parsing. ```python >>> eph = MPC.get_ephemeris('24', start='2020-01-01', step='7d', number=52) >>> print(eph) # doctest: +IGNORE_OUTPUT Date RA Dec Delta r Elongation Phase V Proper motion Direction Uncertainty 3sig Unc. P.A. deg deg AU AU deg deg mag arcsec / h deg arcsec deg ----------------------- ------------------ ------------------- ----- ----- ---------- ----- ---- ------------- --------- ---------------- --------- 2020-01-01 00:00:00.000 209.16749999999996 -11.63361111111111 3.066 2.856 68.5 18.7 12.7 45.15 110.6 -- -- 2020-01-08 00:00:00.000 211.11999999999995 -12.342500000000001 2.98 2.863 73.6 19.2 12.7 42.09 110.2 -- -- 2020-01-15 00:00:00.000 212.93749999999997 -12.987222222222222 2.892 2.87 78.9 19.7 12.6 38.7 109.8 -- -- 2020-01-22 00:00:00.000 214.60083333333333 -13.564722222222223 2.803 2.877 84.3 19.9 12.6 34.89 109.5 -- -- ... ... ... ... ... ... ... ... ... ... ... ... 2020-12-02 00:00:00.000 252.88041666666666 -22.87638888888889 4.224 3.242 4.3 1.3 12.9 54.42 96.9 -- -- ``` -------------------------------- ### ADQL exact string match example Source: https://github.com/astropy/astroquery/blob/main/docs/esa/plato/plato.rst Demonstrates how a simple string equality in Python translates to an ADQL query for exact matching. ```plaintext StarName='star1' -> StarName = 'star1' ``` -------------------------------- ### Download Zcut Cutouts in JPG Format Source: https://github.com/astropy/astroquery/blob/main/docs/mast/mast_cut.rst This example shows how to download Zcut cutouts in JPG format by specifying the `cutout_format` parameter. This is useful for quick-look visualization. The method returns a table of local file paths for the downloaded images. ```python manifest = Zcut.download_cutouts(coordinates=cutout_coord, size=[5, 10], units="px", survey="3dhst_goods-n", cutout_format="jpg") # doctest: +IGNORE_OUTPUT ``` ```python print(manifest) ``` -------------------------------- ### Query STScI Guide Star Catalog Source: https://github.com/astropy/astroquery/blob/main/docs/vo_conesearch/vo_conesearch.rst Query the STScI Guide Star Catalog around M31 with a 0.1-degree search radius using the 'new' Astroquery-style API. Requires importing SkyCoord and ConeSearch. ```python from astropy.coordinates import SkyCoord from astroquery.vo_conesearch import ConeSearch c = SkyCoord.from_name('M31') c result = ConeSearch.query_region(c, '0.1 deg') result result.url ``` -------------------------------- ### Create Vizier Instance with Column and Keyword Filters Source: https://github.com/astropy/astroquery/blob/main/docs/vizier/vizier.rst Creates a Vizier instance pre-configured with specific output columns and keyword filters. This instance can then be used for multiple queries. ```python vizier = Vizier(columns=['_RAJ2000', '_DEJ2000','B-V', 'Vmag', 'Plx'], column_filters={"Vmag":">10"}, keywords=["optical", "xry"]) ``` -------------------------------- ### Query Guide Star Catalog with Astropy Style Source: https://github.com/astropy/astroquery/blob/main/docs/vo_conesearch/vo_conesearch.rst Performs a cone search on the Guide Star Catalog around M31 using the classic Astropy-style API. Requires importing units and specifying the catalog database. ```python from astropy import units as u my_catname = 'Guide Star Catalog 2.3 Cone Search 1' result = conesearch.conesearch(c, 0.1 * u.degree, catalog_db=my_catname) ``` -------------------------------- ### Download ESO Datasets by Data Product ID Source: https://github.com/astropy/astroquery/blob/main/docs/eso/eso.rst Retrieve specific datasets from the ESO archive using their data product IDs. This example shows how to download the first two datasets identified in a previous query. ```python data_files = eso.retrieve_data(table['dp_id'][:2]) ``` -------------------------------- ### Query Guide Stars Based on AGN Table Source: https://github.com/astropy/astroquery/blob/main/docs/vizier/vizier.rst Query the 2MASS catalog for guide stars brighter than Kmag 9.0, within 2 to 30 arcseconds of AGNs found in the previous step. The 'agn' table is used to specify coordinates. ```python guide = Vizier(catalog="II/246", column_filters={"Kmag":"<9.0"}).query_region(agn, radius="30s", inner_radius="2s")[0] guide.pprint() ``` -------------------------------- ### Build Source Distribution Source: https://github.com/astropy/astroquery/wiki/Making-a-release Create a source distribution package for the project. This is typically done before uploading to a package repository. ```bash python setup.py sdist upload ``` -------------------------------- ### Get Spectra Source: https://github.com/astropy/astroquery/blob/main/docs/esasky/esasky.rst Methods to download astronomical spectra. ```APIDOC ## POST /get_spectra ### Description Downloads astronomical spectra. This method is available for retrieving spectral data. ### Method POST ### Endpoint /get_spectra ### Parameters #### Query Parameters - **Parameters for get_spectra are not detailed in the provided text.** ### Request Example ```json { "example": "request body for get_spectra" } ``` ### Response #### Success Response (200) - **spectra** (object) - The downloaded spectra data. #### Response Example ```json { "spectra": "[Spectra data]" } ``` ``` -------------------------------- ### Get Postcard Source: https://github.com/astropy/astroquery/blob/main/docs/esa/iso/iso.rst Retrieves a postcard image for a given ISO observation. ```APIDOC ## GET /get_postcard ### Description Downloads a postcard image for a specified ISO observation. ### Method GET ### Endpoint /get_postcard ### Parameters #### Query Parameters - **tdt** (string) - Required - The observation identifier (TDT) for which to get the postcard. - **filename** (string) - Required - The base name for the saved PNG file (without the .png extension). ### Request Example ```json { "tdt": "80001538", "filename": "postcard" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation that the postcard has been downloaded and saved. #### Response Example ```json { "message": "Postcard for observation 80001538 saved as postcard.png." } ``` ``` -------------------------------- ### Create CSV file for xMatch input Source: https://github.com/astropy/astroquery/blob/main/docs/xmatch/xmatch.rst This setup code creates a CSV file named 'pos_list.csv' with RA and Dec coordinates. It's used as input for the xMatch query. ```python with open('pos_list.csv', 'w') as f: f.write("""ra,dec 267.22029,-20.35869 274.83971,-25.42714 275.92229,-30.36572 283.26621,-8.70756 306.01575,33.86756 322.493,12.16703""") ``` -------------------------------- ### Get Observations from Program Source: https://github.com/astropy/astroquery/blob/main/docs/esa/hubble/hubble.rst Retrieves all observations associated with a specific program ID. ```APIDOC ## GET /api/programs/{program_id}/observations ### Description Retrieves a list of all observations linked to a specific program or proposal ID. ### Method GET ### Endpoint /api/programs/{program_id}/observations ### Parameters #### Path Parameters - **program_id** (integer) - Required - The program or proposal ID to query. ### Request Example ```json { "program_id": 5773 } ``` ### Response #### Success Response (200) - **observations** (array of strings) - A list of observation IDs associated with the program. #### Response Example ```json { "observations": [ "obs1", "obs2", "obs3" ] } ``` ``` -------------------------------- ### Get Astroquery Citation Source: https://github.com/astropy/astroquery/blob/main/README.rst Access the citation information for the astroquery package programmatically. ```python import astroquery astroquery.__citation__ ``` -------------------------------- ### New Module Test Directory Structure Source: https://github.com/astropy/astroquery/blob/main/CONTRIBUTING.rst For each new module, a corresponding `tests/` directory must be created. This directory should contain at least an `__init__.py` and a `test_feature.py` file for unit testing. ```text astroquery/feature/tests astroquery/feature/tests/__init__.py astroquery/feature/tests/test_feature.py ``` -------------------------------- ### Euclid Authentication Methods Source: https://github.com/astropy/astroquery/blob/main/docs/esa/euclid/euclid.rst Demonstrates various ways to log in and log out of the Euclid service. Authentication can be done via a GUI, directly with credentials, or using a credentials file. ```python from astroquery.esa.euclid import Euclid Euclid.login_gui() # Login via graphic interface (pop-up window) Euclid.login() Euclid.login(user='', password='') Euclid.login(credentials_file='') # The file must contain just two rows: the username (first row) and the password. Euclid.logout() ``` -------------------------------- ### Get Datalink Access Source: https://github.com/astropy/astroquery/blob/main/docs/utils/tap.rst Retrieves datalink information for specified IDs from a TAP+ service. ```python >>> from astroquery.utils.tap.core import TapPlus >>> gaia = TapPlus(url="https://gea.esac.esa.int/tap-server/tap") >>> ids="1000103304040175360,1000117258390464896" >>> results = gaia.get_datalink(ids=ids) ``` -------------------------------- ### Login with Credentials File Source: https://github.com/astropy/astroquery/blob/main/docs/esa/jwst/jwst.rst Log in to the JWST service using a credentials file. Ensure the file contains the username and password on separate lines. ```python from astroquery.esa.jwst import Jwst Jwst.login(credentials_file='my_credentials_file') ``` -------------------------------- ### Get Images Source: https://github.com/astropy/astroquery/blob/main/docs/esasky/esasky.rst Methods to fetch astronomical images either by position or by observation IDs. ```APIDOC ## POST /get_images ### Description Fetches astronomical images around a specified target or coordinates, or from a list of observation IDs. The results are separated by mission. ### Method POST ### Endpoint /get_images ### Parameters #### Query Parameters - **position** (str or astropy.coordinates.SkyCoord) - Required (if observation_ids is not provided) - The target position or coordinates. - **radius** (str or astropy.units.Quantity) - Required (if observation_ids is not provided) - The radius around the position (e.g., "15 arcmin"). - **observation_ids** (list) - Required (if position is not provided) - A list of observation IDs. - **missions** (list) - Optional - A list of missions to query (e.g., ['Herschel', 'ISO-IR']). - **download_dir** (str) - Optional - The directory to save the downloaded fits files. ### Request Example (by position) ```json { "position": "V* HT Aqr", "radius": "15 arcmin", "missions": ["Herschel", "ISO-IR"] } ``` ### Request Example (by observation_ids) ```json { "observation_ids": ["100001010", "01500403"], "missions": ["SUZAKU", "ISO-IR"] } ``` ### Response #### Success Response (200) - **images** (dict) - A dictionary where keys are mission names and values are lists of HDULists or dictionaries of HDULists (for Herschel). #### Response Example ```json { "images": { "HERSCHEL": [{"70": [HDUList], "160": HDUList}, ...], "ISO-IR": [HDUList, HDUList, ...] } } ``` ``` -------------------------------- ### Get Images from SkyView Source: https://github.com/astropy/astroquery/blob/main/docs/skyview/skyview.rst Searches for and downloads astronomical image files from various sky surveys. ```APIDOC ## POST /astropy/astroquery/skyview/get_images ### Description Searches for and downloads astronomical image files from various sky surveys based on a given position and survey list. ### Method POST ### Endpoint /astropy/astroquery/skyview/get_images ### Parameters #### Query Parameters - **position** (string) - Required - The celestial coordinates or object name to center the search on. - **survey** (list of strings) - Required - A list of survey names to search within. Available surveys include: - DSS2 IR - Optical:SDSS (SDSSg, SDSSi, SDSSr, SDSSu, SDSSz, SDSSdr7g, SDSSdr7i, SDSSdr7r, SDSSdr7u, SDSSdr7z) - OtherOptical (Mellinger Red, Mellinger Green, Mellinger Blue, NEAT, H-Alpha Comp, SHASSA H, SHASSA CC, SHASSA C, SHASSA Sm) - ROSATDiffuse (RASS Background 1-7) - ROSATw/sources (RASS-Cnt Soft, RASS-Cnt Hard, RASS-Cnt Broad, PSPC 2.0 Deg-Int, PSPC 1.0 Deg-Int, PSPC 0.6 Deg-Int, HRI) - Radio:GHz (CO, GB6 (4850MHz), VLA FIRST (1.4 GHz), NVSS, Stripe82VLA, 1420MHz (Bonn), HI4PI, EBHIS, nH) - Radio:GLEAM (GLEAM 72-103 MHz, GLEAM 103-134 MHz, GLEAM 139-170 MHz, GLEAM 170-231 MHz) - Radio:MHz (SUMSS 843 MHz, 0408MHz, WENSS, TGSS ADR1, VLSSr, 0035MHz) - SoftX-ray (SwiftXRTCnt, SwiftXRTExp, SwiftXRTInt, HEAO 1 A-2) - SwiftUVOT (UVOT WHITE Intensity, UVOT V Intensity, UVOT B Intensity, UVOT U Intensity, UVOT UVW1 Intensity, UVOT UVM2 Intensity, UVOT UVW2 Intensity) - UV (GALEX Near UV, GALEX Far UV, ROSAT WFC F1, ROSAT WFC F2, EUVE 83 A, EUVE 171 A, EUVE 405 A, EUVE 555 A) - X-ray:SwiftBAT (BAT SNR 14-195, BAT SNR 14-20, BAT SNR 20-24, BAT SNR 24-35, BAT SNR 35-50, BAT SNR 50-75, BAT SNR 75-100, BAT SNR 100-150, BAT SNR 150-195) ### Request Example ```python SkyView.get_images(position='Eta Carinae', survey=['Fermi 5', 'HRI', 'DSS']) ``` ### Response #### Success Response (200) - **paths** (list of list of PrimaryHDU) - A list containing lists of astropy.io.fits.hdu.image.PrimaryHDU objects, where each inner list corresponds to the HDUs for a downloaded image. #### Response Example ```json [[]] ``` ``` -------------------------------- ### Load and Inspect a Specific Euclid Table Source: https://github.com/astropy/astroquery/blob/main/docs/esa/euclid/euclid.rst This example shows how to load a specific table from the Euclid Archive and inspect its properties, such as its description, size, and column names. This is useful for understanding the structure of individual tables. ```python raw_detector_table = Euclid.load_table('sedm.raw_detector') print(raw_detector_table) print(*(column.name for column in raw_detector_table.columns), sep="\n") ``` -------------------------------- ### Query All ESO Instruments with Constraints Source: https://github.com/astropy/astroquery/blob/main/docs/eso/eso.rst Fetch data from any ESO instrument, including those without dedicated query interfaces, by using query_main and specifying the 'instrument' and other relevant filters. Set maxrec to -1 to retrieve all results. ```python eso.maxrec = -1 # Return all results # (i.e. do not truncate the query even if it is slow) ``` ```python table = eso.query_main( column_filters={ 'instrument': 'APICAM', 'filter_path': 'LUMINANCE', 'exp_start': "between '2019-04-26' and '2019-04-27'" } ) ``` ```python print(len(table)) ``` ```python print(table.columns) ``` ```python table[["object", "ra", "dec", "date_obs", "prog_id"]].pprint(max_width=200) ``` -------------------------------- ### Get Image List Source: https://github.com/astropy/astroquery/blob/main/docs/ipac/ned/ned.rst Fetches a list of URLs for images or spectra associated with a given object. ```APIDOC ## GET /api/ned/image_list ### Description Fetches a list of URLs for images or spectra of a particular object. ### Method GET ### Endpoint /api/ned/image_list ### Parameters #### Query Parameters - **object_name** (string) - Required - The name of the astronomical object. - **item** (string) - Optional - Specifies the type of item to retrieve. Common values include 'images' and 'spectra'. ### Request Example ```python from astroquery.ipac.ned import Ned spectra_list = Ned.get_image_list("3c 273", item='spectra') print(spectra_list) ``` ### Response #### Success Response (200) - **image_urls** (list of strings) - A list of URLs pointing to the requested items. ``` -------------------------------- ### Configure Astrometry.net API Key Source: https://github.com/astropy/astroquery/blob/main/docs/astrometry_net/astrometry_net.rst Add your Astrometry.net API key to the astroquery.cfg file. Ensure the server URL and timeout are also correctly set. ```ini [astrometry_net] ## The Astrometry.net API key. api_key = ## Name of server server = http://nova.astrometry.net ## Default timeout for connecting to server timeout = 120 ``` -------------------------------- ### Get Tables Source: https://github.com/astropy/astroquery/blob/main/docs/esa/iso/iso.rst Retrieves a list of available tables from the ISO Data Archive via TAP. ```APIDOC ## GET /get_tables ### Description Retrieves a list of available tables from the ISO Data Archive using the Table Access Protocol (TAP). ### Method GET ### Endpoint /get_tables ### Parameters No parameters required. ### Response #### Success Response (200) - **tables** (array of strings) - A list of table names available in the archive. #### Response Example ```json { "tables": [ "hpdp.cam_sato", "hpdp.cambendo", "hpdp.chopc2i", "hpdp.chopc2ii", "hpdp.compkon", "hpdp.evolkon", "hpdp.extrakon", "hpdp.kon3p6i", "hpdp.kon3p6ii", "hpdp.konkoly", "hpdp.lwsasti", "hpdp.lwsastii", "hpdp.misckon", "hpdp.p32_c200", "hpdp.p32virgo", "hpdp.scanskon", "hpdp.sloansws", "hpdp.solarkon", "hpdp.sws01hrd", "hpdp.ysokon" ] } ``` ``` -------------------------------- ### ADQL Column Filters Example Source: https://github.com/astropy/astroquery/blob/main/docs/eso/eso.rst Demonstrates the structure for defining column filters using ADQL syntax for TAP queries. Ensure values comply with TAP field names and ADQL syntax. ```python column_filters = { 'some_int_column': "< 5", 'some_float_column_2': ">= 1.23", 'some_char_column': "like '%John%'", 'some_generic_column': "in ('mango', 'apple', 'kiwi')", 'other_generic_column': "between '2024-01-01' and '2024-12-31'" } ``` -------------------------------- ### Download Observation Data Source: https://github.com/astropy/astroquery/blob/main/docs/esa/hsa/hsa.rst Download data for a specific observation ID and instrument. This example is skipped by default. ```python from astroquery.esa.hsa import HSA HSA.download_data(observation_id='1342205057', retrieval_type='OBSERVATION', instrument_name='PACS') ``` -------------------------------- ### Upload Table from File Source: https://github.com/astropy/astroquery/blob/main/docs/utils/tap.rst Uploads a VOTable file to the TAP service and registers it as a user table. Requires prior login. ```python >>> from astroquery.utils.tap.core import TapPlus >>> gaia = TapPlus(url="https://gea.esac.esa.int/tap-server/tap") >>> gaia.login() >>> job = gaia.upload_table(upload_resource="1535553556177O-result.vot", table_name="table_test_from_file", format="VOTable") ``` ```python >>> full_qualified_table_name = 'user_.table_test_from_file' >>> query = 'select * from ' + full_qualified_table_name >>> job = gaia.launch_job(query=query) >>> results = job.get_resultsjob) >>> print(results) ``` -------------------------------- ### Query ALMA Archive by Source Name Source: https://github.com/astropy/astroquery/blob/main/docs/alma/alma.rst Example of querying the ALMA archive using a source name. ```python Alma.query({'source_name_alma': 'GRB021004'}) ``` -------------------------------- ### Construct TAP Query for All Entries Source: https://github.com/astropy/astroquery/blob/main/docs/heasarc/heasarc.rst Construct a TAP query to retrieve all entries from a catalog, using TOP with a large number to bypass server limits. Requires getting default columns first. ```python from astroquery.heasarc import Heasarc columns = ', '.join(Heasarc._get_default_columns('csc')) query = f'SELECT TOP 9999999 {columns} FROM csc' Heasarc.query_tap(query).to_table() ``` -------------------------------- ### Get Public UKIDSS Images Source: https://github.com/astropy/astroquery/blob/main/docs/ukidss/ukidss.rst Retrieves public images for a given target. No login is required for this operation. ```python >>> from astroquery.ukidss import Ukidss >>> images = Ukidss.get_images("m1") Found 1 targets Downloading http://surveys.roe.ac.uk/wsa/cgi-bin/getFImage.cgi?file=/disk05/wsa/ingest/fits/20071011_v1/w20071011_01818_sf_st.fit&mfid=1737581&extNo=4&lx=1339&hx=1638&ly=1953&hy=2252&rf=0&flip=1&uniq=5348_573_21_31156_1&xpos=150.7&ypos=150.3&band=K&ra=83.633083&dec=22.0145 |===========================================| 174k/174k (100.00%) 02s ``` -------------------------------- ### Get Transmission Data for a Filter Source: https://github.com/astropy/astroquery/blob/main/docs/svo_fps/svo_fps.rst Retrieves the transmission curve data for a specific filter, identified by its filterID. ```APIDOC ## GET /astropy/astroquery/svo_fps/get_transmission_data ### Description Retrieves the transmission curve data for a specific filter, identified by its filterID. The filterID can be obtained from `get_filter_list` or `get_filter_index`. ### Method GET ### Endpoint /astropy/astroquery/svo_fps/get_transmission_data ### Parameters #### Query Parameters - **filter_id** (str) - Required - The unique identifier of the filter. ### Request Example ```python from astroquery.svo_fps import SvoFps transmission_data = SvoFps.get_transmission_data(filter_id='some_filter_id') ``` ### Response #### Success Response (200) - **transmission_data** (astropy.table.Table) - A table containing the transmission curve data for the specified filter. ``` -------------------------------- ### ADQL wildcard match example with asterisk Source: https://github.com/astropy/astroquery/blob/main/docs/esa/plato/plato.rst Shows how using an asterisk (*) as a wildcard in a Python string parameter is converted to an ILIKE 'prefix%' pattern in ADQL. ```plaintext StarName='star*' -> StarName ILIKE 'star%' ``` -------------------------------- ### Download Data Product by Filename Source: https://github.com/astropy/astroquery/blob/main/docs/esa/emds/einsteinprobe/einsteinprobe.rst Download a specific data product using its filename. The file is saved to the current working directory by default. Initializes the EinsteinProbeClass. ```python from astroquery.esa.emds.einsteinprobe import EinsteinProbeClass epsa = EinsteinProbeClass() epsa.download_product(filename='fxt_b_11900008319_ff_01_po_3bb.rmf') # doctest: +SKIP 'fxt_b_11900008319_ff_01_po_3bb.rmf' ``` -------------------------------- ### Get Photometry for an Event Source: https://github.com/astropy/astroquery/blob/main/docs/oac/oac.rst Use the get_photometry method for quick retrieval of photometry data for a given event. ```python from astroquery.oac import OAC photometry = OAC.get_photometry("SN2014J") ``` -------------------------------- ### Launch Job with File Output Source: https://github.com/astropy/astroquery/blob/main/docs/esa/jwst/jwst.rst Launches a TAP job and saves the results to a file. Use when dealing with large result sets or when persistence is needed. ```python from astroquery.esa.jwst import Jwst job = Jwst.launch_job("SELECT TOP 100 " "instrument_name, proposal_id, calibrationlevel, " "dataproducttype " "FROM jwst.main ORDER BY instrument_name, observationuri", dump_to_file=True) print(job) # doctest: +IGNORE_OUTPUT result = job.get_results() ``` -------------------------------- ### Get Table Data Source: https://github.com/astropy/astroquery/blob/main/docs/ipac/ned/ned.rst Retrieves specific data tables for an object, such as photometry, diameters, redshifts, etc. ```APIDOC ## GET /api/ned/table ### Description Fetches specific data tables for an object. ### Method GET ### Endpoint /api/ned/table ### Parameters #### Query Parameters - **object_name** (string) - Required - The name of the astronomical object. - **table** (string) - Required - The type of table to fetch. Accepted values include 'photometry', 'diameters', 'redshifts', 'references', 'object_notes', and 'positions'. ### Request Example ```python from astroquery.ipac.ned import Ned result_table = Ned.get_table("3C 273", table='positions') print(result_table) ``` ### Response #### Success Response (200) - **data_table** (astropy.table.Table) - A table containing the requested data. ```