Skip to main content

Tools to query Archiver Appliance and export data

Project description

Client for EPICS Archive Appliance

Utilities for interacting with an EPICS Archiver Appliance server.

With the exception of aaget --how plot ... PV name strings are passed through verbatim, and may include AA binning operators. See the Processing of data section for a list.

For fidelity, data is retrieved in the binary protobuf encoding native to AA.

Intended to supplant https://github.com/epicsdeb/carchivetools

Building

Dependencies from the python ecosystem (eg. pip)

  • python >= 3.7
  • aiohttp >= 3.7.0 (and perhaps earlier)
  • numpy >= 1.7
  • Cython >= 0.20
  • setuptools >= 40.9.0
  • h5py (optional)

Dependencies from outside the python ecosystem (eg. rpm, deb, etc.)

  • Working C++11 toolchain
  • protobuf compiler
  • protobuf-lite library and headers for >= 3.0
apt-get install protobuf-compiler libprotobuf-dev

yum install protobuf-compiler libprotobuf-devel

dnf install protobuf-compiler libprotobuf-devel

brew install protobuf

(Getting protobuf on windows is difficult... See for an example using vcpkg.)

Build and install with pip

virtualenv aa
. aa/bin/activate
pip install -U pip
pip install Cython
./setup.py sdist
pip install dist/aaclient-*.tar.gz
aaget -h

Alternately, for in-place usage (eg. evaluation or troubleshooting).

./setup.py build_ext -i
python -m aaclient.cmd.get -h

In either case a configuration file is required.

cp aaclient.conf.example aaclient.conf
# edit aaclient.conf and fill in at least "host="

Command Line Interface

This package provides several CLI tools for interacting with an Archiver Appliance server.

See the example configuration file.

aagrep Searching for PVs

Running aagrep without arguments will attempt to print a full list of PV names being archived. Otherwise query patterns (wildcard or regexp) will be applied. If multiple patterns are provided, the output will be all PV names which matched any pattern.

$ aagrep RH
CO2:RH-I

aaget Printing data

Query data from a set of PV names for a certain time range and print the results.

$ aaget --start='-1 h' --end=now CO2:RH-I
01-30 07:50:11.958813 CO2:RH-I 45.10040283203125
01-30 08:13:04.816086 CO2:RH-I 44.56939697265625
01-30 08:40:41.527406 CO2:RH-I 44.06585693359375

aah5 Extract to HDF5 file

Queries like aaget, with results written to a HDF5 file instead of being printed to screen.

$ aah5 --start='-1 h' --end=now out.h5 CO2:RH-I
INFO:__main__:'CO2:RH-I' : (3, 1)
$ h5ls -r out.h5 
/                        Group
/CO2:RH-I                Group
/CO2:RH-I/meta           Dataset {3/Inf}
/CO2:RH-I/value          Dataset {3/Inf, 1/Inf}

Alternate entry points.

  • aaget -> python -m aaclient.cmd.get
  • aagrep -> python -m aaclient.cmd.grep
  • aah5 -> python -m aaclient.cmd.h5

API

The API behind the CLI executables is (primarily) asyncio based.

import asyncio
from aaclient import getArchive

async def demo():
    A= await getArchive()

    V,M = await A.raw('CO2:CO2-I', T0='-12 h')
    print(V.shape, M.shape)

asyncio.run(demo())

The entry point for API usage is aaclient.getArchive(), which returns an object inheriting from aaclient.IArchive.

Streaming

The aaclient.IArchive.raw_iter() method allows for incremental retrieval of arbitrarily large data for long time range. Async. iteration will yield samples in batches.

Blocking API

A blocking (threaded) API is also provided as a convenience for interactive usage.

from matplotlib.pyplot import *
from aaclient.threading import getArchive
A=getArchive()

# Request ~1000 points of "caplotbinning" data
# suitable for quick/efficient visualization of a
# long time range
V,M = A.plot('CO2:CO2-I', T0='-7 d', count=1000)

figure()
plot_date(M.time_mpl, V[:,0], '-')
grid(True)

# Request complete (raw) data for a (shorter)
# time range
figure()
V,M = A.raw('CO2:CO2-I', T0='-12 h')
plot_date(M.time_mpl, V[:,0], '-')
grid(True)

show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aaclient-0.0.2.tar.gz (101.6 kB view hashes)

Uploaded Source

Built Distributions

aaclient-0.0.2-cp310-cp310-win_amd64.whl (280.8 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

aaclient-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (257.2 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

aaclient-0.0.2-cp310-cp310-macosx_10_9_x86_64.whl (323.0 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

aaclient-0.0.2-cp39-cp39-win_amd64.whl (280.8 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

aaclient-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (257.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

aaclient-0.0.2-cp39-cp39-macosx_10_9_x86_64.whl (323.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

aaclient-0.0.2-cp38-cp38-win_amd64.whl (280.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

aaclient-0.0.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (257.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

aaclient-0.0.2-cp38-cp38-macosx_10_9_x86_64.whl (322.7 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

aaclient-0.0.2-cp37-cp37m-win_amd64.whl (280.3 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

aaclient-0.0.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (255.7 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

aaclient-0.0.2-cp37-cp37m-macosx_10_9_x86_64.whl (323.3 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page