Skip to main content

Python 3 tools to request data from the Karabo controlsystem.

Project description

https://travis-ci.org/European-XFEL/karabo-bridge-py.svg?branch=master https://codecov.io/gh/European-XFEL/karabo-bridge-py/branch/master/graph/badge.svg

karabo_bridge is a Python 3 client to receive pipeline data from the Karabo control system used at European XFEL. A simulated Karabo bridge server is included to allow testing code without a connection to a real Karabo server.

Installing

to install the package:

$ python3 -m pip install karabo-bridge

or

$ git clone https://github.com/European-XFEL/karabo-bridge-py.git
$ cd ./karabo-bridge-py
$ python3 -m pip install .

How to use

Request data from a karabo bridge server

Use the Client class from karabo_brige to create a client and the next method to request data from the server. The function returns 2 dictionaries: the first one holds a train data and the second one holds the associated train metadata. Both dictionaries are keyed by source name, and the values are dictionaries containing parameters name and values for data and metadata information (source name, timestamp, trainId) for the metadata. Values are all built-in python types, or numpy arrays.

>>> from karabo_bridge import Client
>>> krb_client = Client('tcp://server-host-name:12345')
>>> data, metadata = krb_client.next()
>>> data.keys()
dict_keys(['source1', 'source2', 'source3'])
>>> data['source1'].keys()
dict_keys(['param1', 'param2'])
>>> metadata['source1']
{'source1': {'source': 'source1',
  'timestamp': 1528476983.744877,
  'timestamp.frac': '744877000000000000',
  'timestamp.sec': '1528476983',
  'timestamp.tid': 10000000073}}

Use the Simulation server

To start a simulation, call the start_gen function and provide a port to bind to. You can the use the Client class and connect to it to test the client without the need to use Karabo.

>>> from karabo_bridge import start_gen
>>> start_gen(1234)
Server : emitted train: 10000000000
Server : emitted train: 10000000001
Server : emitted train: 10000000002
Server : emitted train: 10000000003
Server : emitted train: 10000000004
...

You can also run the simulated server from the command line:

$ karabo-bridge-server-sim 1234

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

karabo_bridge-0.4.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

karabo_bridge-0.4.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file karabo_bridge-0.4.0.tar.gz.

File metadata

  • Download URL: karabo_bridge-0.4.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4

File hashes

Hashes for karabo_bridge-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f8712d25496328428206ece86c8047972b0bd7d16ced010d09dae143428d2f45
MD5 d11881b901cbeeb54344b76a8ff4f37f
BLAKE2b-256 701ef2cf003b4e60d9da394f95f8e259fa7bad87dbc59bec394c99e04652125a

See more details on using hashes here.

File details

Details for the file karabo_bridge-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: karabo_bridge-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4

File hashes

Hashes for karabo_bridge-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e485bad51250eedca7ac1bde07d960713403a65261b44da7c7746a6ce25512f
MD5 a163ce76bc453a6a399f1bd52f3cb2df
BLAKE2b-256 cb7dca44f80a4d2ecaec01e19673424781265b90e416357b1e18cd57589f31b2

See more details on using hashes here.

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