EngdbMast

class romancal.lib.engdb.engdb_mast.EngdbMast(eng_base_url=None, token=None, **service_kwargs)[source]

Bases: EngdbABC

Access the Roman Engineering Database through MAST.

Parameters:
  • eng_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

endtime

The end time of the last query.

eng_base_url

The base URL for the engineering service.

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

configure([eng_base_url, token])

Configure from parameters and environment.

get_meta([search])

Get the mnemonics meta info.

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

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

set_session()

Set up HTTP session.

Attributes Documentation

endtime = None

The end time of the last query.

eng_base_url = None

The base URL for the engineering service.

response = None

The results of the last query.

retries = 1

Number of retries to attempt to contact the service

starttime = None

The start time of the last query.

timeout = 30

Network timeout when communicating with the service

token = None

MAST Token

Methods Documentation

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

Configure from parameters and environment.

Parameters:
  • eng_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(search=None)[source]

Get the mnemonics meta info.

Parameters:

search (str or None) – A partial, or full, mnemonic specification. If None, meta for all available mnemonics are returned

Returns:

meta – The meta information

Return type:

???

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]

Set up HTTP session.