Metadata-Version: 2.1
Name: jungfrau
Version: 1.1.0
Summary: A development library for the Jungfrau DCU.
Home-page: https://gitlab.maxiv.lu.se/kits-maxiv/lib-maxiv-jungfrau
Author: Mikel Eguiraun
Author-email: mikel.eguiraun@maxiv.lu.se
License: GPLv3
Platform: UNKNOWN
Provides-Extra: tests

# lib-maxiv-jungfrau



IN ESSENCE SAME AS THE EIGER LIB... BUT SMALL CHANGES HERE AND THERE. THEY SHOULD BE COMBINED IN THE FUTURE
I CREATED THIS REPO TO AVOID MESSING AROUND TOO MUCH ON THE EIGER LIBRARY.
NOTE THE INSTALLED PACKAGE IS "eiger"

This library implements a class which exposes methods and properties which are used to communicate with the Dectris Eiger.
Both Eiger1 API 1.6.0 (Balder XES and XRD) and Eiger2 API 1.8.0 (Nanomax and Cosaxs) are supported.

example usage:
```
endpoint = "http://localhost:19100"
api_version = "1.8.0"

# Instantiate an eiger instance using given configuration.
self.eiger = EigerDetector(
    urlparse(endpoint).hostname,
    urlparse(endpoint).hostname,
    urlparse(endpoint).port,
    api_version,
    urlparse(endpoint).port)

# Set a value.
self.eiger.frame_time = 0.001

# Execute a command.
self.eiger.trigger()
```

## Tests

**Run the test with simulator to check for proper handling of connection and timeout error.**
```make test-01-communication```

**Run the test with mocks to check for proper url and put-data creation, and proper parsing of response.**
```make test-02-communication```

## Deployment
In order to talk to the Eiger from programs on the command line, the proxy must be disabled for the target ip address or hostname.
```export no_proxy=your-target-ip```
Or you can:
```vi /etc/profile.d/proxy.sh```
Make sure your target IP addres or hostname is on the ```no_proxy``` line.

## Characterizing Eiger2 Timeout
The Eiger2 exhibits a strange behaviour of taking a long time to respond to the first API call, if it has been a while (20-30 seconds) since the last API call.
Note that the Balder equivalents of the procedures below do not show the difficulty in waking up.

```make exercise-10-timing-nanomax```
Check detector status 20 times and report result.
This will illustrate that after about 30 seconds, the Eiger goes to sleep and takes some time to wake up.

```make exercise-11-wakeup-nanomax```
Poll with a short timeout until non-timeout is achieved. Then poll for 50 loops and print response.
This will illustrate that the Eiger wakes up more quickly if you shake it vigorously.

```make exercise-12-poll-nanomax```
Poll for status every second.  Print a line every 10 seconds or if there was a timeout.  To stop the excercise, hit ^C.
This will illustrate that once the Eiger wakes up, it stays awake as long as you talk to it every second.

## TODO
- Investigate why debug of test includes a lot of these: Resetting dropped connection.


