README.md 1.79 KB
Newer Older
Vincent Michel's avatar
Vincent Michel committed
1 2 3 4
python-handel
=============

A python binding for the [handel](http://support.xia.com/default.asp?W381) library.
Vincent Michel's avatar
Vincent Michel committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


System requirements
-------------------

The handel DLL files need to be available in `PATH` (`/usr/local/bin` in Cygwin for instance).

Python compatibility:

- python 2.7
- python 3.6


Python requirements
-------------------

Run requirements:

- cffi
- numpy
Vincent Michel's avatar
Vincent Michel committed
25
- gevent (optional)
Vincent Michel's avatar
Vincent Michel committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

Test requirements:

- mock
- pytest
- pytest-cov

Those requirements are automatically handled by `setuptools`.


Installation
------------

Run:

``` console
$ python setup.py install
```

Usage
-----

Example usage:

``` python
>>> from handel.interface import *
>>> init('xmap.ini')
>>> start_system()
>>> get_detectors()
['detector1']
>>> get_modules()
['module1']
>>> get_module_type('module1')
'mercury'
>>> get_channels()
(0,)
>>> start_run(0)
>>> stop_run(0)
>>> get_run_data(0)
array([13260, 52275,   256, ...,     0,     0,     0], dtype=uint32)
```

Vincent Michel's avatar
Vincent Michel committed
68 69 70 71 72 73 74 75 76 77
Gevent mode
-----------

Make the interface gevent-compatible using:

``` python
>>> from handel.gevent import patch
>>> patch()
```

Vincent Michel's avatar
Vincent Michel committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

Tests
-----

Run:

``` console
$ python setup.py test
```

This also publishes an HTML coverage report in the `htmlcov` directory.


Continuous intergration
-----------------------

This project is automatically tested using Gitlab CI.

The tests are run for python 2.7 and 3.6

The coverage report are published [here](http://bliss.gitlab-pages.esrf.fr/python-handel/).


Vincent Michel's avatar
Vincent Michel committed
101 102 103 104 105
Scripts
-------

A few scripts are provided:

Vincent Michel's avatar
Vincent Michel committed
106
- `parse_error_header.py` which parses `handel_errors.h` and output a python dictionnary of handel errors
Vincent Michel's avatar
Vincent Michel committed
107

Vincent Michel's avatar
Vincent Michel committed
108
- `handel-server` which serves the handel interface over the network using zerorpc. It requires:
Vincent Michel's avatar
Vincent Michel committed
109 110 111 112 113 114
  * python3
  * handel
  * zerorpc
  * msgpack_numpy


Vincent Michel's avatar
Vincent Michel committed
115 116 117 118
Contact
-------

Vincent Michel - vincent.michel@esrf.fr