Skip to main content

ALBA Eiger simulator

Project description

Eiger simulator

Pypi python versions Pypi version License

Dectris Eiger detector simulator.

For now simulates Eiger 9M at full ROI in internal trigger single mode (ints).

Complete HTTP REST API + ZMQ data stream.

Installation

From within your favorite python environment:

$ pip install -e eiger-simulator

If you need the client library, you need in addition:

$ pip install -e eiger-simulator[client]

Usage

Run simulator with:

$ eiger-simulator --dataset=<path to the HDF5 master file> --max-memory=1_000_000_000

This will start a simulator listening to the HTTP interface on port 8000 and the ZMQ streaming socket on TCP port 9999

Run with --help to see the complete list of options

$ eiger-simulator --help
Usage: eiger-simulator [OPTIONS]

Options:
  --host TEXT                     Bind web socket to this host.  [default: 0]
  --port INTEGER                  Bind web socket to this port.  [default: 8000]
  --zmq TEXT                      Bind ZMQ socket  [default: tcp://*:9999]
  --dataset PATH                  dataset path or file
  --max-memory INTEGER            max memory (bytes)  [default: 1000000000]
  --log-level [critical|error|warning|info|debug|trace]
                                  Show only logs with priority LEVEL or above
                                  [default: info]
  --help                          Show this message and exit.

Client

The client is accessible as a python library:

>>> from import eigersim.client import Eiger
>>> eiger = Eiger('127.0.0.1:8000')
>>> eiger.nimages
100
>>> eiger.count_time
0.1
>>> eiger.trigger_mode
'ints'
>>> eiger.arm()
[response 200]
>>> eiger.trigger()
[response 200]

Note that you should be able to use the client to connect to a real Eiger detector, not just the simulated one.

For reference, here is a simple client that listens to the ZMQ stream:

>>> import zmq
>>> ctx = zmq.Context()
>>> sock = ctx.socket(zmq.PULL)
>>> sock.connect('tcp://127.0.0.1:9999')
>>> while True:
      data = sock.recv_multipart()
      size = sum(len(i) for i in data)
      print(f'packet #parts={len(data)} size={size/1000} KB')

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

eiger-simulator-0.2.0.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file eiger-simulator-0.2.0.tar.gz.

File metadata

  • Download URL: eiger-simulator-0.2.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.5

File hashes

Hashes for eiger-simulator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6ef1abf6c0df3e157f8fb8e9f0b4375b51d4d381150056107ffe0b118a20ff5f
MD5 b3985f60a36f359a3451acfded139ffc
BLAKE2b-256 ccd55ef8743025515d75fdaaefa62538cd7c7c6b7bb72a6671c8d1e8cd625227

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