Skip to content

Commit

Permalink
Real Dectris interface code
Browse files Browse the repository at this point in the history
  • Loading branch information
uellue authored and sk1p committed May 10, 2022
1 parent 64d8e51 commit 6b4e2e8
Show file tree
Hide file tree
Showing 3 changed files with 1,670 additions and 5 deletions.
293 changes: 293 additions & 0 deletions prototypes/dectris.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "b4aae32c",
"metadata": {},
"outputs": [],
"source": [
"from DEigerClient import DEigerClient"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "5ccd3cad",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'sequence id': 1}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"DCU_IP = \"\"\n",
"ec = DEigerClient(DCU_IP, port=4011)\n",
"ec.sendDetectorCommand('initialize')\n",
"ec.setFileWriterConfig('mode','enabled')\n",
"ec.setDetectorConfig('count_time', 1)\n",
"ec.setDetectorConfig('frame_time', 1)\n",
"ec.setDetectorConfig('nimages', 3)\n",
"ec.setFileWriterConfig('name_pattern', 'Your_first_image_with_a_DECTRIS_detector_$id') \n",
"ec.sendDetectorCommand('arm')\n",
"ec.sendDetectorCommand('trigger')\n",
"ec.sendDetectorCommand('disarm')"
]
},
{
"cell_type": "code",
"execution_count": 80,
"id": "e72a730a",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['header_appendix', 'header_detail', 'image_appendix', 'mode']"
]
},
"execution_count": 80,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.streamConfig()"
]
},
{
"cell_type": "code",
"execution_count": 81,
"id": "493276d7",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'access_mode': 'r',\n",
" 'allowed_values': ['disabled', 'ready', 'acquire', 'error'],\n",
" 'value': 'ready',\n",
" 'value_type': 'string'}"
]
},
"execution_count": 81,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.streamStatus('state')"
]
},
{
"cell_type": "code",
"execution_count": 82,
"id": "32d33a68",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'access_mode': 'r',\n",
" 'unit': 'deg C',\n",
" 'value': 33.073429107666016,\n",
" 'value_type': 'float'}"
]
},
"execution_count": 82,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.detectorStatus('temperature')"
]
},
{
"cell_type": "code",
"execution_count": 83,
"id": "6e42aa40",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{}"
]
},
"execution_count": 83,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.sendDetectorCommand('initialize')"
]
},
{
"cell_type": "code",
"execution_count": 84,
"id": "ed81b42e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"b''"
]
},
"execution_count": 84,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.setStreamConfig('mode', 'enabled')"
]
},
{
"cell_type": "code",
"execution_count": 172,
"id": "503c210c",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'access_mode': 'r', 'value': 32, 'value_type': 'uint'}"
]
},
"execution_count": 172,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.detectorConfig('bit_depth_image')"
]
},
{
"cell_type": "code",
"execution_count": 185,
"id": "22db4dab",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['compression']"
]
},
"execution_count": 185,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.setDetectorConfig('count_time', 0.1)\n",
"ec.setDetectorConfig('frame_time', 0.1)\n",
"ec.setDetectorConfig('nimages', 32)\n",
"ec.setDetectorConfig('compression', 'bslz4')"
]
},
{
"cell_type": "code",
"execution_count": 183,
"id": "58a4e73f",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'sequence id': 42}"
]
},
"execution_count": 183,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.sendDetectorCommand('arm')"
]
},
{
"cell_type": "code",
"execution_count": 187,
"id": "d88936d8",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{}"
]
},
"execution_count": 187,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.sendDetectorCommand('trigger')\n"
]
},
{
"cell_type": "code",
"execution_count": 159,
"id": "4e4cf19b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'sequence id': 34}"
]
},
"execution_count": 159,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ec.sendDetectorCommand('disarm')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "77dd2cc1",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 6b4e2e8

Please sign in to comment.