Compare commits

...

153 Commits

Author SHA1 Message Date
794e579e12 update tag version in client version 2020-10-09 15:03:00 +02:00
bc6626aa7b docs 2020-10-09 08:55:03 +02:00
6fb2479178 updated docs 2020-10-09 08:52:19 +02:00
6053f2adff update docs 2020-10-08 16:04:58 +02:00
e0e2c2efba updated binaries 2020-10-08 15:55:24 +02:00
6d5f2e66ae updated client APIs 2020-10-08 15:46:26 +02:00
33d85dbfc0 all servers compiled 2020-10-08 15:45:29 +02:00
a838830090 ran tests and fixed 2020-10-08 15:44:15 +02:00
b9a459faa1 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-10-08 14:47:21 +02:00
d4806eb48b Eiger manual with 5.x updates 2020-10-08 14:42:02 +02:00
7f189629fb commands, set multi level but get module level enabled 2020-10-08 14:31:18 +02:00
bee6bcc7a3 Merge pull request #199 from slsdetectorgroup/zmqhwm
Zmqhwm
2020-10-08 13:42:36 +02:00
2f2399d550 minor 2020-10-08 13:29:46 +02:00
6c1035aa99 zmq hwm are specified to 2 for gui and restreaming of receiver if all zmq not closed at end of acquiistion 2020-10-08 13:01:01 +02:00
c9bba6fbdc Merge branch 'developer' into zmqhwm 2020-10-07 18:02:53 +02:00
6d929ce96f Merge pull request #196 from slsdetectorgroup/semfail
Semfail
2020-10-07 18:00:24 +02:00
a36ce8cb1c binaries in 2020-10-07 17:05:38 +02:00
38cc365c01 setting shared mutex attribute for non blackfins 2020-10-07 17:01:16 +02:00
688fe4e3f7 fix zmqport and rx_zmqport, must restart zmq streaming 2020-10-07 14:17:34 +02:00
5c0dff29ed binaries in 2020-10-07 12:27:35 +02:00
51bfa17c6a switching to pthread with shared process attribute as sem_init doesnt work for blackfin 2020-10-07 12:25:14 +02:00
3b619f4488 Update README.md 2020-10-07 11:13:14 +02:00
6f96821275 wip, doc 2020-10-06 18:56:39 +02:00
6e58d845e9 updated ctb and moench server versions 2020-10-06 15:59:27 +02:00
ff3c79eaaa doc update 2020-10-06 15:57:27 +02:00
c2d9532a69 updated versionign server color minor 2020-10-05 09:56:47 +02:00
7855005590 updated 5.0.0-rc2 in binaries 2020-10-05 09:53:13 +02:00
2588a4aced updating 5.0.0-rc2 versioning 2020-10-05 09:51:27 +02:00
0d2d41a9f3 wip, doc 2020-10-02 17:04:12 +02:00
70588ea9a3 wip config 2020-10-02 17:03:18 +02:00
949d0b6ec7 updating client api, tag updating script 2020-10-02 11:36:33 +02:00
b2f5208745 binaries in 2020-10-02 11:19:19 +02:00
91efecd4ca servers: updated fw-sw api version check error message, m3 and g2: updated min fw version 2020-10-02 11:17:11 +02:00
855ed36db2 Merge pull request #193 from slsdetectorgroup/stopfix
Stopfix
2020-10-01 17:57:48 +02:00
a730a13cbe wip 2020-10-01 17:57:07 +02:00
f31260030b bugfix: cannot stop detector if rxr crashed 2020-10-01 17:54:08 +02:00
e5c98150e4 wip, doc 2020-10-01 17:43:22 +02:00
91d688f18c minor doc 2020-10-01 11:47:08 +02:00
c9372f3d0e gui: rx_zmqfreq set to 0 in gui for fast detectors that overload the network unnecessarily 2020-10-01 11:45:45 +02:00
b650ad0376 updated jungfrau firmware pcb 1.0 version to be more intuitive 2020-10-01 10:31:15 +02:00
b3ef6af42a updated jungfrau firmware version (old pcb) to be more intuitive 2020-10-01 10:26:24 +02:00
488c5d3720 wip, doc 2020-09-30 15:49:51 +02:00
cf2b064d95 wip, doc 2020-09-30 15:47:01 +02:00
af5798f569 wip, doc 2020-09-30 15:28:07 +02:00
b036007991 wip, doc 2020-09-30 13:12:23 +02:00
5df25a9eb7 updated new binaries 2020-09-30 12:39:44 +02:00
1c76f76a72 removed old server binaries 2020-09-30 12:36:18 +02:00
b7ec110c57 gui bug fix: setting streaming timer should also set streaming freq to 0 2020-09-30 12:21:33 +02:00
54c719461d doc minor 2020-09-30 11:37:37 +02:00
2d104d9a9b setting 1 giga mode as default for virtual mythen3 2020-09-29 15:51:22 +02:00
e4d1daea02 gui: removing unique ptr in qt stuff 2020-09-29 15:22:59 +02:00
3a3c5b0a6e minor readframefromrxr using unique ptrs 2020-09-29 14:37:43 +02:00
b421a73c3d m3: virtual servers for switching to 1 giga (stop server does not know dr) 2020-09-28 17:27:56 +02:00
ae58e9f0f4 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-25 19:28:12 +02:00
603ddb0d75 updated docs, execcommand multiple words 2020-09-25 19:24:26 +02:00
c0be5ab8cb merge args fix 2020-09-25 11:55:55 +02:00
30f4c80031 fix 2020-09-25 11:00:51 +02:00
d25da43851 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-25 11:00:25 +02:00
ec2d6c597f added merge_args 2020-09-25 11:00:14 +02:00
fe81963873 rxr: udp socket size max of INT_MAX/2 (#191) 2020-09-25 10:15:39 +02:00
f950e32893 fix to utils 2020-09-25 08:53:35 +02:00
aa3af2f0ce Merge pull request #190 from slsdetectorgroup/g2cont
G2cont
2020-09-24 17:20:05 +02:00
e4615a11bb binary in 2020-09-24 17:19:21 +02:00
c01ce3d514 Merge branch 'developer' into g2cont 2020-09-24 17:18:04 +02:00
99642dad69 g2 fix: cont trigger frames in rxr should be 1 2020-09-24 17:16:46 +02:00
2c1fddee84 Cmddacs (#189)
Moved dacs to it's own command for command line. 
Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
2020-09-24 17:16:34 +02:00
c862f1df81 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-24 16:55:50 +02:00
671a2724ac more set_using_dict 2020-09-24 16:55:41 +02:00
9c5d8cfcd7 gui fix g2 disabling frame period in con ext 2020-09-24 16:05:43 +02:00
8483e05f4c binary in 2020-09-24 15:44:07 +02:00
d96352f2ae g2:fix for period in trigger cont 2020-09-24 15:43:14 +02:00
0f65633ea3 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-24 14:07:15 +02:00
18d5c5e26d more element 2020-09-24 14:06:58 +02:00
3f19f29c9e G2ContTrigger (#188)
* g2: setting #frames  to 1 and period to 0 for cont trigger, extra frame reg is set to #frames for cont auto and #trigger for cont trigger
2020-09-24 11:59:11 +02:00
101f029eef generalized set_using_dict 2020-09-24 11:01:51 +02:00
97fea10ee2 more of @element 2020-09-24 08:39:12 +02:00
d3fbfebeb7 generalized make_ for python 2020-09-23 17:44:19 +02:00
50fd9276ce removed unused tests 2020-09-23 17:14:38 +02:00
1f31dd667b more element and dict 2020-09-23 17:06:30 +02:00
18cd363f8f tests in 2020-09-23 16:34:18 +02:00
0b0f5c94d5 master file no index 2020-09-23 16:28:50 +02:00
23720e3c63 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-23 15:09:25 +02:00
3432343adb element 2020-09-23 15:09:16 +02:00
d06e0d1e7f wip, doc 2020-09-23 15:07:12 +02:00
750adffe6a wip, doc 2020-09-23 15:07:03 +02:00
0b02fabaf8 wip, doc 2020-09-23 14:59:27 +02:00
4aa33b5d7f Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-23 14:58:33 +02:00
40a1d27e3a wip, doc 2020-09-23 14:58:30 +02:00
b23410bc5e wip, doc 2020-09-23 14:58:25 +02:00
b6d5efd441 fix for clientversion 2020-09-23 14:54:16 +02:00
79a03c6c92 WIP 2020-09-23 14:25:51 +02:00
330df3463a version prints hex 2020-09-23 14:08:41 +02:00
11754fbb5e tempvalues gives int in case of single value or same values 2020-09-23 13:54:18 +02:00
e786b9f037 wip, doc 2020-09-23 13:15:53 +02:00
bd4299fd15 Wip, doc 2020-09-23 12:32:51 +02:00
a4bdffd0b9 Merge branch 'eigerserverlock' into developer 2020-09-22 18:48:35 +02:00
bb575c6017 wip, doc 2020-09-22 18:39:46 +02:00
65da9e701b wip, doc 2020-09-21 18:30:33 +02:00
804ad0997c wip, doc 2020-09-21 18:20:59 +02:00
2fc0768ad1 minor warning fix 2020-09-21 17:57:31 +02:00
ca0192e27e Merge pull request #184 from slsdetectorgroup/eigerserverlock
Eigerserverlock
2020-09-21 17:29:03 +02:00
4ad486fda0 Merge branch 'developer' into eigerserverlock 2020-09-21 17:28:38 +02:00
cf8581caaa Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-21 17:28:03 +02:00
a8cc47d25c wip, doc 2020-09-21 17:27:49 +02:00
d50c40e2ad Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-21 17:18:43 +02:00
f6a442fd10 detsize in python 2020-09-21 17:18:31 +02:00
f5b8681811 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-21 17:09:49 +02:00
54ca9f7ebb wip, doc 2020-09-21 17:09:39 +02:00
9920987b4d dacvalues return int if same 2020-09-21 14:41:30 +02:00
569c014d3c WIP, doc 2020-09-21 11:23:46 +02:00
608b71d5ea Merge branch 'eigerserverlock' of github.com:slsdetectorgroup/slsDetectorPackage into eigerserverlock 2020-09-18 18:16:09 +02:00
c83daab56d merge solved 2020-09-18 18:15:54 +02:00
d65030f5ca Merge pull request #186 from slsdetectorgroup/g2cwframes
G2cwframes
2020-09-18 18:01:45 +02:00
c3366a6748 g2 binary in 2020-09-18 17:59:48 +02:00
7c21aa96a9 g2: setting continuous mode frames in naother reg, and when changing from burst to continous 2020-09-18 17:58:39 +02:00
d028a120bb binaries in 2020-09-18 14:20:05 +02:00
f6dd02acc2 minor print in temp_Fpgafl in eiger 2020-09-18 14:18:19 +02:00
0906efaf31 moving temp_fpgafl and temp_fpgafr back to the stop server 2020-09-18 14:09:23 +02:00
8ef79ce173 binaries in 2020-09-18 11:37:25 +02:00
539c0c295b replaced pthread_mutex_t with sem_t 2020-09-18 11:30:04 +02:00
e91420bd16 locking in list 2020-09-18 11:23:57 +02:00
515a0c05b9 removed locking in locallink 2020-09-18 11:23:46 +02:00
46b75c1429 minor 2020-09-18 11:23:33 +02:00
092b3fa8b9 eiger: locking for local link access in shared memory 2020-09-18 11:23:21 +02:00
a7e24717a9 dacs 2020-09-17 17:29:57 +02:00
e01e41926c Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-17 17:13:30 +02:00
44a8ce864b dacs for docs 2020-09-17 17:13:22 +02:00
e18f10051e jungfrau and gotthard binaries in 2020-09-17 17:11:57 +02:00
d9bb028da2 added dacnames in server defs for g1 and jungfrau 2020-09-17 17:11:09 +02:00
6d01348bf4 removed setClockFrequency and added some python commands 2020-09-17 16:03:58 +02:00
e8cd75a6ac more python commands 2020-09-17 15:10:02 +02:00
d945f39142 removed unused variables 2020-09-17 14:39:20 +02:00
ac1e9569b5 removed unused fields and added popcount 2020-09-17 14:20:02 +02:00
ea1b41c84a fixed bool ini with nullptr 2020-09-17 14:07:19 +02:00
b0dd82c667 removing sem_wait in acquire (#182) 2020-09-17 13:55:20 +02:00
bf69951456 Merge pull request #183 from slsdetectorgroup/positions
Replacing initializer list with vector
2020-09-17 12:57:18 +02:00
2d2e80469c format 2020-09-17 12:18:34 +02:00
5d648443fa replaced remaning {} 2020-09-17 12:18:08 +02:00
1fb7352378 added missing unit in test 2020-09-17 12:13:09 +02:00
511c206787 replaced initializer list with vector for CmdProxy 2020-09-17 12:11:19 +02:00
74edb6a1c1 test for single mod exptime 2020-09-17 11:42:44 +02:00
3376f7fa37 wip, doc 2020-09-14 15:39:21 +02:00
bfe36085f2 Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer 2020-09-14 15:18:55 +02:00
f061d2273a wip, doc 2020-09-14 15:18:48 +02:00
b12ae5d929 Merge pull request #180 from slsdetectorgroup/serverdoc
Adding auto generated server default #define in documentation
2020-09-14 10:44:01 +02:00
2285061623 column wrap for long attributes 2020-09-11 17:47:28 +02:00
e10ebe33d7 fixed cmake command 2020-09-11 17:25:27 +02:00
01921bc016 WIp, doc 2020-09-11 16:05:53 +02:00
aa10c4665f added ctb 2020-09-11 15:25:23 +02:00
f644cba244 wip, doc 2020-09-11 15:19:22 +02:00
884da7197e fixed command 2020-09-11 15:13:26 +02:00
8ae0659478 docs 2020-09-11 15:09:44 +02:00
ad95f729dc subheadings in Detector API doc 2020-09-11 12:15:51 +02:00
189 changed files with 7239 additions and 5213 deletions

View File

@ -1,3 +1,8 @@
### Note
Please do not update to any xxxx.xx.xx.dev0 tags. They are not releases, but tags for internal usage.
Use only releases with tags such as x.x.x or x.x.x-rcx.
### Documentation
Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support)

View File

@ -1,2 +1,127 @@
Draft
- dr 4, 8, 16 in eiger -> speed 0, 32 stays same (speed 1)
SLS Detector Package 5.0.0-rc2 released on 09.10.2020 (Release Candidate 2)
===========================================================================
CONTENTS
--------
1. Firmware Requirements
2. Download, Documentation & Support
1. Firmware Requirements
========================
Eiger
=====
Compatible version : 08.09.2020 (v27)
Jungfrau
========
Compatible version : 24.07.2020 (v1.1, PCB v1.0)
: 21.07.2020 (v2.1, PCB v2.0)
Gotthard
========
Compatible version : 08.02.2018 (50um and 25um Master)
: 09.02.2018 (25 um Slave)
Mythen3
=======
Compatible version : 25.09.2020 (development)
Gotthard2
=========
Compatible version : 25.09.2020 (development)
Moench
======
Compatible version : 10.05.2020 (v1.0)
Ctb
===
Compatible version : 10.05.2019 (v1.0)
Detector Upgrade
================
The following can be upgraded remotely:
Eiger via bit files
Jungfrau via command <.pof>
Mythen3 via command <.rbf>
Gotthard2 via command <.rbf>
Moench via command <.pof>
Ctb via command <.pof>
The following cannot be upgraded remotely:
Gotthard
Instructions available at
https://slsdetectorgroup.github.io/devdoc/firmware.html
and
https://slsdetectorgroup.github.io/devdoc/serverupgrade.html
Please refer to the link below for more details on the firmware versions.
https://www.psi.ch/en/detectors/firmware
2. Download, Documentation & Support
====================================
Download
--------
The Source Code:
https://github.com/slsdetectorgroup/slsDetectorPackage
Documentation
-------------
Installation:
https://slsdetectorgroup.github.io/devdoc/installation.html#
Firmware Upgrade:
https://slsdetectorgroup.github.io/devdoc/firmware.html
Detector Server upgrade:
https://slsdetectorgroup.github.io/devdoc/serverupgrade.html
Detector Simulators:
https://slsdetectorgroup.github.io/devdoc/virtualserver.html
Consuming slsDetectorPackage:
https://slsdetectorgroup.github.io/devdoc/consuming.html
Command Line Documentation:
https://slsdetectorgroup.github.io/devdoc/commandline.html
Quick Start Guide:
https://slsdetectorgroup.github.io/devdoc/quick_start_guide.html
C++ API Documentation:
https://slsdetectorgroup.github.io/devdoc/detector.html
C++ API Example:
https://slsdetectorgroup.github.io/devdoc/examples.html#
Python API Documentation:
https://slsdetectorgroup.github.io/devdoc/pygettingstarted.html
Python API Example:
https://slsdetectorgroup.github.io/devdoc/pyexamples.html
TroubleShooting:
https://slsdetectorgroup.github.io/devdoc/troubleshooting.html
Further Documentation:
https://www.psi.ch/en/detectors/documentation
Old Release notes:
https://www.psi.ch/en/detectors/latest-installation
Support
-------
dhanya.thattil@psi.ch
erik.frojdh@psi.ch
anna.bergamaschi@psi.ch

View File

@ -38,12 +38,19 @@ set(SPHINX_SOURCE_FILES
src/pydetector.rst
src/pyenums.rst
src/pyexamples.rst
src/receiver.rst
src/servers.rst
src/receiver_api.rst
src/result.rst
src/type_traits.rst
src/ToString.rst
src/examples.rst
src/pygettingstarted.rst
src/firmware.rst
src/serverupgrade.rst
src/virtualserver.rst
src/serverdefaults.rst
src/quick_start_guide.rst
src/troubleshooting.rst
)
@ -57,8 +64,21 @@ configure_file(
"${SPHINX_BUILD}/conf.py"
@ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/gen_server_doc.py.in"
"${SPHINX_BUILD}/gen_server_doc.py"
@ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/static/extra.css"
"${SPHINX_BUILD}/static/css/extra.css"
@ONLY)
add_custom_target(server_rst python gen_server_doc.py)
add_custom_target(docs
gendoc
COMMAND python gen_server_doc.py
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
COMMAND ${SPHINX_EXECUTABLE} -a -b html
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
@ -74,3 +94,4 @@ add_custom_target(rst
${SPHINX_BUILD}/src
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")

View File

@ -59,4 +59,8 @@ html_theme = "sphinx_rtd_theme"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
html_static_path = ['static']
def setup(app):
app.add_stylesheet('css/extra.css') # may also be an URL

86
docs/gen_server_doc.py.in Normal file
View File

@ -0,0 +1,86 @@
import os
import re
from pathlib import Path
def remove_comments(text):
def replacer(match):
s = match.group(0)
if s.startswith('/'):
return " " # note: a space and not an empty string
else:
return s
pattern = re.compile(
r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',
re.DOTALL | re.MULTILINE
)
return re.sub(pattern, replacer, text)
# @CMAKE_CURRENT_BINARY_DIR@
print('\n\n\n\n SERVER CSV')
src = Path('@CMAKE_SOURCE_DIR@')/'slsDetectorServers/'
detectors = ['Mythen3', 'Gotthard2', 'Eiger',
'Jungfrau', 'Moench', 'Gotthard', 'Ctb']
for det in detectors:
print(det)
in_fname = src/f'{det.lower()}DetectorServer/slsDetectorServer_defs.h'
#print(f'Reading: {in_fname}')
with open(in_fname) as f:
lines = f.read().replace('\\\n', '')
lines = lines.splitlines(keepends = True)
lines = [l.strip('#define').strip(' ') for l in lines if l.startswith('#define')]
output = []
signals = []
fields = ['Name,', 'Value', 'Comment']
excluded = ['DAC_NAMES', 'DEFAULT_DAC_VALS', 'CLK_NAMES', 'ONCHIP_DAC_NAMES']
header = f'{fields[0]:35}{fields[1]:35}\n'
output.append(header)
signals.append(header)
dac_names = []
dac_values = []
for line in lines:
name, *parts = line.split()
arg = ' '.join(parts)
value, *comments = arg.split('//')
value = value.strip('() ')
# value = value.replace(', ', ' ')
value = value.replace('\"', '')
if name not in excluded:
name += ','
if name.startswith('SIGNAL_'):
signals.append(f'{name:35}{value}\n')
else:
output.append(f'{name:35}\"{value}\"\n')
elif name == 'DAC_NAMES':
dac_names = [v.strip(', ') for v in value.split()]
dac_names = [n+',' for n in dac_names]
elif name == 'DEFAULT_DAC_VALS':
dac_values = remove_comments(value).strip('{}; ')
dac_values = dac_values.replace(',', '').split()
dac_values = [v.strip('') for v in dac_values]
print(f"dac_names: {len(dac_names)}, dac_values={len(dac_values)}")
if len(dac_values) == 0:
dac_values = ['N/A']*len(dac_names)
rstpath = Path('@CMAKE_SOURCE_DIR@')/'docs/src/'
out_fname = Path.cwd()/f'src/{det.lower()}.csv'
out_dac_fname = Path.cwd()/f'src/{det.lower()}-dacs.csv'
#print(f'Writing: {out_fname}')
with open(out_fname, 'w') as f:
f.writelines(output)
output = [f'{n:35}{v}\n' for n,v in zip(dac_names, dac_values)]
output.insert(0, header)
with open(out_dac_fname, 'w') as f:
f.writelines(output)
print('END\n\n\n\n')

View File

@ -4,12 +4,28 @@ Command line interface
Usage
-------------
Commands can be uses either with sls_detector_get or sls_detector_put
Commands can be used either with sls_detector_get or sls_detector_put
.. code-block::
sls_detector_get vrf
Help
--------
.. code-block::
# get list of commands
sls_detector_get list
# search for a particular command using a word
sls_detector_get list | grep adc
# get help for a particular command
sls_detector_get -h fpath
sls_detector_help fpath
Commands
-----------

View File

@ -6,7 +6,7 @@ slsDetectorPackage there are a few different ways to
consume our package. The recommended way is to use one of the
CMake approaches.
One can test with :ref:`detector simulators<Virtual Detector Servers>` before testing the API with a real detector or when a real detector is not at hand.
CMake: slsDetectorPackage as submodule in your project
---------------------------------------

446
docs/src/firmware.rst Normal file
View File

@ -0,0 +1,446 @@
Firmware Upgrade
=================
Eiger
-------------
Download
^^^^^^^^^^^^^
- `bcp script <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/eiger/bcp>`__
- detector server corresponding to package in slsDetectorPackage/serverBin
- bit files
.. list-table::
:widths: 25 10 30 25 10
:header-rows: 1
* - Software
- Hardware
- Firmware Date
- Firmware Link
- Comments
* - v5.0.0-rcx
-
- 08.09.2020
- `v27 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/eiger/v27/>`__
-
* - v4.0.0 - v4.2.0
-
- 30.07.2019
- `v24 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/eiger/v24/>`__
-
* - v3.1.0 - v3.1.5
-
- 17.08.2017
- `v20 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/eiger/v20/>`__
-
Upgrade
^^^^^^^^
#. Tftp must be already installed on your pc to use the bcp script.
#. Kill the on-board servers and copy new servers to the board.
.. code-block:: bash
# Option 1: from detector console
# kill old server
ssh root@bebxxx
killall eigerDetectorServer
# copy new server
cd executables
scp user@pc:/path/eigerDetectorServerxxx .
chmod 777 eigerDetectorServerxxx
ln -sf eigerDetectorServerxxx eigerDetectorServer
sync
# Options 2: from client console for multiple modules
for i in bebxxx bebyyy;
do ssh root@$i killall eigerDetectorServer;
scp eigerDetectorServerxxx root@$i:~/executables/eigerDetectorServer;
ssh root@$i sync; done
* This is crucial when registers between firmwares change. Failure to do so will result in linux on boards to crash and boards can't be pinged anymore.
#. Bring the board into programmable mode using either of the 2 ways. Both methods result in only the central LED blinking.
* **Manual:**
Do a hard reset for each half module on back panel boards, between the LEDs, closer to each of the 1G ethernet connectors. Push until all LEDs start to blink.
* Software:
.. code-block:: bash
ssh root@bebxxx
cd executables
./boot_recovery
#. Start a terminal for each half module and run the following to see progress.
.. code-block:: bash
nc -p 3000 -u bebxxx 3000
# Press enter twice to see prompt with board name.
> bebxxx
# After each bcp command, wait for this terminal to print "Success".
#. In another terminal, run the following to update firmware. Please update bit files with great caution as it could make your board inaccessible, if done incorrectly.
.. code-block:: bash
#update back end fpga
bcp download.bit bebxxx:/fw0
#update front left fpga
bcp download.bit bebxxx:/febl
#update front right fpga
bcp download.bit bebxxx:/febr
#update kernel (only if required by the SLS Detector Group)
bcp download.bit bebxxx:/kernel
#. Reboot the detector.
Jungfrau
-------------
Download
^^^^^^^^^^^^^
- detector server corresponding to package in slsDetectorPackage/serverBin
- pof files
.. list-table::
:widths: 25 10 30 25 10
:header-rows: 1
* - Software
- Hardware
- Firmware Date
- Firmware Link
- Comments
* - v5.0.0-rcx
- 2.0
- 21.07.2020
- `v2.1 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/jungfrau/v2_1/jungfrau_v2_1.pof>`__
-
* - v5.0.0-rcx
- 1.0
- 24.07.2020
- `v1.1 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/jungfrau/v1_1/jungfrau_v1_1.pof>`__
-
* - v4.0.1 - v4.2.0
- 1.0
- 06.12.2018
- `v0.7 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/jungfrau/v0_7/jungfrau_v0_7.pof>`__
-
* - v3.1.0 - v3.1.5
- 1.0
- 13.11.2017
- `v0.6 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/jungfrau/v0_6/jungfrau_v0_6.pof>`__
-
Upgrade (from v4.x.x)
^^^^^^^^^^^^^^^^^^^^^^
#. Tftp must be installed on pc.
#. Update client package to the latest (5.0.0-rc1).
#. Disable server respawning or kill old server
.. code-block:: bash
# Option 1: if respawning enabled
telnet bchipxxx
# edit /etc/inittab
# comment out line #ttyS0::respawn:/jungfrauDetectorServervxxx
reboot
# ensure servers did not start up after reboot
telnet bchipxxx
ps
# Option 2: if respawning already disabled
telnet bchipxxx
killall jungfrauDetectorServerv*
#. Copy new server and start in update mode
.. code-block:: bash
tftp pcxxx -r jungfrauDetectorServervxxx -g
chmod 777 jungfrauDetectorServervxxx
./jungfrauDetectorServervxxx -u
#. Program fpga from the client console
.. code-block:: bash
sls_detector_get free
# Crucial that the next command executes without any errors
sls_detector_put hostname bchipxxx
sls_detector_put programfpga xxx.pof
#. After programming, kill 'update server' using Ctrl + C in server console.
#. Enable server respawning if needed
.. code-block:: bash
telnet bchipxxx
# edit /etc/inittab
# uncomment out line #ttyS0::respawn:/jungfrauDetectorServervxxx
# ensure the line has the new server name
reboot
# ensure both servers are running using ps
jungfrauDetectorServervxxx
jungfrauDetectorServervxxx --stop-server 1953
Upgrade (from v5.0.0-rcx)
^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# removes old server from respawn, sets up new server to respawn
# and reboots
sls_detector_put update jungfrauDetectorServervxxx pcxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof
Gotthard
---------
Download
^^^^^^^^^^^^^
- detector server corresponding to package in slsDetectorPackage/serverBin
- pof files
.. list-table::
:widths: 15 15 15 15 5
:header-rows: 1
* - Software
- Hardware
- Firmware Date
- Firmware Link
- Comments
* - All versions
- 50um
- 08.02.2018
- `50um <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/gotthard_I/50um/gotthard_I_50um.pof>`__
-
* - All versions
- 25um (master)
- 08.02.2018
- `25um (master) <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/gotthard_I/25um/master/gotthard_I_25um_master.pof>`__
-
* - All versions
- 25um (slave)
- 09.02.2018
- `25um (slave) <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/gotthard_I/25um/slave/gotthard_I_25um_slave.pof>`__
-
Upgrade
^^^^^^^^
.. warning ::
| Gotthard firmware cannot be upgraded remotely and requires the use of USB-Blaster.
| It is generally updated by the SLS Detector group.
#. Download `Altera Quartus software or Quartus programmer <https://fpgasoftware.intel.com/20.1/?edition=standard&platform=linux&product=qprogrammer#tabs-4>`__.
#. Start Quartus programmer, click on Hardware Setup. In the "Currently selected hardware" window, select USB-Blaster.
#. In the Mode combo box, select "Active Serial Programming".
#. Plug the end of your USB-Blaster with the adaptor provided to the connector 'AS config' on the Gotthard board.
#. Click on 'Add file'. Select programming (pof) file provided by the SLS Detector group.
#. Check "Program/Configure" and "Verify". Push the start button. Wait until the programming process is finished.
#. In case of error messages, check the polarity of cable (that pin1 corresponds) and that the correct programming connector is selected.
#. Reboot the detector.
Mythen3
-------
.. note ::
As it is still in developement, the rbf files must be picked up from the SLS Detector Group.
Download
^^^^^^^^^^^^^
- detector server corresponding to package in slsDetectorPackage/serverBin
- rbf files
.. list-table::
:widths: 25 10 30 25 10
:header-rows: 1
* - Software
- Hardware
- Firmware Date
- Firmware Link
- Comments
* - v5.0.0-rcx
-
- 25.09.2020
-
- development
Upgrade (from v5.0.0-rcx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# and reboots (new server not respawned currently)
sls_detector_put update mythen3DetectorServervxxx pcxxx xxx.rbf
# Or only program firmware
sls_detector_put programfpga xxx.rbf
Gotthard2
-------------
.. note ::
As it is still in developement, the rbf files must be picked up from the SLS Detector Group.
Download
^^^^^^^^^^^^^
- detector server corresponding to package in slsDetectorPackage/serverBin
- rbf files
.. list-table::
:widths: 25 10 30 25 10
:header-rows: 1
* - Software
- Hardware
- Firmware Date
- Firmware Link
- Comments
* - v5.0.0-rcx
-
- 25.09.2020
-
- development
Upgrade (from v5.0.0-rcx)
^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# and reboots (new server not respawned currently)
sls_detector_put update gotthard2DetectorServervxxx pcxxx xxx.rbf
# Or only program firmware
sls_detector_put programfpga xxx.rbf
Moench
-------
Download
^^^^^^^^^^^^^
- detector server corresponding to package in slsDetectorPackage/serverBin
- pof files
.. list-table::
:widths: 25 10 30 25 10
:header-rows: 1
* - Software
- Hardware
- Firmware Date
- Firmware Link
- Comments
* - v5.0.0-rcx
- EPCQ128
- 05.10.2020
- `v1.0 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/moench/EPCQ128/v1_0/moench_v1_0_201005.pof>`__
-
* - v5.0.0-rcx
- EPCS128
- 05.10.2020
- `v1.0 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/moench/EPCS128/v1_0/moench_v1_0_201005.pof>`__
-
Upgrade (from v5.0.0-rcx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# removes old server from respawn, sets up new server to respawn
# and reboots
sls_detector_put update moenchDetectorServervxxx pcxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof
Ctb
----
Download
^^^^^^^^^^^^^
- detector server corresponding to package in slsDetectorPackage/serverBin
- pof files
.. list-table::
:widths: 25 10 30 25 10
:header-rows: 1
* - Software
- Hardware
- Firmware Date
- Firmware Link
- Comments
* - v5.0.0-rcx
- EPCQ128
- 05.10.2020
- `v1.0 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/ctb/EPCQ128/v1_0/ctb_v1_0_201005.pof>`__
-
* - v5.0.0-rcx
- EPCS128
- 05.10.2020
- `v1.0 <https://github.com/slsdetectorgroup/slsDetectorFirmware/blob/master/binaries/ctb/EPCS128/v1_0/ctb_v1_0_201005.pof>`__
-
Upgrade (from v5.0.0-rcx)
^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Program from console
.. code-block:: bash
# copies server from tftp folder of pc, programs fpga,
# removes old server from respawn, sets up new server to respawn
# and reboots
sls_detector_put update ctbDetectorServervxxx pcxxx xx.pof
# Or only program firmware
sls_detector_put programfpga xxx.pof

View File

@ -25,7 +25,7 @@ Welcome to slsDetectorPackage's documentation!
detector
result
receiver
receiver_api
examples
.. toctree::
@ -42,6 +42,7 @@ Welcome to slsDetectorPackage's documentation!
:maxdepth: 2
commandline
quick_start_guide
.. toctree::
:caption: Developer
@ -50,6 +51,27 @@ Welcome to slsDetectorPackage's documentation!
type_traits
ToString
.. toctree::
:caption: Firmware
:maxdepth: 2
firmware
.. toctree::
:caption: Detector Server
:maxdepth: 2
servers
serverupgrade
virtualserver
serverdefaults
.. toctree::
:caption: Troubleshooting
troubleshooting
.. Indices and tables
.. ==================

View File

@ -16,6 +16,7 @@
manage the dependencies.
.. _Installation:
Installation
==============================================
@ -44,6 +45,28 @@ The easiest way to configure options is to use the ccmake utility.
ccmake .
Build using cmk.sh script
-------------------------
.. code-block:: bash
The binaries are generated in slsDetectorPackage/build/bin directory.
# new build and make with 9 parallel threads
./cmk.sh -cbj9
# build with python
./cmk.sh -bpj9
# build with GUI
./cmk.sh -bgj9
# build with hdf5
./cmk.sh -hj9 -d [path of hdf5 dir]
# get all options
./cmk.sh -?
Install binaries using conda
--------------------------------
@ -65,6 +88,7 @@ We have three different packages available:
conda config --set channel_priority strict
#cerate an environment with our library, then activate
#replace 2020.07.20.dev0 with the required tag
conda create -n myenv slsdetlib=2020.07.23.dev0
conda activate myenv

View File

@ -70,12 +70,6 @@ exposed to Python through pybind11.
.. autoclass:: masterFlags
:undoc-members:
.. autoclass:: frameModeType
:undoc-members:
.. autoclass:: detectorModeType
:undoc-members:
.. autoclass:: burstMode
:undoc-members:

View File

@ -217,9 +217,9 @@ The enums can be found in slsdet.enums
import slsdet
>>> [e for e in dir(slsdet.enums) if not e.startswith('_')]
['burstMode', 'clockIndex', 'dacIndex', 'detectorModeType',
['burstMode', 'clockIndex', 'dacIndex',
'detectorSettings', 'detectorType', 'dimension', 'externalSignalFlag',
'fileFormat', 'frameDiscardPolicy', 'frameModeType', 'masterFlags',
'fileFormat', 'frameDiscardPolicy', 'masterFlags',
'readoutMode', 'runStatus', 'speedLevel', 'timingMode',
'timingSourceType']

View File

@ -0,0 +1,140 @@
Quick Start Guide
=================
Detector
--------
Start up detector (with cooling if required). Ensure both control server and stop server is running on-board.
Or use a detector simulator to test. Click :ref:`here<Virtual Detector Servers>` for further instructions.
Receiver
--------
| One has to start the slsReceiver before loading config file or using any receiver commands (prefix: **rx_** )
For a Single Module
.. code-block:: bash
# default port 1954
slsReceiver
# custom port 2012
slsReceiver -t2012
For Multiple Modules
.. code-block:: bash
# slsMultiReceiver [starting port] [number of receivers] [print each frame header for debugging]
slsMultiReceiver 2012 2 0
Client
------
Refer :ref:`Sample Config file` to create config file.
.. code-block:: bash
# load config file
sls_detector_put config /path/sample.config
# set number of frames
sls_detector_put frames 5
# acquire
sls_detector_acquire
.. _Sample Config file:
Sample Config file
^^^^^^^^^^^^^^^^^^
There are sample config files for each detector in slsDetectorPackage/examples folder.
For a Single Module
.. code-block:: bash
# connects to module
hostname bchipxxx
# connects to receiver at default port
rx_hostname mpc1922
# or to connect to specific port
# rx_hostname mpc1922:2012
# sets destination udp ports (not needed, default is 50001)
udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips
udp_srcip 192.168.1.112
# destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto
# set file path
fpath /tmp
For a Single Module with custom Receiver (not slsReceiver)
.. code-block:: bash
# connects to module
hostname bchipxxx
# sets destination udp ports (not needed, default is 50001)
udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips
udp_srcip 192.168.1.112
# destination udp ip
udp_dstip 192.168.1.100
# source udp mac
udp_srcmac aa:bb:cc:dd:ee:ff
# destination udp mac
udp_dstmac 3c:ab:98:bf:50:60
# set file path
fpath /tmp
For Multiple Modules
.. code-block:: bash
# connects to mulitple modules
hostname bchipxxx+bchipyyy+
# connects to receivers at ports 2012 and 2014
rx_hostname mpc1922:2012+mpc1922:2013+
# sets differernt destination udp ports
0:udp_dstport 50012
1:udp_dstport 50014
# source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112
1:udp_srcip 192.168.1.114
# destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto
# set file path
fpath /tmp
Gui
----
Compile with SLS_USE_GUI=ON in cmake or -g option in cmk.sh script. One can also just use the conda binary. Refer :ref:`installation instructions<Installation>`.
.. code-block:: bash
slsDetectorGui
.. note ::
| The streaming high water mark (commmand: rx_zmqhwm) and the receiving high water mark (command: zmqhwm) is by default the lib zmq's default (currently 1000).
| At Gui startup, these values are set to 2. Hence, for very fast detectors, many frames will be dropped to be able to view the latest in the gui.
| One can still change this setting in the gui in the Plot tab (ZMQ Streaming), from the command line or API.
| Both hwm's can be set to a -1 to use the lib's default.
| Since the dummy end of acquisition packet streamed from receiver might also be lost, receiver restreams until gui acknowledges.

106
docs/src/serverdefaults.rst Normal file
View File

@ -0,0 +1,106 @@
Default Values
==============================================
Mythen3
-------------
.. csv-table:: Default values
:file: mythen3.csv
:widths: 35, 35
:header-rows: 1
DACS
^^^^^^^^^^^^^
.. csv-table:: Mythen3 DACS
:file: mythen3-dacs.csv
:widths: 35, 35
:header-rows: 1
Gotthard2
-------------
.. csv-table:: Default values
:file: gotthard2.csv
:widths: 35, 35
:header-rows: 1
DACS
^^^^^^^^^^^^^
.. csv-table:: Gotthard 2 DACS
:file: gotthard2-dacs.csv
:widths: 35, 35
:header-rows: 1
Moench
-------------
.. csv-table:: Default values
:file: moench.csv
:widths: 35, 35
:header-rows: 1
DACS
^^^^^^^^^^^^^
.. csv-table:: Moench DACS
:file: moench-dacs.csv
:widths: 35, 35
:header-rows: 1
Ctb
-------------
.. csv-table:: Default values
:file: ctb.csv
:widths: 35, 35
:header-rows: 1
Eiger
-------------
.. csv-table:: Default values
:file: eiger.csv
:widths: 35, 35
:header-rows: 1
DACS
^^^^^^^^^^^^^
.. csv-table:: Eiger DACS
:file: eiger-dacs.csv
:widths: 35, 35
:header-rows: 1
Jungfrau
-------------
.. csv-table:: Default values
:file: jungfrau.csv
:widths: 35, 35
:header-rows: 1
DACS
^^^^^^^^^^^^^
.. csv-table:: Jungfrau DACS
:file: jungfrau-dacs.csv
:widths: 35, 35
:header-rows: 1
Gotthard
-------------
.. csv-table:: Default values
:file: gotthard.csv
:widths: 35, 35
:header-rows: 1
DACS
^^^^^^^^^^^^^
.. csv-table:: Gotthard DACS
:file: gotthard-dacs.csv
:widths: 35, 35
:header-rows: 1

36
docs/src/servers.rst Normal file
View File

@ -0,0 +1,36 @@
Detector Servers
=================
Location
---------
slsDetectorPackage/serverBin/ folder in every release.
.. _Detector Server Arguments:
Arguments
---------
.. code-block:: bash
Possible arguments are:
-v, --version : Software version
-p, --port <port> : TCP communication port with client.
-g, --nomodule : [Mythen3][Gotthard2] Generic or No Module mode.
Skips detector type checks.
-f, --phaseshift <value> : [Gotthard] only. Sets phase shift.
-d, --devel : Developer mode. Skips firmware checks.
-u, --update : Update mode. Skips firmware checks and initial detector setup.
-s, --stopserver : Stop server. Do not use as it is created by control server
Basics
------------
Detector Servers include:
* Control server [default port: 1952]
* Almost all client communication.
* Stop server [default port: 1953]
* Client requests for detector status, stop acquisition, temperature, advanced read/write registers.
When using a blocking acquire command (sls_detector_acquire or Detector::acquire), the control server is blocked until end of acquisition. However, stop server commands could be used in parallel.

114
docs/src/serverupgrade.rst Normal file
View File

@ -0,0 +1,114 @@
Detector Server Upgrade
=======================
Eiger
-------------
**Location:** slsDetectorPackage/serverBin/ folder for every release.
#. Kill old server and copy new server
.. code-block:: bash
# Option 1: from detector console
# kill old server
ssh root@bebxxx
killall eigerDetectorServer
# copy new server
cd executables
scp user@pc:/path/eigerDetectorServerxxx .
chmod 777 eigerDetectorServerxxx
ln -sf eigerDetectorServerxxx eigerDetectorServer
sync
# Options 2: from client console for multiple modules
for i in bebxxx bebyyy;
do ssh root@$i killall eigerDetectorServer;
scp eigerDetectorServerxxx root@$i:~/executables/eigerDetectorServer;
ssh root@$i sync; done
#. Reboot the detector.
Jungfrau
-------------
**Location:** slsDetectorPackage/serverBin/ folder for every release.
#. Install tftp and copy detector server binary to tftp folder
#. Program from console (only from 5.0.0-rcx)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver jungfrauDetectorServerxxx pcxxx
Gotthard
---------
**Location:** slsDetectorPackage/serverBin/ folder for every release.
#. Install tftp and copy detector server binary to tftp folder
#. Program from console (only from 5.0.0-rcx)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver gotthardDetectorServerxxx pcxxx
Mythen3
-------
**Location:** slsDetectorPackage/serverBin/ folder for every release.
#. Install tftp and copy detector server binary to tftp folder
#. Program from console (only from 5.0.0-rcx)
.. code-block:: bash
# copies new server from pc tftp folder and reboots (does not respawn)
sls_detector_put copydetectorserver mythen3DetectorServerxxx pcxxx
Gotthard2
----------
**Location:** slsDetectorPackage/serverBin/ folder for every release.
#. Install tftp and copy detector server binary to tftp folder
#. Program from console (only from 5.0.0-rcx)
.. code-block:: bash
# copies new server from pc tftp folder and reboots (does not respawn)
sls_detector_put copydetectorserver gotthard2DetectorServerxxx pcxxx
Moench
------
**Location:** slsDetectorPackage/serverBin/ folder for every release.
#. Install tftp and copy detector server binary to tftp folder
#. Program from console (only from 5.0.0-rcx)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver moenchDetectorServerxxx pcxxx
Ctb
---
**Location:** slsDetectorPackage/serverBin/ folder for every release.
#. Install tftp and copy detector server binary to tftp folder
#. Program from console (only from 5.0.0-rcx)
.. code-block:: bash
# copies new server from pc tftp folder, respawns and reboots
sls_detector_put copydetectorserver ctbDetectorServerxxx pcxxx

View File

@ -0,0 +1,295 @@
Troubleshooting
=================
Common
------
Missing Packets
^^^^^^^^^^^^^^^
Possible causes could be the following:
#. Receiver PC is not tuned for socket buffer size and input packet queue.
* Refer to :ref:`Increase rmem_default, rmem_max and max_backlog<Receiver PC Tuning>`
#. Wiring
* Faulty wiring or connecting cable to incorrect interface.
#. Link up and speed
* Check to see if there is a blue LED on board to signal that the link is up. Check ethtool and find if Link Deteced:Yes and Speed is acceptable (>10k).
#. Detector is not acquiring (Not Eiger)
* Take an acquisition with many images and using the following steps instead of acquire:
.. code-block:: bash
sls_detector_put status start
# keep executing this command to see if the number of frames left keeps decreasing,
# which means the detector is acquiring.
sls_detector_get framesl
.. note ::
If you are using multiple modules, the previous command can return -1 because each module will return different values. Then, check for a single module instead: sls_detector_get 0:framesl
#. Data cable plugged into the wrong interface on board (Jungfrau)
* Please ensure that the data cable is plugged into the rightmost interface. The middle one is disabled for PCB v1.0 and must be selected via command for PCB v2.0.
#. Detector is not sending data
* Check the board to see if the green LED is blinking next to the data cable, which means that the detector is sending data.
#. Firewall or security feature
* A firewall or some security feature could be blocking the reception of data.
#. Ethernet interface not configured properly
* Ensure that the interfaces used are configured properly with the right mask and ip. Eg. use ifconfig and route commands to verify.
#. Ethernet interface not configured for Jumbo frames (10Gb)
* Ensure that the interfaces used in receiver pc have MTU 9000 (jumbo frames) enabled.
#. Detector IP (Not Eiger)
* Ensure it is valid and does not end if 0 or 255. Also ensure that the detector ip is in the same subnet as rx_udpip and the masking in the interface configuration ensures this rule.
#. Tcpdump or wireshark
* Use one of these to confirm that you receive packets (with the right filtering ie. source and destination ports, ip).
#. Check SFP modules
* Check if the SFP modules on both sides of the fiber are of same type.
#. Pinging the subnet (receiving only a few number of packets each time)
* If a switch is used between a receiver pc and detector instead of plugging the cables directly, one might have to ping any ip in the subnet of the Ethernet interface constantly so that it does not forget the ip during operation.
* Eg. if rx_udpip is 10.2.3.100, then ping constantly 10.2.3.xxx, where xxx is any ip other than 100.
.. _Receiver PC Tuning:
Receiver PC Tuning Options
^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Increase maximum receive socket buffer size and socket input packet queue.
* Temporarily (until shut down)
.. code-block:: bash
# check size
sysctl -a | grep rmem
sysctl -a | grep backlog
# set max and default (use 1Gb for Jungfrau and 100Mb for others)
sysctl net.core.rmem_max=$((100*1024*1024))
sysctl net.core.rmem_default=$((100*1024*1024))
sysctl net.core.netdev_max_backlog=250000
* Permanently
.. code-block:: bash
# edit /etc/sysctl.conf file
# set max and default (use 1Gb for Jungfrau and 100Mb for others)
net.core.rmem_max = 104857600
net.core.rmem_default= 104857600
net.core.netdev_max_backlog = 250000
# save file and run the following
sysctl -p
.. note ::
This is the most basic setting, which is sometimes more than enough.
#. For 10Gb,
* MTU must be set up to 9000 for jumbo frames on detector, switch and server NIC
* Set up static MAC address tables with separated VLANs
#. Write to memory if not a large disk and pc not fast enough.
.. code-block:: bash
mount -t tmpfs none /ramdisk_folder
# or
mount -t tmpfs none /mnt/ramdisk -o size=10G
# check how many GB memory you can allocate, to avoid swapping otherwise
#. Modify ethtool settings.
* rx ring parameters
.. code-block:: bash
# check
ethtool -g xth1
# set to max value in your pc settings
ethtool -G xth1 rx 4096
* coalesce settings (might not always work)
.. code-block:: bash
# check
ethtool -c xth1
# set to max value in your pc settings
ethtool -C xth1 rx-usecs 100
* pause parameters
.. code-block:: bash
# check
ethtool -a xth1
# set to max value in your pc settings
ethtool -A xth1 rx on
.. note ::
| xth1 is example interface name.
| These settings are lost at pc reboot.
#. Give user speicific user scheduling privileges.
.. code-block:: bash
# edit /etc/security/limits.conf
# add following line or similar depending on your distribution
username rtprio 99
.. note ::
This is also set if slsReceiver is run as root user.
#. Disable power saving in CPU frequency
.. code-block:: bash
# or similar command depending on your distribution
cpupower frequency-info
cpupower frequency-set -g performance
# or
cpufreq-info
for i in seq 0 7; do cpufreq-set -c $i -g performance; done
slsReceiver Tuning
^^^^^^^^^^^^^^^^^^
#. Starting receiver as root to have scheduling privileges.
#. For 10g, enable flow control
.. code-block:: bash
sls_detector_put flowcontrol10g 1
#. Increase slsReceiver fifo depth between listening and processing threads.
.. code-block:: bash
sls_detector_get rx_fifodepth
# sets number of frames in fifo to 5000
sls_detector_put rx_fifodepth 5000
#. Increase number of frames per file to reduce time taken to open and close files.
.. code-block:: bash
sls_detector_get rx_framesperfile
sls_detector_put rx_framesperfile 20000
# writes all frames into a single file
sls_detector_put rx_framesperfile 0
Shared memory error
^^^^^^^^^^^^^^^^^^^
| For errors due to access or size, delete shared memory files nd try again.
To list all shared memory files of sls detector package.
.. code-block:: bash
ll /dev/shm/slsDetectorPackage*
-rw-------. 1 l_d l_d 136 Oct 1 11:42 /dev/shm/slsDetectorPackage_multi_0
-rw-------. 1 l_d l_d 3476 Oct 1 11:42 /dev/shm/slsDetectorPackage_multi_0_sls_0
-rw-------. 1 l_d l_d 3476 Oct 1 11:42 /dev/shm/slsDetectorPackage_multi_0_sls_1
Cannot connect to detector
^^^^^^^^^^^^^^^^^^^^^^^^^^
Ensure both control and stop servers are running on the detector.
.. code-block:: bash
ps -ef | grep jungfrauDetectorServer*
Cannot connect to receiver
^^^^^^^^^^^^^^^^^^^^^^^^^^
Start receiver before running a client command that needs to communicate with receiver.
Receiver: cannot bind socket
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. slsReceiver or slsMultiReceiver is already open somewhere.
* Kill it and restart it.
#. Tcp port is in use by another application.
* Start Receiver with a different tcp port and adjust it config file
.. code-block:: bash
# restart receiver with different port
slsReceiver -t1980
# adjust in config file
rx_hostname pcxxxx:1980
.. _common troubleshooting multi module data:
Cannot get multi module data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Possible causes could be the following:
#. Network
* If you have a direct connection, check to see if the network cables are connected correctly to corresponding interfaces on the PC side. Check also the network configuration and that the detectors and receivers are in the corresponding subnet.
#. Power Supply
* Check power supply current limit.
* For Jungfrau, refer to :ref:`Jungfrau Power Supply Troubleshooting<Jungfrau Troubleshooting Power Supply>`.
Gotthard
----------
Missing first frame or next frame after a delay
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Connect the data link from the Module directly to receiver pc or to a private network.
Jungfrau
---------
Temperature event occured
^^^^^^^^^^^^^^^^^^^^^^^^^
This will occur only if:
* temp_threshold (threshold temperature) has been set to a value
* temp_control (temperature control) set to 1
* and the temperature overshooted the threshold temperature.
**Consequence**
* sls_detector_get temp_event will give 1 # temperature event occured
* the chip will be powered off
**Solution**
* Even after fixing the cooling, any subsequent powerchip command will fail unless the temperature event has been cleared.
* Clear the temperature event
.. code-block:: bash
# gives the current chip power status (zero currently as chip powered off)
sls_detector_get powerchip
# clear temperature event
sls_detector_put temp_event 0
# power on the chip
sls_detector_put powerchip 1
.. _Jungfrau Troubleshooting Power Supply:
Cannot get multi module data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. Check :ref:`Common Multi Module Troubleshooting<common troubleshooting multi module data>`
#. Power Supply
* Comment out this line in the config file: powerchip 1
* Powering on the chip increases the power consumption by a considerable amount. If commenting out this line aids in getting data (strange data due to powered off chip), then it could be the power supply current limit. Fix it (possibly to 8A current limit) and uncomment the powerchip line back in config file.

148
docs/src/virtualserver.rst Normal file
View File

@ -0,0 +1,148 @@
.. _Virtual Detector Servers:
Detector Simulators
===================
Compilation
-----------
* Using CMake, turn on the option
.. code-block:: bash
SLS_USE_SIMULATOR=ON
* Using cmk.sh script,
.. code-block:: bash
./cmk.sh -b**s**j9 #option s is for simulator
Binaries
^^^^^^^^
.. code-block:: bash
eigerDetectorServerMaster_virtual
eigerDetectorServerSlaveTop_virtual
eigerDetectorServerSlaveBottom_virtual
jungfrauDetectorServer_virtual
gotthardDetectorServer_virtual
gotthard2DetectorServer_virtual
mythen3DetectorServer_virtual
moenchDetectorServer_virtual
ctbDetectorServer_virtual
Arguments
---------
The arguments are the same as the :ref:`normal server arguments<Detector Server Arguments>`.
When using multiple modules, use different ports for each virtual server.
.. code-block:: bash
# will start control server at port 1912 and stop server at port 1913
jungfrauDetectorServer --port 1912 &
# will start second control server at port 1914 and stop server at port 1915
jungfrauDetectorServer --port 1914 &
Client
------
.. code-block:: bash
# hostname should include the port (if not default)
sls_detector_put hostname localhost:1912+localhost:1914+
# or use virtual command, instead of hostname
# connects to 2 servers at localhost
# (control servers: 1912, 1914; stop servers: 1913, 1915)
sls_detector_put virtual 2 1912
Use the same in the config file.
Sample Config file
^^^^^^^^^^^^^^^^^^
There are sample config files for each detector in slsDetectorPackage/examples folder.
For a Single Module
.. code-block:: bash
# connects to control port 1912
hostname localhost:1912+
# connects to receiver at ports 2012
rx_hostname mpc1922:2012+
# sets destination udp ports (not needed, default is 50001)
udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips
udp_srcip 192.168.1.112
# destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto
# set file path
fpath /tmp
For Multiple Modules
.. code-block:: bash
# connects to control ports 1912, 1914 and stop ports 1913, 1915
virtual 2 1912
# or hostname localhost:1912+localhost:1914+
# connects to receivers at ports 2012 and 2014
rx_hostname mpc1922:2012+mpc1922:2013+
# sets differernt destination udp ports
0:udp_dstport 50012
1:udp_dstport 50014
# source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112
1:udp_srcip 192.168.1.114
# destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto
# set file path
fpath /tmp
Receivers
----------
Same as if you would use an actual detector
For a Single Module
.. code-block:: bash
slsReceiver -t2012
For Multiple Modules
.. code-block:: bash
# slsMultiReceiver [starting port] [number of receivers] [print each frame header for debugging]
slsMultiReceiver 2012 2 0
Gui
----
| Same as if you would use an actual detector.
| Compile with SLS_USE_GUI=ON in cmake or -g option in cmk.sh script.
.. code-block:: bash
slsDetectorGui
Limitations
-----------
#. Data coming out of virtual server is fake. Value at each pixel/ channel is incremented by 1.
#. A stop will stop the virtual acquisition only at the start of every new frame.
#. Triggers are counted as number of virtual frames. trigger command to send a software trigger (Mythen3 & Eiger) is not implemented in virtual server.
#. firmware version and serial number will give 0.

4
docs/static/extra.css vendored Normal file
View File

@ -0,0 +1,4 @@
/* override table no-wrap */
.wy-table-responsive table td, .wy-table-responsive table th {
white-space: normal;
}

View File

@ -1,33 +1,37 @@
detsizechan 1024 512
# detetctor geometry, long side of the module first
detsize 1024 512
# detector hostname for controls
hostname beb059+beb058+
#1Gb detector hostname for controls
0:rx_tcpport 1991
#tcpport for the first halfmodule
0:rx_udpport 50011
# 1Gb receiver pc hostname with tcp port to configure receiver
rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# udp port first quadrant, first halfmodule
0:rx_udpport2 50012
0:udp_dstport 50011
# udp port second quadrant, first halfmodule
0:rx_udpip 10.0.30.210
0:udp_dstport2 50012
# udp IP of the receiver over 10Gb
0:detectorip 10.0.30.100
#first half module 10 Gb IP
0:udp_dstip 10.0.30.210
# first half module 10 Gb IP (same subnet as 0:udp_dstip)
0:udp_srcip 10.0.30.100
1:rx_tcpport 1992
#tcpport for the second halfmodule
1:rx_udpport 50013
# udp port first quadrant, second halfmodule
1:rx_udpport2 50014
1:udp_dstport 50013
# udp port second quadrant, second halfmodule
1:rx_udpip 10.0.40.210
1:udp_dstport2 50014
# udp IP of the receiver over 10Gb,
#can be the same or different from 0:rx_udpip
1:detectorip 10.0.40.101
1:udp_dstip 10.0.40.210
# second half module 10 Gb IP
# can be the same or different from 0:rx_udpip
# butsame subnet as 1:udp_dstip
1:udp_srcip 10.0.40.101
rx_hostname x12sa-vcons
#1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
threaded 1
# output directory
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M

View File

@ -1,24 +1,21 @@
detsizechan 1024 512
# detetctor geometry, long side of the module first
detsize 1024 512
# detector hostname for controls
hostname beb059+beb058+
#1Gb detector hostname for controls
0:rx_tcpport 1991
#tcpport for the first halfmodule
0:rx_udpport 50011
# 1Gb receiver pc hostname with tcp port to configure receiver
rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# udp port first quadrant, first halfmodule
0:rx_udpport2 50012
0:udp_dstport 50011
#udp port second quadrant, first halfmodule
0:udp_dstport2 50012
1:rx_tcpport 1992
#tcpport for the second halfmodule
1:rx_udpport 50013
# udp port first quadrant, second halfmodule
1:rx_udpport2 50014
1:udp_dstport 50013
# udp port second quadrant, second halfmodule
1:udp_dstport2 50014
rx_hostname x12sa-vcons
#1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
threaded 1
# output directory
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M

View File

@ -1,27 +1,12 @@
# detector hostname
hostname bchip007
#0:port 1952
#0:stopport 1953
#0:rx_tcpport 1956 must also have this in receiver config file
0:angdir 1.000000
0:moveflag 0.000000
0:extsig:0 off
#0:detectorip 129.129.202.9
0:detectormac 00:aa:bb:cc:dd:ee
0:rx_udpport 50004
0:rx_udpip 129.129.202.98
0:rx_hostname pc6898
0:outdir /bigRAID/datadir_gotthard/rec_test_data
0:highvoltage 120
master -1
sync none
outdir /bigRAID/datadir_gotthard/rec_test_data
headerbefore none
headerafter none
headerbeforepar none
headerafterpar none
badchannels none
angconv none
globaloff 0.000000
binsize 0.001000
# receiver pc hostname of 1Gb IP of the machine
rx_hostname my_receiver_hostname
# output directory
fpath /bigRAID/datadir_gotthard/rec_test_data
# high voltage
highvoltage 120

View File

@ -1,29 +1,34 @@
# detector hostname
hostname strip3
# receiver pc hostname with tcp port
rx_hostname pc12365:1982
# udp source ip
udp_srcip 10.1.1.184
# udp destination ip (receiver interface ip)
udp_dstip 10.1.1.107
# only needed for debugging veto signals
# udp destination port must be different from udp_dstport (default of 50001)
udp_dstport2 50084
udp_srcip2 10.1.1.185
udp_dstip2 10.1.1.107
rx_hostname pc12365:1954
#udp_dstmac 3c:fd:fe:d2:a4:25
# output directory
fpath /tmp
fname run
# disable file writing
fwrite 0
bursts 10
frames 2700
burstperiod 100ms
# to enable 2nd interface for veto debugging
numinterfaces 2
# enable veto data streaming
veto 1
#fixing data looks
# Sampling pipeline 1 clk
reg 0x120 0x00000010
clkphase 1 135 deg

View File

@ -1,32 +0,0 @@
fname run
index 0
dr 16
settings veryhighgain
threshold 0
exptime 0.000002990
period 0.000024984
delay 0.999999968
gates 1
frames 300000.000000000
triggers 1.000000000
timing auto
fineoff 0.000000
startscript none
startscriptpar none
stopscript none
stopscriptpar none
scriptbefore none
scriptbeforepar none
scriptafter none
scriptafterpar none
scan0script none
scan0par none
scan0prec 0
scan0steps 0
scan1script none
scan1par none
scan1prec 0
scan1steps 0
ratecorr 0.000000
flatfield none
badchannels none

View File

@ -1,17 +1,17 @@
detsizechan 2560 1
# detector hostname
hostname bchip074+bchip075+
# receiver pc hostname of 1Gb IP of the machine (with tcpport)
rx_hostname my_receiver_hostname+my_receiver_hostname:1955
0:extsig:0 trigger_in_rising_edge
0:rx_tcpport 1954
0:rx_udpport 50001
0:highvoltage 0
# default udp destination port 50001
1:udp_dstport 50002
1:extsig:0 trigger_in_rising_edge
1:rx_tcpport 1955
1:rx_udpport 50002
1:highvoltage 0
# output directory
fpath /tmp
extsig 0 trigger_in_rising_edge
highvoltage 0
##############################################################################
#########
@ -19,39 +19,27 @@ hostname bchip074+bchip075+
#########
##############################################################################
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
#0:rx_zmqip my_receiver_hostname
#0:rx_zmqport 30003
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
#0:zmqip my_client_hostname
#0:zmqport 40003
## receiver pc hostname of 1Gb IP of the machine
#rx_zmqip my_receiver_hostname
## client/gui or softIOc pc hostname
#zmqip my_client_hostname
# #replace my_receiver_hostname with the hostname of IP of the machine where the receiver runs
#1:rx_zmqip my_receiver_hostname
## rxr zmq streaming out port
#0:rx_zmqport 30003
## client zmq listening port
#0:zmqport 40003
## rxr zmq streaming out port
#1:rx_zmqport 30004
# #replace my_client_hostname with the hostname of IP of the machine where the client/GUI or softIOC runs
#1:zmqip my_client_hostname
## client zmq listening port
#1:zmqport 40004
## stream out every frame via zmq
#rx_zmqfreq 1
## enable zmq streaming
#rx_zmqstream 1
##############################################################################
#########
######### until here
#########
##############################################################################
r_readfreq 1
rx_zmqstream 1
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
rx_hostname my_receiver_hostname
rx_zmqstream 1
outdir /tmp/
settings veryhighgain
exptime 0.000005
period 0.0001
highvoltage 90

View File

@ -8,8 +8,6 @@ adcclk 20
dbitclk 40
patword 0000 0000000000000000
patword 0001 0000000000000000
patword 0002 0008000900080000
@ -424,21 +422,24 @@ patwaittime1 0
patwait2 0400
patwaittime2 0
#0:rx_tcpport 1977
#############################################
### edit with hostname or 1Gbs IP address of your server
############################################
rx_hostname mpc2011
#rx_hostname mpc2011:1977
#############################################
### edit with 10 Gbs IP of your server
############################################
0:udp_dstip 10.1.1.102
#0:udp_dstip 129.129.202.136
udp_dstip 10.1.1.102
#udp_dstip 129.129.202.136
#############################################
### edit with any number in the subnet of your server (first 3 numbers as above)
############################################
0:udp_srcip 10.1.1.19
#0:udp_srcip 129.129.202.13
udp_srcip 10.1.1.19
#udp_srcip 129.129.202.13
0:udp_dstport 33410
udp_dstport 33410
#############################################
### edit with 10 Gbs IP of your server
############################################
@ -452,13 +453,7 @@ patwaittime2 0
#zmqport 50001
#############################################
### edit with hostname or 1Gbs IP address of your server
############################################
rx_hostname mpc2011
tengiga 1
rx_zmqstream 1
rx_zmqfreq 1
@ -496,6 +491,5 @@ rx_jsonpara detectorMode analog
#flags newpedestal
#flags analog
reg 0x5e 0x00010000
#powerchip 1
powerchip 1
highvoltage 90

View File

@ -1,16 +1,41 @@
hostname localhost
# detector hostname
hostname bchip052
0:rx_udpport 50004
0:rx_udpip 172.24.8.84
0:detectorip 172.24.8.254
rx_hostname localhost
# 1Gb receiver pc hostname (default tcpport: 1954)
rx_hostname pcmoench01
#powerchip 1
#highvoltage 200
# udp destination port (receiver)
udp_dstport 50004
#extsig:0 trigger_in_rising_edge
#timing trigger
# udp destination ip (receiver)
#udp_dstip 172.24.8.84
# or to get ip from rx_hostname
udp_dstip auto
outdir /tmp/slsdetector
# udp source ip (same subnet as udp_dstip)
udp_srcip 172.24.8.254
# PCBv2.0 (using 2 interfaces)
udp_dstport2 50005
udp_dstip2 auto
udp_srcip2 172.24.8.111
# enable two interfaces
numinterfaces 2
# select inner interface(effective only when numinterfaces is 1)
#selinterface 1
# power on chip
powerchip 1
# high voltage
highvoltage 200
# timing to trigger
timing trigger
# output file directory
fpath /external_pool/jungfrau_data/softwaretest
# disable file writing
fwrite 0

View File

@ -1,26 +1,49 @@
detsizechan 1024 1024
# detector geometry x, y
detsize 1024 1024
# detector hostname
hostname bchip048+bchip052+
0:rx_udpport 50004
0:rx_udpip 10.1.1.100
0:rx_udpmac F4:52:14:2F:32:00
0:detectorip 10.1.1.10
0:detectormac 00:aa:bb:cc:dd:33
# 1Gb receiver pc hostname (default tcpport: 1954)
rx_hostname pcmoench01+pcmoench01:1955
1:rx_tcpport 1955
1:rx_udpport 50005
1:rx_udpip 10.1.1.100
1:rx_udpmac F4:52:14:2F:32:00
1:detectorip 10.1.1.11
1:detectormac 00:aa:bb:cc:dd:33
rx_hostname pcmoench01
# udp configurations for 1st module
# udp destination port (receiver)
0:udp_dstport 50004
# udp destination ip (receiver)
0:udp_dstip 10.1.1.100
# udp source ip (same subnet as 0:udp_dstip)
0:udp_srcip 10.1.1.10
# udp configurations for 2nd module
# udp destination port (receiver)
1:udp_dstport 50005
# udp destination ip (receiver)
1:udp_dstip 10.1.1.100
# udp source ip (same subnet as 1:udp_dstip)
1:udp_srcip 10.1.1.11
# power on chip
powerchip 1
# high voltage
highvoltage 200
#extsig:0 trigger_in_rising_edge
#timing trigger
outdir /external_pool/jungfrau_data/softwaretest
# timing to trigger
timing trigger
# output file directory
fpath /external_pool/jungfrau_data/softwaretest
# disable file writing
fwrite 0

32
examples/measurement_setup.det Executable file
View File

@ -0,0 +1,32 @@
# file name prefix
fname measurement1
# file acquisition index
findex 3000
# dynamic range (only for Mythen3 and Eiger)
dr 32
# settings
settings veryhighgain
# exposure time
exptime 100us
# period
period 2ms
# frames per trigger
frames 30000
# timing mode
timing trigger
# triggers
triggers 10
# delay after trigger
delay 1ms

View File

@ -9,7 +9,6 @@ hostname bchip181+
############################################
rx_hostname mpc2011
rx_tcpport 1954
#############################################
### edit with 10 Gbs IP of your server
############################################
@ -33,7 +32,6 @@ zmqport 50001
tengiga 1
rx_zmqstream 1
@ -41,12 +39,13 @@ rx_zmqstream 1
frames 100000
period 0.0006
#############################################
### edit with directory you want to write to
############################################
fpath /mnt/moench_data/scratch/
fwrite 0
rx_zmqstream 1
rx_jsonpara frameMode frame
rx_jsonpara detectorMode counting

View File

@ -1,55 +0,0 @@
#####Any line with a # is not read######
detsizechan 2560 1
hostname bchip007+bchip009+
#0:hostname bchip007
#0:port 1952
#0:stopport 1953
#0:rx_tcpport 1956
0:angdir 1.000000
0:moveflag 0.000000
0:ffdir /home/l_msdetect
0:extsig:0 off
0:detectorip 10.1.1.2
#0:detectormac 00:aa:bb:cc:dd:ee
#0:rx_udpport 50001
0:rx_udpip 10.1.1.1
0:rx_hostname 129.129.202.134
0:outdir /data/speedt
0:highvoltage 120
#1:hostname bchip009
#1:port 1952
#1:stopport 1953
1:rx_tcpport 1957
1:angdir 1.000000
1:moveflag 0.000000
1:ffdir /home/l_msdetect
1:extsig:0 off
1:detectorip 10.1.2.2
#1:detectormac 00:aa:bb:cc:dd:ee
1:rx_udpport 50004
1:rx_udpip 10.1.2.1
1:rx_hostname 129.129.202.134
1:outdir /data/speedt
1:highvoltage 120
master -1
sync none
outdir /data/speedt
ffdir /home/l_msdetect
headerbefore none
headerafter none
headerbeforepar none
headerafterpar none
badchannels none
angconv none
globaloff 0.000000
binsize 0.001000

View File

@ -0,0 +1,477 @@
# detector hostname
hostname localhost:1910
# receiver hostname
rx_hostname mpc1922:2010
# udp destination ports
udp_dstport 50010
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# output file directory
fpath /tmp
# disable file writing
fwrite 0
# default clocks
runclk 40
adcclk 20
dbitclk 40
# patterns
patword 0x0000 0x0000000000000000
patword 0x0001 0x0000000000000000
patword 0x0002 0x0008000900080000
patword 0x0003 0x0008000900080000
patword 0x0004 0x0008000900080000
patword 0x0005 0x0008000900080000
patword 0x0006 0x0008000900080000
patword 0x0007 0x0008000900080000
patword 0x0008 0x0008000900080000
patword 0x0009 0x0008000900080000
patword 0x000a 0x0008000900080000
patword 0x000b 0x0008000900080000
patword 0x000c 0x0008000900080000
patword 0x000d 0x0008000900080000
patword 0x000e 0x0008000900080000
patword 0x000f 0x0008000900080000
patword 0x0010 0x0008000900080000
patword 0x0011 0x0008000900080000
patword 0x0012 0x0008000900080000
patword 0x0013 0x0008000900080000
patword 0x0014 0x0008000900080000
patword 0x0015 0x0008000900080000
patword 0x0016 0x0008400900080020
patword 0x0017 0x0008400900080020
patword 0x0018 0x0008599f0418503a
patword 0x0019 0x0008599f0418503a
patword 0x001a 0x0108599f0418503a
patword 0x001b 0x0108599f0418503a
patword 0x001c 0x0108599f0418503a
patword 0x001d 0x0108599f0418503a
patword 0x001e 0x0108599f0418503a
patword 0x001f 0x0108599f0418503a
patword 0x0020 0x0108599f0418503a
patword 0x0021 0x0108599f0418503a
patword 0x0022 0x0108599f0418503a
patword 0x0023 0x0108599f0418503a
patword 0x0024 0x0108599f0418503a
patword 0x0025 0x0108599f0418503a
patword 0x0026 0x0108599f0418503a
patword 0x0027 0x0108599f0418503a
patword 0x0028 0x0108599f0418503a
patword 0x0029 0x0108599f0418503a
patword 0x002a 0x0108599f0418503a
patword 0x002b 0x0108599f0418503a
patword 0x002c 0x0108599f0418503a
patword 0x002d 0x0108599f0418503a
patword 0x002e 0x0108599f0418503a
patword 0x002f 0x0108599f0418503a
patword 0x0030 0x0108599f0418503a
patword 0x0031 0x0108599f0418503a
patword 0x0032 0x0108599f0418503a
patword 0x0033 0x0108599f0418503a
patword 0x0034 0x0108599f0418503a
patword 0x0035 0x0108599f0418503a
patword 0x0036 0x0108599f0418503a
patword 0x0037 0x0108599f0418503a
patword 0x0038 0x0108599f0418503a
patword 0x0039 0x0108599f0418503a
patword 0x003a 0x0108599f0418503a
patword 0x003b 0x0108599f0418503a
patword 0x003c 0x0108599f0418503a
patword 0x003d 0x0108599f0418503a
patword 0x003e 0x0108599f0418503a
patword 0x003f 0x0108599f0418503a
patword 0x0040 0x0108599f0418503a
patword 0x0041 0x0108599f0418503a
patword 0x0042 0x0108599f0418503a
patword 0x0043 0x0108599f0418503a
patword 0x0044 0x0108599f0418503a
patword 0x0045 0x0108599f0418503a
patword 0x0046 0x0108599f0418503a
patword 0x0047 0x0108599f0418503a
patword 0x0048 0x0108599f0418503a
patword 0x0049 0x0108599f0418503a
patword 0x004a 0x0108599f0418503a
patword 0x004b 0x0108599f0418503a
patword 0x004c 0x0108599f0418503a
patword 0x004d 0x0108599f0418503a
patword 0x004e 0x0108599f0418503a
patword 0x004f 0x0108599f0418503a
patword 0x0050 0x0108599f0418503a
patword 0x0051 0x0108599f0418503a
patword 0x0052 0x0108599f0418503a
patword 0x0053 0x0108599f0418503a
patword 0x0054 0x0108599f0418503a
patword 0x0055 0x0108599f0418503a
patword 0x0056 0x0108599f0418503a
patword 0x0057 0x0108599f0418503a
patword 0x0058 0x0108599f0418503a
patword 0x0059 0x0108599f0418503a
patword 0x005a 0x0108599f0418503a
patword 0x005b 0x0108599f0418503a
patword 0x005c 0x0108599f0418503a
patword 0x005d 0x0108599f0418503a
patword 0x005e 0x0108599f0418503a
patword 0x005f 0x0108599f0418503a
patword 0x0060 0x0108599f0418503a
patword 0x0061 0x0108599f0418503a
patword 0x0062 0x0108599f0418503a
patword 0x0063 0x0108599f0418503a
patword 0x0064 0x0108599f0418503a
patword 0x0065 0x0108599f0418503a
patword 0x0066 0x0108599f0418503a
patword 0x0067 0x0108599f0418503a
patword 0x0068 0x0108599f0418503a
patword 0x0069 0x0108599f0418503a
patword 0x006a 0x0108599f0418503a
patword 0x006b 0x0108599f0418503a
patword 0x006c 0x0108599f0418503a
patword 0x006d 0x0108599f0418503a
patword 0x006e 0x0108599f0418503a
patword 0x006f 0x0108599f0418503a
patword 0x0070 0x0108599f0418503a
patword 0x0071 0x0108599f0418503a
patword 0x0072 0x0108599f0418503a
patword 0x0073 0x0108599f0418503a
patword 0x0074 0x0108599f0418503a
patword 0x0075 0x0108599f0418503a
patword 0x0076 0x0108599f0418503a
patword 0x0077 0x0108599f0418503a
patword 0x0078 0x0108599f0418503a
patword 0x0079 0x0108599f0418503a
patword 0x007a 0x0108599f0418503a
patword 0x007b 0x0108599f0418503a
patword 0x007c 0x0108599f0418503a
patword 0x007d 0x0108599f0418503a
patword 0x007e 0x010859960418503a
patword 0x007f 0x010859960418503a
patword 0x0080 0x010859960418503a
patword 0x0081 0x010859960418503a
patword 0x0082 0x010859960418503a
patword 0x0083 0x010859960418503a
patword 0x0084 0x010859960418503a
patword 0x0085 0x010859960418503a
patword 0x0086 0x010859960418503a
patword 0x0087 0x010859960418503a
patword 0x0088 0x010859960418503a
patword 0x0089 0x010859960418503a
patword 0x008a 0x010859960418503a
patword 0x008b 0x010859960418503a
patword 0x008c 0x010859960418503a
patword 0x008d 0x010859960418503a
patword 0x008e 0x010859960418503a
patword 0x008f 0x010859960418503a
patword 0x0090 0x010859960418503a
patword 0x0091 0x010859960418503a
patword 0x0092 0x010819960418501a
patword 0x0093 0x010819960418501a
patword 0x0094 0x010819960418501a
patword 0x0095 0x010819960418501a
patword 0x0096 0x030819960418501a
patword 0x0097 0x030819960418501a
patword 0x0098 0x030819960418501a
patword 0x0099 0x030819960418501a
patword 0x009a 0x030819960418501a
patword 0x009b 0x030819960418501a
patword 0x009c 0x030819960418501a
patword 0x009d 0x030819960418501a
patword 0x009e 0x030819960418501a
patword 0x009f 0x030819960418501a
patword 0x00a0 0x030819960418501a
patword 0x00a1 0x030819960418501a
patword 0x00a2 0x030819960418501a
patword 0x00a3 0x030819960418501a
patword 0x00a4 0x030819960418501a
patword 0x00a5 0x030819960418501a
patword 0x00a6 0x030819960418501a
patword 0x00a7 0x030819960418501a
patword 0x00a8 0x030819960418501a
patword 0x00a9 0x030819960418501a
patword 0x00aa 0x030819960418501a
patword 0x00ab 0x030819960418501a
patword 0x00ac 0x030819960008501a
patword 0x00ad 0x030819960008501a
patword 0x00ae 0x030819960008501a
patword 0x00af 0x030819960008501a
patword 0x00b0 0x030819960008501a
patword 0x00b1 0x030819960008501a
patword 0x00b2 0x030819960008501a
patword 0x00b3 0x030819960008501a
patword 0x00b4 0x030819960008501a
patword 0x00b5 0x030819960008501a
patword 0x00b6 0x030819960008501a
patword 0x00b7 0x030819960008501a
patword 0x00b8 0x030819960008501a
patword 0x00b9 0x030819960008501a
patword 0x00ba 0x030819960008501a
patword 0x00bb 0x030819960008501a
patword 0x00bc 0x030819960008501a
patword 0x00bd 0x030819960008501a
patword 0x00be 0x030819960008501a
patword 0x00bf 0x030819960008501a
patword 0x00c0 0x0308199f0008501a
patword 0x00c1 0x0308199f0008501a
patword 0x00c2 0x0308199f0008501a
patword 0x00c3 0x0308199f0008501a
patword 0x00c4 0x0308199f0008501a
patword 0x00c5 0x0308199f0008501a
patword 0x00c6 0x0308199f0008501a
patword 0x00c7 0x0308199f0008501a
patword 0x00c8 0x0308199f0008501a
patword 0x00c9 0x0308199f0008501a
patword 0x00ca 0x0308199f0008501a
patword 0x00cb 0x0308199f0008501a
patword 0x00cc 0x0308199f0008501a
patword 0x00cd 0x0308199f0008501a
patword 0x00ce 0x0308199f0008501a
patword 0x00cf 0x0308199f0008501a
patword 0x00d0 0x0308199f0008501a
patword 0x00d1 0x0308199f0008501a
patword 0x00d2 0x0308199f0008501a
patword 0x00d3 0x0308199f0008501a
patword 0x00d4 0x0308599f0008503a
patword 0x00d5 0x0308599f0008503a
patword 0x00d6 0x030c599f000850ba
patword 0x00d7 0x030c599f000850ba
patword 0x00d8 0x030c599f000850ba
patword 0x00d9 0x030c599f000850ba
patword 0x00da 0x030c599f000850ba
patword 0x00db 0x030c599f000850ba
patword 0x00dc 0x030c599f000850ba
patword 0x00dd 0x030c599f000850ba
patword 0x00de 0x030c599f000850ba
patword 0x00df 0x030c599f000850ba
patword 0x00e0 0x030c599f000850ba
patword 0x00e1 0x030c599f000850ba
patword 0x00e2 0x030c599f000850ba
patword 0x00e3 0x030c599f000850ba
patword 0x00e4 0x030c599f000850ba
patword 0x00e5 0x030c599f000850ba
patword 0x00e6 0x030c599f000850ba
patword 0x00e7 0x030c599f000850ba
patword 0x00e8 0x030c599f000850ba
patword 0x00e9 0x030c599f000850ba
patword 0x00ea 0x030c799f010858ba
patword 0x00eb 0x030c799f010858ba
patword 0x00ec 0x030c599f000850ba
patword 0x00ed 0x030c599f000850ba
patword 0x00ee 0x030c599f000850ba
patword 0x00ef 0x030c599f000850ba
patword 0x00f0 0x030c599f000850ba
patword 0x00f1 0x030c599f000850ba
patword 0x00f2 0x030c599f000850ba
patword 0x00f3 0x030c599f000850ba
patword 0x00f4 0x030c599f000850ba
patword 0x00f5 0x030c599f000850ba
patword 0x00f6 0x030c599f000850ba
patword 0x00f7 0x030c599f000850ba
patword 0x00f8 0x030c599f000850ba
patword 0x00f9 0x030c599f000850ba
patword 0x00fa 0x030c599f000850ba
patword 0x00fb 0x030c599f000850ba
patword 0x00fc 0x030c599f000850ba
patword 0x00fd 0x030c599f000850ba
patword 0x00fe 0x030c599f000850ba
patword 0x00ff 0x030c599f000850ba
patword 0x0100 0x030c599f000850ba
patword 0x0101 0x030c599f000850ba
patword 0x0102 0x030c599f400850ba
patword 0x0103 0x030c599f400850ba
patword 0x0104 0x030c599f600850ba
patword 0x0105 0x030c599f400850ba
patword 0x0106 0x030c599f400850ba
patword 0x0107 0x030c599f400850ba
patword 0x0108 0x870c599f682e50ba
patword 0x0109 0x870c599f482850ba
patword 0x010a 0x870c599f000e50ba
patword 0x010b 0x870c599f000850ba
patword 0x010c 0x870c599f000e50ba
patword 0x010d 0x870c599f000850ba
patword 0x010e 0x870c599f000e50ba
patword 0x010f 0x870c599f000850ba
patword 0x0110 0x870c599f000e50ba
patword 0x0111 0x870c599f000850ba
patword 0x0112 0x870c599f000e50ba
patword 0x0113 0x870c599f000850ba
patword 0x0114 0x870c599f000e50ba
patword 0x0115 0x870c599f000850ba
patword 0x0116 0x870c599f000e50ba
patword 0x0117 0x870c599f000850ba
patword 0x0118 0x870c599f000e50ba
patword 0x0119 0x870c599f000850ba
patword 0x011a 0x870c599f000e50ba
patword 0x011b 0x870c599f000850ba
patword 0x011c 0x870c599f000e50ba
patword 0x011d 0x870c599f000850ba
patword 0x011e 0x870c599f000e50ba
patword 0x011f 0x870c599f000850ba
patword 0x0120 0x870c599f000e50ba
patword 0x0121 0x870c599f000850ba
patword 0x0122 0x870c599f200e50ba
patword 0x0123 0x870c599f000850ba
patword 0x0124 0x870c599f000e50ba
patword 0x0125 0x870c599f000850ba
patword 0x0126 0x870c599f000e50ba
patword 0x0127 0x870c599f000850ba
patword 0x0128 0x870c599f000e50ba
patword 0x0129 0x870c599f000850ba
patword 0x012a 0x870c599f000e50ba
patword 0x012b 0x870c599f000850ba
patword 0x012c 0x870c599f000e50ba
patword 0x012d 0x870c599f000850ba
patword 0x012e 0x870c599f000e50ba
patword 0x012f 0x870c599f000850ba
patword 0x0130 0x870c599f000e50ba
patword 0x0131 0x870c599f000850ba
patword 0x0132 0x870c599f000e50ba
patword 0x0133 0x870c599f000850ba
patword 0x0134 0x870c599f000e50ba
patword 0x0135 0x870c599f000850ba
patword 0x0136 0x870c599f000e50ba
patword 0x0137 0x870c599f000850ba
patword 0x0138 0x870c599f000e50ba
patword 0x0139 0x870c599f000850ba
patword 0x013a 0x870c599f282e50ba
patword 0x013b 0x870c599f082850ba
patword 0x013c 0x870c599f000e50ba
patword 0x013d 0x870c599f000850ba
patword 0x013e 0x870c599f000e50ba
patword 0x013f 0x870c599f000850ba
patword 0x0140 0x870c599f000e50ba
patword 0x0141 0x870c599f000850ba
patword 0x0142 0x870c599f000e50ba
patword 0x0143 0x870c599f000850ba
patword 0x0144 0x870c599f000e50ba
patword 0x0145 0x870c599f000850ba
patword 0x0146 0x870c599f000e50ba
patword 0x0147 0x870c599f000850ba
patword 0x0148 0x870c599f000e50ba
patword 0x0149 0x870c599f000850ba
patword 0x014a 0x870c599f000e50ba
patword 0x014b 0x870c599f000850ba
patword 0x014c 0x870c599f000e50ba
patword 0x014d 0x870c599f000850ba
patword 0x014e 0x870c599f000e50ba
patword 0x014f 0x870c599f000850ba
patword 0x0150 0x870c599f000e50ba
patword 0x0151 0x870c599f000850ba
patword 0x0152 0x870c599f000e50ba
patword 0x0153 0x870c599f000850ba
patword 0x0154 0x870c599f200e50ba
patword 0x0155 0x870c599f000850ba
patword 0x0156 0x870c599f000e50ba
patword 0x0157 0x870c599f000850ba
patword 0x0158 0x870c599f000e50ba
patword 0x0159 0x870c599f000850ba
patword 0x015a 0x870c599f000e50ba
patword 0x015b 0x870c599f000850ba
patword 0x015c 0x870c599f000e50ba
patword 0x015d 0x870c599f000850ba
patword 0x015e 0x870c599f000e50ba
patword 0x015f 0x870c599f000850ba
patword 0x0160 0x870c599f000e50ba
patword 0x0161 0x870c599f000850ba
patword 0x0162 0x870c599f000e50ba
patword 0x0163 0x870c599f000850ba
patword 0x0164 0x870c599f000e50ba
patword 0x0165 0x870c599f000850ba
patword 0x0166 0x870c599f000e50ba
patword 0x0167 0x870c599f000850ba
patword 0x0168 0x870c599f000e50ba
patword 0x0169 0x870c599f000850ba
patword 0x016a 0x870c599f000e50ba
patword 0x016b 0x870c599f000850ba
patword 0x016c 0x070c599f000850ba
patword 0x016d 0x070c599f000850ba
patword 0x016e 0x000c599f000850ba
patword 0x016f 0x000c599f000850ba
patword 0x0170 0x0008599f200e503a
patword 0x0171 0x0008599f0008503a
patword 0x0172 0x0008599f200e503a
patword 0x0173 0x0008599f0008503a
patword 0x0174 0x0008599f0008503a
patword 0x0175 0x0008599f0008503a
patword 0x0176 0x0008599f0008503a
patword 0x0177 0x0008599f0008503a
patword 0x0178 0x0008599f0008503a
patword 0x0179 0x0008599f0008503a
patword 0x017a 0x0008599f0008503a
patword 0x017b 0x0008599f0008503a
patword 0x017c 0x0008599f0008503a
patword 0x017d 0x0008599f0008503a
patword 0x017e 0x0008599f0008503a
patword 0x017f 0x0008599f0008503a
patword 0x0180 0x0008599f0008503a
patword 0x0181 0x0008599f0008503a
patword 0x0182 0x0008599f0008503a
patword 0x0183 0x0008599f0008503a
patword 0x0184 0x0008599f0008503a
patword 0x0185 0x0008599f0008503a
patword 0x0186 0x0008599f0008503a
patword 0x0187 0x0008599f0008503a
patword 0x0188 0x0008599f0008503a
patword 0x0189 0x0008599f0008503a
patword 0x018a 0x0008599f0008503a
patword 0x018b 0x0008599f0008503a
patword 0x018c 0x0008599f0008503a
patword 0x018d 0x0008599f0008503a
patioctrl 0x8f0effff6dbffdbf
patlimits 0x0000 0x018c
patloop0 0x013a 0x016b
patnloop0 0x199
patloop1 0x0400 0x0400
patnloop1 0
patloop2 0x0400 0x0400
patnloop2 0
patwait0 0x00aa
patwaittime0 10000
patwait1 0x0400
patwaittime1 0
patwait2 0x0400
patwaittime2 0
# dacs
dac 6 800
dac 0 1300
dac 4 1428
dac 1 1000
dac 7 900
dac 3 680
dac 2 1400
dac 5 1200
adcinvert 4a342593
# analog samples
asamples 5000
# digital samples
dsamples 0
# adc phase
adcphase 30 deg
# adc pipeline
adcpipeline 14
# analog readout
romode analog
# frames
frames 1
# period
period 1ms

View File

@ -0,0 +1,22 @@
# detector hostname
hostname localhost:1900
# receiver hostname
rx_hostname mpc1922:2000
# udp destination ports
udp_dstport 50000
udp_dstport2 50001
# udp destination ip from rx_hostname
udp_dstip auto
# output file directory
fpath /tmp
# disable file writing
fwrite 0
#imagetest 1

View File

@ -0,0 +1,23 @@
# detector hostname
hostname localhost:1900+localhost:1902+
# receiver hostname
rx_hostname mpc1922:2000+mpc1922:2001+
# udp destination ports
0:udp_dstport 50000
0:udp_dstport2 50001
1:udp_dstport 50002
1:udp_dstport2 50003
# udp destination ip from rx_hostname
udp_dstip auto
# output file directory
fpath /tmp
# disable file writing
fwrite 0
#imagetest 1

View File

@ -0,0 +1,23 @@
# detector hostname
hostname localhost:1904
# receiver hostname
rx_hostname mpc1922:2004
# udp destination ports
udp_dstport 50004
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# output file directory
fpath /tmp
# disable file writing
fwrite 0

View File

@ -0,0 +1,37 @@
# detector hostname
hostname localhost:1914
# receiver hostname
rx_hostname mpc1922:2014
# udp destination ports
udp_dstport 50014
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# output file directory
fpath /tmp
# disable file writing
fwrite 0
# enable 2nd interface for veto debugging
# udp destination port for veto
udp_dstport2 50015
# udp destination ip (from rx_hostname)
udp_dstip2 auto
# udp source ip (same subnet as udp_dstip)
udp_srcip2 192.168.1.100
# to enable 2nd interface for veto debugging
numinterfaces 2
# enable veto data streaming
veto 1

View File

@ -0,0 +1,32 @@
# detector hostname
hostname localhost:1906
# receiver hostname
rx_hostname mpc1922:2006
# udp destination ports
udp_dstport 50006
udp_dstport2 50007
# udp destination ip from rx_hostname
udp_dstip auto
udp_dstip2 auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
udp_srcip2 192.168.1.100
# output file directory
fpath /tmp
# disable file writing
fwrite 0
#imagetest 1
#frames 1
# enable two interfaces
numinterfaces 2
# select inner interface(effective only when numinterfaces is 1)
#selinterface 1

View File

@ -0,0 +1,47 @@
# detector geometry
detsize 2048 1024
# detector hostname
virtual 4 1952
# receiver hostname and tcpports
0:rx_tcpport 1970
1:rx_tcpport 1971
2:rx_tcpport 1972
3:rx_tcpport 1973
rx_hostname mpc1922
# udp destination ports
0:udp_dstport2 50001
0:udp_dstport2 50002
1:udp_dstport 50003
1:udp_dstport2 50004
2:udp_dstport 50005
2:udp_dstport2 50006
3:udp_dstport 50007
3:udp_dstport2 50008
# udp destination ip from rx_hostname
udp_dstip auto
udp_dstip2 auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
udp_srcip2 192.168.1.100
# transmission delay frame
0:txndelay_frame 0
1:txndelay_frame 1
2:txndelay_frame 2
3:txndelay_frame 3
# output file directory
fpath /tmp
# disable file writing
fwrite 0
#imagetest 1
#frames 1

View File

@ -0,0 +1,21 @@
# detector hostname
hostname localhost:1908
# receiver hostname
rx_hostname mpc1922:2008
# udp destination ports
udp_dstport 50008
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# output file directory
fpath /tmp
# disable file writing
fwrite 0

View File

@ -0,0 +1,24 @@
# detector hostname
hostname localhost:1912
# receiver hostname
rx_hostname mpc1922:2012
# udp destination ports
udp_dstport 50012
# udp destination ip from rx_hostname
udp_dstip auto
# udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100
# output file directory
fpath /tmp
# disable file writing
fwrite 0
# load ascii pattern file
#pattern ../pat.txt

View File

@ -316,7 +316,11 @@ You can then reset to zero the number of frames caught (in releases<5.0), then
\item {\tt{sls\_detector\_put 0-receiver start}}
\item {\tt{sls\_detector\_put 0-status start}}
\end{enumerate}
In release \textcolor{red}{5.0} it is not needed to reset the frames caughts.
In release \textcolor{red}{5.0} it is not needed to reset the frames caughts and the commands are:
\begin{enumerate}
\item \textcolor{red}{{\tt{sls\_detector\_put 0-rx\_start}}}
\item \textcolor{red}{{\tt{sls\_detector\_put 0-start}}}
\end{enumerate}
You can poll the detector status using:
\begin{verbatim}
@ -325,17 +329,17 @@ sls_detector_get 0-status
When the detector is {\tt{idle}}, then the acquisition is done but the receiver could still be receiving data. If you want, you can check if the receiver is finished receiving as many frames as you were expecting (this is optional but required for many many frames acquisition or when using some delays to send data at very high frame rate.
\begin{enumerate}
\setcounter{enumi}{3}
\item {\tt{sls\_detector\_get framescaught}}
\item {\tt{sls\_detector\_get framescaught}} (\textcolor{red}{rx\_framescaught})
\end{enumerate}
Then you can stop the receiver as well now:
\begin{enumerate}
\setcounter{enumi}{4}
\item {\tt{sls\_detector\_put 0-receiver stop}}
\item {\tt{sls\_detector\_put 0-receiver stop} (\textcolor{red}{sls\_detector\_put 0-rx\_stop})}
\end{enumerate}
The detector will not accept other commands while acquiring. If an acquisition wishes to be properly aborted, then:
\begin{itemize}
\item {\tt{sls\_detector\_put 0-status stop}}
\item {\tt{sls\_detector\_put 0-status stop} (\textcolor{red}{sls\_detector\_put 0-stop})}
\end{itemize}
this same command can be used after a non proper abortion of the acquisition to reset to normal status the detector.
@ -1056,9 +1060,9 @@ Note that if one wants to reconstruct the real time the detector was acquiring
\subsection{Offline image reconstruction}
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. However, it can be retrieved from \\
{\tt{git clone https://github.com/slsdetectorgroup/slsImageReconstruction.git slsImageReconstruction}}.\\
Checkout the {\tt{v3.1}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. There is a {\tt{developer}} branch that has newer updates but needs to be tested.
Checkout the {\tt{v3.1}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. There is a {\tt{developer}} branch that is following the 5.X chnages but it is not officila yet.
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5}. \textbf{tiff} and \textbf{root} format. The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
Four possible conversions are possible: into \textbf{cbf}, \textbf{hdf5}. \textbf{tiff} and \textbf{root} format. The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in \\
{\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:

View File

@ -1,82 +0,0 @@
import pytest
import datetime as dt
from slsdet import Detector, timingMode, detectorType
not_eiger = pytest.mark.skipif(
Detector().type == detectorType.EIGER, reason="Does not work for eiger"
)
@pytest.fixture
def det():
from slsdet import Detector
return Detector()
def test_frames(det):
for n in [1, 100, 3245, 10000]:
det.frames = n
assert det.frames == n
det.frames = 1
def test_triggers(det):
for n in [1, 100, 3245, 10000]:
det.triggers = n
assert det.triggers == n
det.triggers = 1
def test_exptime(det):
det.exptime = 1
assert det.exptime == 1
det.exptime = dt.timedelta(milliseconds=10)
assert det.exptime == 0.01
det.exptime = 1
def test_period(det):
det.period = 3.2
assert det.period == 3.2
p = dt.timedelta(microseconds=1020)
det.period = p
assert det.period == 0.001020
r = det.getPeriod()
assert r[0] == p
det.period = 0
assert det.period == 0
def test_lock(det):
for l in [True, False]:
det.lock = l
assert det.lock == l
def test_timing(det):
# auto and trigger is available for all det
for m in [timingMode.TRIGGER_EXPOSURE, timingMode.AUTO_TIMING]:
det.timing = m
assert det.timing == m
@not_eiger
def test_delay(det):
det.delay = 1
assert det.delay == 1
t = dt.timedelta(microseconds=1)
det.delay = t
assert det.delay == t.total_seconds()
r = det.getDelayAfterTrigger()[0]
assert r == t
det.delay = 0
assert det.delay == 0
@not_eiger
def test_delayl(det):
assert det.delayl == 0

View File

@ -1,89 +0,0 @@
import pytest
import datetime as dt
from slsdet import Detector, detectorType
"""
These tests are designed to work the API and catch
any changes in behavior or naming. Tests are expected
to pass with a virtual detector or a real one
"""
@pytest.fixture
def jf():
from slsdet import Jungfrau
return Jungfrau()
jungfrautest = pytest.mark.skipif(
Detector().type != detectorType.JUNGFRAU, reason="Only valid for Jungfrau"
)
@jungfrautest
def test_storagecells(jf):
for i in range(16):
jf.storagecells = i
assert jf.storagecells == i
jf.storagecells = 0 # default
@jungfrautest
def test_storagecell_start(jf):
for i in range(16):
jf.storagecell_start = i
assert jf.storagecell_start == i
jf.storagecells = 15 # default
@jungfrautest
def test_storagecell_delay(jf):
for t in [0.001, 0.0002, 0.0013]:
jf.storagecell_delay = t
assert jf.storagecell_delay == t
jf.storagecell_delay = 0 # default
@jungfrautest
def test_temp_event(jf):
# hard to test with virtual server
assert jf.temp_event == 0
@jungfrautest
def test_temp_threshold(jf):
for th in [0, 10, 43, 72]:
jf.temp_threshold = th
assert jf.temp_threshold == th
jf.temp_threshold = 0
@jungfrautest
def test_auto_comp_disable(jf):
for v in [True, False]:
jf.auto_comp_disable = v
assert jf.auto_comp_disable == v
@jungfrautest
def test_numinterfaces(jf):
for n in [2, 1]:
jf.numinterfaces = n
assert jf.numinterfaces == n
@jungfrautest
def test_dr(jf):
assert jf.dr == 16
@jungfrautest
def test_temp_control(jf):
for v in [True, False]:
jf.temp_control = v
assert jf.temp_control == v
@jungfrautest
def test_startingfnum(jf):
for n in [10, 127, 43321, 1]:
jf.startingfnum = n
assert jf.startingfnum == n
@jungfrautest
def test_selinterface(jf):
for i in [1, 0]:
jf.selinterface = i
assert jf.selinterface == i

View File

@ -1,11 +1,14 @@
import os
import sys
import numpy as np
from pathlib import Path
sys.path.append(os.path.join(os.getcwd(), 'bin'))
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb, Gotthard2, Moench
from slsdet import dacIndex, readoutMode
from slsdet.lookup import view, find
import slsdet
d = Detector()
e = Eiger()

View File

@ -80,7 +80,10 @@ dacs = [
'vth1',
'vth2',
'vth3',
'vtrim'
'vtrim',
'ib_test_c',
'ibias_sfp',
]
intentionally_missing = [
@ -102,6 +105,14 @@ intentionally_missing = [
'pulse', # use pulseChip pulsePixel pulsePixelNmove
'pulsechip',
'pulsenmove',
'savepattern', #use savePattern()
'resetfpga', #use resetFPGA()
'rebootcontroller', #use rebootController()
'firmwaretest', #use executeFirmwareTest
'bustest', # executeBusTest
'programfpga', #programFPGA
'dac', #use setDAC or detector specific class
'clearroi', #clearROI
]
pycmd += intentionally_missing

View File

@ -1,17 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 16:49:07 2017
@author: l_frojdh
"""
fw_version = 23
detector_type = 'Eiger'
known_hostnames = ['beb083', 'beb098']
image_size = (512,1024) #rows, cols
module_geometry = (1,2) #horizontal, vertical
#Remember to change these in the settings file as well!
settings_path = '/home/l_frojdh/slsDetectorPackage/settingsdir/eiger'
file_path = '/home/l_frojdh/out'

View File

@ -1,27 +0,0 @@
import pytest
from sls_detector import Detector
@pytest.fixture
def detector():
from sls_detector import Detector
return Detector()
@pytest.fixture
def eiger():
from sls_detector import Eiger
d = Eiger()
d.n_frames = 1
d.exposure_time = 1
d.file_write = False
return d
@pytest.fixture
def jungfrau():
from sls_detector import Jungfrau
return Jungfrau()
detector_type = Detector().detector_type
eigertest = pytest.mark.skipif(detector_type != 'Eiger', reason = 'Only valid for Eiger')
jungfrautest = pytest.mark.skipif(detector_type != 'Jungfrau', reason = 'Only valid for Jungfrau')

View File

@ -1,33 +0,0 @@
detsizechan 1024 512
#hostname for top+bottom+
hostname beb083+beb098+
#top
0:rx_tcpport 1954
0:lock 0
0:rx_udpport 50010
0:rx_udpport2 50011
0:rx_hostname mpc2048
0:flippeddatax 0
#bottom
1:rx_tcpport 1955
1:lock 0
1:rx_udpport 50004
1:rx_udpport2 50005
1:rx_hostname mpc2048
1:flippeddatax 1
settingsdir /home/l_frojdh/slsDetectorPackage/settingsdir/eiger
outdir /home/l_frojdh/out
vthreshold 1500
vtr 4000
dr 32
threaded 1
tengiga 0
highvoltage 150
iodelay 660
#gappixels 1

View File

@ -1,2 +0,0 @@
vrf 3000
vthreshold 1800

View File

@ -1,44 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Testing setting dynamic range for Eiger.
If the detector is not Eiger the tests are skipped
"""
import pytest
import config_test
from fixtures import detector, eiger, jungfrau, eigertest, jungfrautest
from sls_detector.errors import DetectorValueError
@eigertest
def test_set_dynamic_range_and_make_acq(eiger):
eiger.exposure_time = 0.5
eiger.n_frames = 2
for dr in [4, 8, 16, 32]:
eiger.dynamic_range = dr
assert eiger.dynamic_range == dr
eiger.acq()
assert eiger.frames_caught == 2
@eigertest
def test_set_dynamic_range_raises(eiger):
with pytest.raises(DetectorValueError):
eiger.dynamic_range = 1
with pytest.raises(DetectorValueError):
eiger.dynamic_range = 75
with pytest.raises(DetectorValueError):
eiger.dynamic_range = -3
with pytest.raises(DetectorValueError):
eiger.dynamic_range = 12
@eigertest
def test_set_dynamic_range_reduces_speed(eiger):
eiger.readout_clock = 'Full Speed'
eiger.dynamic_range = 32
assert eiger.dynamic_range == 32
assert eiger.readout_clock == 'Quarter Speed'
eiger.dynamic_range = 16
assert eiger.dynamic_range == 16
assert eiger.readout_clock == 'Half Speed'

View File

@ -1,119 +0,0 @@
import pytest
import config_test
import time
from sls_detector.errors import DetectorValueError
from fixtures import eiger, eigertest
@eigertest
def test_set_matrix_reset(eiger):
eiger.eiger_matrix_reset = False
assert eiger.eiger_matrix_reset == False
eiger.eiger_matrix_reset = True
assert eiger.eiger_matrix_reset == True
@eigertest
def test_set_tx_delay_left_single(eiger):
eiger.tx_delay.left[0] = 130
assert eiger.tx_delay.left[0] == 130
eiger.tx_delay.left[1] = 150
assert eiger.tx_delay.left[1] == 150
eiger.tx_delay.left[0] = 0
eiger.tx_delay.left[1] = 0
assert eiger.tx_delay.left[0] == 0
assert eiger.tx_delay.left[1] == 0
@eigertest
def test_set_tx_delay_right_single(eiger):
eiger.tx_delay.right[0] = 130
assert eiger.tx_delay.right[0] == 130
eiger.tx_delay.right[1] = 150
assert eiger.tx_delay.right[1] == 150
eiger.tx_delay.right[0] = 0
eiger.tx_delay.right[1] = 0
assert eiger.tx_delay.right[0] == 0
assert eiger.tx_delay.right[1] == 0
@eigertest
def test_set_tx_delay_frame_single(eiger):
eiger.tx_delay.frame[0] = 500
eiger.tx_delay.frame[1] = 600
assert eiger.tx_delay.frame[0] == 500
assert eiger.tx_delay.frame[1] == 600
eiger.tx_delay.frame[0] = 0
eiger.tx_delay.frame[1] = 0
assert eiger.tx_delay.frame[0] == 0
assert eiger.tx_delay.frame[1] == 0
@eigertest
def test_tx_delay_from_list(eiger):
eiger.tx_delay.left = [123,456]
assert eiger.tx_delay.left[:] == [123,456]
eiger.tx_delay.right = [789,100]
assert eiger.tx_delay.right[:] == [789,100]
eiger.tx_delay.frame = [1000,90000]
assert eiger.tx_delay.frame[:] == [1000,90000]
eiger.tx_delay.left = [0, 0]
eiger.tx_delay.right = [0, 0]
eiger.tx_delay.frame = [0, 0]
assert eiger.tx_delay.left[:] == [0, 0]
assert eiger.tx_delay.right[:] == [0, 0]
assert eiger.tx_delay.frame[:] == [0, 0]
@eigertest
def test_acitve(eiger):
eiger.file_write = False
eiger.reset_frames_caught()
eiger.active[1] = False
eiger.acq()
assert eiger._api.getFramesCaughtByReceiver(1) == 0
assert eiger._api.getFramesCaughtByReceiver(0) == 1
eiger.active = True
time.sleep(0.5)
eiger.acq()
assert eiger.frames_caught == 1
@eigertest
def test_set_default_settings(eiger):
eiger.default_settings()
assert eiger.n_frames == 1
assert eiger.exposure_time == 1
assert eiger.period == 0
assert eiger.n_cycles == 1
assert eiger.dynamic_range == 16
@eigertest
def test_flowcontrol10g(eiger):
eiger.flowcontrol_10g = True
assert eiger.flowcontrol_10g == True
eiger.flowcontrol_10g = False
assert eiger.flowcontrol_10g == False
@eigertest
def test_read_vcmp(eiger):
eiger.vthreshold = 1500
assert eiger.vcmp[:] == [1500]*4*eiger.n_modules
@eigertest
def test_set_vcmp(eiger):
eiger.vcmp = [1000,1100,1200,1300,1400,1500,1600,1700]
assert eiger.vcmp[:] == [1000,1100,1200,1300,1400,1500,1600,1700]
eiger.vthreshold = 1500
#Disabled only works with receiver on the same pc
# @eigertest
# def test_setup500k():
# from sls_detector import Eiger, free_shared_memory
# free_shared_memory()
# d = Eiger()
# d.setup500k(config_test.known_hostnames)
# d.acq()
# assert d.rx_tcpport == [1954,1955]
# assert d.frames_caught == 1
# #could assert more setting but if the frame is caught it worked...

View File

@ -1,129 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tests specific for the firmware.
Check that register values are correct after starting an exposure
0x4 exposure time
0x5 period
0x6 sub exposure time
"""
import pytest
import config_test
from fixtures import detector, eiger, jungfrau, eigertest, jungfrautest
from sls_detector.errors import DetectorValueError
from sls_detector.utils import eiger_register_to_time
# testdata_exptimes = [0.001, 0.002, 0.0236]
@eigertest
def test_short_exposure_time(eiger):
t = 1.23
eiger.exposure_time = t
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
#Register 0x4 holds exposure time
reg = eiger.register[0x4]
assert pytest.approx(t, 1e-9) == eiger_register_to_time(reg)
@eigertest
def test_short_minimal_exposure_time(eiger):
t = 1e-8
eiger.exposure_time = t
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
#Register 0x4 holds exposure time
reg = eiger.register[0x4]
assert pytest.approx(t, 1e-9) == eiger_register_to_time(reg)
@eigertest
def test_long_exposure_time(eiger):
t = 623
eiger.exposure_time = t
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
# Register 0x4 holds exposure time
reg = eiger.register[0x4]
assert pytest.approx(t, 1e-9) == eiger_register_to_time(reg)
@eigertest
def test_short_period(eiger):
t = 0.1
eiger.exposure_time = 0.001
eiger.period = t
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
# Register 0x5 holds period
reg = eiger.register[0x5]
assert pytest.approx(t, 1e-9) == eiger_register_to_time(reg)
@eigertest
def test_long_period(eiger):
t = 8900
eiger.exposure_time = 0.001
eiger.period = t
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
# Register 0x5 holds period
reg = eiger.register[0x5]
assert pytest.approx(t, 1e-9) == eiger_register_to_time(reg)
@eigertest
def test_zero_period_with_acq(eiger):
t = 0
eiger.exposure_time = 0.001
eiger.period = t
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
# Register 0x5 holds period
reg = eiger.register[0x5]
assert pytest.approx(t, 1e-9) == eiger_register_to_time(reg)
testdata_times = [0.001, 0.002, 0.0236]
@eigertest
@pytest.mark.parametrize("t", testdata_times)
def test_subexptime(eiger,t):
eiger.sub_exposure_time = t
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
# Register 0x6 holds sub exposure time
# time is stored straight as n clocks
reg = eiger.register[0x6]
assert pytest.approx(t, 1e-9) == reg/100e6
@eigertest
@pytest.mark.parametrize("t", testdata_times)
def test_subdeadtime(eiger, t):
eiger.sub_deadtime = t
eiger.sub_exposure_time = 1
eiger.sub_exposure_time = 0.001
eiger.file_write = False
eiger.start_detector()
eiger.stop_detector()
# Register 0x7 holds sub period
# time is stored straight as n clocks
# exptime+deadtime
reg = eiger.register[0x7]
assert pytest.approx(t, 1e-7) == (reg/100e6-0.001)

View File

@ -1,187 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
General tests for the Detector class. Should not depend on the connected detector. Aim is to have tests working
for both Jungfrau and Eiger.
NOTE! Uses hostnames from config_test
"""
import pytest
import config_test
from fixtures import detector
from sls_detector.errors import DetectorValueError, DetectorError
def test_error_handling(detector):
with pytest.raises(DetectorError):
detector._provoke_error()
def test_not_busy(detector):
"""Test that the detector is not busy from the start"""
assert detector.busy == False
def test_reset_frames_caught(detector):
detector.file_write = False
detector.acq()
assert detector.frames_caught == 1
detector.reset_frames_caught()
assert detector.frames_caught == 0
def test_set_busy_true_then_false(detector):
"""Test both cases of assignment"""
detector.busy = True
assert detector.busy == True
detector.busy = False
assert detector.busy == False
def test_set_readout_speed(detector):
for s in ['Full Speed', 'Half Speed', 'Quarter Speed', 'Super Slow Speed']:
detector.readout_clock = s
assert detector.readout_clock == s
def test_wrong_speed_raises_error(detector):
with pytest.raises(KeyError):
detector.readout_clock = 'Something strange'
def test_readout_clock_remains(detector):
s = detector.readout_clock
try:
detector.readout_clock = 'This does not exists'
except KeyError:
pass
assert detector.readout_clock == s
def test_len_method(detector):
"""to test this we need to know the length, this we get from the configuration of hostnames"""
assert len(detector) == len(config_test.known_hostnames)
def test_setting_n_cycles_to_zero_gives_error(detector):
with pytest.raises(DetectorValueError):
detector.n_cycles = 0
def test_setting_n_cycles_to_negative_gives_error(detector):
with pytest.raises(DetectorValueError):
detector.n_cycles = -50
def test_set_cycles_frome_one_to_ten(detector):
for i in range(1,11):
detector.n_cycles = i
assert detector.n_cycles == i
detector.n_cycles = 1
assert detector.n_cycles == 1
def test_get_detector_type(detector):
assert detector.detector_type == config_test.detector_type
def test_set_file_index(detector):
detector.file_index = 5
assert detector.file_index == 5
def test_negative_file_index_raises(detector):
with pytest.raises(ValueError):
detector.file_index = -8
def test_setting_file_name(detector):
fname = 'hej'
detector.file_name = fname
assert detector.file_name == fname
def test_set_file_write(detector):
detector.file_write = True
assert detector.file_write == True
detector.file_write = False
assert detector.file_write == False
def test_set_high_voltage(detector):
detector.high_voltage = 55
assert detector.high_voltage == 55
def test_negative_voltage_raises(detector):
with pytest.raises(DetectorValueError):
detector.high_voltage = -5
def test_high_voltage_raises_on_to_high(detector):
with pytest.raises(DetectorValueError):
detector.high_voltage = 500
def test_get_image_size(detector):
"""Compares with the size in the config file"""
assert detector.image_size.rows == config_test.image_size[0]
assert detector.image_size.cols == config_test.image_size[1]
def test_get_module_geometry(detector):
"""Compares with the size in the config file"""
assert detector.module_geometry.horizontal == config_test.module_geometry[0]
assert detector.module_geometry.vertical == config_test.module_geometry[1]
def test_set_nframes(detector):
detector.n_frames = 5
assert detector.n_frames == 5
detector.n_frames = 1
assert detector.n_frames == 1
def test_set_n_measurements(detector):
detector.n_measurements = 7
assert detector.n_measurements == 7
detector.n_measurements = 1
assert detector.n_measurements == 1
def test_negative_nframes_raises(detector):
with pytest.raises(DetectorValueError):
detector.n_frames = -2
def test_nmodules(detector):
"""Assume that the number of modules should be the same as the number of hostnames"""
assert detector.n_modules == len(config_test.known_hostnames)
def test_is_detector_online(detector):
assert detector.online == True
def test_set_online(detector):
detector.online = False
assert detector.online == False
detector.online = True
assert detector.online == True
def test_receiver_is_online(detector):
assert detector.receiver_online == True
def test_set_receiver_online(detector):
detector.receiver_online = False
assert detector.receiver_online == False
detector.receiver_online = True
assert detector.receiver_online == True
def test_set_receiver_online_raises_on_non_bool(detector):
with pytest.raises(TypeError):
detector.receiver_online = 'probably not this'
def test_set_period(detector):
detector.period = 5.123
assert detector.period == 5.123
detector.period = 0
assert detector.period == 0
def test_set_timing_mode(detector):
detector.timing_mode = 'trigger'
assert detector.timing_mode == 'trigger'
detector.timing_mode = 'auto'
assert detector.timing_mode == 'auto'

View File

@ -1,38 +0,0 @@
import pytest
import config_test
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
from sls_detector.detector import element_if_equal
from sls_detector.errors import DetectorValueError
from fixtures import eiger, eigertest
@eigertest
def test_load_config_file_eiger(eiger):
"""Load a settings file and assert all settings"""
eiger.load_config(os.path.join(dir_path, 'test.config'))
assert eiger.rx_tcpport == [1954, 1955]
assert eiger.lock == False
assert eiger.rx_udpport == [50010, 50011, 50004, 50005]
assert eiger.rx_hostname == 'mpc2048'
assert eiger.flipped_data_x[:] == [False, True]
assert eiger.settings_path == config_test.settings_path
assert eiger.file_path == config_test.file_path
assert eiger.vthreshold == 1500
assert element_if_equal(eiger.dacs.vtr[:]) == 4000
assert eiger.dynamic_range == 32
assert eiger.tengiga == False
assert eiger.high_voltage == 150
assert element_if_equal(eiger.dacs.iodelay[:]) == 660
@eigertest
def test_load_parameters_file_eiger(eiger):
"""Load a parametes file and assert the settings in the file"""
eiger.load_parameters(os.path.join(dir_path, 'test.par'))
assert element_if_equal(eiger.dacs.vrf[:]) == 3000
assert eiger.vthreshold == 1800

View File

@ -1,81 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tests for network related functions of the detector
"""
import pytest
import config_test
from fixtures import eiger, eigertest, detector
# def test_last_client(detector):
# import socket
# # We probably should check for multiple ip's
# myip = socket.gethostbyname_ex(socket.gethostname())[-1][0]
# assert detector.last_client_ip == myip
def test_get_hostname(detector):
for detector_host, config_host in zip(detector.hostname, config_test.known_hostnames):
assert detector_host == config_host
def test_hostname_has_same_length_as_n_modules(detector):
assert len(detector.hostname) == detector.n_modules
# # def test_get_receiver_hostname(detector):
# # """Assume that the receiver are on the local computer"""
# # import socket
# # host = socket.gethostname().split('.')[0]
# # assert detector.rx_hostname == host
# def test_set_receiver_hostname(detector):
# import socket
# host = socket.gethostname().split('.')[0]
# phony_host = 'madeup'
# detector.rx_hostname = phony_host
# assert detector.rx_hostname == phony_host
# detector.rx_hostname = host
# assert detector.rx_hostname == host
@eigertest
def test_set_rx_zmqport_single_value(eiger):
eiger.rx_zmqport = 35000
assert eiger.rx_zmqport == [35000, 35001, 35002, 35003]
@eigertest
def test_set_rx_zmqport_list(eiger):
eiger.rx_zmqport = [37000, 38000]
assert eiger.rx_zmqport == [37000, 37001, 38000, 38001]
@eigertest
def test_set_rx_updport(eiger):
ports = [60010,60011,60012,60013]
eiger.rx_udpport = ports
assert eiger.rx_udpport == ports
eiger.acq()
assert eiger.frames_caught == 1
@eigertest
def test_rx_tcpport(eiger):
ports = eiger.rx_tcpport
eiger.rx_tcpport = [2000,2001]
assert eiger.rx_tcpport == [2000,2001]
eiger.rx_tcpport = ports
assert eiger.rx_tcpport == ports
eiger.acq()
assert eiger.frames_caught == 1
# @eigertest
# @pytest.mark.new
# def test_enable_disable_tengiga(eiger):
# """
# This test does not check for dat on the 10Gbit link, only the set and get functions
# """
# eiger.tengiga = True
# assert eiger.tengiga == True
# eiger.tengiga = False
# assert eiger.tengiga == False
#TODO! Add test for Jungfrau

View File

@ -1,54 +0,0 @@
import pytest
import config_test
from fixtures import detector, eiger, jungfrau, eigertest, jungfrautest
from sls_detector.errors import DetectorValueError
@eigertest
@pytest.mark.local
def test_set_path(eiger, tmpdir):
import os
path = os.path.join(tmpdir.dirname, tmpdir.basename)
eiger.file_path = path
assert eiger.file_path == path
@eigertest
@pytest.mark.local
def test_set_path_and_write_files(eiger, tmpdir):
import os
prefix = 'testprefix'
path = os.path.join(tmpdir.dirname, tmpdir.basename)
eiger.file_path = path
eiger.file_write = True
eiger.exposure_time = 0.1
eiger.n_frames = 1
eiger.timing_mode = 'auto'
eiger.file_name = prefix
eiger.file_index = 0
eiger.acq()
files = [f.basename for f in tmpdir.listdir()]
assert len(files) == 5
assert (prefix+'_d0_0.raw' in files) == True
assert (prefix+'_d1_0.raw' in files) == True
assert (prefix+'_d2_0.raw' in files) == True
assert (prefix+'_d3_0.raw' in files) == True
def test_set_discard_policy(detector):
detector.frame_discard_policy = 'nodiscard'
assert detector.frame_discard_policy == 'nodiscard'
detector.frame_discard_policy = 'discardpartial'
assert detector.frame_discard_policy == 'discardpartial'
detector.frame_discard_policy = 'discardempty'
assert detector.frame_discard_policy == 'discardempty'
def test_set_discard_policy_raises(detector):
with pytest.raises(ValueError):
detector.frame_discard_policy = 'adjfvadksvsj'
def test_set_frames_perfile(detector):
detector.frames_per_file = 5000
assert detector.frames_per_file == 5000

View File

@ -1,47 +0,0 @@
import pytest
import config_test
import time
from sls_detector.errors import DetectorValueError
import os
from fixtures import eiger, eigertest
testdata_th = [0,333,500,1750,2000]
@eigertest
@pytest.mark.parametrize("th", testdata_th)
def test_set_vthreshold(eiger, th):
eiger.vthreshold = th
assert eiger.vthreshold == th
@eigertest
def test_vthreshold_with_different_vcmp(eiger):
#When vcmp is different for the chip vthreshold should return -1
eiger.vthreshold = 1500
eiger.dacs.vcmp_ll = 1400
assert eiger.vthreshold == -1
@eigertest
def test_set_settingsdir(eiger):
path = os.path.dirname( os.path.realpath(__file__) )
path = os.path.join(path, 'settingsdir')
eiger.settings_path = path
assert eiger.settings_path == path
@eigertest
def test_set_trimmed_energies(eiger):
en = [5000,6000,7000]
eiger.trimmed_energies = en
assert eiger.trimmed_energies == en
#TODO! add checks for vcmp as well and improve naming
#TODO! remove dependency on beb number
testdata_en = [(5000, 500),(5500,750),(6000,1000),(6200,1100),(7000,1500)]
@eigertest
@pytest.mark.parametrize('val', testdata_en)
def test_set_energy_threshold(eiger, val):
eiger.settings = 'standard'
eiger.threshold = val[0]
assert eiger.threshold == val[0]
assert eiger.dacs.vrf[0] == val[1]

View File

@ -1,136 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tests regarding exposure time and period of the detector
Set and get test as well as test for duration and on detector
measurement of the time.
"""
import pytest
import config_test
from fixtures import detector, eiger, jungfrau, eigertest, jungfrautest
from sls_detector.errors import DetectorValueError, DetectorError
import time
testdata_times = [1e-8, 0.001, 0.5, 3.125, 5.0, 600, 784]
@pytest.mark.parametrize("t", testdata_times)
def test_set_and_get_exposure_time(eiger, t):
"""
Test that the exposure time we set in the detector
is the same as the one read back
"""
eiger.exposure_time = t
assert eiger.exposure_time == t
def test_negative_exposure_time_raises_error(eiger):
with pytest.raises(DetectorValueError):
eiger.exposure_time = -15
testdata_times = [0.001, 0.0025, 0.005, 5]
@pytest.mark.parametrize("t", testdata_times)
def test_set_subexptime(eiger, t):
eiger.sub_exposure_time = t
assert eiger.sub_exposure_time == t
testdata_times = [-5,6,7,50]
@pytest.mark.parametrize("t", testdata_times)
def test_set_subextime_too_large_or_neg(eiger, t):
with pytest.raises((DetectorError, DetectorValueError)):
eiger.sub_exposure_time = t
testdata_times = [0.2, 0.5, 1, 2, 5, 7]
@pytest.mark.slow
@pytest.mark.parametrize("t", testdata_times)
def test_measure_exposure_time_from_python(eiger, t):
"""
The main idea with this test is to make sure the overhead of a
single acq is less than tol[s]. This test also catches stupid bugs
that would for example not change the exposure time or make acquire
not blocking.
"""
tol = 0.5
eiger.dynamic_range = 16
eiger.file_write = False
eiger.n_frames = 1
eiger.exposure_time = t
assert eiger.exposure_time == t
t0 = time.time()
eiger.acq()
duration = time.time()-t0
assert duration < (t+tol)
testdata_times = [0.5, 1, 3, 5]
@pytest.mark.slow
@pytest.mark.parametrize("t", testdata_times)
def test_measure_period_from_python_and_detector(eiger, t):
tol = 0.5
nframes = 5
eiger.dynamic_range = 16
eiger.file_write = False
eiger.n_frames = nframes
eiger.exposure_time = 0.001
eiger.period = t
t0 = time.time()
eiger.acq()
duration = time.time()-t0
assert duration < t*(nframes-1)+tol
for mp in eiger.measured_period:
assert pytest.approx(mp, 1e-5) == t
testdata_times = [0.001, 0.002, 0.003, 0.005, 0.01]
@pytest.mark.parametrize("t", testdata_times)
def test_measure_subperiod_nonparallel(eiger, t):
readout_time = 500e-6
eiger.dynamic_range = 32
eiger.file_write = False
eiger.flags = 'nonparallel'
eiger.n_frames = 1
eiger.period = 0
eiger.exposure_time = 0.5
eiger.sub_exposure_time = t
eiger.sub_deadtime = 0
eiger.acq()
for mp in eiger.measured_subperiod:
assert pytest.approx(mp, abs=1e-5) == t+readout_time
@pytest.mark.parametrize("t", testdata_times)
def test_measure_subperiod_parallel(eiger, t):
readout_time = 12e-6
eiger.dynamic_range = 32
eiger.file_write = False
eiger.flags = 'parallel'
eiger.n_frames = 1
eiger.period = 0
eiger.exposure_time = 0.5
eiger.sub_exposure_time = t
eiger.sub_deadtime = 0
eiger.acq()
for mp in eiger.measured_subperiod:
assert pytest.approx(mp, abs=1e-5) == t+readout_time
@pytest.mark.parametrize("t", testdata_times)
def test_measure_subperiod_parallel_when_changing_deadtime(eiger, t):
readout_time = 12e-6
exposure_time = 0.001
eiger.dynamic_range = 32
eiger.file_write = False
eiger.flags = 'parallel'
eiger.n_frames = 1
eiger.period = 0
eiger.exposure_time = 0.5
eiger.sub_exposure_time = exposure_time
eiger.sub_deadtime = t
eiger.acq()
for mp in eiger.measured_subperiod:
assert pytest.approx(mp, abs=1e-5) == t+exposure_time

View File

@ -1,34 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tests for trimbit and dac related functions
"""
import pytest
import config_test
from fixtures import detector, eiger, jungfrau, eigertest, jungfrautest
from sls_detector.errors import DetectorValueError
@eigertest
def test_set_trimbits(eiger):
"""Limited values due to time"""
for i in [17, 32, 60]:
print(i)
eiger.trimbits = i
assert eiger.trimbits == i
@eigertest
def test_set_trimbits_raises_on_too_big(eiger):
with pytest.raises(DetectorValueError):
eiger.trimbits = 75
@eigertest
def test_set_trimbits_raises_on_negative(eiger):
with pytest.raises(DetectorValueError):
eiger.trimbits = -5
# @jungfrautest
# def test_jungfrau(jungfrau):
# """Example of a test that is not run with Eiger connected"""
# pass

View File

@ -1,16 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tests for hostname related functions of the detector
"""
import pytest
import config_test
from fixtures import detector, eiger, jungfrau, eigertest, jungfrautest
from sls_detector.errors import DetectorValueError
def test_firmware_version(detector):
assert detector.firmware_version == config_test.fw_version

View File

@ -1,42 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 14:13:48 2018
@author: l_frojdh
"""
import os
from sls_detector_tools.io import write_trimbit_file
from sls_detector_tools import mask
energy = [5000, 6000, 7000]
vrf = [500, 1000, 1500]
for i,e in enumerate(energy):
dacs = np.array( [[ 0., 0.], #vsvp
[4000., 4000.], #vtr
[vrf[i], vrf[i]], #vrf
[1400., 1400.], #vrs
[4000., 4000.], #vsvn
[2556., 2556.], #vtgstv
[1400., 1400.], #vcmp_ll
[1500., 1500.], #vcmp_lr
[4000., 4000.], #vcall
[1500., 1500.], #vcmp_rl
[1100., 1100.], #rxb_rb
[1100., 1100.], #rxb_lb
[1500., 1500.], #vcmp_rr
[1500., 1500.], #vcp
[2000., 2000.], #vcn
[1550., 1550.], #vis
[ 660., 660.], #iodelay
[ 0., 0.], #tau
])
tb = np.zeros((256,1024))
for beb in [83,98]:
write_trimbit_file(f'settingsdir/standard/{e}eV/noise.sn{beb:03d}', tb, dacs[:,0])
#print(os.getcwd())
#print( os.path.realpath(__file__))

View File

@ -1,17 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 14 16:49:07 2017
@author: l_frojdh
"""
fw_version = 0x180220
detector_type = 'Jungfrau'
known_hostnames = ['bchip038']
image_size = (512,1024) #rows, cols
module_geometry = (1,1) #horizontal, vertical
#Remember to change these in the settings file as well!
settings_path = '/home/l_lopez/projects/slsDetectorPackage/settingsdir/jungfrau'
file_path = '/home/l_lopez/out'

View File

@ -1,23 +0,0 @@
import pytest
from sls_detector import Detector
@pytest.fixture
def detector():
from sls_detector import Detector
return Detector()
@pytest.fixture
def eiger():
from sls_detector import Eiger
return Eiger()
@pytest.fixture
def jungfrau():
from sls_detector import Jungfrau
return Jungfrau()
detector_type = Detector().detector_type
eigertest = pytest.mark.skipif(detector_type != 'Eiger', reason = 'Only valid for Eiger')
jungfrautest = pytest.mark.skipif(detector_type != 'Jungfrau', reason = 'Only valid for Jungfrau')

View File

@ -1,17 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
General tests for the Jungfrau detector.
NOTE! Uses hostnames from config_test
"""
import pytest
import config_test
import tests
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
pytest.main(['-x', '-s', os.path.join(dir_path, 'tests/test_load_config.py')]) #Test 1
pytest.main(['-x', '-s', os.path.join(dir_path, 'tests/test_overtemperature.py')]) #Test 2

View File

@ -1,21 +0,0 @@
detsizechan 1024 512
settingsdir /home/l_lopez/projects/slsDetectorPackage/settingsdir/jungfrau
caldir /home/l_lopez/projects/slsDetectorPackage/settingsdir/jungfrau
lock 0
hostname bchip094+
rx_udpport 1754
rx_udpip 10.1.1.107
rx_udpmac 90:E2:BA:9A:4F:D4
detectorip 10.1.1.9
detectormac 00:aa:bb:cc:dd:ee
configuremac 0
powerchip 1
timing auto
outdir /home/l_lopez/out
threaded 1
high

View File

@ -1 +0,0 @@
highvoltage 200

View File

@ -1,43 +0,0 @@
import pytest
import config_test
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
from fixtures import jungfrau, jungfrautest
def load_config_file_jungfrau_test(jungfrau):
"""Load a settings file and assert all settings"""
print('\tStarting load_config_file_jungfrau_test test case')
jungfrau.free_shared_memory
jungfrau.load_config(os.path.join(dir_path, 'test.config'))
assert jungfrau.lock == False
assert jungfrau.rx_udpport == ['1754']
assert jungfrau.hostname == ['bchip094']
assert jungfrau.firmware_version == config_test.fw_version
print('\tFinished load_config_file_jungfrau_test test case')
def load_parameters_file_jungfrau_test(jungfrau):
"""Load a parametes file and assert the settings in the file"""
print('\tStarting load_parameters_file_jungfrau_test test case')
jungfrau.load_parameters(os.path.join(dir_path, 'test.par'))
assert jungfrau.high_voltage == 200
print('\tFinished load_parameters_file_jungfrau_test test case')
@jungfrautest
def test_main(jungfrau):
print('\nTesting configuration file loading')
load_config_file_jungfrau_test(jungfrau)
load_parameters_file_jungfrau_test(jungfrau)
print('Tested configuration file loading')

View File

@ -1,68 +0,0 @@
import pytest
import config_test
import time
from fixtures import jungfrau, jungfrautest
def powerchip_test(jungfrau, control):
"""
Test the main overtemperature protection control
"""
#Set test initial conditions
print('\tStarting powerchip_test test case')
jungfrau.power_chip = False
jungfrau.temperature_control = control
assert jungfrau.power_chip == False
jungfrau.temperature_threshold = 35
jungfrau.power_chip = True
if jungfrau.temperature_control is True:
if jungfrau.temperature_event is True:
assert jungfrau.power_chip == False
jungfrau.power_chip = True
assert jungfrau.power_chip == False
jungfrau.temperature_control = False
assert jungfrau.power_chip == True
jungfrau.temperature_control = True
jungfrau.temperature_threshold = 50
assert jungfrau.power_chip == False
print('\t\tWaiting to cool down the board. This may take a while...')
while jungfrau.temperature_threshold < jungfrau.temp.fpga[0]:
time.sleep(5)
print('\t\tJungfrau MCB temperature: {0:.2f} °C'.format(jungfrau.temp.fpga[0]))
#Leave enough time to let the board cool down a bit more
time.sleep(30)
jungfrau.reset_temperature_event()
assert jungfrau.temperature_event == False
assert jungfrau.power_chip == True
else:
assert jungfrau.power_chip == True
else:
print('\t\tWaiting to warm up the board. This may take a while...')
while jungfrau.temperature_threshold > jungfrau.temp.fpga[0]:
time.sleep(5)
print('\t\tJungfrau MCB temperature: {0:.2f} °C'.format(jungfrau.temp.fpga[0]))
assert jungfrau.temperature_event == False
assert jungfrau.power_chip == True
print('\tFinished powerchip_test test case')
#@jungfrautest
def test_main(jungfrau):
print('\nTesting overtemperature protection control')
powerchip_test(jungfrau, False)
powerchip_test(jungfrau, True)
print('Tested overtemperature protection control')

View File

@ -10,7 +10,7 @@ from .gotthard import Gotthard
from .moench import Moench
import _slsdet
xy = _slsdet.xy
defs = _slsdet.slsDetectorDefs
from .enums import *

File diff suppressed because it is too large Load Diff

View File

@ -51,12 +51,12 @@ class SlowAdcProxy:
def __repr__(self):
rstr = ''
for i in range(7):
for i in range(8):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item} mV' for item in r)
rstr += ' '.join(f'{item} uV' for item in r)
else:
rstr += f'{i}: {r} mV\n'
rstr += f'{i}: {r} uV\n'
return rstr.strip('\n')
@ -83,3 +83,46 @@ class ClkDivProxy:
rstr += f'{i}: {r}\n'
return rstr.strip('\n')
class MaxPhaseProxy:
"""
Proxy class to allow for more intuitive reading clockdivider
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
return element_if_equal(self.det.getMaxClockPhaseShift(key))
def __repr__(self):
rstr = ''
for i in range(5):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item}' for item in r)
else:
rstr += f'{i}: {r}\n'
return rstr.strip('\n')
class ClkFreqProxy:
"""
Proxy class to allow for more intuitive reading clockdivider
"""
def __init__(self, det):
self.det = det
def __getitem__(self, key):
return element_if_equal(self.det.getClockFrequency(key))
def __repr__(self):
rstr = ''
for i in range(5):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item}' for item in r)
else:
rstr += f'{i}: {r}\n'
return rstr.strip('\n')

View File

@ -3,16 +3,17 @@ Utility functions that are useful for testing and troubleshooting
but not directly used in controlling the detector
"""
from collections import namedtuple
import _slsdet #C++ lib
import functools
import datetime as dt
import pathlib
import os
from pathlib import Path
Geometry = namedtuple('Geometry', ['x', 'y'])
def is_iterable(item):
try:
iter(item)
@ -20,12 +21,14 @@ def is_iterable(item):
return False
return True
def get_set_bits(mask):
"""
Return a list of the set bits in a python integer
"""
return [i for i in range(mask.bit_length()) if (mask >> i) & 1]
def list_to_bitmask(values):
"""
Convert a list of integers to a bitmask with set bits
@ -37,11 +40,21 @@ def list_to_bitmask(values):
mask += 1 << v
return mask
def make_bitmask(args):
if isinstance(args, list):
return list_to_bitmask(args)
elif isinstance(args, dict):
return {key: list_to_bitmask(value) for key, value in args.items()}
else:
raise ValueError("Cannot convert arg to bitmask")
def to_geo(value):
if isinstance(value, _slsdet.xy):
return Geometry(x=value.x, y=value.y)
else:
raise ValueError("Can only convert sls_detector.xy")
raise ValueError("Can only convert slsdet.xy")
def all_equal(mylist):
"""If all elements are equal return true otherwise false"""
@ -61,6 +74,7 @@ def element_if_equal(mylist):
else:
return mylist
def reduce_time(mylist):
res = element_if_equal(element_if_equal(mylist))
if isinstance(res, dt.timedelta):
@ -70,6 +84,7 @@ def reduce_time(mylist):
else:
return [r.total_seconds() for r in res]
def element(func):
"""
Wrapper to return either list or element
@ -77,6 +92,7 @@ def element(func):
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
return element_if_equal(func(self, *args, **kwargs))
return wrapper
@ -91,13 +107,15 @@ def eiger_register_to_time(register):
exponent = register & 0b111
return clocks * 10**exponent / 100e6
def make_timedelta(t):
if isinstance(t, dt.timedelta):
return t
else:
return dt.timedelta(seconds=t)
def make_string_path(path):
def _make_string_path(path):
"""
Accepts either a pathlib.Path or a string, expands ~ to user and convert
Path to str
@ -110,12 +128,49 @@ def make_string_path(path):
raise ValueError("Cannot convert argument to posix path")
def set_using_dict(func, args):
if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
for key, value in args.items():
func(value, [key])
def make_string_path(path):
return _make(path, _make_string_path)
def make_ip(arg):
return _make(arg, _slsdet.IpAddr)
def make_mac(arg):
return _make(arg, _slsdet.MacAddr)
def make_path(arg):
return _make(arg, Path)
def _make(arg, transform):
"""Helper function for make_mac and make_ip special cases for
dict, list and tuple. Otherwise just calls transform"""
if isinstance(arg, dict):
return {key: transform(value) for key, value in arg.items()}
elif isinstance(arg, list):
return [transform(a) for a in arg]
elif isinstance(arg, tuple):
return tuple(transform(a) for a in arg)
else:
func(args)
return transform(arg)
def set_using_dict(func, *args):
if len(args) == 1 and isinstance(args[0], dict) and all(
isinstance(k, int) for k in args[0].keys()):
for key, value in args[0].items():
if not isinstance(value, tuple):
value = (value,)
try:
func(*value, [key])
except TypeError:
func(*value, key)
else:
func(*args)
def set_time_using_dict(func, args):
if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
@ -127,3 +182,80 @@ def set_time_using_dict(func, args):
if isinstance(args, int):
args = float(args)
func(args)
def lhex(iterable):
return [hex(item) for item in iterable]
def lpath(iterable):
return [Path(item) for item in iterable]
def add_argument_before(a, args):
"""Add a before the other arguments. Also works with
dict that holds args to several modules. Always puts the
args in a dict to be compatible with set_using_dict"""
if isinstance(args, tuple):
return (a, *args)
elif isinstance(args, dict):
ret = {}
for key, value in args.items():
if isinstance(value, tuple):
ret[key] = (a, *value)
else:
ret[key] = (a, value)
return (ret,)
return a, args
def add_argument_after(args, a):
"""Add a before the other arguments. Also works with
dict that holds args to several modules. Always puts the
args in a dict to be compatible with set_using_dict"""
if isinstance(args, tuple):
return (*args, a)
elif isinstance(args, dict):
ret = {}
for key, value in args.items():
if isinstance(value, tuple):
ret[key] = (*value, a)
else:
ret[key] = (value, a)
return (ret,)
return args, a
def pop_dict(args):
for i,a in enumerate(args):
if isinstance(a, dict):
return args.pop(i), i
def tuplify(args):
if not isinstance(args, tuple):
return (args, )
else:
return args
def merge_args(*args):
n_dict = sum(isinstance(a, dict) for a in args)
if n_dict == 0: #no dict just make a tuple of arguments
ret = []
for a in args:
if isinstance(a, tuple):
ret.extend(a)
else:
ret.append(a)
return tuple(ret)
elif n_dict == 1:
args = [a for a in args] #these are the args to be added
values,pos = pop_dict(args)
ret = {}
for k, v in values.items():
v = tuplify(v)
items = [a for a in args]
items[pos:pos] = v
ret[k] = tuple(items)
return (ret,)
else:
raise ValueError("Multiple dictionaries passes cannot merge args")

View File

@ -253,10 +253,6 @@ void init_det(py::module &m) {
(Result<int>(Detector::*)(int, sls::Positions)) &
Detector::getClockFrequency,
py::arg(), py::arg() = Positions{})
.def("setClockFrequency",
(void (Detector::*)(int, int, sls::Positions)) &
Detector::setClockFrequency,
py::arg(), py::arg(), py::arg() = Positions{})
.def("getClockPhase",
(Result<int>(Detector::*)(int, sls::Positions)) &
Detector::getClockPhase,
@ -669,13 +665,10 @@ void init_det(py::module &m) {
Detector::setFileWrite,
py::arg(), py::arg() = Positions{})
.def("getMasterFileWrite",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getMasterFileWrite,
py::arg() = Positions{})
(bool (Detector::*)() const) & Detector::getMasterFileWrite)
.def("setMasterFileWrite",
(void (Detector::*)(bool, sls::Positions)) &
Detector::setMasterFileWrite,
py::arg(), py::arg() = Positions{})
(void (Detector::*)(bool)) & Detector::setMasterFileWrite,
py::arg())
.def("getFileOverWrite",
(Result<bool>(Detector::*)(sls::Positions) const) &
Detector::getFileOverWrite,
@ -972,6 +965,10 @@ void init_det(py::module &m) {
(void (Detector::*)(sls::ns, sls::Positions)) &
Detector::setBurstPeriod,
py::arg(), py::arg() = Positions{})
.def("getNumberOfBurstsLeft",
(Result<int64_t>(Detector::*)(sls::Positions) const) &
Detector::getNumberOfBurstsLeft,
py::arg() = Positions{})
.def("getInjectChannel",
(Result<std::array<int, 2>>(Detector::*)(sls::Positions)) &
Detector::getInjectChannel,
@ -1381,6 +1378,10 @@ void init_det(py::module &m) {
(void (Detector::*)(uint32_t, int, sls::Positions)) &
Detector::clearBit,
py::arg(), py::arg(), py::arg() = Positions{})
.def("getBit",
(Result<int>(Detector::*)(uint32_t, int, sls::Positions)) &
Detector::getBit,
py::arg(), py::arg(), py::arg() = Positions{})
.def("executeFirmwareTest",
(void (Detector::*)(sls::Positions)) &
Detector::executeFirmwareTest,

View File

@ -1,173 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Testing setting and getting dacs from the detector
"""
from unittest.mock import Mock, call
import pytest
from pytest_mock import mocker
import numpy as np
from sls_detector import Eiger
from sls_detector import DetectorApi
def test_get_vrf_for_three_mod(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 3
m = mocker.patch.object(DetectorApi, 'getDac', autospec=True)
m.return_value = 1560
d = Eiger()
vrf = d.dacs.vrf[:]
assert vrf == [1560, 1560, 1560]
def test_set_vrf_for_three_mod_same_value(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 3
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
# m.return_value = 1560
d = Eiger()
d.dacs.vrf[:] = 1500
calls = [call('vrf', 0, 1500), call('vrf', 1, 1500), call('vrf', 2, 1500)]
m.assert_has_calls(calls)
assert m.call_count == 3
def test_set_vrf_for_four_mod_different_value(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 4
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
# m.return_value = 1560
d = Eiger()
d.dacs.vrf = [1500, 1600, 1800, 1502]
calls = [call('vrf', 0, 1500),
call('vrf', 1, 1600),
call('vrf', 2, 1800),
call('vrf', 3, 1502)]
m.assert_has_calls(calls)
assert m.call_count == 4
def test_set_vrf_for_four_mod_different_value_slice(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 4
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
# m.return_value = 1560
d = Eiger()
d.dacs.vrf[:] = [1500, 1600, 1800, 1502]
calls = [call('vrf', 0, 1500),
call('vrf', 1, 1600),
call('vrf', 2, 1800),
call('vrf', 3, 1502)]
m.assert_has_calls(calls)
assert m.call_count == 4
def test_set_vcp_single_call(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 2
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
# m.return_value = 1560
d = Eiger()
d.dacs.vcp[1] = 1637
m.assert_called_once_with('vcp', 1, 1637)
def test_iterate_on_index_call_vcn(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 10
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
# m.return_value = 1560
d = Eiger()
d.dacs.vcn[0,3,8] = 1532
calls = [call('vcn', 0, 1532),
call('vcn', 3, 1532),
call('vcn', 8, 1532)]
m.assert_has_calls(calls)
assert m.call_count == 3
def test_set_dac_from_element_in_numpy_array(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 2
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
d = Eiger()
vrf = np.array((1600,1700,1800))
d.dacs.vrf = vrf[0]
calls = [call('vrf', 0, 1600),
call('vrf', 1, 1600),]
m.assert_has_calls(calls)
assert m.call_count == 2
def test_set_dac_from_element_in_numpy_array_using_slice(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 2
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
d = Eiger()
vrf = np.array((1600,1700,1800))
d.dacs.vrf[:] = vrf[0]
calls = [call('vrf', 0, 1600),
call('vrf', 1, 1600),]
m.assert_has_calls(calls)
assert m.call_count == 2
def test_set_eiger_default(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 2
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
# m.return_value = 1560
d = Eiger()
d.dacs.set_default()
calls = [call('vsvp', 0, 0),
call('vsvp', 1, 0),
call('vtr', 0, 2500),
call('vtr', 1, 2500),
call('vrf', 0, 3300),
call('vrf', 1, 3300),
call('vrs', 0, 1400),
call('vrs', 1, 1400),
call('vsvn', 0, 4000),
call('vsvn', 1, 4000),
call('vtgstv', 0, 2556),
call('vtgstv', 1, 2556),
call('vcmp_ll', 0, 1500),
call('vcmp_ll', 1, 1500),
call('vcmp_lr', 0, 1500),
call('vcmp_lr', 1, 1500),
call('vcall', 0, 4000),
call('vcall', 1, 4000),
call('vcmp_rl', 0, 1500),
call('vcmp_rl', 1, 1500),
call('rxb_rb', 0, 1100),
call('rxb_rb', 1, 1100),
call('rxb_lb', 0, 1100),
call('rxb_lb', 1, 1100),
call('vcmp_rr', 0, 1500),
call('vcmp_rr', 1, 1500),
call('vcp', 0, 200),
call('vcp', 1, 200),
call('vcn', 0, 2000),
call('vcn', 1, 2000),
call('vis', 0, 1550),
call('vis', 1, 1550),
call('iodelay', 0, 660),
call('iodelay', 1, 660)]
m.assert_has_calls(calls)
assert m.call_count == 17*2
def test_set_eiger_set_from_array_call_count(mocker):
import numpy as np
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 3
m = mocker.patch.object(DetectorApi, 'setDac', autospec=True)
# m.return_value = 1560
d = Eiger()
d.dacs.set_from_array( np.zeros((17,3)))
assert m.call_count == 17*3
def test_get_fpga_temp(mocker):
m2= mocker.patch.object(DetectorApi, 'getNumberOfDetectors', autospec=True)
m2.return_value = 2
m = mocker.patch.object(DetectorApi, 'getAdc', autospec=True)
m.return_value = 34253
d = Eiger()
t = d.temp.fpga[:]
assert t == [34.253, 34.253]

View File

@ -1,489 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Testing parameters and methods of the Detector class using mocks
"""
from unittest.mock import Mock
import pytest
from pytest_mock import mocker
@pytest.fixture
def d():
from sls_detector import Eiger
return Eiger()
def test_acq_call(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.acq')
d.acq()
m.assert_called_once_with()
def test_busy_call(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
m.return_value = False
assert d.busy == False
def test_assign_to_detector_type(d):
with pytest.raises(AttributeError):
d.detector_type = 'Eiger'
def test_det_type(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
m.return_value = 'Eiger'
assert d.detector_type == 'Eiger'
def test_set_dynamic_range_4(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
d.dynamic_range = 4
m.assert_called_with(4)
def test_set_dynamic_range_8(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
d.dynamic_range = 8
m.assert_called_with(8)
def test_set_dynamic_range_16(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
d.dynamic_range = 16
m.assert_called_with(16)
def test_set_dynamic_range_32(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
d.dynamic_range = 32
m.assert_called_with(32)
def test_set_dynamic_range_raises_exception(d, mocker):
mocker.patch('_slsdet.DetectorApi.setDynamicRange')
with pytest.raises(ValueError):
d.dynamic_range = 17
def test_get_dynamic_range_32(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDynamicRange')
m.return_value = 32
dr = d.dynamic_range
assert dr == 32
def test_eiger_matrix_reset(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getCounterBit')
m.return_value = True
assert d.eiger_matrix_reset == True
def test_set_eiger_matrix_reset(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setCounterBit')
d.eiger_matrix_reset = True
m.assert_called_once_with(True)
def test_get_exposure_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
m.return_value = 100000000
assert d.exposure_time == 0.1
def test_set_exposure_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setExposureTime')
d.exposure_time = 1.5
m.assert_called_once_with(1500000000)
def test_set_exposure_time_less_than_zero(d, mocker):
mocker.patch('_slsdet.DetectorApi.setExposureTime')
with pytest.raises(ValueError):
d.exposure_time = -7
def test_get_file_index(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
m.return_value = 8
assert d.file_index == 8
def test_set_file_index(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
d.file_index = 9
m.assert_called_with(9)
def test_set_file_index_raises_on_neg(d, mocker):
mocker.patch('_slsdet.DetectorApi.setFileIndex')
with pytest.raises(ValueError):
d.file_index = -9
def test_get_file_name(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getFileName')
d.file_name
m.assert_called_once_with()
def test_set_file_name(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setFileName')
d.file_name = 'hej'
m.assert_called_once_with('hej')
def test_get_file_path(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getFilePath')
d.file_path
m.assert_called_once_with()
def test_set_file_path_when_path_exists(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setFilePath')
#To avoid raising an exception because path is not there
mock_os = mocker.patch('os.path.exists')
mock_os.return_value = True
d.file_path = '/path/to/something/'
m.assert_called_once_with('/path/to/something/')
def test_set_file_path_raises_when_not_exists(d, mocker):
mocker.patch('_slsdet.DetectorApi.setFilePath')
mock_os = mocker.patch('os.path.exists')
mock_os.return_value = False
with pytest.raises(FileNotFoundError):
d.file_path = '/path/to/something/'
def test_get_file_write(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
m.return_value = False
assert d.file_write == False
def test_set_file_write(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
d.file_write = True
m.assert_called_once_with(True)
def test_get_firmware_version(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
m.return_value = 20
assert d.firmware_version == 20
def test_cannot_set_fw_version(d):
with pytest.raises(AttributeError):
d.firmware_version = 20
def test_get_high_voltage_call_signature(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDac')
d.high_voltage
m.assert_called_once_with('highvoltage', -1)
def test_get_high_voltage(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDac')
m.return_value = 80
assert d.high_voltage == 80
#self._api.setDac('highvoltage', -1, voltage)
def test_set_high_voltage(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDac')
d.high_voltage = 80
m.assert_called_once_with('highvoltage', -1, 80)
def test_decode_hostname_two_names(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getHostname')
m.return_value = 'beb059+beb048+'
assert d.hostname == ['beb059', 'beb048']
def test_decode_hostname_four_names(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getHostname')
m.return_value = 'beb059+beb048+beb120+beb153+'
assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
def test_decode_hostname_blank(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getHostname')
m.return_value = ''
assert d.hostname == []
def test_get_image_size_gives_correct_size(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getImageSize')
m.return_value = (512,1024)
im_size = d.image_size
assert im_size.rows == 512
assert im_size.cols == 1024
def test_load_config(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
#To avoid raising an exception because path is not there
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = True
d.load_config('/path/to/my/file.config')
m.assert_called_once_with('/path/to/my/file.config')
def test_load_config_raises_when_file_is_not_found(d, mocker):
mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = False
with pytest.raises(FileNotFoundError):
d.load_config('/path/to/my/file.config')
def test_load_parameters(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.readParametersFile')
#To avoid raising an exception because path is not there
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = True
d.load_parameters('/path/to/my/file.par')
m.assert_called_once_with('/path/to/my/file.par')
def test_load_parameters_raises_when_file_is_not_found(d, mocker):
mocker.patch('_slsdet.DetectorApi.readParametersFile')
mock_os = mocker.patch('os.path.isfile')
mock_os.return_value = False
with pytest.raises(FileNotFoundError):
d.load_parameters('/path/to/my/file.par')
#getDetectorGeometry
def test_get_module_geometry_gives_correct_size(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
m.return_value = (13,7)
g = d.module_geometry
assert g.vertical == 7
assert g.horizontal == 13
def test_get_module_geometry_access(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
m.return_value = (12,3)
assert d.module_geometry[0] == 12
assert d.module_geometry[1] == 3
assert d.module_geometry.vertical == 3
assert d.module_geometry.horizontal == 12
def test_get_n_frames(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
m.return_value = 3
assert d.n_frames == 3
def test_set_n_frames(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
d.n_frames = 9
m.assert_called_once_with(9)
def test_set_n_frames_raises_on_neg(d, mocker):
mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
with pytest.raises(ValueError):
d.n_frames = -1
def test_set_n_frames_raises_on_zero(d, mocker):
mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
with pytest.raises(ValueError):
d.n_frames = 0
def test_get_n_modules(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
m.return_value = 12
assert d.n_modules == 12
def test_get_period_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getPeriod')
m.return_value = 130000000
assert d.period == 0.13
def test_set_period_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setPeriod')
d.period = 1.953
m.assert_called_once_with(1953000000)
def test_set_period_time_less_than_zero(d, mocker):
mocker.patch('_slsdet.DetectorApi.setPeriod')
with pytest.raises(ValueError):
d.period = -7
def test_pulse_chip_call(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.pulseChip')
d.pulse_chip(15)
m.assert_called_once_with(15)
def test_pulse_chip_call_minus_one(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.pulseChip')
d.pulse_chip(-1)
m.assert_called_once_with(-1)
def test_pulse_chip_asserts_on_smaller_than_minus_one(d, mocker):
mocker.patch('_slsdet.DetectorApi.pulseChip')
with pytest.raises(ValueError):
d.pulse_chip(-3)
#--------------------------------------------------------------------subexptime
def test_get_sub_exposure_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getSubExposureTime')
m.return_value = 2370000
assert d.sub_exposure_time == 0.00237
def test_set_sub_exposure_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
d.sub_exposure_time = 0.002
m.assert_called_once_with(2000000)
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
with pytest.raises(ValueError):
d.sub_exposure_time = 0
#-------------------------------------------------------------Rate correction
def test_get_rate_correction(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getRateCorrection')
m.return_value = [132,129]
assert d.rate_correction == [132,129]
def test_set_rate_correction(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
mock_n.return_value = 3
d.rate_correction = [123,90,50]
m.assert_called_once_with([123,90,50])
def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
mocker.patch('_slsdet.DetectorApi.setRateCorrection')
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
mock_n.return_value = 4
with pytest.raises(ValueError):
d.rate_correction = [123,90,50]
#----------------------------------------------------------------Readout clock
def test_get_readout_clock_0(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
m.return_value = 0
assert d.readout_clock == 'Full Speed'
def test_get_readout_clock_1(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
m.return_value = 1
assert d.readout_clock == 'Half Speed'
def test_get_readout_clock_2(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
m.return_value = 2
assert d.readout_clock == 'Quarter Speed'
def test_get_readout_clock_3(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
m.return_value = 3
assert d.readout_clock == 'Super Slow Speed'
def test_set_readout_clock_0(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Full Speed'
m.assert_called_once_with(0)
def test_set_readout_clock_1(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Half Speed'
m.assert_called_once_with(1)
def test_set_readout_clock_2(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Quarter Speed'
m.assert_called_once_with(2)
def test_set_readout_clock_3(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
d.readout_clock = 'Super Slow Speed'
m.assert_called_once_with(3)
#----------------------------------------------------------------rx_zmqstream
def test_get_rx_zmqstream(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
m.return_value = False
assert d.rx_zmqstream == False
def test_set_rx_zmqstream(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
d.rx_zmqstream = True
m.assert_called_once_with(True)
def test_get_rx_zmqip(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
d.rx_zmqip
m.assert_called_once_with('rx_zmqip')
def test_get_rx_zmqport_call(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
d.rx_zmqport
m.assert_called_once_with('rx_zmqport')
def test_get_rx_zmqport_decode(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
m.return_value = '30001+30003+'
assert d.rx_zmqport == [30001, 30002, 30003, 30004]
def test_get_rx_zmqport_empty(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
m.return_value = ''
assert d.rx_zmqport == []
#--------------------------------------------------------------------status
def test_status_call(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
d.status
m.assert_called_once_with()
def test_start_acq_call(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
d.start_acq()
m.assert_called_once_with()
def test_stop_acq_call(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
d.stop_acq()
m.assert_called_once_with()
#--------------------------------------------------------------------subexptime
def test_get_sub_exposure_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getSubExposureTime')
m.return_value = 2370000
assert d.sub_exposure_time == 0.00237
def test_set_sub_exposure_time(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
d.sub_exposure_time = 0.002
m.assert_called_once_with(2000000)
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
with pytest.raises(ValueError):
d.sub_exposure_time = 0
#------------------------------------------------------------------timing mode
def test_get_timing_mode(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
d.timing_mode
m.assert_called_once_with()
def test_set_timing_mode(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
d.timing_mode = 'auto'
m.assert_called_once_with('auto')
#----------------------------------------------------------------vthreshold
def test_get_vthreshold(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDac')
d.vthreshold
m.assert_called_once_with('vthreshold', -1)
def test_set_vthreshold(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDac')
d.vthreshold = 1675
m.assert_called_once_with('vthreshold', -1, 1675)
#----------------------------------------------------------------trimbits
def test_get_trimbits(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getAllTrimbits')
d.trimbits
m.assert_called_once_with()
def test_set_trimbits(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
d.trimbits = 15
m.assert_called_once_with(15)
def test_set_trimbits_raises_outside_range(d, mocker):
mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
with pytest.raises(ValueError):
d.trimbits = 69
with pytest.raises(ValueError):
d.trimbits = -5

View File

@ -1,489 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Testing the Detector python class by mocking calls.
Should only be used when there is functionality in
the detector.py file.
An example is converting a mask to a list of set bits.
"""
from unittest.mock import Mock
import pytest
from pytest_mock import mocker
import sys
sys.path.append('/home/l_frojdh/slsdetectorgrup/sls_detector')
import _slsdet
from sls_detector.errors import DetectorValueError, DetectorError
from sls_detector.utils import all_equal, element_if_equal
@pytest.fixture
def d():
from sls_detector import Detector
return Detector()
def test_length(d, mocker):
m = mocker.patch('sls_detector.Detector.size')
m.return_value = 5
assert(len(d) == 5)
def test_counters_single(d, mocker):
m = mocker.patch('sls_detector.Detector.getCounterMask')
m.return_value = [7]
assert(d.counters == [0,1,2])
def test_counters_multi(d, mocker):
m = mocker.patch('sls_detector.Detector.getCounterMask')
m.return_value = [7, 9]
assert(d.counters == [[0,1,2],[0,3]])
def test_set_counters_single(d, mocker):
m = mocker.patch('sls_detector.Detector.setCounterMask')
d.counters = [0,2]
m.assert_called_once_with(5)
# def test_busy_call(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
# m.return_value = False
# assert d.busy == False
# def test_set_busy(d):
# d.busy = True
# assert d.busy == True
# assert d._api.getAcquiringFlag() == True
# d.busy = False
# assert d.busy == False
# assert d._api.getAcquiringFlag() == False
# def test_error_mask(d):
# d._api.setErrorMask(1)
# assert d.error_mask == 1
# d.clear_errors()
# def test_error_handling(d):
# with pytest.raises(DetectorError):
# d._provoke_error()
# def test_assign_to_detector_type(d):
# with pytest.raises(AttributeError):
# d.detector_type = 'Eiger'
# def test_det_type(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
# m.return_value = 'Eiger'
# assert d.detector_type == 'Eiger'
# def test_get_exposure_time(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
# m.return_value = 100000000
# assert d.exposure_time == 0.1
# def test_set_exposure_time(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setExposureTime')
# d.exposure_time = 1.5
# m.assert_called_once_with(1500000000)
# def test_set_exposure_time_less_than_zero(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setExposureTime')
# with pytest.raises(DetectorValueError):
# d.exposure_time = -7
# def test_get_file_index(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
# m.return_value = 8
# assert d.file_index == 8
# def test_set_file_index(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
# d.file_index = 9
# m.assert_called_with(9)
# def file_index_with_no_detector(d):
# assert d.file_index == -100
# def dr_with_no_detector(d):
# assert d.dynamic_range == -100
# def test_set_file_index_raises_on_neg(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setFileIndex')
# with pytest.raises(ValueError):
# d.file_index = -9
# def test_get_file_name(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getFileName')
# d.file_name
# m.assert_called_once_with()
# def test_set_file_name(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setFileName')
# d.file_name = 'hej'
# m.assert_called_once_with('hej')
# def test_get_file_path(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getFilePath')
# d.file_path
# m.assert_called_once_with()
# def test_set_file_path_when_path_exists(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setFilePath')
# #To avoid raising an exception because path is not there
# mock_os = mocker.patch('os.path.exists')
# mock_os.return_value = True
# d.file_path = '/path/to/something/'
# m.assert_called_once_with('/path/to/something/')
# def test_set_file_path_raises_when_not_exists(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setFilePath')
# mock_os = mocker.patch('os.path.exists')
# mock_os.return_value = False
# with pytest.raises(FileNotFoundError):
# d.file_path = '/path/to/something/'
# def test_get_file_write(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
# m.return_value = False
# assert d.file_write == False
# def test_set_file_write(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
# d.file_write = True
# m.assert_called_once_with(True)
# def test_get_firmware_version(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
# m.return_value = 20
# assert d.firmware_version == 20
# def test_cannot_set_fw_version(d):
# with pytest.raises(AttributeError):
# d.firmware_version = 20
# def test_get_high_voltage_call_signature(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDac')
# d.high_voltage
# m.assert_called_once_with('highvoltage', -1)
# def test_get_high_voltage(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDac')
# m.return_value = 80
# assert d.high_voltage == 80
# #self._api.setDac('highvoltage', -1, voltage)
# def test_set_high_voltage(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setDac')
# d.high_voltage = 80
# m.assert_called_once_with('highvoltage', -1, 80)
# def test_decode_hostname_two_names(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
# m.return_value = 'beb059+beb048+'
# assert d.hostname == ['beb059', 'beb048']
# def test_decode_hostname_four_names(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
# m.return_value = 'beb059+beb048+beb120+beb153+'
# assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
# def test_decode_hostname_blank(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
# m.return_value = ''
# assert d.hostname == []
# def test_get_image_size_gives_correct_size(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getImageSize')
# m.return_value = (512,1024)
# im_size = d.image_size
# assert im_size.rows == 512
# assert im_size.cols == 1024
# def test_load_config(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
# #To avoid raising an exception because path is not there
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = True
# d.load_config('/path/to/my/file.config')
# m.assert_called_once_with('/path/to/my/file.config')
# def test_load_config_raises_when_file_is_not_found(d, mocker):
# mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = False
# with pytest.raises(FileNotFoundError):
# d.load_config('/path/to/my/file.config')
# def test_load_parameters(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.readParametersFile')
# #To avoid raising an exception because path is not there
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = True
# d.load_parameters('/path/to/my/file.par')
# m.assert_called_once_with('/path/to/my/file.par')
# def test_load_parameters_raises_when_file_is_not_found(d, mocker):
# mocker.patch('_slsdet.DetectorApi.readParametersFile')
# mock_os = mocker.patch('os.path.isfile')
# mock_os.return_value = False
# with pytest.raises(FileNotFoundError):
# d.load_parameters('/path/to/my/file.par')
# #getDetectorGeometry
# def test_get_module_geometry_gives_correct_size(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
# m.return_value = (13,7)
# g = d.module_geometry
# assert g.vertical == 7
# assert g.horizontal == 13
# def test_get_module_geometry_access(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
# m.return_value = (12,3)
# assert d.module_geometry[0] == 12
# assert d.module_geometry[1] == 3
# assert d.module_geometry.vertical == 3
# assert d.module_geometry.horizontal == 12
# def test_module_geometry_without_detectors(d):
# t = d.module_geometry
# assert t.horizontal == 0
# assert t.vertical == 0
# def test_get_n_frames(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
# m.return_value = 3
# assert d.n_frames == 3
# def test_set_n_frames(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
# d.n_frames = 9
# m.assert_called_once_with(9)
# def test_nframes_without_detector(d):
# assert d.n_frames == -100
# def test_set_n_frames_raises_on_neg(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
# with pytest.raises(DetectorValueError):
# d.n_frames = -1
# def test_set_n_frames_raises_on_zero(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
# with pytest.raises(DetectorValueError):
# d.n_frames = 0
# def test_n_cycles_without_detector(d):
# assert d.n_cycles == -100
# def test_set_n_cycles_raises_on_zero(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setCycles')
# with pytest.raises(DetectorValueError):
# d.n_cycles = 0
# def test_set_n_cycles(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setCycles')
# d.n_cycles = 56
# m.assert_called_once_with(56)
# def test_n_measurements_without_detector(d):
# assert d.n_measurements == -100
# def test_set_n_measurements_raises_on_zero(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
# with pytest.raises(DetectorValueError):
# d.n_measurements = 0
# def test_set_n_measurements(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
# d.n_measurements = 560
# m.assert_called_once_with(560)
# def test_get_n_modules_no_detector(d):
# assert d.n_modules == 0
# def test_get_n_modules(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
# m.return_value = 12
# assert d.n_modules == 12
# def test_get_period_time(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getPeriod')
# m.return_value = 130000000
# assert d.period == 0.13
# def test_set_period_time(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setPeriod')
# d.period = 1.953
# m.assert_called_once_with(1953000000)
# def test_set_period_time_less_than_zero(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setPeriod')
# with pytest.raises(ValueError):
# d.period = -7
# def test_get_online(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getOnline')
# d.online
# m.assert_called_once_with()
# def test_set_online(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setOnline')
# d.online = True
# m.assert_called_once_with(True)
# def test_last_client_ip_no_detector(d):
# assert d.last_client_ip == ''
# def test_last_cliten_ip_call(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getLastClientIP')
# d.last_client_ip
# m.assert_called_once_with()
# #-------------------------------------------------------------Rate correction
# def test_get_rate_correction(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getRateCorrection')
# m.return_value = [132,129]
# assert d.rate_correction == [132,129]
# def test_set_rate_correction(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
# mock_n.return_value = 3
# d.rate_correction = [123,90,50]
# m.assert_called_once_with([123,90,50])
# def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
# mocker.patch('_slsdet.DetectorApi.setRateCorrection')
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
# mock_n.return_value = 4
# with pytest.raises(ValueError):
# d.rate_correction = [123,90,50]
# #----------------------------------------------------------------Readout clock
# def test_get_readout_clock_0(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
# m.return_value = 0
# assert d.readout_clock == 'Full Speed'
# def test_get_readout_clock_1(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
# m.return_value = 1
# assert d.readout_clock == 'Half Speed'
# def test_get_readout_clock_2(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
# m.return_value = 2
# assert d.readout_clock == 'Quarter Speed'
# def test_get_readout_clock_3(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
# m.return_value = 3
# assert d.readout_clock == 'Super Slow Speed'
# def test_set_readout_clock_0(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Full Speed'
# m.assert_called_once_with(0)
# def test_set_readout_clock_1(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Half Speed'
# m.assert_called_once_with(1)
# def test_set_readout_clock_2(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Quarter Speed'
# m.assert_called_once_with(2)
# def test_set_readout_clock_3(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
# d.readout_clock = 'Super Slow Speed'
# m.assert_called_once_with(3)
# #----------------------------------------------------------------rx_zmqstream
# def test_get_rx_zmqstream(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
# m.return_value = False
# assert d.rx_zmqstream == False
# def test_set_rx_zmqstream(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
# d.rx_zmqstream = True
# m.assert_called_once_with(True)
# def test_get_rx_zmqip(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
# d.rx_zmqip
# m.assert_called_once_with('rx_zmqip')
# def test_get_rx_zmqport_call(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
# d.rx_zmqport
# m.assert_called_once_with('rx_zmqport')
# def test_get_rx_zmqport_decode(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
# m.return_value = ['30001', '30003']
# assert d.rx_zmqport == [30001, 30003]
# def test_get_rx_zmqport_empty(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
# m.return_value = ''
# assert d.rx_zmqport == []
# #--------------------------------------------------------------------status
# def test_status_call(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
# d.status
# m.assert_called_once_with()
# def test_start_detecor(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
# d.start_detector()
# m.assert_called_once_with()
# def test_stop_acq_call(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
# d.stop_detector()
# m.assert_called_once_with()
# #------------------------------------------------------------------timing mode
# def test_get_timing_mode(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
# d.timing_mode
# m.assert_called_once_with()
# def test_set_timing_mode(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
# d.timing_mode = 'auto'
# m.assert_called_once_with('auto')
# #----------------------------------------------------------------vthreshold
# def test_get_vthreshold(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDac')
# d.vthreshold
# m.assert_called_once_with('vthreshold', -1)
# def test_set_vthreshold(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setDac')
# d.vthreshold = 1675
# m.assert_called_once_with('vthreshold', -1, 1675)

View File

@ -1,76 +0,0 @@
import pytest
from sls_detector.detector_property import DetectorProperty
class Holder:
"""
This class does nothing except hold values
for testing of the DetectorProperty class
"""
def __init__(self, N):
self.values = [i for i in range(N)]
def get(self, i):
return self.values[i]
def set(self, i,v):
self.values[i] = v
def nmod(self):
return len(self.values)
@pytest.fixture
def p():
h = Holder(5)
return DetectorProperty(h.get, h.set, h.nmod, 'prop')
def test_initialization():
def getf(i):
return 5
def setf():
return
def nmod():
return 3
name = 'a property'
p = DetectorProperty(getf, setf, nmod, name)
assert p.get == getf
assert p.set == setf
assert p.get_nmod == nmod
assert p.__name__ == name
def test_get_single_value(p):
assert p[2] == 2
def test_get_all_values(p):
assert p[:] == [0, 1, 2, 3, 4]
def test_get_values_by_iterable(p):
vals = p[1,3]
assert vals == [1,3]
def test_set_single_value(p):
p[2] = 7
assert p[:] == [0,1,7,3,4]
def test_set_all(p):
p[:] = 10
assert p[:] == [10,10,10,10,10]
def test_set_all_by_list(p):
p[:] = [7,8,9,10,11]
assert p[:] == [7,8,9,10,11]
def test_set_all_bool(p):
p[:] = True
assert p[:] == [True]*5
def test_set_by_iter(p):
keys = [2,4]
vals = [18,23]
p[keys] = vals
assert p[:] == [0,1,18,3,23]
def test_set_by_iter_single_val(p):
keys = [2,4]
val = 9
p[keys] = val
assert p[:] == [0,1,9,3,9]
def test_print_values(p):
assert repr(p) == 'prop: [0, 1, 2, 3, 4]'

View File

@ -6,8 +6,11 @@ Testing functions from utils.py
import pytest
from slsdet.utils import *
from slsdet import IpAddr, MacAddr
import datetime as dt
import pathlib
from pathlib import Path
def test_iterable():
assert is_iterable(5) == False
@ -15,17 +18,24 @@ def test_iterable():
assert is_iterable([]) == True
assert is_iterable(5.9) == False
def test_reduce_time_to_single_value_from_list():
t = 3 * [dt.timedelta(seconds=1)]
assert reduce_time(t) == 1
def test_reduce_time_to_single_value_from_list_of_lists():
t = 3 * [dt.timedelta(seconds=3.3)]
tt = 5 * t
assert reduce_time(tt) == 3.3
def test_reduce_time_when_sublist_is_different():
t = [dt.timedelta(seconds = 1), dt.timedelta(seconds = 2), dt.timedelta(seconds = 1)]
t = [
dt.timedelta(seconds=1),
dt.timedelta(seconds=2),
dt.timedelta(seconds=1)
]
tt = [t for i in range(4)]
assert reduce_time(tt) == [1, 2, 1]
@ -33,56 +43,55 @@ def test_reduce_time_when_sublist_is_different():
def test_convert_zero():
assert eiger_register_to_time(0) == 0
def test_convert_smallest_unit():
assert pytest.approx(eiger_register_to_time(0b1000), 1e-9) == 1e-8
def test_convert_second_smallest_unit():
assert pytest.approx(eiger_register_to_time(0b10000), 1e-9) == 2e-8
def test_convert_one_ms_using_exponent():
assert pytest.approx(eiger_register_to_time(0b1101), 1e-9) == 1e-3
def test_convert_five_seconds():
assert pytest.approx(eiger_register_to_time(0b1001110001000101), 1e-9) == 5.0
assert pytest.approx(eiger_register_to_time(0b1001110001000101),
1e-9) == 5.0
def test_all_equal_int():
assert all_equal([5, 5]) == True
def test_all_equal_fails():
assert all_equal([5, 6]) == False
def test_all_equal_tuple():
assert all_equal(('a', 'a', 'a')) == True
def test_all_equal_str():
assert all_equal('aaa') == True
def test_all_equal_str_fails():
assert all_equal('aaab') == False
def test_element_if_equal_int():
assert element_if_equal([5, 5]) == 5
def test_element_if_equal_str():
assert element_if_equal('hhh') == 'h'
def test_element_if_equal_int_fails():
assert element_if_equal([5, 6, 7]) == [5, 6, 7]
def test_get_set_bits():
assert(get_set_bits(0) == [])
assert get_set_bits(7) == [0, 1, 2]
def test_list_to_mask():
assert(list_to_bitmask([0,1,2]) == 7)
assert(list_to_bitmask([]) == 0)
assert(list_to_bitmask([0]) == 1)
assert(list_to_bitmask([1]) == 2)
assert(list_to_bitmask([3]) == 8)
assert(list_to_bitmask([1,1,1]) == 2)
def test_make_timedelta_from_double():
t = 1.7
@ -90,6 +99,7 @@ def test_make_timedelta_from_double():
assert t == r.total_seconds()
assert r == dt.timedelta(seconds=t)
def test_make_timedelta_from_timedelta():
t = dt.timedelta(minutes=1)
r = make_timedelta(t)
@ -105,6 +115,7 @@ def test_make_string_path_from_Path():
assert r == p.as_posix()
assert r == pathstr
def test_make_string_path_expand_user():
pathstr = "~/tmp/virtual.config"
home = pathlib.Path.home()
@ -114,3 +125,218 @@ def test_make_string_path_expand_user():
rs = make_string_path(pathstr)
assert rp == expanded_str
assert rs == expanded_str
def test_lhex_passing_list():
values = [0, 1, 2, 3, 4]
assert lhex(values) == ["0x0", "0x1", "0x2", "0x3", "0x4"]
def test_lhex_emty_list():
assert lhex([]) == []
def test_make_ip_from_dict():
arg = {0: 0, 1: "192.168.1.1"}
res = make_ip(arg)
assert res == {0: IpAddr("0.0.0.0"), 1: IpAddr("192.168.1.1")}
assert res[0].str() == "0.0.0.0"
assert res[1].str() == "192.168.1.1"
def test_make_ip_from_str():
ip = "192.168.1.1"
assert make_ip(ip).str() == ip
def test_make_ip_from_list():
arg = ["192.168.1.1", "192.168.1.2", "127.0.0.1"]
assert make_ip(arg) == [IpAddr(a) for a in arg]
def test_make_ip_from_tuple():
arg = ("127.0.0.1")
assert make_ip(arg) == (IpAddr(arg))
def test_make_mac_from_dict():
arg = {6: "84:a9:aa:24:32:88", 12: "84:a9:3e:24:32:aa"}
res = make_mac(arg)
assert res == {
6: MacAddr("84:a9:aa:24:32:88"),
12: MacAddr("84:a9:3e:24:32:aa")
}
assert res[6].str() == "84:a9:aa:24:32:88"
assert res[12].str() == "84:a9:3e:24:32:aa"
def test_make_mac_from_str():
mac = "84:a9:aa:24:32:88"
assert make_mac(mac) == MacAddr(mac)
assert make_mac(mac).str() == mac
def test_make_mac_from_list():
arg = ["84:a9:aa:24:32:88", "84:a9:3e:24:32:aa"]
assert make_mac(arg) == [MacAddr(a) for a in arg]
def test_make_mac_from_tuple():
arg = ("84:a9:aa:24:32:88", "84:a9:3e:24:32:aa")
assert make_mac(arg) == (MacAddr("84:a9:aa:24:32:88"),
MacAddr("84:a9:3e:24:32:aa"))
def test_make_path_from_str():
assert make_path("/") == Path("/")
assert make_path("/home") == Path("/home")
def test_make_path_from_list():
arg = ["/", "/home", "/another/path"]
assert make_path(arg) == [Path(p) for p in arg]
def test_make_string_path_from_str():
arg = "/path/to/something"
assert make_string_path(arg) == arg
def test_make_string_path_from_Path():
s = "/path/to/something"
arg = Path(s)
assert make_string_path(arg) == s
def test_make_string_path_from_list_of_Path_and_string():
args = ["/path/to", Path("/something/something"), "else/"]
assert make_string_path(args) == [
"/path/to", "/something/something", "else/"
]
def test_make_string_path_from_Path_list():
s = "/path/to/something"
arg = [Path(s)]
assert make_string_path(arg) == [s]
def test_make_string_path_from_dict():
args = {0: "/path/to/something", 1: Path("/something/else")}
assert make_string_path(args) == {
0: "/path/to/something",
1: "/something/else"
}
class DummyClass:
def __init__(self):
self.args = []
def call(self, *args):
"""Normal type call in slsdet where list of detectors is passed"""
self.args.append(args)
def call_int_id(self, *args):
"""call where det_is is an int"""
*args, i = args
if isinstance(i, list):
raise TypeError
self.args.append((*args, i))
def test_set_using_dict_single_int():
c = DummyClass()
set_using_dict(c.call, 5)
assert c.args == [(5, )]
def test_set_using_dict_two_ints():
c = DummyClass()
set_using_dict(c.call, 1, 2)
assert c.args == [(1, 2)]
def test_set_using_dict_passing_dict():
c = DummyClass()
set_using_dict(c.call, {0: 5, 8: 3, 9: 7})
assert len(c.args) == 3
assert c.args == [(5, [0]), (3, [8]), (7, [9])]
def test_set_using_dict_calling_int_id():
c = DummyClass()
set_using_dict(c.call_int_id, {0: "hej", 8: 3, 9: 7})
assert len(c.args) == 3
assert c.args == [("hej", 0), (3, 8), (7, 9)]
def test_set_using_dict_pass_multiple_args():
c = DummyClass()
set_using_dict(c.call, "a", "b", "c")
assert len(c.args) == 1
assert c.args == [("a", "b", "c")]
def test_set_using_dict_passing_dict_with_multiple_args():
c = DummyClass()
set_using_dict(c.call, {0: ("a", "b"), 1: ("c", "d")})
assert c.args == [("a", "b", [0]), ("c", "d", [1])]
def test_get_set_bits():
assert (get_set_bits(0) == [])
assert get_set_bits(7) == [0, 1, 2]
def test_list_to_mask():
assert (list_to_bitmask([0, 1, 2]) == 7)
assert (list_to_bitmask([]) == 0)
assert (list_to_bitmask([0]) == 1)
assert (list_to_bitmask([1]) == 2)
assert (list_to_bitmask([3]) == 8)
assert (list_to_bitmask([1, 1, 1]) == 2)
def test_make_bitmask_from_list_of_int():
assert make_bitmask([0, 1, 2]) == 0b111
assert make_bitmask([0, 1, 7]) == 0b10000011
assert make_bitmask([1, 1, 1]) == 0b10
def test_make_bitmask_from_dict():
assert make_bitmask({0: [0, 1], 1: [0, 1, 7]}) == {0: 0b11, 1: 0b10000011}
def test_add_argument_before():
assert add_argument_before("a", 5) == ("a", 5)
assert add_argument_before(3, ("a", "b")) == (3, "a", "b")
def test_add_argument_before_dict():
assert add_argument_before(5, {0: "a"}) == ({0: (5, "a")},)
assert add_argument_before(0, {0: 1}) == ({0: (0, 1)},)
assert add_argument_before(5, {0: ("a", "b")}) == ({0: (5, "a", "b")}, )
assert add_argument_before(6, "hej") == (6, "hej")
assert add_argument_before("another", {9: "string"}) == ({
9: ("another", "string")
}, )
def test_add_argument_after():
assert add_argument_after("a", 5) == ("a", 5)
assert add_argument_after(("a", "b"), 3) == ("a", "b", 3)
def test_add_argument_after_dict():
assert add_argument_after({0: "a"}, "b") == ({0: ("a", "b")},)
assert add_argument_after({0: ("a", 1)}, True) == ({0: ("a", 1, True)}, )
def test_merge_args():
assert merge_args("a", "b", 1) == ("a", "b", 1)
assert merge_args({0:1, 1:2}, "a") == ({0: (1, "a"), 1: (2, "a")},)
def test_merge_args_tuple():
assert merge_args(*("a", "b"), 5) == ("a", "b", 5)
def test_merge_args_dict_with_tuple():
assert merge_args({0: (1,2)}, 3) == ({0: (1,2,3)},)

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv5.0.0-rc2

View File

@ -1 +0,0 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.0.0.22.0

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv5.0.0-rc2

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv5.0.0-rc2

View File

@ -1 +0,0 @@
../slsDetectorSoftware/gotthardDetectorServer/gotthardDetectorServerv4.0.0.3

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv5.0.0-rc2

View File

@ -1 +0,0 @@
../slsDetectorSoftware/jungfrauDetectorServer/bin/jungfrauDetectorServerv4.0.0.0

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv5.0.0-rc2

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv5.0.0-rc2

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv5.0.0-rc2

View File

@ -1 +0,0 @@
../slsDetectorSoftware/mythenDetectorServer/mythenDetectorServerv2.0.3

View File

@ -75,7 +75,7 @@
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="4" colspan="4">
<item row="1" column="3" colspan="4">
<widget class="QGroupBox" name="box2D">
<property name="enabled">
<bool>true</bool>
@ -1388,7 +1388,7 @@ Displays minimum, maximum and sum of values for each plot.
</layout>
</widget>
</item>
<item row="2" column="0" colspan="7">
<item row="2" column="0" colspan="6">
<widget class="QGroupBox" name="boxPlotAxis">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@ -1789,7 +1789,7 @@ Displays minimum, maximum and sum of values for each plot.
</layout>
</widget>
</item>
<item row="2" column="7">
<item row="2" column="6">
<widget class="QGroupBox" name="boxSave">
<property name="enabled">
<bool>true</bool>
@ -1990,23 +1990,7 @@ Displays minimum, maximum and sum of values for each plot.
</layout>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4" colspan="4">
<item row="0" column="0" colspan="7">
<widget class="QGroupBox" name="boxFrequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -2016,7 +2000,7 @@ Displays minimum, maximum and sum of values for each plot.
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>350</width>
<height>65</height>
</size>
</property>
@ -2024,7 +2008,7 @@ Displays minimum, maximum and sum of values for each plot.
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Sets the pace at which the receiver streams out images. Images in between the timeout or frequency are not sent out.&lt;br/&gt;&lt;br/&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Time Interval&lt;/span&gt;: Streaming time interval when an image should be streamed. &lt;br/&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Every nth Image&lt;/span&gt;: Only every nth image is streamed. &lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="title">
<string>Receiver Streaming Frequency / Timer</string>
<string>ZMQ Streaming</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -2052,6 +2036,31 @@ Displays minimum, maximum and sum of values for each plot.
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="chkNoPlot">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If checked, there is no call back and no images are plotted.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>No Plot</string>
</property>
</widget>
</item>
<item row="0" column="11">
<widget class="QComboBox" name="comboFrequency">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
@ -2061,13 +2070,13 @@ Displays minimum, maximum and sum of values for each plot.
</property>
<property name="minimumSize">
<size>
<width>150</width>
<width>135</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<width>135</width>
<height>16777215</height>
</size>
</property>
@ -2150,29 +2159,25 @@ Displays minimum, maximum and sum of values for each plot.
</item>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<item row="0" column="13">
<widget class="QStackedWidget" name="stackedTimeInterval">
<property name="maximumSize">
<size>
<width>80</width>
<height>20</height>
<width>150</width>
<height>16777215</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QStackedWidget" name="stackedTimeInterval">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="pageTimeGap">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<item>
<widget class="QDoubleSpinBox" name="spinTimeGap">
<property name="sizePolicy">
@ -2181,17 +2186,23 @@ Displays minimum, maximum and sum of values for each plot.
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>30</height>
</size>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>3</number>
<number>2</number>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
<property name="value">
<double>200.000000000000000</double>
<double>500.000000000000000</double>
</property>
</widget>
</item>
@ -2238,6 +2249,9 @@ Displays minimum, maximum and sum of values for each plot.
</widget>
<widget class="QWidget" name="pageFrequency">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<property name="leftMargin">
<number>2</number>
</property>
<item>
<widget class="QSpinBox" name="spinNthFrame">
<property name="sizePolicy">
@ -2267,78 +2281,8 @@ Displays minimum, maximum and sum of values for each plot.
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="boxPlotType">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>65</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Plot Type</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QRadioButton" name="radioDataGraph">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data Graph</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_5">
<item row="0" column="10">
<spacer name="horizontalSpacer_18">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -2347,22 +2291,159 @@ Displays minimum, maximum and sum of values for each plot.
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QRadioButton" name="radioNoPlot">
<item row="0" column="2">
<widget class="QLabel" name="lblSndHwm">
<property name="text">
<string>Snd Hwm: </string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_25">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="4">
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="6">
<widget class="QSpinBox" name="spinRcvHwm">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High water mark for inbound messages for gui.&lt;/p&gt;&lt;p&gt; #zmqhwm#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="spinSndHwm">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;High water mark for outbound messages for receiver.&lt;/p&gt;&lt;p&gt;#rx_zmqhwm#&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string/>
</property>
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>99999</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="lblRcvHwm">
<property name="text">
<string>No Plot</string>
<string>Rcv Hwm: </string>
</property>
</widget>
</item>
@ -2370,7 +2451,6 @@ Displays minimum, maximum and sum of values for each plot.
</widget>
</item>
</layout>
<zorder>boxPlotType</zorder>
<zorder>box1D</zorder>
<zorder>boxFrequency</zorder>
<zorder>box2D</zorder>
@ -2378,8 +2458,6 @@ Displays minimum, maximum and sum of values for each plot.
<zorder>boxSave</zorder>
</widget>
<tabstops>
<tabstop>radioNoPlot</tabstop>
<tabstop>radioDataGraph</tabstop>
<tabstop>comboFrequency</tabstop>
<tabstop>spinTimeGap</tabstop>
<tabstop>comboTimeGapUnit</tabstop>

Some files were not shown because too many files have changed in this diff Show More