ESAHubbleClass

class astroquery.esa.hubble.ESAHubbleClass(*, tap_handler=None, show_messages=True)[source]

Bases: BaseQuery

Class to init ESA Hubble Module and communicate with eHST TAP

Attributes Summary

TIMEOUT

calibration_levels

copying_string

product_types

Methods Summary

cone_search(coordinates, radius, *[, ...])

To execute a cone search defined by a coordinate and a radius

cone_search_criteria(radius, *[, target, ...])

To execute a cone search defined by a coordinate (an astropy.coordinate element or a target name which is resolved), a radius and a set of criteria to filter the results.

download_file(file, *[, filename, folder, ...])

Download a file from eHST based on its filename.

download_files_from_program(program, *[, ...])

Download artifacts from EHST.

download_fits_files(observation_id, *[, ...])

Retrieves all the FITS files associated to an observation

download_product(observation_id, *[, ...])

Download products from EHST based on their observation ID and the calibration level or the product type.

get_artifact(artifact_id, *[, filename, ...])

Download artifacts from EHST.

get_associated_files(observation_id, *[, ...])

Retrieves all the files associated to an observation

get_columns(table_name, *[, only_names, verbose])

Get the available columns for a table in EHST TAP service

get_hap_hst_link(observation_id)

Returns the related members of hap and hst observations

get_member_observations(observation_id)

Returns the related members of simple and composite observations

get_observation_type(observation_id)

Returns the type of an observation

get_observations_from_program(program, *[, ...])

Retrieves all the observations associated to a program/proposal ID

get_postcard(observation_id, *[, ...])

Download postcards from EHST

get_status_messages()

Retrieve the messages to inform users about the status of eHST TAP

get_tables(*[, only_names, verbose])

Get the available table in EHST TAP service

query_criteria(*[, calibration_level, ...])

Launches a synchronous or asynchronous job to query the HST tap using calibration level, data product type, intent, collection, instrument name, and filters as criteria to create and execute the associated query.

query_hst_tap(query, *[, async_job, ...])

Deprecated since version 0.4.7.

query_metadata(*[, output_format, verbose])

query_tap(query, *[, async_job, ...])

Launches a synchronous or asynchronous job to query the HST tap

query_target(name, *[, filename, ...])

It executes a query over EHST and download the xml with the results.

Attributes Documentation

TIMEOUT = 60
calibration_levels = {'AUXILIARY': 0, 'CALIBRATED': 2, 'PRODUCT': 3, 'RAW': 1}
copying_string = 'Copying file to {0}...'
product_types = ['SCIENCE', 'PREVIEW', 'THUMBNAIL', 'AUXILIARY']

Methods Documentation

To execute a cone search defined by a coordinate and a radius

Parameters:
coordinatesastropy.coordinate, mandatory

coordinates of the center in the cone search

radiusfloat or quantity

radius in arcmin (int, float) or quantity of the cone_search

filenamestr, default None

Path and name of the file to store the results. If the filename is defined, the file will be automatically saved

output_formatstring

results format. Options are: ‘votable’: str, binary VOTable format ‘csv’: str, comma-separated values format

async_jobbool, optional, default ‘False’

executes the query (job) in asynchronous/synchronous mode (default synchronous)

cachebool

optional, default ‘True’ Flag to save the results in the local cache

verbosebool, optional, default ‘False’

flag to display information about the process

Returns:
astropy.table.Table with the result of the cone_search
cone_search_criteria(radius, *, target=None, coordinates=None, calibration_level=None, data_product_type=None, intent=None, obs_collection=None, instrument_name=None, filters=None, proposal=None, async_job=True, filename=None, output_format='votable', save=False, cache=True, verbose=False)[source]

To execute a cone search defined by a coordinate (an astropy.coordinate element or a target name which is resolved), a radius and a set of criteria to filter the results. This function comprises the outputs of query_target, cone_search and query_criteria methods.

Parameters:
radiusfloat or quantity

radius in arcmin (int, float) or quantity of the cone_search

targetstr, mandatory if no coordinates is provided

name of the target, that will act as center in the cone search

coordinatesastropy.coordinate, mandatory if no target is provided

coordinates of the center in the cone search

calibration_levelstr or int, optional

The identifier of the data reduction/processing applied to the data. RAW (1), CALIBRATED (2), PRODUCT (3) or AUXILIARY (0)

data_product_typestr, optional

High level description of the product. image, spectrum or timeseries.

intentstr, optional

The intent of the original observer in acquiring this observation. SCIENCE or CALIBRATION

collectionlist of str, optional

List of collections that are available in eHST catalogue. HLA, HST

instrument_namelist of str, optional

Name(s) of the instrument(s) used to generate the dataset

filterslist of str, optional

Name(s) of the filter(s) used to generate the dataset

proposalint, optional

Proposal ID associated to the observations

async_jobbool, optional, default ‘False’

executes the query (job) in asynchronous/synchronous mode (default synchronous)

filenamestr, default None

Path and name of the file to store the results. If the filename is defined, the file will be automatically saved

output_formatstring

results format. Options are: ‘votable’: str, binary VOTable format ‘csv’: str, comma-separated values format

savebool

optional, default ‘False’ Flag to save the result in a file. If the filename is not defined, it will use a formatted name to save the file

cachebool

optional, default ‘True’ Flag to save the results in the local cache

verbosebool, optional, default ‘False’

flag to display information about the process

Returns:
astropy.table.Table with the result of the cone_search
download_file(file, *, filename=None, folder=None, verbose=False)[source]

Download a file from eHST based on its filename.

Parameters:
filestring

file name of the artifact to be downloaded

filenamestring

file name to be used to store the file, optional, default None

folderstring

optional, default current path Local folder to store the file

verbosebool

optional, default ‘False’ flag to display information about the process

Returns:
None. The file is associated
download_files_from_program(program, *, folder=None, calibration_level=None, data_product_type=None, intent=None, obs_collection=None, instrument_name=None, filters=None, only_fits=False)[source]

Download artifacts from EHST. Artifact is a single Hubble product file.

Parameters:
programint

Program or Proposal ID associated to the observations

folderstring

optional, default current path Local folder to store the file

calibration_levelstr or int, optional

The identifier of the data reduction/processing applied to the data. RAW (1), CALIBRATED (2), PRODUCT (3) or AUXILIARY (0)

data_product_typestr, optional

High level description of the product. image, spectrum or timeseries.

intentstr, optional

The intent of the original observer in acquiring this observation. SCIENCE or CALIBRATION

obs_collectionlist of str, optional

List of collections that are available in eHST catalogue. HLA, HST, HAP

instrument_namestr or list of str, optional

Name(s) of the instrument(s) used to generate the dataset

filterslist of str, optional

Name(s) of the filter(s) used to generate the dataset

only_fitsbool

optional, default ‘False’ flag to download only FITS files

Returns:
None. It downloads the artifact indicated
download_fits_files(observation_id, *, folder=None, verbose=False)[source]

Retrieves all the FITS files associated to an observation

Parameters:
observation_idstring or list of strings

id of the observation to be downloaded, mandatory The identifier of the observation we want to retrieve, regardless of whether it is simple or composite.

folderstring

optional, default current path Local folder to store the file

verbosebool

optional, default ‘False’ flag to display information about the process

Returns:
None. The file is associated
download_product(observation_id, *, calibration_level=None, filename=None, folder=None, verbose=False, product_type=None)[source]

Download products from EHST based on their observation ID and the calibration level or the product type.

Parameters:
observation_idstring

id of the observation to be downloaded, mandatory The identifier of the observation we want to retrieve, regardless of whether it is simple or composite.

calibration_levelstring

calibration level, optional The identifier of the data reduction/processing applied to the data. By default, the most scientifically relevant level will be chosen. RAW, CALIBRATED, PRODUCT or AUXILIARY

filenamestring

File name to be used to store the artifact, optional, default None

folderstring

optional, default current folder Local folder to store the file

verbosebool

optional, default ‘False’ flag to display information about the process

product_typestring

type of product retrieval, optional SCIENCE, PREVIEW, THUMBNAIL or AUXILIARY ———— Deprecation Warning: PRODUCT, SCIENCE_PRODUCT or POSTCARD are no longer supported. ————

Returns:
None. It downloads the observation indicated
get_artifact(artifact_id, *, filename=None, folder=None, verbose=False)[source]

Download artifacts from EHST. Artifact is a single Hubble product file.

Parameters:
artifact_idstring

filename to be downloaded, mandatory The identifier of the physical product (file) we want to retrieve.

filenamestring

file name to be used to store the artifact, optional, default None File name for the artifact

folderstring

optional, default current path Local folder to store the file

verbosebool

optional, default ‘False’ flag to display information about the process

Returns:
None. It downloads the artifact indicated
get_associated_files(observation_id, *, verbose=False)[source]

Retrieves all the files associated to an observation

Parameters:
observation_idstring or list of strings

id(s) of the observation(s) to be downloaded, mandatory The identifier of the observation we want to retrieve, regardless of whether it is simple or composite.

verbosebool

optional, default ‘False’ flag to display information about the process

Returns:
None. The file is associated
get_columns(table_name, *, only_names=True, verbose=False)[source]

Get the available columns for a table in EHST TAP service

Parameters:
table_namestring, mandatory, default None

table name of which, columns will be returned

only_namesbool, TAP+ only, optional, default ‘False’

True to load table names only

verbosebool, optional, default ‘False’

flag to display information about the process

Returns:
A list of columns

Returns the related members of hap and hst observations

Parameters:
observation_idstring

id of the observation to be downloaded, mandatory The identifier of the observation we want to retrieve, regardless of whether it is simple or composite.

Returns:
A list of strings with the observation_id of the associated
observations
get_member_observations(observation_id)[source]

Returns the related members of simple and composite observations

Parameters:
observation_idstr

Observation identifier.

Returns:
A list of strings with the observation_id of the associated
observations
get_observation_type(observation_id)[source]

Returns the type of an observation

Parameters:
observation_idstring

id of the observation to be downloaded, mandatory The identifier of the observation we want to retrieve, regardless of whether it is simple or composite.

Returns:
String with the observation type
get_observations_from_program(program, *, output_file=None, output_format='votable', verbose=False)[source]

Retrieves all the observations associated to a program/proposal ID

Parameters:
programint

Program or Proposal ID associated to the observations

output_filestring

optional, default None file name to be used to store the result

output_formatstring

results format. Options are: ‘votable’: str, binary VOTable format ‘csv’: str, comma-separated values format

verbosebool

optional, default ‘False’ flag to display information about the process

Returns:
A table object
get_postcard(observation_id, *, calibration_level='RAW', resolution=256, filename=None, verbose=False)[source]

Download postcards from EHST

Parameters:
observation_idstring

id of the observation for which download the postcard, mandatory The identifier of the observation we want to retrieve, regardless of whether it is simple or composite.

calibration_levelstring

calibration level, optional, default ‘RAW’ The identifier of the data reduction/processing applied to the data. By default, the most scientifically relevant level will be chosen. RAW, CALIBRATED, PRODUCT or AUXILIARY

resolutioninteger

postcard resolution, optional, default 256 Resolution of the retrieved postcard. 256 or 1024

filenamestring

file name to be used to store the postcard, optional, default None File name for the artifact

verbosebool

optional, default ‘False’ Flag to display information about the process

Returns:
None. It downloads the observation postcard indicated
get_status_messages()[source]

Retrieve the messages to inform users about the status of eHST TAP

get_tables(*, only_names=True, verbose=False)[source]

Get the available table in EHST TAP service

Parameters:
only_namesbool, TAP+ only, optional, default ‘False’

True to load table names only

verbosebool, optional, default ‘False’

flag to display information about the process

Returns:
A list of tables
query_criteria(*, calibration_level=None, data_product_type=None, intent=None, obs_collection=None, instrument_name=None, filters=None, proposal=None, async_job=True, output_file=None, output_format='votable', verbose=False, get_query=False)[source]

Launches a synchronous or asynchronous job to query the HST tap using calibration level, data product type, intent, collection, instrument name, and filters as criteria to create and execute the associated query.

Parameters:
calibration_levelstr or int, optional

The identifier of the data reduction/processing applied to the data. RAW (1), CALIBRATED (2), PRODUCT (3) or AUXILIARY (0)

data_product_typestr, optional

High level description of the product. image, spectrum or timeseries.

intentstr, optional

The intent of the original observer in acquiring this observation. SCIENCE or CALIBRATION

obs_collectionlist of str, optional

List of collections that are available in eHST catalogue. HLA, HST, HAP

instrument_namestr or list of str, optional

Name(s) of the instrument(s) used to generate the dataset

filterslist of str, optional

Name(s) of the filter(s) used to generate the dataset

proposalint, optional

Proposal ID associated to the observations

async_jobbool, optional, default ‘True’

executes the query (job) in asynchronous/synchronous mode (default synchronous)

output_filestr, optional, default None

file name where the results are saved if dumpToFile is True. If this parameter is not provided, the jobid is used instead

output_formatstr, optional, default ‘votable’

results format

verbosebool, optional, default ‘False’

flag to display information about the process

get_querybool, optional, default ‘False’

flag to return the query associated to the criteria as the result of this function.

Returns:
A table object
query_hst_tap(query, *, async_job=False, output_file=None, output_format='votable', verbose=False)[source]

Deprecated since version 0.4.7: The query_hst_tap function is deprecated and may be removed in a future version. Use query_tap instead.

Launches a synchronous or asynchronous job to query the HST 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 dumpToFile is True. If this parameter is not provided, the jobid is used instead

output_formatstr, optional, default ‘votable’

results format

verbosebool, optional, default ‘False’

flag to display information about the process

Returns:
A table object
query_metadata(*, output_format='votable', verbose=False)[source]
query_tap(query, *, async_job=False, output_file=None, output_format='votable', verbose=False)[source]

Launches a synchronous or asynchronous job to query the HST 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 dumpToFile is True. If this parameter is not provided, the jobid is used instead

output_formatstr, optional, default ‘votable’

results format

verbosebool, optional, default ‘False’

flag to display information about the process

Returns:
A table object
query_target(name, *, filename=None, output_format='votable', verbose=False, async_job=False, radius=7)[source]

It executes a query over EHST and download the xml with the results.

Parameters:
namestring

target name to be requested, mandatory

filenamestring

file name to be used to store the metadata, optional, default None

output_formatstring

optional, default ‘votable’ output format of the query

verbosebool

optional, default ‘False’ Flag to display information about the process

async_jobbool, optional, default ‘False’

executes the query (job) in asynchronous/synchronous mode (default synchronous)

radiusint

optional, default 7 radius in arcmin (int, float) or quantity of the cone_search

Returns:
Table with the result of the query. It downloads metadata as a file.