Skip to content

Tips for controlling EIGER detector

keitaroyam edited this page Nov 11, 2017 · 7 revisions

May be specific for EIGER X 9M (at BL32XU, SPring-8)..

Changing ROI mode

EIGER 9M (and 16M) have function to use 4M ROI. To enable 4M ROI,

import eigerclient
e = eigerclient.DEigerClient(host=eiger_host)
e.setDetectorConfig("roi_mode", "4M")

The beam center coordinate is not automatically shifted. Need to subtract 511 (one panel plus gap) from beam center y (slow). To disable ROI mode, call e.setDetectorConfig("roi_mode", "disabled").

Updating pixel mask

Reference: EIGER User Manual

We updated pixel_mask when hot pixels were accidentally made (by very intense X-ray).

Get current pixel_mask

import eigerclient
import numpy
from base64 import b64decode
e = eigerclient.DEigerClient(host=eiger_host)
tmp = e.detectorConfig("pixel_mask")
pm = numpy.fromstring(b64decode(tmp["value"]["data"]), dtype=tmp["value"]["type"]).reshape(tmp["value"]["shape"])

This pm is pixel_mask which is equivalent to what is stored in master.h5:

import h5py
h = h5py.File("foo_master.h5", "r")
pm_in_h5 = h["/entry/instrument/detector/detectorSpecific/pixel_mask"][:]
print numpy.all(pm==pm_in_h5) # True

Update pixel_mask

import eigerclient
from base64 import b64encode
e = eigerclient.DEigerClient(host=eiger_host)

pm = ... # Prepare somehow

new_conf = {
'__darray__': (1,0,0),
'type': pm.dtype.str,
'shape': pm.shape,
'filters': ['base64'],
'data': b64encode(pm.data) }

e.setDetectorConfig("pixel_mask", new_conf)

After this, pixel_mask is kept on EIGER system. It was kept after rebooting DCU. Probably firmware update will revert this.

Pseudo-ROI mode (trick)

If you are only interested in the central panels, masking other panels can reduce the file size (due to bslz4 compression). This trick seems to work, but use it with care.

import eigerclient
import json
import numpy
import time
from base64 import b64encode, b64decode
import cPickle as pickle
import os

e = eigerclient.DEigerClient(host=eiger_host)
tmp = e.detectorConfig("pixel_mask")

pm = numpy.fromstring(b64decode(tmp["value"]["data"]), dtype=tmp["value"]["type"]).reshape(tmp["value"]["shape"])
pklout = time.strftime("pixel_mask_%y%m%d_%H%M%S.pkl")
pickle.dump(pm, open(pklout, "w"), -1) # save backup

val = 2 # 1 (gap) does not work.
nt,nb = 2,2 # number of upper/lower panels to be masked
nl,nr = 1,1 # number of left/right-most panels to be masked

if nt>0: pm[0:551*nt,:] |= val
if nb>0: pm[-551*nb:-1,:] |= val
if nl>0: pm[:,0:1040*nl] |= val
if nr>0: pm[:,-1040*nr:-1] |= val

pickle.dump(pm, open(os.path.splitext(pklinout)[0]+"_masked.pkl", "w"), -1) # backup

new_conf = {
'__darray__': (1,0,0),
'type': pm.dtype.str,
'shape': pm.shape,
'filters': ['base64'],
'data': b64encode(pm.data) }

print e.setDetectorConfig("pixel_mask", new_conf)

Downloading DCU logs

May be helpful when reporting issues to DECTRIS.

#!/bin/sh
host= # give address of EIGER DCU
wd=eiger_logs_`date "+%y%m%d_%H%M%S"`
mkdir $wd
cd $wd

wget -i - <<+
http://$host/logs/filewriter_api.log
http://$host/logs/monitor_api.log
http://$host/logs/rest_api.log
http://$host/logs/rest_documentation.log
http://$host/logs/stream_api.log
http://$host/logs/sysctrl.log
+