The ESOAsg API reference

ESOAsg

The archive_catalogues module

The archive_observations module

The archive_science_portal module

ESOAsg.archive_science_portal.query_from_polygons(polygons=None, instruments=None, data_types=None, open_link=False, show_link=False)[source]

Query the ESO ASP service given a polygon

The polygons value (or list) needs to be given as a string defining the location in the sky of the polygon with RA, Dec, separated by commas and with the first RA, Dec pair that matches the last one (to close the polygon)

Parameters
  • polygons (list) – list of str (or single str) containing the coordinates of the polygon in the sky you want to query

  • instruments (list) – list of str (or single str) containing the instruments used to limit the search

  • data_types (list) – list of str (or single str) containing the data types used to limit the search

  • open_link (bool) – open a link to the ASP page

  • show_link (bool) – show the link on the terminal

Returns

None

ESOAsg.archive_science_portal.query_from_radec(positions, radius=None, instruments=None, data_types=None, open_link=False, show_link=False)[source]

Query the ESO ASP service given a position

The positions value (or list) needs to be given as an astropy.coordinates.SkyCoord object. For further detail see here: astropy coordinates

Parameters
  • positions (astropy.coordinates.SkyCoord) – coordinates (or list of coordinates) of the sky you want to query

  • radius (float) – search radius in arcseconds

  • instruments (list) – list of str (or single str) containing the instruments used to limit the search

  • data_types (list) – list of str (or single str) containing the data types used to limit the search

  • open_link (bool) – open a link to the ASP page

  • show_link (bool) – show the link on the terminal

Returns

None

ESOAsg.queries

The query.Query class

The query_catalogues.ESOCatalogues class

The query_observations.ESOObservations class

ESOAsg.core

The tap_queries module

The asp_queries module

Module to create and run ASP queries

The ESO Archive Science Portal (ASP) allows browsing and exploration of archive content using an intuitive interactive user interface that supports iterative queries

ESOAsg.core.asp_queries.base_url()[source]

Return the url for ASP

Returns

url

Return type

str

ESOAsg.core.asp_queries.condition_data_types(data_types, connector=None)[source]

Return condition for data types

Parameters
  • data_types (list) – limit the search to the selected list of dataproduct types (e.g., spectrum)

  • connector (str, optional) – connector to be put in front of the the condition (e.g., ‘&’)

Returns

string containing the dp_type= condition for ASP

Return type

str

ESOAsg.core.asp_queries.condition_instruments(instruments, connector=None)[source]

Return condition for instruments

Parameters
  • instruments (list) – limit the search to the selected list of instruments (e.g., XSHOOTER)

  • connector (str, optional) – connector to be put in front of the the condition (e.g., ‘&’)

Returns

string containing the ins_id= condition for ASP

Return type

str

ESOAsg.core.asp_queries.condition_polygon(polygon, connector=None)[source]

Return condition for polygon

Parameters
  • polygon (any) – string containing the RA and Dec vertices (in degrees) of the polygon

  • connector (str, optional) – connector to be put in front of the the condition (e.g., ‘&’)

Returns

string containing the poly= condition for ASP

Return type

str

ESOAsg.core.asp_queries.condition_position(ra, dec, radius=None, connector=None)[source]

Return condition for position

Parameters
  • ra (any) – string containing the RA of the source in degree

  • dec (any) – string containing the Dec of the source in degree

  • radius (any) – string containing the search radius in arcseconds

  • connector (str, optional) – connector to be put in front of the the condition (e.g., ‘&’)

Returns

string containing the pos= condition for ASP

Return type

str

ESOAsg.core.asp_queries.condition_radius(radius, connector=None)[source]

Return condition for radius

Parameters
  • radius (any) – string containing the search radius in arcseconds

  • connector (str, optional) – connector to be put in front of the the condition (e.g., ‘&’)

Returns

string containing the r= condition for ASP

Return type

str

ESOAsg.core.asp_queries.run_query(query_url, show_link=True, open_link=True)[source]

Run the ASP query

Parameters
  • query_url (str) – url of the ASP query

  • open_link (bool) – open a link to the ASP page

  • show_link (bool) – show the link on the terminal

Returns

None

ESOAsg.core.asp_queries.sort_by(sort_type='-obs_date', connector=None)[source]

Sort the ASP query for a specific keyword

Parameters
  • sort_type (str) – value for which sort the ASP query

  • connector (str, optional) – connector to be put in front of the the condition (e.g., ‘&’)

Returns

string that defines the sort type in a ASP query

Return type

str

ESOAsg.datacontainers

eso_prodcatg

Class that defines the properties of an ESO PRODCATG

The current implementation follows the ESO Science Data Products Standard Version 6. More information in the Document ESO-044286.

class ESOAsg.datacontainers.eso_prodcatg.ProdCatg(prodcatg_type=None)[source]

Class that defines the data product categories of the ESO Archive

Parameters

prodcatg_type (str) – Name of the data product category

Raises
  • TypeError – if prodcatg is not a str

  • ValueError – if prodcatg is not a valid category accordingly to the ESO standard

data_format()[source]

Returns a string describing the data format associated to the prodcatg.

Returns

string containing the general description of the data format of the given prodcatg.

Return type

str

property descriptor

Dictionary that dictates the property of a prodcatg

get_header_keyword_dictionary(header_keyword)[source]
Parameters

header_keyword

Returns:

property header_keywords

Dictionary that dictates the property of the header keywords of a prodcatg

property prodcatg

Name of the prodcatg.

This set also the descriptor dictionary containing the relevant properties of the prodcatg.

show_header_keywords_info(header_keyword)[source]

Given the name of a header keywords, the method prints its status for the assigned prodcatg

Parameters

header_keyword (list) –

science_cube_ifs

Class to work on SCIENCE.CUBE.IFS

class ESOAsg.datacontainers.science_cube_ifs.ScienceCubeIfs(primary_header=None, scidata_hdu=None, errdata_hdu=None, qualdata_hdu=None, others_hdu=None)[source]

A class used to define and make simple operations on data of type PRODCATG=`SCIENCE.CUBE.IFS`

This is a child of ESOAsg.datacontainers.DataContainer.

Please refer to the ESO Science Data Products Standard for a full description of the format.

Attributes:

Methods:

ESOASG.ancillary

checks

Module that performs some useful and basic checks and transformations

ESOAsg.ancillary.checks.check_checksums(hdul)bool[source]

Test if the datasum and checksum keywords in a HDUList are present and up-to-date

Parameters

hdul (astropy.io.fits.hdu.hdulist.HDUList) – list of astropy HDUs to be checked

Returns

True all the HDUs in the input HDUL have the correct datasum and checksum

Return type

bool

ESOAsg.ancillary.checks.check_disk_space(min_disk_space=6.0)bool[source]

Check that there is enough space on the location where the code is running

Given a disk space limit in GB, the macro returns True if the disk where the code is running has more free GB than the given limit.

Warning

The current implementation checks the disk where the code is running (i.e., from the directory: ./). This may cause some troubles with shared disks.

Parameters

min_disk_space (float) – Size of free space on disk required

Returns

True if there is enough space on disk

Return type

bool

ESOAsg.ancillary.checks.connection_to_website(url, timeout=1.0)bool[source]

Check there is an active connection to a website

Parameters
  • url (str) – link to the website you want to check

  • timeout (float) – timeout waiting for the website to respond

Returns

True if there is an active connection, False and error raised if not.

Return type

bool

ESOAsg.ancillary.checks.fits_file_is_valid(fits_file, verify_fits=False, overwrite=False)bool[source]

Check if a file exists and has a valid extension

The option verify_fits checks the header of the fits file using astropy.io.fits.verify

Parameters
  • fits_file (str) – fits file you would like to check

  • verify_fits (bool) – if set to True, it will verify that the fits file is complaint to the FITS standard.

  • overwrite (bool) – if True, overwrite the input fits file with the header corrections from verify_fits

Returns

True if exists False and warning raised if not.

Return type

bool

ESOAsg.ancillary.checks.header_is_valid(header)[source]

Check if an header is valid

ESOAsg.ancillary.checks.image2d_is_valid(image2d)bool[source]

Check if a 2D image is valid

Parameters

(obj (image2d) – numpy.ndarray): image that you would like to check

Returns

True if a valid 2D image False and error raised if not.

Return type

bool

ESOAsg.ancillary.checks.table_is_valid(table)[source]

Check if a table is valid

Parameters

table (fits.BinTableHDU or fits.TableHDU) – table that you would like to check

Returns

True if a valid table format False and error raised if not.

Return type

is_table (boolean)