EsoClass#
- class astroquery.eso.EsoClass[source]#
Bases:
QueryWithLoginUser facing class to query the ESO archive
Attributes Summary
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_catalogs(*[, all_versions])List available catalogue tables offered by the ESO archive.
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_catalog(catalog, *[, cone_ra, ...])Query catalogue data contained in the ESO archive.
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, tap_endpoint])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, *, mode='raw', savexml=False, destination=None)[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
Tablewhere 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.
- product_idseither a list of strings or a
- Returns:
- result
Table A table where: columns are header keywords, rows are product_ids.
- result
- list_catalogs(*, all_versions=False)[source]#
List available catalogue tables offered by the ESO archive.
- Parameters:
- all_versionsbool, optional
If True, list all versions of each catalogue table. If False (default), return only the current version of each catalogue (as flagged by
is_current = 1inTAP_SCHEMA.tables).
- Returns:
- list[str]
List of catalogue table names.
- list_instruments(cache=True)[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)[source]#
List all the available surveys (phase 3) in the ESO archive.
- Returns:
- collection_listlist of strings
- cachebool
Deprecated - unused.
- login(username=None, store_password=False, reenter_password=False)#
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=None, *, columns=None, column_filters=None, top=None, count_only=False, get_query_payload=False, help=False, authenticated=False, open_form=False, cache=False)[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 topNrecords.- count_onlybool, optional
If
True, returns only anint: the count of the records the query would return when set toFalse. Default isFalse.- get_query_payloadbool, optional
If
True, returns only astr: the query string that would be issued to the TAP service. Default isFalse.- helpbool, optional
If
True, prints all the parameters accepted incolumn_filtersandcolumns. Default isFalse.- authenticatedbool, optional
If
True, runs the query as an authenticated user. Authentication must be done beforehand vialogin(). Note that authenticated queries are slower. Default isFalse.- 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 isNone.- open_formbool, optional
Deprecated - unused.
- cachebool, optional
Deprecated - unused.
- Returns:
- astropy.table.Table, str, int, or None
By default, returns an
Tablecontaining records based on the specified columns and constraints. ReturnsNoneif no results.When
count_onlyisTrue, returns anintrepresenting the record count for the specified filters.When
get_query_payloadisTrue, returns the query string that would be issued to the TAP service given the specified arguments.
- query_catalog(catalog, *, cone_ra=None, cone_dec=None, cone_radius=None, columns=None, column_filters=None, top=None, count_only=False, get_query_payload=False, help=False, authenticated=False)[source]#
Query catalogue data contained in the ESO archive.
- Parameters:
- catalogstr
Name of the catalogue to query. Should be ONLY ONE of the names returned by
list_catalogs().- cone_rafloat, optional
Not yet implemented. Cone Search Center - Right Ascension in degrees.
- cone_decfloat, optional
Not yet implemented. Cone Search Center - Declination in degrees.
- cone_radiusfloat, optional
Not yet implemented. 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 topNrecords.- count_onlybool, optional
If
True, returns only anint: the count of the records the query would return when set toFalse. Default isFalse.- get_query_payloadbool, optional
If
True, returns only astr: the query string that would be issued to the TAP service. Default isFalse.- helpbool, optional
If
True, prints all the parameters accepted incolumn_filtersandcolumns. Default isFalse.- authenticatedbool, optional
If
True, runs the query as an authenticated user. Authentication must be done beforehand vialogin(). Note that authenticated queries are slower. Default isFalse.- column_filtersdict or None, optional
Constraints applied to the query in ADQL syntax, e.g.,
{"mag": "< 20"}. Default isNone.
- Returns:
- astropy.table.Table, str, int, or None
By default, returns an
Tablecontaining records based on the specified columns and constraints. ReturnsNoneif no results.When
count_onlyisTrue, returns anintrepresenting the record count for the specified filters.When
get_query_payloadisTrue, returns the query string that would be issued to the TAP service given the specified arguments.
- query_instrument(instrument, *, cone_ra=None, cone_dec=None, cone_radius=None, columns=None, column_filters=None, top=None, count_only=False, get_query_payload=False, help=False, authenticated=False, open_form=False, cache=False)[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 topNrecords.- count_onlybool, optional
If
True, returns only anint: the count of the records the query would return when set toFalse. Default isFalse.- get_query_payloadbool, optional
If
True, returns only astr: the query string that would be issued to the TAP service. Default isFalse.- helpbool, optional
If
True, prints all the parameters accepted incolumn_filtersandcolumns. Default isFalse.- authenticatedbool, optional
If
True, runs the query as an authenticated user. Authentication must be done beforehand vialogin(). Note that authenticated queries are slower. Default isFalse.- 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 isNone.- open_formbool, optional
Deprecated - unused.
- cachebool, optional
Deprecated - unused.
- Returns:
- astropy.table.Table, str, int, or None
By default, returns an
Tablecontaining records based on the specified columns and constraints. ReturnsNoneif no results.When
count_onlyisTrue, returns anintrepresenting the record count for the specified filters.When
get_query_payloadisTrue, returns the query string that would be issued to the TAP service given the specified arguments.
- query_main(instruments=None, *, cone_ra=None, cone_dec=None, cone_radius=None, columns=None, column_filters=None, top=None, count_only=False, get_query_payload=False, help=False, authenticated=False, open_form=False, cache=False)[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 isNone.- 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 topNrecords.- count_onlybool, optional
If
True, returns only anint: the count of the records the query would return when set toFalse. Default isFalse.- get_query_payloadbool, optional
If
True, returns only astr: the query string that would be issued to the TAP service. Default isFalse.- helpbool, optional
If
True, prints all the parameters accepted incolumn_filtersandcolumns. Default isFalse.- authenticatedbool, optional
If
True, runs the query as an authenticated user. Authentication must be done beforehand vialogin(). Authenticated queries may be slower. Default isFalse.- 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 isNone.- open_formbool, optional
Deprecated - unused.
- cachebool, optional
Deprecated - unused.
- Returns:
- astropy.table.Table, str, int or None
By default, returns an
Tablecontaining records based on the specified columns and constraints. ReturnsNoneif the query has no results.When
count_onlyisTrue, returns anintrepresenting the record count for the specified filters.When
get_query_payloadisTrue, returns the query string that would be issued to the TAP service given the specified arguments.
- query_surveys(surveys=None, *, cone_ra=None, cone_dec=None, cone_radius=None, columns=None, column_filters=None, top=None, count_only=False, get_query_payload=False, help=False, authenticated=False, open_form=False, cache=False)[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 isNone.- 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 topNrecords.- count_onlybool, optional
If
True, returns only anint: the count of the records the query would return when set toFalse. Default isFalse.- get_query_payloadbool, optional
If
True, returns only astr: the query string that would be issued to the TAP service. Default isFalse.- helpbool, optional
If
True, prints all the parameters accepted incolumn_filtersandcolumns. Default isFalse.- authenticatedbool, optional
If
True, runs the query as an authenticated user. Authentication must be done beforehand vialogin(). Authenticated queries may be slower. Default isFalse.- 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 isNone.- open_formbool, optional
Deprecated - unused.
- cachebool, optional
Deprecated - unused.
- Returns:
- astropy.table.Table, str, int or None
By default, returns an
Tablecontaining records based on the specified columns and constraints. ReturnsNoneif the query has no results.When
count_onlyisTrue, returns anintrepresenting the record count for the specified filters.When
get_query_payloadisTrue, returns the query string that would be issued to the TAP service given the specified arguments.
- query_tap(query, *, authenticated=False, tap_endpoint='tap_obs')[source]#
Query the ESO TAP service using a free ADQL string.
- Parameters:
- querystr
The ADQL query string to be executed.
- authenticatedbool, optional
If
True, the query is run as an authenticated user. Authentication must be performed beforehand viaastroquery.eso.EsoClass.login(). Authenticated queries may be slower. Default isFalse.- tap_endpoint{“tap_obs”, “tap_cat”}, optional
TAP endpoint to query. Default is
"tap_obs".
- 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.
Trueby 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)