EmdsClass#
- class astroquery.esa.emds.EmdsClass(auth_session=None, tap_url=None)[source]#
Bases:
EsaTapEMDS TAP client (multi-mission / multi-schema).
EMDS provides access to multiple missions through a single TAP service. Mission data are organised under different TAP schemas. This client offers a small convenience layer to work with mission-specific tables while reusing the standard TAP utilities.
Set the session, alternative TAP url, initial parameter for the TAP connection
- Parameters:
- auth_sessionpyvo.auth.authsession.AuthSession, optional, default None
Authentication session to manage login
- tap_urlstr, optional, default None
In case an alternative URL for the TAP needs to be defined
- Returns:
- A list of table objects
Attributes Summary
Class to init ESA TAP Module to communicate with {ESA_ARCHIVE_NAME} Science Archive
Initialize {ESA_ARCHIVE_NAME} TAP connection
Methods Summary
__call__(*args, **kwargs)init a fresh copy of self
Removes all cache files.
create_cone_search_query(ra, dec, ra_column, ...)download_products(products, *[, path, ...])Download all products from a table returned by
get_products().get_job(jobid)Returns the job corresponding to an ID from ISLA TAP.
get_job_list(*[, phases, after, last, ...])Returns all the asynchronous jobs stored in ISLA TAP.
get_metadata(table)Gets the specified table from ISLA TAP
get_observations(*[, target_name, ...])Query the observation catalogue for this mission.
get_products(*[, target_name, coordinates, ...])Retrieve data products given a Taget Name, coordinates and/or some filters
get_table(table)Gets the specified table from ISLA TAP
get_tables(*[, only_names])Return the tables available for this mission.
Retrieve the list of missions available in the EMDS ObsCore view.
login(*[, user, password])Performs a login in ISLA TAP.
logout()Performs a logout in ISLA TAP.
query_table(table_name, *[, columns, ...])Query a set of columns from a specific table in ISLA TAP, using filters defined by the user
query_tap(query, *[, async_job, ...])Launches a synchronous or asynchronous job to query the ISLA TAP
Resets the cache location to the default astropy cache
Attributes Documentation
- REQUEST_PARAMETERS = {}#
- THRESHOLD = 1e-05#
Class to init ESA TAP Module to communicate with {ESA_ARCHIVE_NAME} Science Archive
- Subclasses must define:
ESA_ARCHIVE_NAME: str TAP_URL: str LOGIN_URL: str LOGOUT_URL: str TIMEOUT (Optional) = 60 REQUEST_PARAMETERS = {} THRESHOLD = 1e-5
- TIMEOUT = 60#
- cache_location#
- tap#
Initialize {ESA_ARCHIVE_NAME} TAP connection
- Returns:
- A
TAPServiceobject connected to {ESA_ARCHIVE_NAME} TAP
- A
Methods Documentation
- __call__(*args, **kwargs)#
init a fresh copy of self
- clear_cache()#
Removes all cache files.
- create_cone_search_query(ra, dec, ra_column, dec_column, radius)#
- download_products(products, *, path='', cache=False, cache_folder=None, verbose=False, params=None)[source]#
Download all products from a table returned by
get_products().- Parameters:
- products
Table Table returned by
get_products(). The table must contain theaccess_urlandobs_publisher_didcolumns.- pathstr, optional
Local directory where the downloaded files will be stored. If not provided, files are downloaded to the current working directory. Ignored if
cache=True.- cachebool, optional
If True, store the downloaded files in the Astroquery cache. Default is False.
- cache_folderstr, optional
Subdirectory within the Astroquery cache where files will be stored. Only used if
cache=True.- verbosebool, optional
If True, print progress messages during download. Default is False.
- paramsdict, optional
Additional parameters passed to the HTTP request.
- products
- Returns:
- list of str
List of local file paths for the downloaded products.
- get_job(jobid)#
Returns the job corresponding to an ID from ISLA TAP. Note that the user must be able to see the job in the current security context.
- Parameters:
- jobidstr, mandatory
ID of the job to view
- Returns:
- JobSummary corresponding to the job ID
- get_job_list(*, phases=None, after=None, last=None, short_description=True)#
Returns all the asynchronous jobs stored in ISLA TAP. Note that the user must be able to see the job in the current security context.
- Parameters:
- phaseslist of str
Union of job phases to filter the results by.
- afterdatetime
Return only jobs created after this datetime
- lastint
Return only the most recent number of jobs
- short_descriptionflag - True or False
If True, the jobs in the list will contain only the information corresponding to the TAP ShortJobDescription object (job ID, phase, run ID, owner ID and creation ID) whereas if False, a separate GET call to each job is performed for the complete job description
- Returns:
- A list of Job objects
- get_metadata(table)#
Gets the specified table from ISLA TAP
- Parameters:
- tablestr, mandatory
- full qualified table name (i.e. schema name.table name)
- Returns:
- A table object
- get_observations(*, target_name=None, coordinates=None, radius=1.0, columns=None, get_metadata=False, output_file=None, **filters)[source]#
Query the observation catalogue for this mission.
This method queries the mission-specific observation catalogue configured for this client and returns observation-level metadata as an Astropy table. Queries can be restricted using a cone search (by target name or coordinates) and additional column-based filters.
- Parameters:
- target_name: str, optional
Name of the target to be resolved against SIMBAD/NED/VIZIER
- coordinates: str or SkyCoord, optional
coordinates of the center in the cone search
- radius: float or quantity, optional, default value 1 degree
radius in degrees (int, float) or quantity of the cone_search
- columnsstr or list of str, optional, default None
Columns from the table to be retrieved. They can be checked using get_metadata=True
- get_metadatabool, optional, default False
Get the table metadata to verify the columns that can be filtered
- output_filestr, optional, default None
file name where the results are saved. If this parameter is not provided, the jobid is used instead
- **filtersstr, optional, default None
Filters to be applied to the search. The column name is the keyword and the value is any value accepted by the column datatype. They will be used to generate the SQL filters for the query. Some examples are described below, where the left side is the parameter defined for this method and the right side the SQL filter generated: obs_collection=”EPSA” -> obs_collection = ‘EPSA’ target_name=”AT 2023%” -> target_name ILIKE ‘AT 2023%’ dataproduct_type=[“img”, “pha”] -> dataproduct_type = ‘img’ OR dataproduct_type = ‘pha’ dataproduct_type=[“img”, “pha”] -> dataproduct_type IN (‘img’, ‘pha’) t_min=(“>”, 60000) -> t_min > 60000 s_ra=(80, 82) -> s_ra >= 80 AND s_ra <= 82
- Returns:
- An astropy.table containing the query results, or the metadata table when
get_metadata=True
- An astropy.table containing the query results, or the metadata table when
- get_products(*, target_name=None, coordinates=None, radius=1.0, get_metadata=False, **filters)[source]#
Retrieve data products given a Taget Name, coordinates and/or some filters
This method queries the mission product catalogue and returns product-level information. It ensures that the
obs_publisher_didandaccess_urlcolumns required for downloading products are included in the results.- Parameters:
- target_name: str, optional
Name of the target to be resolved against SIMBAD/NED/VIZIER
- coordinates: str or SkyCoord, optional
coordinates of the center in the cone search
- radius: float or quantity, optional, default value 1 degree
radius in degrees (int, float) or quantity of the cone_search
- get_metadatabool, optional, default False
Get the table metadata to verify the columns that can be filtered
- **filtersstr, optional, default None
Filters to be applied to the search. The column name is the keyword and the value is any value accepted by the column datatype. They will be used to generate the SQL filters for the query. Some examples are described below, where the left side is the parameter defined for this method and the right side the SQL filter generated: obs_collection=”EPSA” -> obs_collection = ‘EPSA’ target_name=”AT 2023%” -> target_name ILIKE ‘AT 2023%’ dataproduct_type=[“img”, “pha”] -> dataproduct_type = ‘img’ OR dataproduct_type = ‘pha’ dataproduct_type=[“img”, “pha”] -> dataproduct_type IN (‘img’, ‘pha’) t_min=(“>”, 60000) -> t_min > 60000 s_ra=(80, 82) -> s_ra >= 80 AND s_ra <= 82
- Returns:
- astropy.table.Table
- get_table(table)#
Gets the specified table from ISLA TAP
- Parameters:
- tablestr, mandatory
full qualified table name (i.e. schema name + table name)
- Returns:
- A table object
- get_tables(*, only_names: bool = False)[source]#
Return the tables available for this mission.
By default, only tables belonging to the mission-specific schema(s) are returned. Set
only_names=Trueto return table names instead of table objects.- Parameters:
- only_namesbool, optional
If True, return table names as strings. If False, return table objects.
- Returns:
- list
Table names (str) if
only_names=True, otherwise table objects.
- list_missions()[source]#
Retrieve the list of missions available in the EMDS ObsCore view.
This method returns the distinct values of the
obs_collectionfield from theivoa.ObsCoreview, whereobs_collectiontypically identifies the mission or data collection associated with each observation.- Returns:
- astropy.table that contains the distinct mission identifiers present in ObsCore.
- login(*, user=None, password=None)#
Performs a login in ISLA TAP. TAP+ only User and password shall be used
- Parameters:
- userstr, mandatory, default None
Username. If no value is provided, a prompt to type it will appear
- passwordstr, mandatory, default None
User password. If no value is provided, a prompt to type it will appear
- logout()#
Performs a logout in ISLA TAP. TAP+ only
- query_table(table_name, *, columns=None, custom_filters=None, get_metadata=False, async_job=False, output_file=None, output_format='votable', **filters)#
Query a set of columns from a specific table in ISLA TAP, using filters defined by the user
- Parameters:
- table_namestr, mandatory
name of the table where this query will be executed
- columnslist of str or str, optional, default ‘None’
columns from the table to be retrieved
- custom_filtersstr, optional, default ‘None’
No SQL filters defined by the user E.g. ADQL Intersect filter
- get_metadata: bool, optional, default False
If set to true, the method will return an astropy.Table containing the available columns for this table, including the description, units, ucd, utype and data type
- async_jobbool, optional, default ‘False’
executes the query (job) in asynchronous/synchronous mode (default synchronous)
- output_filestr, optional, default None
file name where the results are saved
- output_formatstr, optional, default ‘votable’
results format
- Users can defined more parameters, using the column names. They will be
- used to generate the SQL filters for the query. Some examples are described below,
- where the left side is the parameter defined for this method and the right side the
- SQL filter generated:
- StarName=’star1’ -> StarName = ‘star1’
- StarName=’star*’ -> StarName ILIKE ‘star%’
- StarName=’star%’ -> StarName ILIKE ‘star%’
- StarName=[‘star1’, ‘star2’] -> StarName = ‘star1’ OR StarName - ‘star2’
- ra=(‘>’, 30) -> ra > 30
- ra=(20, 30) -> ra >= 20 AND ra <= 30
- Returns:
- An astropy.table object containing the results
- query_tap(query, *, async_job=False, output_file=None, output_format='votable', verbose=False)#
Launches a synchronous or asynchronous job to query the ISLA TAP
- Parameters:
- querystr, mandatory
query (adql) to be executed
- async_jobbool, optional, default ‘False’
executes the query (job) in asynchronous/synchronous mode (default synchronous)
- output_filestr, optional, default None
file name where the results are saved. If this parameter is not provided
- output_formatstr, optional, default ‘votable’
results format
- verbose: bool, optional, default False
To log the query when executing this method.
- Returns:
- An astropy.table object containing the results
- reset_cache_location()#
Resets the cache location to the default astropy cache