epicsarchiver.retrieval.archiver_retrieval.archiver_retrieval

Archiver Retrieval methods.

Attributes

LOG

ENDPOINT_GET_DATA

ENDPOINT_GET_MATCHING_PVS

Classes

ArchiverRetrieval

Retrieval EPICS Archiver Appliance client.

Functions

json_to_dataframe(→ pandas.DataFrame)

Converts json from the archiver.

Module Contents

epicsarchiver.retrieval.archiver_retrieval.archiver_retrieval.LOG: logging.Logger[source]
epicsarchiver.retrieval.archiver_retrieval.archiver_retrieval.ENDPOINT_GET_DATA = '/data/getData.raw'[source]
epicsarchiver.retrieval.archiver_retrieval.archiver_retrieval.ENDPOINT_GET_MATCHING_PVS = '/bpl/getMatchingPVs'[source]
epicsarchiver.retrieval.archiver_retrieval.archiver_retrieval.json_to_dataframe(data: Any) pandas.DataFrame[source]

Converts json from the archiver.

Converts to a dataframe with two columns “date” and “val” and the index is “date”.

Parameters:

data – json from a json archiver request

Returns:

pd.DataFrame

class epicsarchiver.retrieval.archiver_retrieval.archiver_retrieval.ArchiverRetrieval(hostname: str = 'localhost', port: int = 17665)[source]

Bases: epicsarchiver.common.base_archiver.BaseArchiverAppliance

Retrieval EPICS Archiver Appliance client.

Hold a session to the Retrieval Archiver Appliance web application.

Parameters:
  • hostname – EPICS Archiver Appliance hostname [default: localhost]

  • port – EPICS Archiver Appliance management port [default: 17665]

Examples:

from epicsarchiver.archiver.retrieval import ArchiverRetrieval

archappl = ArchiverRetrieval("archiver-01.tn.esss.lu.se")
print(archappl.version)
df = archappl.get_data("my:pv", start="2018-07-04 13:00", end=datetime.utcnow())
_data_retrieval_url[source]
data_url: str[source]
matching_pvs_url: str[source]
_get_data_raw(pv: str, start: datetime.datetime, end: datetime.datetime) requests.Response[source]

Retrieve archived data.

Parameters:
  • pv – name of the pv.

  • start – start time. Can be a string or datetime.datetime object.

  • end – end time. Can be a string or datetime.datetime object.

Returns:

Response

_get_matching_pvs(query: str, limit: int) list[str][source]

Retrieve list of matching pv names for given regex search string.

Parameters:
  • query (str) – A regex search string.

  • limit (int) – Limit of PV names to return.

Returns:

List of pv names

Return type:

list[str]

_check_for_pvs_in_time_range(query: list[str], start: datetime.datetime | None = None, end: datetime.datetime | None = None) list[str][source]

Check if data recorded during the given time range for each PV in list.

If both start and end given, return only PVs which recorded data during that time range.

If start given and end not, return PVs which recorded data between start and now.

If end given and start not, return PVs which recorded any data before end.

Parameters:
Returns:

List of PV names found.

Return type:

list[str]

get_events(pv: str, start: datetime.datetime, end: datetime.datetime, processor: epicsarchiver.retrieval.archiver_retrieval.processor.Processor | None = None) list[epicsarchiver.retrieval.archive_event.ArchiveEvent][source]

Retrieve archived data.

Parameters:
  • pv – name of the pv.

  • start – start time. Can be a string or datetime.datetime object.

  • end – end time. Can be a string or datetime.datetime object.

  • processor (Processor | None, optional) – Preprocessor to use. Defaults to None.

Returns:

requested events from the archiver.

Return type:

list[ArchiveEvent]

get_data(pv: str, start: str | datetime.datetime, end: str | datetime.datetime, processor: epicsarchiver.retrieval.archiver_retrieval.processor.Processor | None = None) pandas.DataFrame[source]

Retrieve archived data.

Parameters:
  • pv – name of the pv.

  • start – start time. Can be a string or datetime.datetime object.

  • end – end time. Can be a string or datetime.datetime object.

  • processor (Processor | None, optional) – Preprocessor to use. Defaults to None.

Returns:

pandas.DataFrame

search(query: str, *, start: datetime.datetime | None = None, end: datetime.datetime | None = None, limit: int = 500) list[str][source]

Search for names of PVs matching the given regex search string.

Optionally specify start and/or end times to only return PVs that recorded data in the specified time range.

Parameters:
  • query (str) – A regex search string.

  • start (datetime.datetime | None) – Start time of the time period.

  • end (datetime.datetime | None) – End time of the time period.

  • limit (int) – Limit of PV names to return for each search string given. To get all the PV names, (potentially in the millions), set limit to -1. [default: 500]

Returns:

List of PV names found.

Return type:

list[str]