EsoClass

class astroquery.eso.EsoClass[source]

Bases: QueryWithLogin

User facing class to query the ESO archive

Attributes Summary

AUTH_URL

CALSELECTOR_URL

DOWNLOAD_URL

GUNZIP

ROW_LIMIT

Getter.

USERNAME

Methods Summary

get_associated_files(datasets, *[, mode, ...])

Invoke Calselector service to find calibration files associated to the provided datasets.

get_headers(product_ids, *[, cache])

Get the headers associated to a list of data product IDs

list_column(table_name)

Prints the columns contained in a given table

list_instruments([cache])

List all the available instrument-specific queries offered by the ESO archive.

list_surveys(*[, cache])

List all the available surveys (phase 3) in the ESO archive.

login([username, store_password, ...])

Login to the ESO User Portal.

query_apex_quicklooks([project_id, columns, ...])

APEX data are distributed with quicklook products identified with a different name than other ESO products.

query_instrument(instrument, *[, cone_ra, ...])

Query instrument-specific raw data contained in the ESO archive.

query_main([instruments, cone_ra, cone_dec, ...])

Query raw data from all instruments contained in the ESO archive.

query_surveys([surveys, cone_ra, cone_dec, ...])

Query survey Phase 3 data contained in the ESO archive.

query_tap(query, *[, authenticated])

Query the ESO TAP service using a free ADQL string.

retrieve_data(datasets, *[, continuation, ...])

Retrieve a list of datasets form the ESO archive.

tap([authenticated])

Attributes Documentation

AUTH_URL = 'https://www.eso.org/sso/oidc/token'
CALSELECTOR_URL = 'https://archive.eso.org/calselector/v1/associations'
DOWNLOAD_URL = 'https://dataportal.eso.org/dataPortal/file/'
GUNZIP = 'gunzip'
ROW_LIMIT

Getter. Safeguard that truncates the number of records returned by a query

USERNAME = ''

Methods Documentation

get_associated_files(datasets: List[str], *, mode: str = 'raw', savexml: bool = False, destination: str = None) List[str][source]

Invoke Calselector service to find calibration files associated to the provided datasets.

Parameters:
datasetslist of strings

List of datasets for which calibration files should be retrieved.

modestring
Calselector mode: ‘raw’ (default) for raw calibrations,

or ‘processed’ for processed calibrations.

savexmlbool

If true, save to disk the XML association tree returned by Calselector.

destinationstring

Directory where the XML files are saved (default = astropy cache).

Returns:
files

List of unique datasets associated to the input datasets.

get_headers(product_ids, *, cache=True)[source]

Get the headers associated to a list of data product IDs

This method returns a Table where the rows correspond to the provided data product IDs, and the columns are from each of the Fits headers keywords.

Note: The additional column 'DP.ID' found in the returned table corresponds to the provided data product IDs.

Parameters:
product_idseither a list of strings or a Column

List of data product IDs.

cachebool

Defaults to True. If set overrides global caching behavior. See caching documentation.

Returns:
resultTable

A table where: columns are header keywords, rows are product_ids.

list_column(table_name: str) None[source]

Prints the columns contained in a given table

list_instruments(cache=True) List[str][source]

List all the available instrument-specific queries offered by the ESO archive.

Returns:
instrument_listlist of strings
cachebool

Deprecated - unused.

list_surveys(*, cache=True) List[str][source]

List all the available surveys (phase 3) in the ESO archive.

Returns:
collection_listlist of strings
cachebool

Deprecated - unused.

login(username: str = None, store_password: bool = False, reenter_password: bool = False) bool

Login to the ESO User Portal.

Parameters:
usernamestr, optional

Username to the ESO Public Portal. If not given, it should be specified in the config file.

store_passwordbool, optional

Stores the password securely in your keyring. Default is False.

reenter_passwordbool, optional

Asks for the password even if it is already stored in the keyring. This is the way to overwrite an already stored passwork on the keyring. Default is False.

query_apex_quicklooks(project_id: List[str] | str = None, *, columns: List | str = None, column_filters: dict | None = None, top: int = None, count_only: bool = False, get_query_payload: bool = False, help: bool = False, authenticated: bool = False, open_form: bool = False, cache: bool = False) Table | int | str[source]

APEX data are distributed with quicklook products identified with a different name than other ESO products. This query tool searches by project ID or any other supported keywords.

Parameters:
project_idstr

ID of the project from which APEX quicklook data is to be queried.

columnsstr or list of str, optional

Name of the columns the query should return. If specified as a string, it should be a comma-separated list of column names.

topint, optional

When set to N, returns only the top N records.

count_onlybool, optional

If True, returns only an int: the count of the records the query would return when set to False. Default is False.

get_query_payloadbool, optional

If True, returns only a str: the query string that would be issued to the TAP service. Default is False.

helpbool, optional

If True, prints all the parameters accepted in column_filters and columns. Default is False.

authenticatedbool, optional

If True, runs the query as an authenticated user. Authentication must be done beforehand via login(). Note that authenticated queries are slower. Default is False.

column_filtersdict or None, optional

Constraints applied to the query in ADQL syntax, e.g., {"exp_start": "between '2024-12-31' and '2025-12-31'"}. Default is None.

open_formbool, optional

Deprecated - unused.

cachebool, optional

Deprecated - unused.

Returns:
astropy.table.Table, str, int, or None
  • By default, returns an Table containing records based on the specified columns and constraints. Returns None if no results.

  • When count_only is True, returns an int representing the record count for the specified filters.

  • When get_query_payload is True, returns the query string that would be issued to the TAP service given the specified arguments.

query_instrument(instrument: str, *, cone_ra: float = None, cone_dec: float = None, cone_radius: float = None, columns: List | str = None, column_filters: dict | None = None, top: int = None, count_only: bool = False, get_query_payload: bool = False, help: bool = False, authenticated: bool = False, open_form: bool = False, cache: bool = False) Table | int | str[source]

Query instrument-specific raw data contained in the ESO archive.

Parameters:
instrumentstr

Name of the instrument from which raw data is to be queried. Should be ONLY ONE of the names returned by list_instruments().

cone_rafloat, optional

Cone Search Center - Right Ascension in degrees.

cone_decfloat, optional

Cone Search Center - Declination in degrees.

cone_radiusfloat, optional

Cone Search Radius in degrees.

columnsstr or list of str, optional

Name of the columns the query should return. If specified as a string, it should be a comma-separated list of column names.

topint, optional

When set to N, returns only the top N records.

count_onlybool, optional

If True, returns only an int: the count of the records the query would return when set to False. Default is False.

get_query_payloadbool, optional

If True, returns only a str: the query string that would be issued to the TAP service. Default is False.

helpbool, optional

If True, prints all the parameters accepted in column_filters and columns. Default is False.

authenticatedbool, optional

If True, runs the query as an authenticated user. Authentication must be done beforehand via login(). Note that authenticated queries are slower. Default is False.

column_filtersdict or None, optional

Constraints applied to the query in ADQL syntax, e.g., {"exp_start": "between '2024-12-31' and '2025-12-31'"}. Default is None.

open_formbool, optional

Deprecated - unused.

cachebool, optional

Deprecated - unused.

Returns:
astropy.table.Table, str, int, or None
  • By default, returns an Table containing records based on the specified columns and constraints. Returns None if no results.

  • When count_only is True, returns an int representing the record count for the specified filters.

  • When get_query_payload is True, returns the query string that would be issued to the TAP service given the specified arguments.

query_main(instruments: List[str] | str = None, *, cone_ra: float = None, cone_dec: float = None, cone_radius: float = None, columns: List | str = None, column_filters: dict | None = None, top: int = None, count_only: bool = False, get_query_payload: bool = False, help: bool = False, authenticated: bool = False, open_form: bool = False, cache: bool = False) Table | int | str[source]

Query raw data from all instruments contained in the ESO archive.

Parameters:
instrumentsstr or list, optional

Name of the instruments to filter. Should be one or more of the names returned by list_instruments(). If specified as a string, it should be a comma-separated list of instrument names. If not specified, returns records relative to all instruments. Default is None.

cone_rafloat, optional

Cone Search Center - Right Ascension in degrees.

cone_decfloat, optional

Cone Search Center - Declination in degrees.

cone_radiusfloat, optional

Cone Search Radius in degrees.

columnsstr or list of str, optional

Name of the columns the query should return. If specified as a string, it should be a comma-separated list of column names.

topint, optional

When set to N, returns only the top N records.

count_onlybool, optional

If True, returns only an int: the count of the records the query would return when set to False. Default is False.

get_query_payloadbool, optional

If True, returns only a str: the query string that would be issued to the TAP service. Default is False.

helpbool, optional

If True, prints all the parameters accepted in column_filters and columns. Default is False.

authenticatedbool, optional

If True, runs the query as an authenticated user. Authentication must be done beforehand via login(). Authenticated queries may be slower. Default is False.

column_filtersdict or None, optional

Constraints applied to the query in ADQL syntax, e.g., {"exp_start": "between '2024-12-31' and '2025-12-31'"}. Default is None.

open_formbool, optional

Deprecated - unused.

cachebool, optional

Deprecated - unused.

Returns:
astropy.table.Table, str, int or None
  • By default, returns an Table containing records based on the specified columns and constraints. Returns None if the query has no results.

  • When count_only is True, returns an int representing the record count for the specified filters.

  • When get_query_payload is True, returns the query string that would be issued to the TAP service given the specified arguments.

query_surveys(surveys: List[str] | str = None, *, cone_ra: float = None, cone_dec: float = None, cone_radius: float = None, columns: List | str = None, column_filters: dict | None = None, top: int = None, count_only: bool = False, get_query_payload: bool = False, help: bool = False, authenticated: bool = False, open_form: bool = False, cache: bool = False) Table | int | str[source]

Query survey Phase 3 data contained in the ESO archive.

Parameters:
surveysstr or list, optional

Name of the survey(s) to query. Should be one or more of the names returned by list_surveys(). If specified as a string, it should be a comma-separated list of survey names. If not specified, returns records relative to all surveys. Default is None.

cone_rafloat, optional

Cone Search Center - Right Ascension in degrees.

cone_decfloat, optional

Cone Search Center - Declination in degrees.

cone_radiusfloat, optional

Cone Search Radius in degrees.

columnsstr or list of str, optional

Name of the columns the query should return. If specified as a string, it should be a comma-separated list of column names.

topint, optional

When set to N, returns only the top N records.

count_onlybool, optional

If True, returns only an int: the count of the records the query would return when set to False. Default is False.

get_query_payloadbool, optional

If True, returns only a str: the query string that would be issued to the TAP service. Default is False.

helpbool, optional

If True, prints all the parameters accepted in column_filters and columns. Default is False.

authenticatedbool, optional

If True, runs the query as an authenticated user. Authentication must be done beforehand via login(). Authenticated queries may be slower. Default is False.

column_filtersdict or None, optional

Constraints applied to the query in ADQL syntax, e.g., {"exp_start": "between '2024-12-31' and '2025-12-31'"}. Default is None.

open_formbool, optional

Deprecated - unused.

cachebool, optional

Deprecated - unused.

Returns:
astropy.table.Table, str, int or None
  • By default, returns an Table containing records based on the specified columns and constraints. Returns None if the query has no results.

  • When count_only is True, returns an int representing the record count for the specified filters.

  • When get_query_payload is True, returns the query string that would be issued to the TAP service given the specified arguments.

query_tap(query: str, *, authenticated: bool = False) Table[source]

Query the ESO TAP service using a free ADQL string.

Parameters:
query_strstr

The ADQL query string to be executed.

authenticatedbool, optional

If True, the query is run as an authenticated user. Authentication must be performed beforehand via astroquery.eso.EsoClass.login(). Authenticated queries may be slower. Default is False.

Returns:
astropy.table.Table

Examples

from astroquery.eso import Eso eso_instance = Eso() eso_instance.query_tap(“SELECT * FROM ivoa.ObsCore”)

retrieve_data(datasets, *, continuation=False, destination=None, with_calib=None, unzip=True)[source]

Retrieve a list of datasets form the ESO archive.

Parameters:
datasetslist of strings or string

List of datasets strings to retrieve from the archive.

destination: string

Directory where the files are copied. Files already found in the destination directory are skipped, unless continuation=True. Default to astropy cache.

continuationbool

Force the retrieval of data that are present in the destination directory.

with_calibstring

Retrieve associated calibration files: None (default), ‘raw’ for raw calibrations, or ‘processed’ for processed calibrations.

unzipbool

Unzip compressed files from the archive after download. True by default.

Returns:
fileslist of strings or string

List of files that have been locally downloaded from the archive.

Examples

dptbl = Eso.query_instrument(‘apex’, pi_coi=’ginsburg’) dpids = [row[‘DP.ID’] for row in dptbl if ‘Map’ in row[‘Object’]] files = Eso.retrieve_data(dpids)

tap(authenticated: bool = False) TAPService[source]