EngdbMast

class jwst.lib.engdb_mast.EngdbMast(base_url=None, token=None, **service_kwargs)[source]

Bases: EngdbABC

Access the JWST Engineering Database through MAST

Parameters:
  • base_url (str) – The base url for the engineering RESTful service. If not defined, the environmental variable ENG_BASE_URL is queried. Otherwise the default MAST website is used.

  • token (str or None) – The MAST access token. If not defined, the environmental variable MAST_API_TOKEN is queried. A token is required. For more information, see ‘https://auth.mast.stsci.edu/

  • service_kwargs (dict) – Service-specific keyword arguments that are not relevant to this implementation of EngdbABC.

Raises:

RuntimeError – Any and all failures with connecting with the MAST server.

Attributes Summary

base_url

The base URL for the engineering service.

endtime

The end time of the last query.

response

The results of the last query.

retries

Number of retries to attempt to contact the service

starttime

The start time of the last query.

timeout

Network timeout when communicating with the service

token

MAST Token

Methods Summary

cache(mnemonics, starttime, endtime, cache_path)

Cache results for the list of mnemonics

cache_as_local(mnemonics, starttime, ...)

Cache results for the list of mnemonics, but in the EngdbLocal format

configure([base_url, token])

Configure from parameters and environment

get_meta(*kwargs)

Get the mnemonics meta info

get_values(mnemonic, starttime, endtime[, ...])

Retrieve all results for a mnemonic in the requested time range.

set_session()

Setup HTTP session

Attributes Documentation

base_url = None

The base URL for the engineering service.

endtime = None

The end time of the last query.

response = None

The results of the last query.

retries = 10

Number of retries to attempt to contact the service

starttime = None

The start time of the last query.

timeout = 600

Network timeout when communicating with the service

token = None

MAST Token

Methods Documentation

cache(mnemonics, starttime, endtime, cache_path)[source]

Cache results for the list of mnemonics

Parameters:
  • mnemonics (iterable) – List of mnemonics to retrieve

  • starttime (str or astropy.time.Time) – The, inclusive, start time to retrieve from.

  • endtime (str or astropy.time.Time) – The, inclusive, end time to retrieve from.

  • cache_path (str or Path-like) – Path of the cache directory.

cache_as_local(mnemonics, starttime, endtime, cache_path)[source]

Cache results for the list of mnemonics, but in the EngdbLocal format

The target format is native to what the EngdbDirect service provides.

Parameters:
  • mnemonics (iterable) – List of mnemonics to retrieve

  • starttime (str or astropy.time.Time) – The, inclusive, start time to retrieve from.

  • endtime (str or astropy.time.Time) – The, inclusive, end time to retrieve from.

  • cache_path (str or Path-like) – Path of the cache directory.

configure(base_url=None, token=None)[source]

Configure from parameters and environment

Parameters:
  • base_url (str) – The base url for the engineering RESTful service. If not defined, the environmental variable ENG_BASE_URL is queried. Otherwise the default MAST website is used.

  • token (str or None) – The MAST access token. If not defined, the environmental variable MAST_API_TOKEN is queried. A token is required. For more information, see ‘https://auth.mast.stsci.edu/

get_meta(*kwargs)[source]

Get the mnemonics meta info

The MAST interface does not provide any meta.

get_values(mnemonic, starttime, endtime, time_format=None, include_obstime=False, include_bracket_values=False, zip_results=True)[source]

Retrieve all results for a mnemonic in the requested time range.

Parameters:
  • mnemonic (str) – The engineering mnemonic to retrieve

  • starttime (str or astropy.time.Time) – The, inclusive, start time to retrieve from.

  • endtime (str or astropy.time.Time) – The, inclusive, end time to retrieve from.

  • time_format (str) – The format of the input time used if the input times are strings. If None, a guess is made.

  • include_obstime (bool) – If True, the return values will include observation time as astropy.time.Time. See zip_results for further details.

  • include_bracket_values (bool) – The DB service, by default, returns the bracketing values outside of the requested time. If True, include these values.

  • zip_results (bool) – If True and include_obstime is True, the return values will be a list of 2-tuples. If false, the return will be a single 2-tuple, where each element is a list.

Returns:

values – Returns the list of values. See include_obstime and zip for modifications.

Return type:

[value, …] or [(obstime, value), …] or ([obstime,…], [value, …])

set_session()[source]

Setup HTTP session