Compare commits

..

12 Commits

75 changed files with 830 additions and 1170 deletions

View File

@ -2,7 +2,7 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package # Copyright (C) 2021 Contributors to the SLS Detector Package
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.14)
project(slsDetectorPackage) project(slsDetectorPackage)
set(PROJECT_VERSION 8.0.0) set(PROJECT_VERSION 7.0.0)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

View File

@ -1,264 +1,36 @@
SLS Detector Package Major Release 8.0.0 released on 13.11.2023 SLS Detector Package Major Release 7.x.x released on xx.xx.2023
=============================================================== ===============================================================
This document describes the differences between v8.0.0 and v7.0.3 This document describes the differences between v7.x.x and v7.0.2
CONTENTS CONTENTS
-------- --------
1 Compilation Changes 1 New, Changed or Resolved Features
2 New or Changed Features 1.1 Compilation
2.1 Breaking API 1.2 Callback
2.2 Resolved or Changed Features 1.3 Python
2.3 New Features 1.4 Client
3 On-board Detector Server Compatibility 1.5 Detector Server
4 Firmware Requirements 1.6 Simulator
5 Kernel Requirements 1.7 Receiver
6 Download, Documentation & Support 1.8 Gui
2 On-board Detector Server Compatibility
3 Firmware Requirements
4 Kernel Requirements
5 Download, Documentation & Support
2 Compilation Changes 1 New, Changed or Resolved Features
=====================
* Minimum CMake version changed from 3.12 to 3.14
* Internal zmq lib
Building zmq from tar file in repo (libs/libzmq/libzmq-4.3.4.tar.gz),
but added option (SLS_FETCH_ZMQ_FROM_GITHUB) to pull zmq version (v4.3.4)
from github (https://github.com/zeromq/libzmq.git)
* Internal pybind11 lib
Building pybind11 from tar file in repo (libs/pybind11/v2.11.0.tar.gz),
but added option (SLS_FETCH_PYBIND11_FROM_GITHUB) to pull pybind11 version
(v2.11.0) from github (https://github.com/pybind/pybind11)
2 New, Changed or Resolved Features
===================================== =====================================
- moench being made compatible with jungfrau 2.0 boards (jungfrau structure, away from ctb)
2.1 Breaking API - eiger febl and feb in versions
================== - fix ctb slow adcs
Firmware
--------
* [Jungfrau] Status register and Sync mode fix
The regiser bit definition changed and fixes for stable control in sync mode.
Effect: Master and slaves give same status (previously master is sometimes 'idle' when acquisition is stopped), same #frames left and #nextframenumber.
Also ERROR status connected, but never noticed to occur.
For user, everything is transparent unless one touches status register
using advanced commands.
* [Moench] Status: Development mode
Moench is now being made compatible with Jungfrau v2.0 readout boards.
Hence, firmware and software is in development mode.
7.x.x will continue to have fixes for Moench until this version is deployed.
* [Ctb] Fixes and features described later on.
Client
======
* Datatype change of port numbers from int to uint16_t
API: setVirtualDetectorServers,
get/setRxPort, get/setControlPort, get/setStopPort,
get/setDestinationUDPPort(2), get/setRxZmqPort, get/setClientZmqPort
* [Eiger] versions, hardware version, febl/r firmware version
Versions command modified to give more info about hardware version ['fx30', 'fx70'] and Febl/r firmware versions.
Command line: versions (output modified), hardwareversion (added for Eiger)
API added for Eiger: getHardwareVersion, getFrontEndFirmwareVersion
Enums added: fpgaPosition {FRONT_LEFT, FRONT_RIGHT}
* [Ctb] Voltage->Power name change
Command line: voltagelist ->powerlist
API: get/setVoltage -> get/setPower, get/setVoltageList -> get/setPowerList,
getMeasuredVoltage -> getMeasuredPower
2.2 Resolved or Changed Features
================================
Detector Server
---------------
* Set bit and clear bit validation
Previously, validation expected all the other bits in the register to
not change. Now, it only validates the selected bit.
* [Jungfrau] Electron collection mode (bit 14 of 0x5D register)
Affected Command line: setbit, clearbit, reg
Affected API: setBit, clearBit, writeRegister
Electron collection mode and requires chip reconfiguration.
Temporary fix added that touching this bit will reconfigure chip if chip
is v1.1 and powered on. Permanent fix by introducing a command for the
same in future release.
* [Ctb] Fixes
- Patioctrl, patsetbit, patbitmask
MSB (64 bit unsigned) could not be set as a value of -1 was interpreted
as a 'get'. Fixed in server.
- Allow dac tristate when v_limit is set. Fixed.
- Changing fw bit from disable analog to enable analog
- Allow adc enable for 1 GbE and 10GbE to be 0.
- Slow ADCs previously misread (a high 5k+ value). Firmware updated
and software adjusted now.
- Allow non blocking acquire for 1GbE. Added Transmitting status when it
might still be reading from fifo.
- Clean memory before reading from fifo in 1GbE mode. Read fifo then
RD strobe (corresponding firmware fix) fixes number of reads, but
increases all pipelines by 1.
- Fixed pattern viewer (auto legend buf without wait and loop), allow
pyat files. (/patterngenerator)
Simulator
---------
* Unique TCP port for multiple simulators
Checks include unique TCP port-hostname combo.
Receiver
--------
* Unique TCP port for multiple receivers
7.x.x already has automatically increasing TCP ports in shared memory
for multiple receivers. Now, checks include unique TCP port-hostname
combo.
* [Ctb] Fixes
- Readout mode updated
'rx_hostname' should configure the receiver with parameters from detector,
but readout mode in receiver always configured at start up to Analog only.
Fixed.
- Incorrect image size in zmq header, which happens when dbit list is
less than 64 bits. Fixed.
- Rearranging digital data when dbit list less than 64 bits fixed.
Client
------
* [Jungfrau][Mythen3][Gotthard2] Sync mode should have at least one master
Multi module synced detectors should have at least one master when
starting acquisition, else it will throw. Once master is done acquiring
(blocking mode), status of all modules checked to ensure none of the
slaves in waiting due to hardware issues such as cabling.
2.3 New Features
================
Client
------
* [Jungfrau] Pedestal mode
Command line: pedestalmode
API: get/setPedestalMode
Example:
pedestalmode 0 # turns off pedestal mode
pedestalmode 50 10 # turns on pedestal mode (50 pedestal frames, 10 loops)
In pedestal mode, number of frames/triggers
is overwritten by '#pedestal_frames x #pedestal_loops x 2'.
In auto timing mode or trigger mode with #frames > 1, #frames is overwritten
with #triggers is 1. Otherwise, #triggers is overwritten with #frames is 1.
In pedestal mode, one cannot set #frames, #triggers or timing mode (exception).
Disabling pedestal mode will set back to normal mode with normal previous
values of #frames and #triggers.
* Source UDP IP: Auto
Command line: udp_srcip, udp_srcip2
API: get/setSourceUDPIP(2)
Allow 'auto' for udp_srcip to pick up IP from detector hostname. Not allowed
for Gotthard1.
* Custom row and column for detector UDP header
Command line: row, column
API: get/setRow, get/setColumn
By default, row and column of module is determined in a pre-determined
manner or by custom detector size (Command line: detsize).
This is useful if user accesses row and column in multi- detector UDP header
or for the GUI to rearrange for complete image.
Option now added to set custom row and column.
* [Ctb] Features
- List for ADC, signal, power, slowadc
Also allow their list to set names and to obtain their indices and values.
Command line: dacname, dacindex,
adclist, adcname, adcindex,
signallist, signalname,signalindex,
powerlist, powername, powerindex, powervalues,
slowadclist, slowadcname, slowadcindex, slowadcvalues
API: get/setDacName, getDacIndex,
get/setAdcNames, getAdcIndex, get/setAdcName,
get/setSignalNames, getSignalIndex, get/setSignalName,
get/setPowerNames, getPowerIndex, get/setPowerName, getPowerList,
get/setSlowADCNames, getSlowADCIndex, get/setSlowADCName, getSlowADCList
- Added more modes for transceiver in read out mode.
Allow to set number of samples and enable mask for transceiver.
Command line: romode (more modes: 'transceiver', 'digital_transceiver'),
tsamples, transceiverenable
API: get/setTransceiverEnableMask, get/setNumberOfTransceiverSamples,
get/setReadoutMode (more enums: TRANSCEIVER_ONLY, DIGITAL_AND_TRANSCEIVER)
- Command to get file name with path of last pattern uploaded.
Command line: patfname
API: getPatterFileName
* Automatic test script for all virtual simulators added.
@ -266,13 +38,13 @@ This document describes the differences between v8.0.0 and v7.0.3
========================================== ==========================================
Eiger 8.0.0 Eiger 7.0.0
Jungfrau 8.0.0 Jungfrau 7.0.2
Mythen3 8.0.0 Mythen3 7.0.0
Gotthard2 8.0.0 Gotthard2 7.0.0
Gotthard 8.0.0 Gotthard 7.0.0
Moench 8.0.0 Moench 7.0.0
Ctb 8.0.0 Ctb 7.0.0
On-board Detector Server Upgrade On-board Detector Server Upgrade
@ -293,21 +65,21 @@ This document describes the differences between v8.0.0 and v7.0.3
======================== ========================
Eiger 02.10.2023 (v32) (updated in 7.0.3) Eiger 20.02.2023 (v31)
Jungfrau 20.09.2023 (v1.5, HW v1.0) (updated in 8.0.0) Jungfrau 04.11.2022 (v1.4, HW v1.0)
21.09.2023 (v2.5, HW v2.0) (updated in 8.0.0) 03.11.2022 (v2.4, HW v2.0)
Mythen3 24.01.2023 (v1.4) (updated in 7.0.0) Mythen3 24.01.2023 (v1.4)
Gotthard2 23.11.2022 (v0.3) (updated in 7.0.0) Gotthard2 23.11.2022 (v0.3)
Gotthard 08.02.2018 (50um and 25um Master) Gotthard 08.02.2018 (50um and 25um Master)
09.02.2018 (25 um Slave) 09.02.2018 (25 um Slave)
Moench 10.07.2023 (v0.3.2) (updated in 8.0.0, under development) Moench 05.12.2022 (v0.3)
Ctb 28.08.2023 (v1.2) (updated in 8.0.0) Ctb 03.04.2023 (v1.2?)
Detector Upgrade Detector Upgrade

2
cmk.sh
View File

@ -26,7 +26,7 @@ CMAKE_PRE=""
CMAKE_POST="" CMAKE_POST=""
usage() { echo -e " usage() { echo -e "
Usage: $0 [-b] [-c] [-d <HDF5 directory>] [-e] [-g] [-h] [-i] [-j <Number of threads>] [-k <CMake command>] [-l <Install directory>] [-m] [-n] [-p] [-r] [-s] [-t] [-u] [-z] Usage: $0 [-b] [-c] [-d <HDF5 directory>] [e] [g] [-h] [i] [-j <Number of threads>] [-k <CMake command>] [-l <Install directory>] [m] [n] [-p] [r] [s] [t] [u] [z]
-[no option]: only make -[no option]: only make
-b: Builds/Rebuilds CMake files normal mode -b: Builds/Rebuilds CMake files normal mode
-c: Clean -c: Clean

View File

@ -3,5 +3,6 @@ python:
- 3.9 - 3.9
- 3.10 - 3.10
- 3.11 - 3.11
- 3.12
numpy:
- 1.17

View File

@ -19,7 +19,7 @@ A minimal CMakeLists.txt could look like this:
.. code-block:: cmake .. code-block:: cmake
project(myDetectorIntegration) project(myDetectorIntegration)
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.12)
add_subdirectory(slsDetectorPackage) add_subdirectory(slsDetectorPackage)
#Add your executable #Add your executable
@ -43,7 +43,7 @@ should be needed, otherwise specify cmake prefix path.
.. code-block:: cmake .. code-block:: cmake
cmake_minimum_required(VERSION 3.14) cmake_minimum_required(VERSION 3.12)
project(myintegration) project(myintegration)
find_package(slsDetectorPackage 5.0 REQUIRED) find_package(slsDetectorPackage 5.0 REQUIRED)

View File

@ -13,36 +13,24 @@ To use the basic building blocks, meaning sls_detector_get/put and
the shared libraries these are needed: the shared libraries these are needed:
* Linux, preferably recent kernel (currently no cross platform support) * Linux, preferably recent kernel (currently no cross platform support)
* CMake >= 3.14 * CMake > 3.12
* C++11 compatible compiler. (We test with gcc and clang) * C++11 compatible compiler. (We test with gcc and clang)
* ZeroMQ version 4
-----------------------
Python bindings
-----------------------
* Python > 3.6
* pybind11 2.11.0 (packaged in libs)
.. note ::
Refer :ref:`pybind11 notes. <pybind for different slsDetectorPackage versions>`
-----------------------
ZeroMQ
-----------------------
* Zeromq 4.3.4 (packaged in libs)
.. note ::
Refer :ref:`zeromq notes. <zeromq for different slsDetectorPackage versions>`
----------------------- -----------------------
GUI GUI
----------------------- -----------------------
* Qt 5.9 * Qt 5.9
* Qwt 6.1.5 (packaged in libs) * Qwt 6.1.5 (packaged in libs/)
-----------------------
Python bindings
-----------------------
* Python > 3.6
* pybind11 (packaged in libs/)
----------------------- -----------------------
Moench executables Moench executables
@ -67,5 +55,3 @@ Packaged in libs/
* catch2 (unit testing) * catch2 (unit testing)
* rapidjson (streaming from receiver) * rapidjson (streaming from receiver)
* pybind11 (python bindings) * pybind11 (python bindings)
* qwt (gui plotting)
* libzmq (streaming to/from receiver)

View File

@ -1,19 +1,16 @@
Detector Detector
============================================== ==============================================
The sls::Detector is the public API to control The sls::Detector is the new public API to control
detectors from C++. This API is also used internally detectors from C++. This API is also used internally
for the Python bindings and the command line interface. for the Python bindings and the command line interface.
If a receiver has been configured, this is also controlled If a receiver has been configured this is also controlled
through this class. through this class.
Most, if not all, functions are called in parallel Most, if not all, functions are called in parallel
and the return value is a thin std::vector wrapper and the return value is a thin std::vector wrapper
containing results from all modules. (:ref:`Result class<Result Class>`) containing results from all modules. (Result<T>)
Here are some :ref:`examples <Cplusplus Api Examples>` on how to use the API.
.. _Cplusplus Api Examples:
.. doxygenclass:: sls::Detector .. doxygenclass:: sls::Detector
:members: :members:
:undoc-members: :undoc-members:

View File

@ -1,4 +1,3 @@
.. _Cplusplus Api Examples:
@ -54,8 +53,8 @@ then set up the detector.
jungfrauDetectorServer_virtual jungfrauDetectorServer_virtual
This launches a virtual Jungfrau detector server. As default it uses port 1952 and 1953 This launches a virtual Jungfrau detector server. As default is uses port 1952 and 1953
for communication over TCP. Most commands go on 1952 and only a few such as stop and status on 1953. for communication over TCP. Most commands go on 1952 and only stop and status on 1953.
**Run example to configure** **Run example to configure**
@ -91,10 +90,7 @@ std::vector.
sls::Result<int> res1{1, 1, 1}; sls::Result<int> res1{1, 1, 1};
std::cout << "res1: " << res1 << '\n'; std::cout << "res1: " << res1 << '\n';
res1.squash(); res1.squash();
# return -1 if different
res1.squash(-1); res1.squash(-1);
# throw exception with custom message if different
res1.tsquash("Values are different);

View File

@ -120,7 +120,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc # v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update jungfrauDetectorServervxxx pcxxx xx.pof sls_detector_put update jungfrauDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -190,7 +190,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc # v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update mythen3DetectorServervxxx pcxxx xxx.rbf sls_detector_put update mythen3DetectorServervxxx pcxxx xxx.rbf
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -224,7 +224,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc # v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update gotthard2DetectorServervxxx pcxxx xxx.rbf sls_detector_put update gotthard2DetectorServervxxx pcxxx xxx.rbf
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -275,7 +275,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc # v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update moenchDetectorServervxxx pcxxx xx.pof sls_detector_put update moenchDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)
@ -310,7 +310,7 @@ Program from console
# removes old server from respawn, sets up new lnked server to respawn # removes old server from respawn, sets up new lnked server to respawn
# programs fpga, reboots # programs fpga, reboots
# older versions: v5.0.0 - 6.0.0 using tftp from tftp folder of pc # v5.0.0 - 6.0.0 (copies server from tftp folder of the pc)
sls_detector_put update ctbDetectorServervxxx pcxxx xx.pof sls_detector_put update ctbDetectorServervxxx pcxxx xx.pof
# v6.1.1 - present (copies server from the full path provided) # v6.1.1 - present (copies server from the full path provided)

View File

@ -8,8 +8,8 @@ Welcome to slsDetectorPackage's documentation!
.. note :: .. note ::
This is the documentation for the latest development version of slsDetectorPackage. This is the documentation for the latest development version of slsDetectorPackage
For further documentation, visit the official page: https://www.psi.ch/en/detectors/documentation For documentation on current and previous releases visit the official page: https://www.psi.ch/en/detectors/documentation
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@ -57,6 +57,7 @@ We have three different packages available:
Build from source Build from source
------------------- -------------------
1. Download Source Code from github 1. Download Source Code from github
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -64,9 +65,23 @@ Build from source
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch 6.1.1 git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git --branch 6.1.1
.. note ::
For v6.x.x of slsDetectorPackage and older, refer :ref:`pybind11 notes on cloning. <pybind for different slsDetectorPackage versions>` | **Pybind for Python**
| v7.0.0+:
| pybind11 packaged into 'libs/pybind'. No longer a submodule. No need for "recursive" or "submodule update".
|
| Older versions:
| pybind11 is a submodule. Must be cloned using "recursive" and updated when switching between versions using the following commands.
.. code-block:: bash
# clone using recursive to get pybind11 submodule
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
# update submodule when switching between releases
cd slsDetectorPackage
git submodule update --init
.. _build from source using cmake: .. _build from source using cmake:
@ -103,23 +118,20 @@ Instead of the cmake command, one can use ccmake to get a list of options to con
ccmake .. ccmake ..
# choose the options # choose the options
# first press [c] - configure (maybe multiple times till you see [g]) # first press [c] - configure
# then press [g] - generate # then press [g] - generate
=============================== ===============================
=============================== ===========================================
Example cmake options Comment Example cmake options Comment
=============================== =============================== =============================== ===========================================
-DSLS_USE_PYTHON=ON Python -DSLS_USE_PYTHON=ON Python
-DPython_FIND_VIRTUALENV=ONLY Python from the conda env -DPython_FIND_VIRTUALENV=ONLY Python from only the conda environment
-DZeroMQ_HINT=/usr/lib64 Use system zmq instead
-DSLS_USE_GUI=ON GUI -DSLS_USE_GUI=ON GUI
-DSLS_USE_HDF5=ON HDF5 =============================== ===========================================
-DSLS_USE_SIMULATOR=ON Simulator
=============================== ===============================
.. note ::
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmake option to hint library location. <zeromq for different slsDetectorPackage versions>`
Build using in-built cmk.sh script Build using in-built cmk.sh script
@ -130,9 +142,9 @@ Build using in-built cmk.sh script
The binaries are generated in slsDetectorPackage/build/bin directory. The binaries are generated in slsDetectorPackage/build/bin directory.
Usage: $0 [-b] [-c] [-d <HDF5 directory>] [-e] [-g] [-h] [-i] Usage: ./cmk.sh [-b] [-c] [-d <HDF5 directory>] [e] [g] [-h] [i] [-j <Number of threads>]
[-j <Number of threads>] [-k <CMake command>] [-l <Install directory>] [-k <CMake command>] [-l <Install directory>] [m] [n] [-p] [-q <Zmq hint directory>]
[-m] [-n] [-p] [-r] [-s] [-t] [-u] [-z] [r] [s] [t] [u] [z]
-[no option]: only make -[no option]: only make
-b: Builds/Rebuilds CMake files normal mode -b: Builds/Rebuilds CMake files normal mode
-c: Clean -c: Clean
@ -147,6 +159,7 @@ Build using in-built cmk.sh script
-m: Manuals -m: Manuals
-n: Manuals without compiling doxygen (only rst) -n: Manuals without compiling doxygen (only rst)
-p: Builds/Rebuilds Python API -p: Builds/Rebuilds Python API
-q: Zmq hint directory
-r: Build/Rebuilds only receiver -r: Build/Rebuilds only receiver
-s: Simulator -s: Simulator
-t: Build/Rebuilds only text client -t: Build/Rebuilds only text client
@ -163,13 +176,9 @@ Build using in-built cmk.sh script
# new build, python and compile in parallel: # new build, python and compile in parallel:
./cmk.sh -cbpj5 ./cmk.sh -cbpj5
#For rebuilding only certain sections #To use the system zmq (/usr/lib64) instead
./cmk.sh -tg #only text client and gui ./cmk.sh -cbj5 -q /usr/lib64
./cmk.sh -r #only receiver
.. note ::
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for cmk script option to hint library location. <zeromq for different slsDetectorPackage versions>`
Build on old distributions Build on old distributions
@ -182,7 +191,7 @@ using this compiler
.. code-block:: bash .. code-block:: bash
#Create an environment with the dependencies #Create an environment with the dependencies
conda create -n myenv gxx_linux-64 cmake conda create -n myenv gxx_linux-64 cmake zmq
conda activate myenv conda activate myenv
# outside slsDetecorPackage folder # outside slsDetecorPackage folder
@ -191,11 +200,6 @@ using this compiler
make -j12 make -j12
.. note ::
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for dependencies for conda. <zeromq for different slsDetectorPackage versions>`
Build slsDetectorGui (Qt5) Build slsDetectorGui (Qt5)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -224,9 +228,9 @@ Build slsDetectorGui (Qt5)
# create environment to compile # create environment to compile
# on rhel7 # on rhel7
conda create -n slsgui gxx_linux-64 gxx_linux-64 mesa-libgl-devel-cos6-x86_64 qt conda create -n slsgui zeromq gxx_linux-64 gxx_linux-64 mesa-libgl-devel-cos6-x86_64 qt
# on fedora or newer systems # on fedora or newer systems
conda create -n slsgui qt conda create -n slsgui zeromq qt
# when using conda compilers, would also need libgl, but no need for it on fedora unless maybe using it with ROOT # when using conda compilers, would also need libgl, but no need for it on fedora unless maybe using it with ROOT
@ -242,9 +246,6 @@ Build slsDetectorGui (Qt5)
cd slsDetectorPackage cd slsDetectorPackage
./cmk.sh -cbgj9 ./cmk.sh -cbgj9
.. note ::
For v7.x.x of slsDetectorPackage and older, refer :ref:`zeromq notes for dependencies for conda. <zeromq for different slsDetectorPackage versions>`
@ -257,7 +258,7 @@ is to use conda
.. code-block:: bash .. code-block:: bash
conda create -n myenv python=3.12 sphinx sphinx_rtd_theme breathe doxygen numpy conda create -n myenv python sphinx_rtd_theme breathe
.. code-block:: bash .. code-block:: bash
@ -269,51 +270,3 @@ is to use conda
make docs # generate API docs and build Sphinx RST make docs # generate API docs and build Sphinx RST
make rst # rst only, saves time in case the API did not change make rst # rst only, saves time in case the API did not change
Pybind and Zeromq
^^^^^^^^^^^^^^^^^^^
.. _pybind for different slsDetectorPackage versions:
| **Pybind for Python**
| v8.0.0+:
| pybind11 (v2.11.0) is built
| * by default from tar file in repo (libs/pybind/v2.11.0.tar.gz)
| * or use advanced option SLS_FETCH_PYBIND11_FROM_GITHUB [`link <https://github.com/pybind/pybind11>`__].
|
| v7.x.x:
| pybind11 packaged into 'libs/pybind'. No longer a submodule. No need for "recursive" or "submodule update".
|
| Older versions:
| pybind11 is a submodule. Must be cloned using "recursive" and updated when switching between versions using the following commands.
.. code-block:: bash
# Note: Only for v6.x.x versions and older
# clone using recursive to get pybind11 submodule
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
# update submodule when switching between releases
cd slsDetectorPackage
git submodule update --init
.. _zeromq for different slsDetectorPackage versions:
| **Zeromq**
| v8.0.0+:
| zeromq (v4.3.4) is built
| * by default from tar file in repo (libs/libzmq/libzmq-4.3.4.tar.gz)
| * or use advanced option SLS_FETCH_ZMQ_FROM_GITHUB [`link <https://github.com/zeromq/libzmq.git>`__].
|
| v7.x.x and older:
| zeromq must be installed and one can hint its location using
| * cmake option:'-DZeroMQ_HINT=/usr/lib64' or
| * option '-q' in cmk.sh script: : ./cmk.sh -cbj5 -q /usr/lib64
| * 'zeromq' dependency added when installing using conda

View File

@ -109,14 +109,12 @@ For Multiple Modules
# connects to mulitple modules # connects to mulitple modules
hostname bchipxxx+bchipyyy+ hostname bchipxxx+bchipyyy+
# tcp port increases for each module (multi detector command)
rx_tcpport 2012
# connects to receivers at ports 2012 and 2014 # connects to receivers at ports 2012 and 2014
rx_hostname mpc1922 rx_hostname mpc1922:2012+mpc1922:2013+
# increasing udp ports (multi detector command) # sets differernt destination udp ports
udp_dstport 50012 0:udp_dstport 50012
1:udp_dstport 50014
# source udp ips must be same subnet at destintaion udp ips # source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112 0:udp_srcip 192.168.1.112

View File

@ -1,5 +1,3 @@
.. _Result Class:
Result Result
============================================== ==============================================

View File

@ -53,12 +53,7 @@ Client Commands
# multi modules with custom ports # multi modules with custom ports
rx_hostname xxx:1955+xxx:1956+ rx_hostname xxx:1955+xxx:1956+
# multi modules with custom ports on same rxr pc
# multi modules using increasing tcp ports when using multi detector command
rx_tcpport 1955
rx_hostname xxx
# or specify multi modules with custom ports on same rxr pc
0:rx_tcpport 1954 0:rx_tcpport 1954
1:rx_tcpport 1955 1:rx_tcpport 1955
2:rx_tcpport 1956 2:rx_tcpport 1956

View File

@ -92,9 +92,6 @@ Common
sls_detector_put rx_arping 1 sls_detector_put rx_arping 1
#. Only the slaves get no data
* Check trigger cabling and trigger configuration
* When you cannot stop Jungfrau slaves in sync mode, refer to :ref:`Cannot stop slaves<Jungfrau Troubleshooting Sync Slaves Cannot Stop>`.
.. _Receiver PC Tuning: .. _Receiver PC Tuning:
@ -424,20 +421,3 @@ Cannot get multi module data
* Comment out this line in the config file: powerchip 1 * 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. * 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.
.. _Jungfrau Troubleshooting Sync Slaves Cannot Stop:
Cannot stop slaves in sync mode
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#. If cabling is accessible, ensure termination board and flatband cable between the masters and the slaves are connnected properly. Then try to stop.
#. If cabling is inaccessible, unsync first so that the slaves can get the stop directly from the client using the command. Then, don't use sync mode until the cabling is fixed.
.. code-block:: bash
# unsync, slaves command will fail as it is still in waiting state
sls_detector_put sync 0
# stop should now be successful as master does not determine the stop anymore
sls_detector_put stop

View File

@ -86,8 +86,7 @@ For a Single Module (With Options)
udp_dstport 50012 udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips # source udp ips must be same subnet at destintaion udp ips
# takes the same ip as hostname udp_srcip 192.168.1.112
udp_srcip auto
# destination udp ip picked up from rx_hostname (if auto) # destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto udp_dstip auto
@ -102,14 +101,12 @@ For Multiple Modules
virtual 2 1912 virtual 2 1912
# or hostname localhost:1912+localhost:1914+ # or hostname localhost:1912+localhost:1914+
# increasing receiver tcp ports (multi detector command) # connects to receivers at ports 2012 and 2014
rx_tcpport 2012 rx_hostname mpc1922:2012+mpc1922:2013+
# connects to reciever at port 2012 and 2013 # sets differernt destination udp ports
rx_hostname mpc1922 0:udp_dstport 50012
1:udp_dstport 50014
# sets increasing destination udp ports
udp_dstport 50012
# source udp ips must be same subnet at destintaion udp ips # source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112 0:udp_srcip 192.168.1.112

View File

@ -4,26 +4,14 @@ detsize 1024 512
# detector hostname for controls # detector hostname for controls
hostname beb059+beb058+ hostname beb059+beb058+
# increasing receiver tcp port (multi detector command) # 1Gb receiver pc hostname with tcp port to configure receiver
rx_tcpport 1991 rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# 1Gb receiver pc hostname to configure receiver
rx_hostname x12sa-vcons
# or 1Gb receiver pc hostname with tcp port to configure receiver
#rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# increasing udp destination ports for all half modules
udp_dstport 50011
# udp port first quadrant, first halfmodule # udp port first quadrant, first halfmodule
#0:udp_dstport 50011 0:udp_dstport 50011
# udp port second quadrant, first halfmodule # udp port second quadrant, first halfmodule
#0:udp_dstport2 50012 0:udp_dstport2 50012
# udp port first quadrant, second halfmodule
#1:udp_dstport 50013
# udp port second quadrant, second halfmodule
#1:udp_dstport2 50014
# udp IP of the receiver over 10Gb # udp IP of the receiver over 10Gb
0:udp_dstip 10.0.30.210 0:udp_dstip 10.0.30.210
@ -31,6 +19,12 @@ udp_dstport 50011
# first half module 10 Gb IP (same subnet as 0:udp_dstip) # first half module 10 Gb IP (same subnet as 0:udp_dstip)
0:udp_srcip 10.0.30.100 0:udp_srcip 10.0.30.100
# udp port first quadrant, second halfmodule
1:udp_dstport 50013
# udp port second quadrant, second halfmodule
1:udp_dstport2 50014
# udp IP of the receiver over 10Gb, # udp IP of the receiver over 10Gb,
1:udp_dstip 10.0.40.210 1:udp_dstip 10.0.40.210

View File

@ -4,23 +4,18 @@ detsize 1024 512
# detector hostname for controls # detector hostname for controls
hostname beb059+beb058+ hostname beb059+beb058+
# increasing receiver tcp port (multi detector command) # 1Gb receiver pc hostname with tcp port to configure receiver
rx_tcpport 1991 rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# 1Gb receiver pc hostname to configure receiver
rx_hostname x12sa-vcons
# increasing udp destination ports for all half modules
udp_dstport 50011
# udp port first quadrant, first halfmodule # udp port first quadrant, first halfmodule
#0:udp_dstport 50011 0:udp_dstport 50011
#udp port second quadrant, first halfmodule #udp port second quadrant, first halfmodule
#0:udp_dstport2 50012 0:udp_dstport2 50012
# udp port first quadrant, second halfmodule # udp port first quadrant, second halfmodule
#1:udp_dstport 50013 1:udp_dstport 50013
# udp port second quadrant, second halfmodule # udp port second quadrant, second halfmodule
#1:udp_dstport2 50014 1:udp_dstport2 50014
# output directory # output directory
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M

View File

@ -4,18 +4,14 @@ detsize 1024 1024
# detector hostname # detector hostname
hostname bchip048+bchip052+ hostname bchip048+bchip052+
# increasing receiver ports 1954 and 1955 (multi detector command) # 1Gb receiver pc hostname (default tcpport: 1954)
rx_tcpport 1954 rx_hostname pcmoench01:1954+pcmoench01:1955+
# 1Gb receiver pc hostname
rx_hostname pcmoench01
# increasing udp ports 50004 and 50005 (multi detector command)
udp_dstport 50004
# or custom udp destination port (receiver) for 1st module
#0:udp_dstport 50014
# udp configurations for 1st module
# udp destination port (receiver)
0:udp_dstport 50004
# udp destination ip (receiver) # udp destination ip (receiver)
0:udp_dstip 10.1.1.100 0:udp_dstip 10.1.1.100
@ -23,11 +19,17 @@ udp_dstport 50004
# udp source ip (same subnet as 0:udp_dstip) # udp source ip (same subnet as 0:udp_dstip)
0:udp_srcip 10.1.1.10 0:udp_srcip 10.1.1.10
# udp configurations for 2nd module
# udp destination port (receiver)
1:udp_dstport 50005
# udp destination ip (receiver) # udp destination ip (receiver)
1:udp_dstip 10.1.2.100 1:udp_dstip 10.1.1.100
# udp source ip (same subnet as 1:udp_dstip) # udp source ip (same subnet as 1:udp_dstip)
1:udp_srcip 10.1.2.11 1:udp_srcip 10.1.1.11
@ -43,5 +45,5 @@ timing trigger
# output file directory # output file directory
fpath /external_pool/jungfrau_data/softwaretest fpath /external_pool/jungfrau_data/softwaretest
# disable file writing (default) # disable file writing
fwrite 0 fwrite 0

View File

@ -2,8 +2,10 @@
hostname localhost:1900+localhost:1902+ hostname localhost:1900+localhost:1902+
# udp destination ports # udp destination ports
udp_dstport 50000 0:udp_dstport 50000
udp_dstport2 50001 0:udp_dstport2 50001
1:udp_dstport 50002
1:udp_dstport2 50003
# receiver hostname # receiver hostname
rx_hostname mpc1922:2000+mpc1922:2001+ rx_hostname mpc1922:2000+mpc1922:2001+

View File

@ -5,26 +5,24 @@ detsize 2048 1024
virtual 4 1952 virtual 4 1952
# udp destination ports # udp destination ports
udp_dstport 50001 0:udp_dstport2 50001
#0:udp_dstport2 50001 0:udp_dstport2 50002
#0:udp_dstport2 50002 1:udp_dstport 50003
#1:udp_dstport 50003 1:udp_dstport2 50004
#1:udp_dstport2 50004 2:udp_dstport 50005
#2:udp_dstport 50005 2:udp_dstport2 50006
#2:udp_dstport2 50006 3:udp_dstport 50007
#3:udp_dstport 50007 3:udp_dstport2 50008
#3:udp_dstport2 50008
# udp source ip (same subnet as udp_dstip) # udp source ip (same subnet as udp_dstip)
udp_srcip 192.168.1.100 udp_srcip 192.168.1.100
udp_srcip2 192.168.1.100 udp_srcip2 192.168.1.100
# receiver hostname and tcpports # receiver hostname and tcpports
rx_tcpport 1970 0:rx_tcpport 1970
#0:rx_tcpport 1970 1:rx_tcpport 1971
#1:rx_tcpport 1971 2:rx_tcpport 1972
#2:rx_tcpport 1972 3:rx_tcpport 1973
#3:rx_tcpport 1973
rx_hostname mpc1922 rx_hostname mpc1922
# udp destination ip from rx_hostname # udp destination ip from rx_hostname

View File

@ -360,8 +360,7 @@ class Detector(CppDetectorApi):
@property @property
def settings(self): def settings(self):
""" """
Detector settings. Detector settings. Enum: detectorSettings
Enum: detectorSettings
Note Note
----- -----
@ -401,9 +400,6 @@ class Detector(CppDetectorApi):
def framesl(self): def framesl(self):
""" """
[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of frames left in acquisition.\n [Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of frames left in acquisition.\n
Note
----
[Gotthard2] only in continuous auto mode. [Gotthard2] only in continuous auto mode.
:setter: Not Implemented :setter: Not Implemented
@ -479,8 +475,7 @@ class Detector(CppDetectorApi):
@element @element
def gaincaps(self): def gaincaps(self):
""" """
[Mythen3] Gain caps. [Mythen3] Gain caps. Enum: M3_GainCaps \n
Enum: M3_GainCaps
Note Note
---- ----
@ -578,6 +573,8 @@ class Detector(CppDetectorApi):
""" """
Period between frames, accepts either a value in seconds or datetime.timedelta Period between frames, accepts either a value in seconds or datetime.timedelta
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getPeriod :getter: always returns in seconds. To get in DurationWrapper, use getPeriod
Example Example
@ -644,6 +641,9 @@ class Detector(CppDetectorApi):
""" """
[Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTrigger :getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTrigger
Example Example
@ -895,8 +895,7 @@ class Detector(CppDetectorApi):
@element @element
def rx_discardpolicy(self): def rx_discardpolicy(self):
""" """
Frame discard policy of receiver. Frame discard policy of receiver. Enum: frameDiscardPolicy
Enum: frameDiscardPolicy
Note Note
----- -----
@ -970,8 +969,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def fformat(self): def fformat(self):
""" File format of data file in receiver. """ File format of data file in receiver. Enum: fileFormat
Enum: fileFormat
Note Note
----- -----
@ -1567,8 +1565,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def status(self): def status(self):
"""Gets detector status. """Gets detector status. Enum: runStatus
Enum: runStatus
Note Note
----- -----
@ -1582,8 +1579,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def rx_status(self): def rx_status(self):
"""Gets receiver listener status. """Gets receiver listener status. Enum: runStatus
Enum: runStatus
Note Note
----- -----
@ -1677,11 +1673,6 @@ class Detector(CppDetectorApi):
def sync(self): def sync(self):
""" """
[Jungfrau][Moench] Enables or disables synchronization between modules. [Jungfrau][Moench] Enables or disables synchronization between modules.
Note
----
Sync mode requires at least one master configured. Also requires flatband cabling between master and slave with termination board.
""" """
return self.getSynchronization() return self.getSynchronization()
@ -1812,7 +1803,6 @@ class Detector(CppDetectorApi):
def daclist(self): def daclist(self):
""" """
List of enums/names for every dac for this detector List of enums/names for every dac for this detector
:setter: Only implemented for Chiptestboard :setter: Only implemented for Chiptestboard
""" """
@ -1825,7 +1815,9 @@ class Detector(CppDetectorApi):
@property @property
def adclist(self): def adclist(self):
""" """
[Chiptestboard] List of names for every adc for this board. 32 adcs List of names for every adc for this board. 32 adcs
:setter: Only implemented for Chiptestboard
""" """
return self.getAdcNames() return self.getAdcNames()
@ -1836,7 +1828,9 @@ class Detector(CppDetectorApi):
@property @property
def signallist(self): def signallist(self):
""" """
[Chiptestboard] List of names for every io signal for this board. 64 signals List of names for every io signal for this board. 64 signals
:setter: Only implemented for Chiptestboard
""" """
return self.getSignalNames() return self.getSignalNames()
@ -1847,7 +1841,8 @@ class Detector(CppDetectorApi):
@property @property
def powerlist(self): def powerlist(self):
""" """
[Chiptestboard] List of names for every power for this board. 5 power supply List of names for every power for this board. 5 power supply
:setter: Only implemented for Chiptestboard
""" """
return self.getPowerNames() return self.getPowerNames()
@ -1859,7 +1854,8 @@ class Detector(CppDetectorApi):
@property @property
def slowadclist(self): def slowadclist(self):
""" """
[Chiptestboard] List of names for every slowadc for this board. 8 slowadc List of names for every slowadc for this board. 8 slowadc
:setter: Only implemented for Chiptestboard
""" """
return self.getSlowADCNames() return self.getSlowADCNames()
@ -1878,7 +1874,7 @@ class Detector(CppDetectorApi):
@property @property
def powervalues(self): def powervalues(self):
"""[Chiptestboard] Gets the power values for every power for this detector.""" """Gets the power values for every power for this detector."""
return { return {
power.name.lower(): element_if_equal(np.array(self.getPower(power))) power.name.lower(): element_if_equal(np.array(self.getPower(power)))
for power in self.getPowerList() for power in self.getPowerList()
@ -1886,7 +1882,7 @@ class Detector(CppDetectorApi):
@property @property
def slowadcvalues(self): def slowadcvalues(self):
"""[Chiptestboard] Gets the slow adc values for every slow adc for this detector.""" """Gets the slow adc values for every slow adc for this detector."""
return { return {
slowadc.name.lower(): element_if_equal(np.array(self.getSlowADC(slowadc))) slowadc.name.lower(): element_if_equal(np.array(self.getSlowADC(slowadc)))
for slowadc in self.getSlowADCList() for slowadc in self.getSlowADCList()
@ -2060,7 +2056,8 @@ class Detector(CppDetectorApi):
----- -----
To set default rate correction from trimbit file, use setDefaultRateCorrection To set default rate correction from trimbit file, use setDefaultRateCorrection
Known Issue: Known Issue
------------
:getter: Always give 0 due to the microseconds precision. :getter: Always give 0 due to the microseconds precision.
:setter: Use scientific notation to set custom rate correction, since timedelta resolution is 1 microseconds. \n :setter: Use scientific notation to set custom rate correction, since timedelta resolution is 1 microseconds. \n
@ -2084,8 +2081,7 @@ class Detector(CppDetectorApi):
@element @element
def readoutspeed(self): def readoutspeed(self):
""" """
[Eiger][Jungfrau|Gotthard2] Readout speed of chip. [Eiger][Jungfrau|Gotthard2] Readout speed of chip. Enum: speedLevel
Enum: speedLevel
Note Note
----- -----
@ -2174,8 +2170,7 @@ class Detector(CppDetectorApi):
@element @element
def timing(self): def timing(self):
""" """
Set Timing Mode of detector. Set Timing Mode of detector. Enum: timingMode
Enum: timingMode
Note Note
----- -----
@ -2235,11 +2230,13 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def type(self): def type(self):
""" Returns detector type. """ Returns detector type. Enum: detectorType
Enum: detectorType
[EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2, CHIPTESTBOARD] Note
----
:setter: Not implemented :setter: Not implemented
Values: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2, CHIPTESTBOARD
""" """
return self.getDetectorType() return self.getDetectorType()
@ -2500,6 +2497,9 @@ class Detector(CppDetectorApi):
""" """
[Eiger] Measured sub frame period between last sub frame and previous one. [Eiger] Measured sub frame period between last sub frame and previous one.
Note
-----
:setter: Not implemented :setter: Not implemented
""" """
return ut.reduce_time(self.getMeasuredSubFramePeriod()) return ut.reduce_time(self.getMeasuredSubFramePeriod())
@ -2777,8 +2777,7 @@ class Detector(CppDetectorApi):
@property @property
def gainmode(self): def gainmode(self):
""" """
[Jungfrau] Detector gain mode. [Jungfrau] Detector gain mode. Enum: gainMode
Enum: gainMode
Note Note
----- -----
@ -2891,7 +2890,10 @@ class Detector(CppDetectorApi):
@property @property
def maxclkphaseshift(self): def maxclkphaseshift(self):
""" """
[Gotthard2][Mythen3] Absolute maximum Phase shift of clocks. [Gotthard2][Mythen3] Absolute maximum Phase shift of clocks.
Note
----
:setter: Not Implemented :setter: Not Implemented
@ -2910,8 +2912,7 @@ class Detector(CppDetectorApi):
@element @element
def timingsource(self): def timingsource(self):
""" """
[Gotthard2] Timing source. [Gotthard2] Timing source. Enum: timingSourceType
Enum: timingSourceType
Note Note
----- -----
@ -2955,8 +2956,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def burstmode(self): def burstmode(self):
"""[Gotthard2] Burst mode of detector. """[Gotthard2] Burst mode of detector. Enum: burstMode
Enum: burstMode
Note Note
---- ----
@ -2974,6 +2974,9 @@ class Detector(CppDetectorApi):
""" """
[Gotthard2] Period between 2 bursts. Only in burst mode and auto timing mode. [Gotthard2] Period between 2 bursts. Only in burst mode and auto timing mode.
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getBurstPeriod :getter: always returns in seconds. To get in DurationWrapper, use getBurstPeriod
:setter: Not Implemented :setter: Not Implemented
@ -3096,8 +3099,7 @@ class Detector(CppDetectorApi):
@property @property
def vetoalg(self): def vetoalg(self):
"""[Gotthard2] Algorithm used for veto. """[Gotthard2] Algorithm used for veto. Enum: vetoAlgorithm, streamingInterface
Enum: vetoAlgorithm, streamingInterface
Note Note
---- ----
@ -3271,8 +3273,7 @@ class Detector(CppDetectorApi):
@element @element
def romode(self): def romode(self):
""" """
[CTB] Readout mode of detector. [CTB] Readout mode of detector. Enum: readoutMode
Enum: readoutMode
Note Note
------ ------
@ -3378,6 +3379,9 @@ class Detector(CppDetectorApi):
def maxdbitphaseshift(self): def maxdbitphaseshift(self):
"""[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits. """[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits.
Note
-----
:setter: Not Implemented :setter: Not Implemented
""" """
return self.getMaxDBITPhaseShift() return self.getMaxDBITPhaseShift()
@ -3422,6 +3426,9 @@ class Detector(CppDetectorApi):
def maxadcphaseshift(self): def maxadcphaseshift(self):
"""[Jungfrau][Moench][CTB] Absolute maximum Phase shift of ADC clock. """[Jungfrau][Moench][CTB] Absolute maximum Phase shift of ADC clock.
Note
-----
:setter: Not Implemented :setter: Not Implemented
""" """
return self.getMaxADCPhaseShift() return self.getMaxADCPhaseShift()
@ -3471,6 +3478,9 @@ class Detector(CppDetectorApi):
""" """
[Ctb] Sync clock in MHz. [Ctb] Sync clock in MHz.
Note
-----
:setter: Not implemented :setter: Not implemented
""" """
return self.getSYNCClock() return self.getSYNCClock()
@ -3479,6 +3489,9 @@ class Detector(CppDetectorApi):
def pattern(self): def pattern(self):
"""[Mythen3][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line). """[Mythen3][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line).
Note
----
:getter: Not Implemented :getter: Not Implemented
Example Example
@ -3907,6 +3920,9 @@ class Detector(CppDetectorApi):
def im_a(self): def im_a(self):
"""[Ctb] Measured current of power supply a in mA. """[Ctb] Measured current of power supply a in mA.
Note
-----
:setter: Not implemented :setter: Not implemented
""" """
return self.getMeasuredCurrent(dacIndex.I_POWER_A) return self.getMeasuredCurrent(dacIndex.I_POWER_A)
@ -3916,6 +3932,9 @@ class Detector(CppDetectorApi):
def im_b(self): def im_b(self):
"""[Ctb] Measured current of power supply b in mA. """[Ctb] Measured current of power supply b in mA.
Note
-----
:setter: Not implemented :setter: Not implemented
""" """
return self.getMeasuredCurrent(dacIndex.I_POWER_B) return self.getMeasuredCurrent(dacIndex.I_POWER_B)
@ -3925,6 +3944,9 @@ class Detector(CppDetectorApi):
def im_c(self): def im_c(self):
"""[Ctb] Measured current of power supply c in mA. """[Ctb] Measured current of power supply c in mA.
Note
-----
:setter: Not implemented :setter: Not implemented
""" """
return self.getMeasuredCurrent(dacIndex.I_POWER_C) return self.getMeasuredCurrent(dacIndex.I_POWER_C)
@ -3934,6 +3956,9 @@ class Detector(CppDetectorApi):
def im_d(self): def im_d(self):
"""[Ctb] Measured current of power supply d in mA. """[Ctb] Measured current of power supply d in mA.
Note
-----
:setter: Not implemented :setter: Not implemented
""" """
return self.getMeasuredCurrent(dacIndex.I_POWER_D) return self.getMeasuredCurrent(dacIndex.I_POWER_D)
@ -3943,6 +3968,9 @@ class Detector(CppDetectorApi):
def im_io(self): def im_io(self):
"""[Ctb] Measured current of power supply io in mA. """[Ctb] Measured current of power supply io in mA.
Note
-----
:setter: Not implemented :setter: Not implemented
""" """
return self.getMeasuredCurrent(dacIndex.I_POWER_IO) return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
@ -3992,6 +4020,9 @@ class Detector(CppDetectorApi):
def exptimel(self): def exptimel(self):
"""[Gotthard] Exposure time left for current frame. """[Gotthard] Exposure time left for current frame.
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getExptimeLeft :getter: always returns in seconds. To get in DurationWrapper, use getExptimeLeft
:setter: Not Implemented :setter: Not Implemented
@ -4026,6 +4057,9 @@ class Detector(CppDetectorApi):
""" """
[Gotthard2][Mythen3] Frequency of clock in Hz. [Gotthard2][Mythen3] Frequency of clock in Hz.
Note
----
:setter: Not implemented. Use clkdiv to set frequency :setter: Not implemented. Use clkdiv to set frequency
Example Example
@ -4045,9 +4079,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def polarity(self): def polarity(self):
"""[Mythen3] Set positive or negative polarity. """[Mythen3] Set positive or negative polarity. Enum: polarity"""
Enum: polarity
"""
return self.getPolarity() return self.getPolarity()
@polarity.setter @polarity.setter

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer

View File

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

View File

@ -28,6 +28,10 @@
@li version is the version number of this structure format @li version is the version number of this structure format
*/ */
#include <algorithm>
#include <numeric>
#include <tuple>
namespace strixelSingleChip { namespace strixelSingleChip {
constexpr int nc_rawimg = 1024; // for full images //256; constexpr int nc_rawimg = 1024; // for full images //256;
constexpr int nr_rawimg = 512; constexpr int nr_rawimg = 512;
@ -77,7 +81,7 @@ constexpr int c6g1_ystart = c6g2_yend + 1; // 448
constexpr int c6g1_yend = c6g2_yend + 64 - gr; // 502 constexpr int c6g1_yend = c6g2_yend + 64 - gr; // 502
// y shift due to faulty bonding (relevant for M408) // y shift due to faulty bonding (relevant for M408)
constexpr int bond_shift_y = 1; // CHANGE IF YOU CHANGE MODULE! constexpr int bond_shift_y = 0; // CHANGE IF YOU CHANGE MODULE!
} // namespace strixelSingleChip } // namespace strixelSingleChip
@ -97,6 +101,13 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
int chip_x0; int chip_x0;
int chip_y0; int chip_y0;
int x0, y0, x1, y1, shifty; int x0, y0, x1, y1, shifty;
struct {
uint16_t xmin;
uint16_t xmax;
uint16_t ymin;
uint16_t ymax;
int nc;
} globalROI;
int getMultiplicator(const int group) { int getMultiplicator(const int group) {
int multiplicator; int multiplicator;
@ -215,9 +226,113 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
} }
} }
void remapROI(uint16_t xmin, uint16_t xmax, uint16_t ymin, uint16_t ymax) {
std::tuple< uint16_t, uint16_t, uint16_t, uint16_t > adjustROItoLimits(uint16_t xmin,
uint16_t xmax,
uint16_t ymin,
uint16_t ymax,
uint16_t lim_roi_xmin,
uint16_t lim_roi_xmax,
uint16_t lim_roi_ymin,
uint16_t lim_roi_ymax) {
uint16_t xmin_roi, xmax_roi, ymin_roi, ymax_roi;
if ( xmin < lim_roi_xmin)
xmin_roi = lim_roi_xmin;
else
xmin_roi = xmin;
if ( xmax > lim_roi_xmax )
xmax_roi = lim_roi_xmax;
else
xmax_roi = xmax;
if ( ymin < lim_roi_ymin )
ymin_roi = lim_roi_ymin;
else
ymin_roi = ymin;
if ( ymax > lim_roi_ymax )
ymax_roi = lim_roi_ymax;
else
ymax_roi = ymax;
return std::make_tuple(xmin_roi, xmax_roi, ymin_roi, ymax_roi);
}
std::vector < std::tuple< int, int, uint16_t, uint16_t, uint16_t, uint16_t > > mapSubROIs(uint16_t xmin,
uint16_t xmax,
uint16_t ymin,
uint16_t ymax) {
bool chip_1_1 = false;
bool chip_1_2 = false;
bool chip_1_3 = false;
bool chip_6_1 = false;
bool chip_6_2 = false;
bool chip_6_3 = false;
for ( int x=xmin; x!=xmax+1; ++x ) {
for ( int y=ymin; y!=ymax; ++y ) {
if ( c1g1_xstart<=x && x<=c1_xend && (c1g1_ystart+bond_shift_y)<=y && y<=(c1g1_yend+bond_shift_y) )
chip_1_1 = true;
if ( c1g2_xstart<=x && x<=c1_xend && (c1g2_ystart+bond_shift_y)<=y && y<=(c1g2_yend+bond_shift_y) )
chip_1_2 = true;
if ( c1g3_xstart<=x && x<=c1_xend && (c1g3_ystart+bond_shift_y)<=y && y<=(c1g3_yend+bond_shift_y) )
chip_1_3 = true;
if ( c6_xstart<=x && x<=c6g1_xend && (c6g1_ystart-bond_shift_y)<=y && y<=(c6g1_yend-bond_shift_y) )
chip_6_1 = true;
if ( c6_xstart<=x && x<=c6g2_xend && (c6g2_ystart-bond_shift_y)<=y && y<=(c6g2_yend-bond_shift_y) )
chip_6_2 = true;
if ( c6_xstart<=x && x<=c6g3_xend && (c6g3_ystart-bond_shift_y)<=y && y<=(c6g3_yend-bond_shift_y) )
chip_6_3 = true;
}
}
uint16_t xmin_roi{}, xmax_roi{}, ymin_roi{}, ymax_roi{};
//[ chip, group, xmin, xmax, ymin, ymax ]
std::vector < std::tuple< int, int, uint16_t, uint16_t, uint16_t, uint16_t > > rois{};
if (chip_1_1) {
std::tie( xmin_roi, xmax_roi, ymin_roi, ymax_roi ) =
adjustROItoLimits( xmin, xmax, ymin, ymax,
c1g1_xstart, c1_xend, 0, c1g1_yend+bond_shift_y );
rois.push_back( std::make_tuple( 1, 1, xmin_roi, xmax_roi, ymin_roi, ymax_roi ) );
}
if (chip_1_2) {
std::tie( xmin_roi, xmax_roi, ymin_roi, ymax_roi ) =
adjustROItoLimits( xmin, xmax, ymin, ymax,
c1g2_xstart, c1_xend, c1g2_ystart+bond_shift_y, c1g2_yend+bond_shift_y );
rois.push_back( std::make_tuple( 1, 2, xmin_roi, xmax_roi, ymin_roi, ymax_roi ) );
}
if (chip_1_3) {
std::tie( xmin_roi, xmax_roi, ymin_roi, ymax_roi ) =
adjustROItoLimits( xmin, xmax, ymin, ymax,
c1g3_xstart, c1_xend, c1g3_ystart+bond_shift_y, c1g3_yend+bond_shift_y );
rois.push_back( std::make_tuple( 1, 3, xmin_roi, xmax_roi, ymin_roi, ymax_roi ) );
}
if (chip_6_3) {
std::tie( xmin_roi, xmax_roi, ymin_roi, ymax_roi ) =
adjustROItoLimits( xmin, xmax, ymin, ymax,
c6_xstart, c6g3_xend, c6g3_ystart-bond_shift_y, c6g3_yend-bond_shift_y );
rois.push_back( std::make_tuple( 6, 3, xmin_roi, xmax_roi, ymin_roi, ymax_roi ) );
}
if (chip_6_2) {
std::tie( xmin_roi, xmax_roi, ymin_roi, ymax_roi ) =
adjustROItoLimits( xmin, xmax, ymin, ymax,
c6_xstart, c6g2_xend, c6g2_ystart-bond_shift_y, c6g2_yend-bond_shift_y );
rois.push_back( std::make_tuple( 6, 2, xmin_roi, xmax_roi, ymin_roi, ymax_roi ) );
}
if (chip_6_1) {
std::tie( xmin_roi, xmax_roi, ymin_roi, ymax_roi ) =
adjustROItoLimits( xmin, xmax, ymin, ymax,
c6_xstart, c6g1_xend, c6g1_ystart-bond_shift_y, 511 );
rois.push_back( std::make_tuple( 6, 1, xmin_roi, xmax_roi, ymin_roi, ymax_roi ) );
}
return rois;
}
void remapROI(std::tuple< int, int, uint16_t, uint16_t, uint16_t, uint16_t > roi) {
// determine group and chip selected by ROI // determine group and chip selected by ROI
int group; int group, xmin, xmax, ymin, ymax;
std::tie( mchip, group, xmin, xmax, ymin, ymax ) = roi;
/*
if (ymax <= c1g1_yend + bond_shift_y) { if (ymax <= c1g1_yend + bond_shift_y) {
group = 1; group = 1;
mchip = 1; mchip = 1;
@ -243,18 +358,17 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
group = -1; group = -1;
mchip = -1; mchip = -1;
} }
*/
int multiplicator = getMultiplicator(group); int multiplicator = getMultiplicator(group);
setMappingShifts(group); setMappingShifts(group);
std::cout << "chip: " << mchip << ", group: " << group << ", m: " << multiplicator std::cout << "remapping chip: " << mchip << ", group: " << group << ", m: " << multiplicator
<< ", x0: " << x0 << ", x1: " << x1 << ", y0: " << y0 << ", x0: " << x0 << ", x1: " << x1 << ", y0: " << y0
<< ", y1: " << y1 << std::endl; << ", y1: " << y1 << std::endl;
std::cout << "Adjusted roi: [" << xmin << ", " << xmax << ", " << ymin << ", " << ymax << "]" << std::endl;
// get ROI raw image number of columns
int nc_roi = xmax - xmin + 1;
std::cout << "nc_roi = " << nc_roi << std::endl;
// make sure loop bounds are correct // make sure loop bounds are correct
/*
if (y0 < ymin) if (y0 < ymin)
std::cout << "Error ymin" << std::endl; std::cout << "Error ymin" << std::endl;
if (y1 > ymax) if (y1 > ymax)
@ -264,6 +378,7 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
std::cout << "Error xmin" << std::endl; std::cout << "Error xmin" << std::endl;
if (x1 > xmax) if (x1 > xmax)
std::cout << "Error xmax" << std::endl; std::cout << "Error xmax" << std::endl;
*/
// remapping loop // remapping loop
int ix, iy = 0; int ix, iy = 0;
@ -277,8 +392,10 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
} }
// if (iy< 40) cout << iy << " " << ix <<endl; // if (iy< 40) cout << iy << " " << ix <<endl;
dataMap[iy][ix] = if ( ipx>=xmin && ipx<=xmax && ipy>=ymin && ipy <=ymax )
sizeof(header) + (nc_roi * (ipy - ymin) + (ipx - xmin)) * 2; dataMap[iy][ix] =
sizeof(header) + (globalROI.nc * (ipy - globalROI.ymin) + (ipx - globalROI.xmin)) * 2;
else dataMap[iy][ix] = sizeof(header);
groupmap[iy][ix] = group - 1; groupmap[iy][ix] = group - 1;
} }
} }
@ -307,16 +424,31 @@ class jungfrauLGADStrixelsData : public slsDetectorData<uint16_t> {
} }
} }
globalROI.xmin = xmin;
globalROI.xmax = xmax;
globalROI.ymin = ymin;
globalROI.ymax = ymax;
std::cout << "sizeofheader = " << sizeof(header) << std::endl; std::cout << "sizeofheader = " << sizeof(header) << std::endl;
std::cout << "Jungfrau strixels 2X single chip with full module data " std::cout << "Jungfrau strixels 2X single chip with full module data "
<< std::endl; << std::endl;
if (xmin < xmax && ymin < ymax) { if (xmin < xmax && ymin < ymax) {
dataSize = // get ROI raw image number of columns
(xmax - xmin + 1) * (ymax - ymin + 1) * 2 + sizeof(header); globalROI.nc = xmax - xmin + 1;
std::cout << "datasize " << dataSize << std::endl; std::cout << "nc_roi = " << globalROI.nc << std::endl;
remapROI(xmin, xmax, ymin, ymax);
dataSize =
(xmax - xmin + 1) * (ymax - ymin + 1) * 2 + sizeof(header);
std::cout << "datasize " << dataSize << std::endl;
//[ chip, group, xmin, xmax, ymin, ymax ]
auto rois = mapSubROIs(xmin, xmax, ymin, ymax);
//function to fill vector of rois from globalROI
for ( auto roi : rois )
remapROI(roi);
} else { } else {

View File

@ -3,6 +3,7 @@
#ifndef JUNGFRAUMODULEDATA_H #ifndef JUNGFRAUMODULEDATA_H
#define JUNGFRAUMODULEDATA_H #define JUNGFRAUMODULEDATA_H
#include <cstdint> #include <cstdint>
#include "sls/sls_detector_defs.h"
#include "slsDetectorData.h" #include "slsDetectorData.h"
//#define VERSION_V2 //#define VERSION_V2
@ -27,7 +28,7 @@ typedef struct {
uint64_t bunchNumber; /**< is the frame number */ uint64_t bunchNumber; /**< is the frame number */
uint64_t pre; /**< something */ uint64_t pre; /**< something */
} jf_header; } jf_header; //Aldo's header!
using namespace std; using namespace std;
class jungfrauModuleData : public slsDetectorData<uint16_t> { class jungfrauModuleData : public slsDetectorData<uint16_t> {
@ -42,20 +43,56 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
1286 large etc.) \param c crosstalk parameter for the output buffer 1286 large etc.) \param c crosstalk parameter for the output buffer
*/ */
#ifdef ALDO
using header = jf_header;
#else
using header = sls::defs::sls_receiver_header;
#endif
#ifndef ZMQ #ifndef ZMQ
#define off sizeof(jf_header) #define off sizeof(header)
#endif #endif
#ifdef ZMQ #ifdef ZMQ
#define off 0 #define off 0
#endif #endif
jungfrauModuleData() jungfrauModuleData(uint16_t xmin=0, uint16_t xmax=0,
uint16_t ymin=0, uint16_t ymax=0)
: slsDetectorData<uint16_t>(1024, 512, : slsDetectorData<uint16_t>(1024, 512,
1024* 512 * 2 + off) { 1024* 512 * 2 + off) {
for (int ix = 0; ix < 1024; ix++) { for (int ix = 0; ix != 1024; ++ix) {
for (int iy = 0; iy < 512; iy++) { for (int iy = 0; iy != 512; ++iy) {
dataMap[iy][ix] = off;
}
}
if (xmin < xmax && ymin < ymax) {
int nc_roi = xmax - xmin + 1;
int nr_roi = ymax - ymin + 1;
std::cout << "nc_roi = " << nc_roi << std::endl;
std::cout << "nr_roi = " << nr_roi << std::endl;
dataSize =
(xmax - xmin + 1) * (ymax - ymin + 1) * 2 + off;
std::cout << "datasize " << dataSize << std::endl;
for (int ix = xmin; ix < xmax+1; ++ix) {
for (int iy = ymin; iy < ymax+1; ++iy) {
dataMap[iy][ix] = off + (nc_roi * iy + ix) * 2;
#ifdef HIGHZ
dataMask[iy][ix] = 0x3fff;
#endif
}
}
} else {
for (int ix = 0; ix < 1024; ++ix) {
for (int iy = 0; iy < 512; ++iy) {
dataMap[iy][ix] = off + (1024 * iy + ix) * 2; dataMap[iy][ix] = off + (1024 * iy + ix) * 2;
#ifdef HIGHZ #ifdef HIGHZ
dataMask[iy][ix] = 0x3fff; dataMask[iy][ix] = 0x3fff;
@ -63,7 +100,7 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
} }
} }
}
iframe = 0; iframe = 0;
@ -150,7 +187,7 @@ class jungfrauModuleData : public slsDetectorData<uint16_t> {
//int pn; //int pn;
// cout << dataSize << endl; // cout << dataSize << endl;
if (ff >= 0) //if (ff >= 0)
//fnum = ff; //fnum = ff;
if (filebin.is_open()) { if (filebin.is_open()) {

View File

@ -7,6 +7,7 @@
set(JUNGFRAU_EXECUTABLES) set(JUNGFRAU_EXECUTABLES)
find_package(fmt REQUIRED) find_package(fmt REQUIRED)
find_package(nlohmann_json 3.11.2 REQUIRED)
# jungfrauRawDataProcess # jungfrauRawDataProcess
add_executable(jungfrauRawDataProcess jungfrauRawDataProcess.cpp) add_executable(jungfrauRawDataProcess jungfrauRawDataProcess.cpp)
@ -79,6 +80,7 @@ foreach(exe ${JUNGFRAU_EXECUTABLES})
pthread pthread
tiffio tiffio
fmt::fmt fmt::fmt
nlohmann_json::nlohmann_json
#-L/usr/lib64/ #-L/usr/lib64/
#-lm -lstdc++ -lrt #-lm -lstdc++ -lrt

View File

@ -41,6 +41,9 @@
#include <ctime> #include <ctime>
#include <fmt/core.h> #include <fmt/core.h>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
std::string getRootString( const std::string& filepath ) { std::string getRootString( const std::string& filepath ) {
size_t pos1 = filepath.find_last_of("/"); size_t pos1 = filepath.find_last_of("/");
@ -61,20 +64,24 @@ std::string getRootString( const std::string& filepath ) {
std::string createFileName( const std::string& dir, const std::string& fprefix="run", const std::string& fsuffix="", const std::string& fext="raw", int aindex=0, int mindex=0, int findex=0, int outfilecounter=-1 ) { std::string createFileName( const std::string& dir, const std::string& fprefix="run", const std::string& fsuffix="", const std::string& fext="raw", int aindex=0, int mindex=0, int findex=0, int outfilecounter=-1 ) {
if (outfilecounter >= 0) if (outfilecounter >= 0)
return fmt::format("{:s}/{:s}_d{:d}_f{:d}_{:d}_f{:05d}.{:s}", dir, fprefix, mindex, findex, aindex, outfilecounter, fext); return fmt::format("{:s}/{:s}_d{:d}_f{:d}_{:d}_f{:05d}.{:s}", dir, fprefix, mindex, findex, aindex, outfilecounter, fext);
else if (fsuffix.length()!=0) else if (fsuffix.length()!=0) {
return fmt::format("{:s}/{:s}_{:s}.{:s}", dir, fprefix, fsuffix, fext); if (fsuffix == "master")
return fmt::format("{:s}/{:s}_master_{:d}.{:s}", dir, fprefix, aindex, fext);
else
return fmt::format("{:s}/{:s}_{:s}.{:s}", dir, fprefix, fsuffix, fext);
}
else else
return fmt::format("{:s}/{:s}_d{:d}_f{:d}_{:d}.{:s}", dir, fprefix, mindex, findex, aindex, fext); return fmt::format("{:s}/{:s}_d{:d}_f{:d}_{:d}.{:s}", dir, fprefix, mindex, findex, aindex, fext);
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 5) { if (argc < 6) {
std::cout std::cout
<< "Usage is " << argv[0] << "Usage is " << argv[0]
<< "indir outdir fprefix(excluding slsDetector standard suffixes and extension) fextension " << "indir outdir [fprefix(excluding slsDetector standard suffixes and extension)] [fextension] "
"[runmin] [runmax] [pedfile (raw or tiff)] [threshold] " "[fmin] [fmax] [runmin] [runmax] [pedfile (raw or tiff)] [threshold] "
"[nframes] [xmin xmax ymin ymax] [gainmap]" "[nframes] [xmin xmax ymin ymax] [optional: bool read rxroi from data file header] [gainmap]"
<< std::endl; << std::endl;
std::cout std::cout
<< "threshold <0 means analog; threshold=0 means cluster finder; " << "threshold <0 means analog; threshold=0 means cluster finder; "
@ -106,34 +113,69 @@ int main(int argc, char *argv[]) {
std::string outdir(argv[2]); std::string outdir(argv[2]);
std::string fprefix(argv[3]); std::string fprefix(argv[3]);
std::string fext(argv[4]); std::string fext(argv[4]);
int fmin = 0;
if (argc >= 6)
fmin = atoi(argv[5]);
int fmax = fmin;
if (argc >= 7)
fmax = atoi(argv[6]);
int runmin = 0; int runmin = 0;
// cout << "argc is " << argc << endl; // cout << "argc is " << argc << endl;
if (argc >= 6) { if (argc >= 8) {
runmin = atoi(argv[5]); runmin = atoi(argv[7]);
} }
int runmax = runmin; int runmax = runmin;
if (argc >= 9) {
if (argc >= 7) { runmax = atoi(argv[8]);
runmax = atoi(argv[6]);
} }
std::string pedfilename{}; std::string pedfilename{};
if (argc >= 8) { if (argc >= 10) {
pedfilename = argv[7]; pedfilename = argv[9];
} }
double thr = 0; double thr = 0;
double thr1 = 1; double thr1 = 1;
if (argc >= 9) { if (argc >= 11) {
thr = atof(argv[8]); thr = atof(argv[10]);
} }
int nframes = 0; int nframes = 0;
if (argc >= 10) { if (argc >= 12) {
nframes = atoi(argv[9]); nframes = atoi(argv[11]);
}
bool readrxroifromdatafile = false;
if (argc >= 17)
readrxroifromdatafile = atoi(argv[16]);
// Receiver ROI
uint16_t rxroi_xmin = 0;
uint16_t rxroi_xmax = 0;
uint16_t rxroi_ymin = 0;
uint16_t rxroi_ymax = 0;
{ //protective scope so ifstream gets destroyed properly
auto jsonmastername = createFileName( indir, fprefix, "master", "json", runmin );
std::cout << "json master file " << jsonmastername << std::endl;
std::ifstream masterfile(jsonmastername); //, ios::in | ios::binary);
if (masterfile.is_open()) {
json j;
masterfile >> j;
rxroi_xmin = j["Receiver Roi"]["xmin"];
rxroi_xmax = j["Receiver Roi"]["xmax"];
rxroi_ymin = j["Receiver Roi"]["ymin"];
rxroi_ymax = j["Receiver Roi"]["ymax"];
masterfile.close();
std::cout << "Read Receiver ROI [" << rxroi_xmin << ", " << rxroi_xmax << ", "
<< rxroi_ymin << ", " << rxroi_ymax << "] from json master file" << std::endl;
} else
std::cout << "Could not open master file " << jsonmastername << std::endl;
} }
// Define decoders... // Define decoders...
@ -144,56 +186,52 @@ int main(int argc, char *argv[]) {
int nx = 256, ny = 256; int nx = 256, ny = 256;
#endif #endif
#ifdef MODULE #ifdef MODULE
jungfrauModuleData *decoder = new jungfrauModuleData(); jungfrauModuleData *decoder = new jungfrauModuleData(rxroi_xmin, rxroi_xmax, rxroi_ymin, rxroi_ymax);
int nx = 1024, ny = 512; int nx = 1024, ny = 512;
#endif #endif
#endif #endif
#ifdef JFSTRX #ifdef JFSTRX
cout << "Jungfrau strixel full module readout" << endl; cout << "Jungfrau strixel full module readout" << endl;
// ROI
uint16_t xxmin = 0;
uint16_t xxmax = 0;
uint16_t yymin = 0;
uint16_t yymax = 0;
#ifndef ALDO #ifndef ALDO
{ //THIS SCOPE IS IMPORTANT! (To ensure proper destruction of ifstream) if (readrxroifromdatafile)
using header = sls::defs::sls_receiver_header; { //THIS SCOPE IS IMPORTANT! (To ensure proper destruction of ifstream)
// check if there is a roi in the header using header = sls::defs::sls_receiver_header;
typedef struct { // check if there is a roi in the header
uint16_t xmin; typedef struct {
uint16_t xmax; uint16_t xmin;
uint16_t ymin; uint16_t xmax;
uint16_t ymax; uint16_t ymin;
} receiverRoi_compact; uint16_t ymax;
receiverRoi_compact croi; } receiverRoi_compact;
std::string fsuffix{}; receiverRoi_compact croi;
auto filename = createFileName( indir, fprefix, fsuffix, fext, runmin ); std::string fsuffix{};
std::cout << "Reading header of file " << filename << " to check for ROI " auto filename = createFileName( indir, fprefix, fsuffix, fext, runmin );
<< std::endl; std::cout << "Reading header of file " << filename << " to check for ROI "
ifstream firstfile(filename, ios::in | ios::binary); << std::endl;
if (firstfile.is_open()) { ifstream firstfile(filename, ios::in | ios::binary);
header hbuffer; if (firstfile.is_open()) {
std::cout << "sizeof(header) = " << sizeof(header) << std::endl; header hbuffer;
if (firstfile.read((char *)&hbuffer, sizeof(header))) { std::cout << "sizeof(header) = " << sizeof(header) << std::endl;
memcpy(&croi, &hbuffer.detHeader.detSpec1, 8); if (firstfile.read((char *)&hbuffer, sizeof(header))) {
std::cout << "Read ROI [" << croi.xmin << ", " << croi.xmax << ", " memcpy(&croi, &hbuffer.detHeader.detSpec1, 8);
<< croi.ymin << ", " << croi.ymax << "]" << std::endl; std::cout << "Read ROI [" << croi.xmin << ", " << croi.xmax << ", "
xxmin = croi.xmin; << croi.ymin << ", " << croi.ymax << "]" << std::endl;
xxmax = croi.xmax; rxroi_xmin = croi.xmin;
yymin = croi.ymin; rxroi_xmax = croi.xmax;
yymax = croi.ymax; rxroi_ymin = croi.ymin;
} else rxroi_ymax = croi.ymax;
std::cout << "reading error" << std::endl; } else
firstfile.close(); std::cout << "reading error" << std::endl;
} else firstfile.close();
std::cout << "Could not open " << filename << " for reading " << std::endl; } else
} //end of protective scope std::cout << "Could not open " << filename << " for reading " << std::endl;
} //end of protective scope
#endif #endif
jungfrauLGADStrixelsData *decoder = jungfrauLGADStrixelsData *decoder =
new jungfrauLGADStrixelsData(xxmin, xxmax, yymin, yymax); new jungfrauLGADStrixelsData(rxroi_xmin, rxroi_xmax, rxroi_ymin, rxroi_ymax);
int nx = 1024 / 3, ny = 512 * 5; int nx = 1024 / 3, ny = 512 * 5;
#endif #endif
#ifdef JFSTRXCHIP1 #ifdef JFSTRXCHIP1
@ -218,19 +256,20 @@ int main(int argc, char *argv[]) {
decoder->getDetectorSize(nx, ny); decoder->getDetectorSize(nx, ny);
std::cout << "Detector size is " << nx << " " << ny << std::endl; std::cout << "Detector size is " << nx << " " << ny << std::endl;
int xmin = 0, xmax = nx, ymin = 0, ymax = ny; //Cluster finder ROI
if (argc >= 14) { int xmin = 0, xmax = nx-1, ymin = 0, ymax = ny-1;
xmin = atoi(argv[10]); if (argc >= 16) {
xmax = atoi(argv[11]); xmin = atoi(argv[12]);
ymin = atoi(argv[12]); xmax = atoi(argv[13]);
ymax = atoi(argv[13]); ymin = atoi(argv[14]);
ymax = atoi(argv[15]);
} }
std::cout << xmin << " " << xmax << " " << ymin << " " << ymax << " " std::cout << "Cluster finder ROI: [" << xmin << ", " << xmax << ", " << ymin << ", " << ymax << "]"
<< std::endl; << std::endl;
char *gainfname = NULL; char *gainfname = NULL;
if (argc > 14) { if (argc > 17) {
gainfname = argv[14]; gainfname = argv[17];
std::cout << "Gain map file name is: " << gainfname << std::endl; std::cout << "Gain map file name is: " << gainfname << std::endl;
} }
@ -239,6 +278,8 @@ int main(int argc, char *argv[]) {
std::cout << "input directory is " << indir << std::endl; std::cout << "input directory is " << indir << std::endl;
std::cout << "output directory is " << outdir << std::endl; std::cout << "output directory is " << outdir << std::endl;
std::cout << "input file prefix is " << fprefix << std::endl; std::cout << "input file prefix is " << fprefix << std::endl;
std::cout << "fmin is " << fmin << std::endl;
std::cout << "fmax is " << fmax << std::endl;
std::cout << "runmin is " << runmin << std::endl; std::cout << "runmin is " << runmin << std::endl;
std::cout << "runmax is " << runmax << std::endl; std::cout << "runmax is " << runmax << std::endl;
if (pedfilename.length()!=0) if (pedfilename.length()!=0)
@ -319,7 +360,7 @@ int main(int argc, char *argv[]) {
mt->setFrameMode(ePedestal); mt->setFrameMode(ePedestal);
ifstream pedefile(fname, ios::in | ios::binary); std::ifstream pedefile(fname, ios::in | ios::binary);
// //open file // //open file
if (pedefile.is_open()) { if (pedefile.is_open()) {
std::cout << "bbbb " << std::ctime(&end_time) << std::endl; std::cout << "bbbb " << std::ctime(&end_time) << std::endl;
@ -380,26 +421,27 @@ int main(int argc, char *argv[]) {
} }
ifr = 0; ifr = 0;
int ifile = 0; int ioutfile = 0;
mt->setFrameMode(eFrame); mt->setFrameMode(eFrame);
FILE *of = NULL; FILE *of = NULL;
for (int irun = runmin; irun <= runmax; irun++) { for (int irun = runmin; irun <= runmax; ++irun) {
for (int ifile = fmin; ifile <= fmax; ++ifile) {
std::cout << "DATA "; std::cout << "DATA ";
std::string fsuffix{}; std::string fsuffix{};
auto fname = createFileName( indir, fprefix, fsuffix, fext, irun ); auto fname = createFileName( indir, fprefix, fsuffix, fext, irun, 0, ifile );
auto imgfname = createFileName( outdir, fprefix, fsuffix, "tiff", irun ); auto imgfname = createFileName( outdir, fprefix, fsuffix, "tiff", irun, 0, ifile );
auto cfname = createFileName( outdir, fprefix, fsuffix, "clust", irun ); auto cfname = createFileName( outdir, fprefix, fsuffix, "clust", irun, 0, ifile );
std::cout << fname << " "; std::cout << fname << " ";
std::cout << imgfname << std::endl; std::cout << imgfname << std::endl;
std::time(&end_time); std::time(&end_time);
std::cout << std::ctime(&end_time) << std::endl; std::cout << std::ctime(&end_time) << std::endl;
// std::cout << fname << " " << outfname << " " << imgfname << std::endl; // std::cout << fname << " " << outfname << " " << imgfname << std::endl;
ifstream filebin(fname, ios::in | ios::binary); std::ifstream filebin(fname, ios::in | ios::binary);
// //open file // //open file
ifile = 0; ioutfile = 0;
if (filebin.is_open()) { if (filebin.is_open()) {
if (thr <= 0 && cf != 0) { // cluster finder if (thr <= 0 && cf != 0) { // cluster finder
if (of == NULL) { if (of == NULL) {
@ -436,10 +478,10 @@ int main(int argc, char *argv[]) {
std::cout << " " << ifr << " " << ff << std::endl; std::cout << " " << ifr << " " << ff << std::endl;
if (nframes > 0) { if (nframes > 0) {
if (ifr % nframes == 0) { if (ifr % nframes == 0) {
imgfname = createFileName( outdir, fprefix, fsuffix, "tiff", irun, 0, 0, ifile ); imgfname = createFileName( outdir, fprefix, fsuffix, "tiff", irun, 0, 0, ioutfile );
mt->writeImage(imgfname.c_str(), thr1); mt->writeImage(imgfname.c_str(), thr1);
mt->clearImage(); mt->clearImage();
ifile++; ioutfile++;
} }
} }
// } else // } else
@ -453,7 +495,7 @@ int main(int argc, char *argv[]) {
} }
if (nframes >= 0) { if (nframes >= 0) {
if (nframes > 0) if (nframes > 0)
imgfname = createFileName( outdir, fprefix, fsuffix, "tiff", irun, 0, 0, ifile ); imgfname = createFileName( outdir, fprefix, fsuffix, "tiff", irun, 0, 0, ioutfile );
std::cout << "Writing tiff to " << imgfname << " " << thr1 std::cout << "Writing tiff to " << imgfname << " " << thr1
<< std::endl; << std::endl;
mt->writeImage(imgfname.c_str(), thr1); mt->writeImage(imgfname.c_str(), thr1);
@ -469,9 +511,10 @@ int main(int argc, char *argv[]) {
} else } else
std::cout << "Could not open " << fname << " for reading " std::cout << "Could not open " << fname << " for reading "
<< std::endl; << std::endl;
}
} }
if (nframes < 0) { if (nframes < 0) {
auto imgfname = createFileName( outdir, fprefix, "sum", "tiff", -1, 0, 0, -1 ); auto imgfname = createFileName( outdir, fprefix, "sum", "tiff", runmin, 0, fmin, -1 );
std::cout << "Writing tiff to " << imgfname << " " << thr1 << std::endl; std::cout << "Writing tiff to " << imgfname << " " << thr1 << std::endl;
mt->writeImage(imgfname.c_str(), thr1); mt->writeImage(imgfname.c_str(), thr1);
} }

View File

@ -41,6 +41,9 @@
#include <ctime> #include <ctime>
#include <fmt/core.h> #include <fmt/core.h>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
std::string getRootString( const std::string& filepath ) { std::string getRootString( const std::string& filepath ) {
size_t pos1; size_t pos1;
@ -71,11 +74,11 @@ std::string createFileName( const std::string& dir, const std::string& fprefix="
//NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS! //NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS!
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 10) { if (argc < 11) {
std::cout std::cout
<< "Usage is " << argv[0] << "Usage is " << argv[0]
<< " filestxt outdir [pedfile (raw or tiff)] [xmin xmax ymin ymax] " << " filestxt outdir [json master] [pedfile (raw or tiff)] [xmin xmax ymin ymax] "
"[threshold] [nframes] " "[threshold] [nframes] [optional: bool read rxroi from data file header]"
"NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS! " "NOTE THAT THE DATA FILES HAVE TO BE IN THE RIGHT ORDER SO THAT PEDESTAL TRACKING WORKS! "
<< std::endl; << std::endl;
std::cout std::cout
@ -105,19 +108,19 @@ int main(int argc, char *argv[]) {
const std::string txtfilename(argv[1]); const std::string txtfilename(argv[1]);
const std::string outdir(argv[2]); const std::string outdir(argv[2]);
const std::string pedfilename(argv[3]); const std::string jsonmastername(argv[3]);
const std::string pedfilename(argv[4]);
int xmin = atoi(argv[4]);
int xmax = atoi(argv[5]);
int ymin = atoi(argv[6]);
int ymax = atoi(argv[7]);
double thr = 0; double thr = 0;
double thr1 = 1; double thr1 = 1;
thr = atof(argv[8]); thr = atof(argv[9]);
int nframes = 0; int nframes = 0;
nframes = atoi(argv[9]); nframes = atoi(argv[10]);
bool readrxroifromdatafile = false;
if (argc > 11)
readrxroifromdatafile = atoi(argv[11]);
//Get vector of filenames from input txt-file //Get vector of filenames from input txt-file
std::vector<std::string> filenames{}; std::vector<std::string> filenames{};
@ -147,6 +150,30 @@ int main(int argc, char *argv[]) {
std::cout << "###############" << std::endl; std::cout << "###############" << std::endl;
// Receiver ROI
uint16_t rxroi_xmin = 0;
uint16_t rxroi_xmax = 0;
uint16_t rxroi_ymin = 0;
uint16_t rxroi_ymax = 0;
{ //protective scope so ifstream gets destroyed properly
std::ifstream masterfile(jsonmastername); //, ios::in | ios::binary);
if (masterfile.is_open()) {
json j;
masterfile >> j;
rxroi_xmin = j["Receiver Roi"]["xmin"];
rxroi_xmax = j["Receiver Roi"]["xmax"];
rxroi_ymin = j["Receiver Roi"]["ymin"];
rxroi_ymax = j["Receiver Roi"]["ymax"];
masterfile.close();
std::cout << "Read rxROI [" << rxroi_xmin << ", " << rxroi_xmax << ", "
<< rxroi_ymin << ", " << rxroi_ymax << "]" << std::endl;
} else
std::cout << "Could not open master file " << jsonmastername << std::endl;
}
// Define decoders... // Define decoders...
#if !defined JFSTRX && !defined JFSTRXOLD && !defined JFSTRXCHIP1 && \ #if !defined JFSTRX && !defined JFSTRXOLD && !defined JFSTRXCHIP1 && \
!defined JFSTRXCHIP6 !defined JFSTRXCHIP6
@ -162,48 +189,44 @@ int main(int argc, char *argv[]) {
#ifdef JFSTRX #ifdef JFSTRX
cout << "Jungfrau strixel full module readout" << endl; cout << "Jungfrau strixel full module readout" << endl;
// ROI
uint16_t xxmin = 0;
uint16_t xxmax = 0;
uint16_t yymin = 0;
uint16_t yymax = 0;
#ifndef ALDO #ifndef ALDO
{ //THIS SCOPE IS IMPORTANT! (To ensure proper destruction of ifstream) if (readrxroifromdatafile)
using header = sls::defs::sls_receiver_header; { //THIS SCOPE IS IMPORTANT! (To ensure proper destruction of ifstream)
// check if there is a roi in the header using header = sls::defs::sls_receiver_header;
typedef struct { // check if there is a roi in the header
uint16_t xmin; typedef struct {
uint16_t xmax; uint16_t xmin;
uint16_t ymin; uint16_t xmax;
uint16_t ymax; uint16_t ymin;
} receiverRoi_compact; uint16_t ymax;
receiverRoi_compact croi; } receiverRoi_compact;
//std::string filepath(argv[9]); //This is a problem if the input files have different ROIs! receiverRoi_compact croi;
std::cout << "Reading header of file " << filenames[0] << " to check for ROI " //std::string filepath(argv[9]); //This is a problem if the input files have different ROIs!
<< std::endl; std::cout << "Reading header of file " << filenames[0] << " to check for ROI "
ifstream firstfile(filenames[0], ios::in | ios::binary); << std::endl;
if (firstfile.is_open()) { std::ifstream firstfile( filenames[0], ios::in | ios::binary);
header hbuffer; if (firstfile.is_open()) {
std::cout << "sizeof(header) = " << sizeof(header) << std::endl; header hbuffer;
if (firstfile.read((char *)&hbuffer, sizeof(header))) { std::cout << "sizeof(header) = " << sizeof(header) << std::endl;
memcpy(&croi, &hbuffer.detHeader.detSpec1, 8); if (firstfile.read((char *)&hbuffer, sizeof(header))) {
std::cout << "Read ROI [" << croi.xmin << ", " << croi.xmax << ", " memcpy(&croi, &hbuffer.detHeader.detSpec1, 8);
<< croi.ymin << ", " << croi.ymax << "]" << std::endl; std::cout << "Read ROI [" << croi.xmin << ", " << croi.xmax << ", "
xxmin = croi.xmin; << croi.ymin << ", " << croi.ymax << "]" << std::endl;
xxmax = croi.xmax; rxroi_xmin = croi.xmin;
yymin = croi.ymin; rxroi_xmax = croi.xmax;
yymax = croi.ymax; rxroi_ymin = croi.ymin;
} else rxroi_ymax = croi.ymax;
std::cout << "reading error" << std::endl; } else
firstfile.close(); std::cout << "reading error" << std::endl;
} else firstfile.close();
std::cout << "Could not open " << filenames[0] << " for reading " << std::endl; } else
} //end of protective scope std::cout << "Could not open " << filenames[0] << " for reading " << std::endl;
} //end of protective scope
#endif #endif
jungfrauLGADStrixelsData *decoder = jungfrauLGADStrixelsData *decoder =
new jungfrauLGADStrixelsData(xxmin, xxmax, yymin, yymax); new jungfrauLGADStrixelsData(rxroi_xmin, rxroi_xmax, rxroi_ymin, rxroi_ymax);
int nx = 1024 / 3, ny = 512 * 5; int nx = 1024 / 3, ny = 512 * 5;
#endif #endif
#ifdef JFSTRXCHIP1 #ifdef JFSTRXCHIP1
@ -228,7 +251,16 @@ int main(int argc, char *argv[]) {
decoder->getDetectorSize(nx, ny); decoder->getDetectorSize(nx, ny);
std::cout << "Detector size is " << nx << " " << ny << std::endl; std::cout << "Detector size is " << nx << " " << ny << std::endl;
//Cluster finder ROI
int xmin = 0, xmax = nx-1, ymin = 0, ymax = ny-1;
xmin = atoi(argv[5]);
xmax = atoi(argv[6]);
ymin = atoi(argv[7]);
ymax = atoi(argv[8]);
std::cout << "Cluster finder ROI: [" << xmin << ", " << xmax << ", " << ymin << ", " << ymax << "]"
<< std::endl;
/* old
if ( xmin == xmax ) { if ( xmin == xmax ) {
xmin = 0; xmin = 0;
xmax = nx; xmax = nx;
@ -239,6 +271,7 @@ int main(int argc, char *argv[]) {
} }
std::cout << xmin << " " << xmax << " " << ymin << " " << ymax << " " std::cout << xmin << " " << xmax << " " << ymin << " " << ymax << " "
<< std::endl; << std::endl;
*/
/* /*
char *gainfname = NULL; char *gainfname = NULL;
@ -410,7 +443,7 @@ int main(int argc, char *argv[]) {
std::time(&end_time); std::time(&end_time);
std::cout << std::ctime(&end_time) << std::endl; std::cout << std::ctime(&end_time) << std::endl;
ifstream filebin(filenames[ifile], ios::in | ios::binary); std::ifstream filebin(filenames[ifile], ios::in | ios::binary);
// //open file // //open file
ioutfile = 0; ioutfile = 0;
if (filebin.is_open()) { if (filebin.is_open()) {

View File

@ -803,9 +803,8 @@ void qTabMeasurement::GetNextFrameNumber() {
"Inconsistent starting frame number for all detectors."); "Inconsistent starting frame number for all detectors.");
spinNextFrameNumber->setValue(retval); spinNextFrameNumber->setValue(retval);
} }
CATCH_HANDLE("Could not get starting frame number.", CATCH_DISPLAY("Could not get starting frame number.",
"qTabMeasurement::GetNextFrameNumber", spinNextFrameNumber, "qTabMeasurement::GetNextFrameNumber")
&QSpinBox::setValue, -1)
connect(spinNextFrameNumber, SIGNAL(valueChanged(int)), this, connect(spinNextFrameNumber, SIGNAL(valueChanged(int)), this,
SLOT(SetNextFrameNumber(int))); SLOT(SetNextFrameNumber(int)));
} }

View File

@ -10,7 +10,7 @@
#define HARDWARE_VERSION_NAMES \ #define HARDWARE_VERSION_NAMES \
{ "FX70T", "FX30T" } { "FX70T", "FX30T" }
#define REQUIRED_FIRMWARE_VERSION (32) #define REQUIRED_FIRMWARE_VERSION (31)
// virtual ones renamed for consistency // virtual ones renamed for consistency
// real ones keep previous name for compatibility (already in production) // real ones keep previous name for compatibility (already in production)
#ifdef VIRTUAL #ifdef VIRTUAL

View File

@ -24,18 +24,16 @@
#define RUN_BUSY_OFST (0) #define RUN_BUSY_OFST (0)
#define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST) #define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST)
#define WAITING_FOR_TRIGGER_OFST (1) #define WAITING_FOR_TRIGGER_OFST (3)
#define WAITING_FOR_TRIGGER_MSK (0x00000001 << WAITING_FOR_TRIGGER_OFST) #define WAITING_FOR_TRIGGER_MSK (0x00000001 << WAITING_FOR_TRIGGER_OFST)
#define WAITING_FOR_START_FRAME_OFST (2) #define DELAYBEFORE_OFST (4) // Not used in software
#define WAITING_FOR_START_FRAME_MSK (0x00000001 << WAITING_FOR_START_FRAME_OFST) #define DELAYBEFORE_MSK (0x00000001 << DELAYBEFORE_OFST) // Not used in software
#define ACQUIRING_FRAME_OFST (3) // Not used in software #define DELAYAFTER_OFST (5) // Not used in software
#define ACQUIRING_FRAME_MSK (0x00000001 << ACQUIRING_FRAME_OFST) #define DELAYAFTER_MSK (0x00000001 << DELAYAFTER_OFST) // Not used in software
#define WAITING_FOR_PERIOD_TO_ELAPSE_OFST (4) // Not used in software #define STOPPED_OFST (15)
#define WAITING_FOR_PERIOD_TO_ELAPSE_MSK (0x00000001 << WAITING_FOR_PERIOD_TO_ELAPSE_OFST)
#define STOPPED_OFST (8)
#define STOPPED_MSK (0x00000001 << STOPPED_OFST) #define STOPPED_MSK (0x00000001 << STOPPED_OFST)
#define INTERNAL_STOP_OFST (9) #define RUNMACHINE_BUSY_OFST (17)
#define INTERNAL_STOP_MSK (0x00000001 << INTERNAL_STOP_OFST) #define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
/* Look at me register */ /* Look at me register */
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) // Not used in firmware or software #define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) // Not used in firmware or software

View File

@ -2924,17 +2924,14 @@ int softwareTrigger(int block) {
LOG(logINFO, ("Sending Software Trigger\n")); LOG(logINFO, ("Sending Software Trigger\n"));
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_SOFTWARE_TRIGGER_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_SOFTWARE_TRIGGER_MSK);
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_SOFTWARE_TRIGGER_MSK); bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_SOFTWARE_TRIGGER_MSK);
// wait to make sure its out of this state and even 'wait for start frame'
usleep(100);
#ifndef VIRTUAL #ifndef VIRTUAL
// block till frame sent out & back to wait for trigger (or not busy // block till frame is sent out
// anymore)
if (block) { if (block) {
uint32_t retval = bus_r(STATUS_REG); enum runStatus s = getRunStatus();
while ((retval & RUN_BUSY_MSK) && !(retval & WAITING_FOR_TRIGGER_MSK)) { while (s == RUNNING || s == TRANSMITTING) {
usleep(5000); usleep(5000);
retval = bus_r(STATUS_REG); s = getRunStatus();
} }
} }
LOG(logINFO, ("Ready for Next Trigger...\n")); LOG(logINFO, ("Ready for Next Trigger...\n"));
@ -2967,16 +2964,9 @@ enum runStatus getRunStatus() {
u_int32_t retval = bus_r(STATUS_REG); u_int32_t retval = bus_r(STATUS_REG);
LOG(logINFO, ("Status Register: %08x\n", retval)); LOG(logINFO, ("Status Register: %08x\n", retval));
// error
if (retval & INTERNAL_STOP_MSK) {
LOG(logINFOBLUE, ("Status: ERROR\n"));
s = ERROR;
}
// running // running
else if (retval & RUN_BUSY_MSK) { if (retval & RUN_BUSY_MSK) {
if ((retval & WAITING_FOR_TRIGGER_MSK) || if (retval & WAITING_FOR_TRIGGER_MSK) {
(retval & WAITING_FOR_START_FRAME_MSK)) {
LOG(logINFOBLUE, ("Status: WAITING\n")); LOG(logINFOBLUE, ("Status: WAITING\n"));
s = WAITING; s = WAITING;
} else { } else {
@ -2987,13 +2977,19 @@ enum runStatus getRunStatus() {
// not running // not running
else { else {
// stopped or idle // stopped or error
if (retval & STOPPED_MSK) { if (retval & STOPPED_MSK) {
LOG(logINFOBLUE, ("Status: STOPPED\n")); LOG(logINFOBLUE, ("Status: STOPPED\n"));
s = STOPPED; s = STOPPED;
} else { } else if (retval & RUNMACHINE_BUSY_MSK) {
LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n"));
s = TRANSMITTING;
} else if (!retval) {
LOG(logINFOBLUE, ("Status: IDLE\n")); LOG(logINFOBLUE, ("Status: IDLE\n"));
s = IDLE; s = IDLE;
} else {
LOG(logERROR, ("Status: Unknown status %08x\n", retval));
s = ERROR;
} }
} }

View File

@ -15,11 +15,6 @@ u_int32_t *csp0base = 0;
#define CSP0 0x20200000 #define CSP0 0x20200000
#define MEM_SIZE 0x100000 #define MEM_SIZE 0x100000
#ifdef JUNGFRAUD
extern void configureChip();
#endif
void bus_w16(u_int32_t offset, u_int16_t data) { void bus_w16(u_int32_t offset, u_int16_t data) {
volatile u_int16_t *ptr1; volatile u_int16_t *ptr1;
ptr1 = (u_int16_t *)(csp0base + offset / 2); ptr1 = (u_int16_t *)(csp0base + offset / 2);
@ -85,21 +80,7 @@ u_int32_t readRegister(u_int32_t offset) {
} }
u_int32_t writeRegister(u_int32_t offset, u_int32_t data) { u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
// if electron mode bit touched
#ifdef JUNGFRAUD
int electronCollectionModeChange = 0;
if ((offset << MEM_MAP_SHIFT) == DAQ_REG) {
if ((readRegister(offset) ^ data) & DAQ_ELCTRN_CLLCTN_MDE_MSK) {
electronCollectionModeChange = 1;
}
}
#endif
bus_w(offset << MEM_MAP_SHIFT, data); bus_w(offset << MEM_MAP_SHIFT, data);
#ifdef JUNGFRAUD
if (electronCollectionModeChange) {
configureChip();
}
#endif
return readRegister(offset); return readRegister(offset);
} }

View File

@ -532,11 +532,6 @@ int executeCommand(char *command, char *result, enum TLogLevel level) {
fflush(stdout); fflush(stdout);
FILE *sysFile = popen(cmd, "r"); FILE *sysFile = popen(cmd, "r");
if (sysFile == NULL) {
ret = FAIL;
sprintf(mess, "Executing cmd[%s] failed\n", cmd);
return ret;
}
while (fgets(temp, tempsize, sysFile) != NULL) { while (fgets(temp, tempsize, sysFile) != NULL) {
// size left excludes terminating character // size left excludes terminating character
size_t sizeleft = MAX_STR_LENGTH - strlen(result) - 1; size_t sizeleft = MAX_STR_LENGTH - strlen(result) - 1;
@ -552,15 +547,17 @@ int executeCommand(char *command, char *result, enum TLogLevel level) {
if (strlen(result) == 0) { if (strlen(result) == 0) {
strcpy(result, "No result"); strcpy(result, "No result");
} }
int retval = OK;
int success = pclose(sysFile); int success = pclose(sysFile);
if (success == -1) { if (success) {
ret = FAIL; retval = FAIL;
strcpy(mess, result); LOG(logERROR, ("Executing cmd[%s]:%s\n", cmd, result));
LOG(logERROR, ("Executing cmd[%s] failed:%s\n", cmd, mess));
} else { } else {
LOG(level, ("Result:\n[%s]\n", result)); LOG(level, ("Result:\n[%s]\n", result));
} }
return ret;
return retval;
} }
int M_nofunc(int file_des) { int M_nofunc(int file_des) {
@ -588,7 +585,7 @@ int exec_command(int file_des) {
// set // set
if (Server_VerifyLock() == OK) { if (Server_VerifyLock() == OK) {
executeCommand(cmd, retval, logINFO); ret = executeCommand(cmd, retval, logINFO);
} }
return Server_SendResult(file_des, OTHER, retval, sizeof(retval)); return Server_SendResult(file_des, OTHER, retval, sizeof(retval));
} }
@ -1951,57 +1948,59 @@ int acquire(int blocking, int file_des) {
#ifdef EIGERD #ifdef EIGERD
// check for hardware mac and hardware ip // check for hardware mac and hardware ip
if (udpDetails[0].srcmac != getDetectorMAC()) { if (udpDetails[0].srcmac != getDetectorMAC()) {
ret = FAIL; ret = FAIL;
uint64_t sourcemac = getDetectorMAC(); uint64_t sourcemac = getDetectorMAC();
char src_mac[MAC_ADDRESS_SIZE]; char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac); getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf(mess, sprintf(
mess,
"Invalid udp source mac address for this detector. Must be " "Invalid udp source mac address for this detector. Must be "
"same as hardware detector mac address %s\n", "same as hardware detector mac address %s\n",
src_mac); src_mac);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(GET_FLAG) && } else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails[0].srcip != getDetectorIP())) { (udpDetails[0].srcip != getDetectorIP())) {
ret = FAIL; ret = FAIL;
uint32_t sourceip = getDetectorIP(); uint32_t sourceip = getDetectorIP();
char src_ip[INET_ADDRSTRLEN]; char src_ip[INET_ADDRSTRLEN];
getIpAddressinString(src_ip, sourceip); getIpAddressinString(src_ip, sourceip);
sprintf(mess, sprintf(
mess,
"Invalid udp source ip address for this detector. Must be " "Invalid udp source ip address for this detector. Must be "
"same as hardware detector ip address %s in 1G readout " "same as hardware detector ip address %s in 1G readout "
"mode \n", "mode \n",
src_ip); src_ip);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else } else
#endif #endif
if (configured == FAIL) { if (configured == FAIL) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is "
"already running!\n");
LOG(logERROR, (mess));
} else {
memset(scanErrMessage, 0, MAX_STR_LENGTH);
sharedMemory_setScanStop(0);
sharedMemory_setScanStatus(IDLE); // if it was error
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
&blocking)) {
ret = FAIL; ret = FAIL;
strcpy(mess, "Could not start acquisition thread!\n"); strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is "
"already running!\n");
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else { } else {
// wait for blocking always (scan or not) memset(scanErrMessage, 0, MAX_STR_LENGTH);
// non blocking-no scan also wait (for error message) sharedMemory_setScanStop(0);
// non blcoking-scan dont wait (there is scanErrorMessage) sharedMemory_setScanStatus(IDLE); // if it was error
if (blocking || !scan) { if (pthread_create(&pthread_tid, NULL, &start_state_machine,
pthread_join(pthread_tid, NULL); &blocking)) {
ret = FAIL;
strcpy(mess, "Could not start acquisition thread!\n");
LOG(logERROR, (mess));
} else {
// wait for blocking always (scan or not)
// non blocking-no scan also wait (for error message)
// non blcoking-scan dont wait (there is scanErrorMessage)
if (blocking || !scan) {
pthread_join(pthread_tid, NULL);
}
} }
} }
}
} }
return Server_SendResult(file_des, INT32, NULL, 0); return Server_SendResult(file_des, INT32, NULL, 0);
} }
@ -4772,8 +4771,7 @@ int set_read_n_rows(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set
if ((Server_VerifyLock() == OK) && if (Server_VerifyLock() == OK) {
(check_detector_idle("set number of rows") == OK)) {
if (arg < MIN_ROWS_PER_READOUT || arg > MAX_ROWS_PER_READOUT) { if (arg < MIN_ROWS_PER_READOUT || arg > MAX_ROWS_PER_READOUT) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
@ -4805,7 +4803,8 @@ int set_read_n_rows(int file_des) {
LOG(logERROR, (mess)); LOG(logERROR, (mess));
} else } else
#elif defined(JUNGFRAUD) || defined(MOENCHD) #elif defined(JUNGFRAUD) || defined(MOENCHD)
if (arg % READ_N_ROWS_MULTIPLE != 0) { if ((check_detector_idle("set number of rows") == OK) &&
(arg % READ_N_ROWS_MULTIPLE != 0)) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set number of rows. %d must be a multiple " "Could not set number of rows. %d must be a multiple "
@ -8472,9 +8471,9 @@ int set_master(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set
if ((Server_VerifyLock() == OK) && if (Server_VerifyLock() == OK) {
(check_detector_idle("set master") == OK)) { if ((check_detector_idle("set master") == OK) &&
if (arg != 0 && arg != 1) { (arg != 0 && arg != 1)) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not set master. Invalid argument %d.\n", arg); sprintf(mess, "Could not set master. Invalid argument %d.\n", arg);
LOG(logERROR, (mess)); LOG(logERROR, (mess));
@ -9028,9 +9027,9 @@ int set_flip_rows(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set
if ((Server_VerifyLock() == OK) && if (Server_VerifyLock() == OK) {
(check_detector_idle("set flip rows") == OK)) { if ((check_detector_idle("set flip rows") == OK) &&
if (arg != 0 && arg != 1) { (arg != 0 && arg != 1)) {
ret = FAIL; ret = FAIL;
sprintf(mess, "Could not set flip rows. Invalid argument %d.\n", sprintf(mess, "Could not set flip rows. Invalid argument %d.\n",
arg); arg);
@ -10365,9 +10364,9 @@ int set_synchronization(int file_des) {
functionNotImplemented(); functionNotImplemented();
#else #else
// only set // only set
if ((Server_VerifyLock() == OK) && if (Server_VerifyLock() == OK) {
(check_detector_idle("set synchronization") == OK)) { if ((check_detector_idle("set synchronization") == OK) &&
if (arg != 0 && arg != 1) { (arg != 0 && arg != 1)) {
ret = FAIL; ret = FAIL;
sprintf(mess, sprintf(mess,
"Could not set synchronization. Invalid argument %d.\n", "Could not set synchronization. Invalid argument %d.\n",

View File

@ -216,10 +216,7 @@ class Detector {
/** [Jungfrau][Moench] **/ /** [Jungfrau][Moench] **/
Result<bool> getSynchronization(Positions pos = {}) const; Result<bool> getSynchronization(Positions pos = {}) const;
/** [Jungfrau][Moench] Sync mode requires at least one master configured. /** [Jungfrau][Moench] */
Also requires flatband cabling between master and slave with
termination board.
*/
void setSynchronization(bool value); void setSynchronization(bool value);
/** [Gotthard2][Mythen3] */ /** [Gotthard2][Mythen3] */

View File

@ -8,8 +8,7 @@
* from the detector. Since every module could have a different value, we need * from the detector. Since every module could have a different value, we need
* to return a vector instead of just a single value. * to return a vector instead of just a single value.
* *
* Easy conversions to single values are provided using the squash and tsquash * Easy conversions to single values are provided using the squash method.
* method.
*/ */
#include <algorithm> #include <algorithm>
@ -17,7 +16,6 @@
#include <vector> #include <vector>
#include "sls/ToString.h" #include "sls/ToString.h"
#include "sls/TypeTraits.h"
#include "sls/container_utils.h" #include "sls/container_utils.h"
namespace sls { namespace sls {
@ -130,25 +128,6 @@ template <class T, class Allocator = std::allocator<T>> class Result {
/** Test whether all elements of the result are equal */ /** Test whether all elements of the result are equal */
bool equal() const noexcept { return allEqual(vec); } bool equal() const noexcept { return allEqual(vec); }
/** Test whether any element of the result are equal to a value */
bool any(const T &value) const noexcept { return anyEqualTo(vec, value); }
template <typename V, typename... Args, typename = AllSame<V, Args...>>
typename std::enable_if<std::is_same<V, T>::value, bool>::type
contains_only(const V &a, const Args &...args) const noexcept {
auto values = {a, args...};
for (const auto &element : vec) {
int found = 0;
for (const auto &value : values) {
if (value == element)
found++;
}
if (!found)
return false;
}
return true;
}
/** Convert Result<T> to std::vector<T> */ /** Convert Result<T> to std::vector<T> */
operator std::vector<T>() { return vec; } operator std::vector<T>() { return vec; }
}; };

View File

@ -1543,9 +1543,7 @@ class CmdProxy {
INTEGER_COMMAND_SET_NOID_GET_ID( INTEGER_COMMAND_SET_NOID_GET_ID(
sync, getSynchronization, setSynchronization, StringTo<int>, sync, getSynchronization, setSynchronization, StringTo<int>,
"[0, 1]\n\t[Jungfrau][Moench] Enables or disables " "[0, 1]\n\t[Jungfrau][Moench] Enables or disables "
"synchronization between modules. Sync mode requires at least one " "synchronization between modules.");
"master configured. Also requires flatband cabling between master and "
"slave with termination board.");
INTEGER_COMMAND_VEC_ID(row, getRow, setRow, StringTo<int>, INTEGER_COMMAND_VEC_ID(row, getRow, setRow, StringTo<int>,
"[value]\n\tSet Detector row (udp header) to value. " "[value]\n\tSet Detector row (udp header) to value. "

View File

@ -18,7 +18,6 @@
#include <chrono> #include <chrono>
#include <fstream> #include <fstream>
#include <set>
#include <thread> #include <thread>
namespace sls { namespace sls {
@ -874,26 +873,18 @@ void Detector::startDetectorReadout() {
void Detector::stopDetector(Positions pos) { void Detector::stopDetector(Positions pos) {
// stop and check status X times
int retries{0}; int retries{0};
auto status = getDetectorStatus(pos); // avoid default construction of runStatus::IDLE on squash
auto status = getDetectorStatus().squash(defs::runStatus::RUNNING);
// jf sync fix: status [stopped or idle] = [stopped] while (status != defs::runStatus::IDLE &&
// sync issue: (master idle sometimes, slaves stopped) status != defs::runStatus::STOPPED) {
if (status == defs::runStatus::ERROR) {
// eiger fix: stop multiple times from multi client till all modules stopped throw RuntimeError(
// issue: asynchronous start and stop scripts with a module being started "Could not stop detector. Returned error status.");
// (stop before) and waiting for the other to be done. So a module that was
// idle before stopping will return running (after async start script) when
// getting status after, which will then be stopped again.
while (!status.contains_only(defs::runStatus::IDLE,
defs::runStatus::STOPPED)) {
if (status.any(defs::runStatus::ERROR)) {
throw RuntimeError("Could not stop detector. At least one module "
"returned error status.");
} }
pimpl->stopDetector(pos); pimpl->stopDetector(pos);
status = getDetectorStatus(pos); status = getDetectorStatus().squash(defs::runStatus::RUNNING);
++retries; ++retries;
if (retries == 10) if (retries == 10)
@ -912,7 +903,7 @@ void Detector::stopDetector(Positions pos) {
for (auto it : res) { for (auto it : res) {
maxVal = std::max(maxVal, it); maxVal = std::max(maxVal, it);
} }
setNextFrameNumber(maxVal + 1, pos); setNextFrameNumber(maxVal + 1);
} }
} break; } break;
default: default:

View File

@ -1220,26 +1220,10 @@ int DetectorImpl::acquire() {
dataProcessingThread.join(); dataProcessingThread.join();
if (acquisition_finished != nullptr) { if (acquisition_finished != nullptr) {
// status int status = Parallel(&Module::getRunStatus, {}).squash(ERROR);
runStatus status = IDLE;
auto statusList = Parallel(&Module::getRunStatus, {});
status = statusList.squash(ERROR);
// difference, but none error
if (status == ERROR && (!statusList.any(ERROR))) {
// handle jf sync issue (master idle, slaves stopped)
if (statusList.contains_only(IDLE, STOPPED)) {
status = STOPPED;
} else
status = statusList.squash(RUNNING);
}
// progress
auto a = Parallel(&Module::getReceiverProgress, {}); auto a = Parallel(&Module::getReceiverProgress, {});
double progress = (*std::max_element(a.begin(), a.end())); double progress = (*std::max_element(a.begin(), a.end()));
acquisition_finished(progress, status, acqFinished_p);
// callback
acquisition_finished(progress, static_cast<int>(status),
acqFinished_p);
} }
clock_gettime(CLOCK_REALTIME, &end); clock_gettime(CLOCK_REALTIME, &end);
@ -1309,24 +1293,13 @@ void DetectorImpl::startAcquisition(const bool blocking, Positions pos) {
std::vector<int> masters; std::vector<int> masters;
std::vector<int> slaves; std::vector<int> slaves;
getMasterSlaveList(pos, masters, slaves); getMasterSlaveList(pos, masters, slaves);
if (masters.empty()) {
throw RuntimeError("Cannot start acquisition in sync mode. No "
"master module found");
}
if (!slaves.empty()) { if (!slaves.empty()) {
Parallel(&Module::startAcquisition, slaves); Parallel(&Module::startAcquisition, slaves);
} }
if (blocking) { if (!masters.empty()) {
Parallel(&Module::startAndReadAll, masters); Parallel((blocking ? &Module::startAndReadAll
// ensure all status normal (slaves not blocking) : &Module::startAcquisition),
// to catch those slaves that are still 'waiting' masters);
auto status = Parallel(&Module::getRunStatus, pos);
if (!status.contains_only(IDLE, STOPPED, RUN_FINISHED)) {
throw RuntimeError("Acquisition not successful. "
"Unexpected detector status");
}
} else {
Parallel(&Module::startAcquisition, masters);
} }
} }
// all in parallel // all in parallel

View File

@ -84,7 +84,9 @@ class DetectorImpl : public virtual slsDetectorDefs {
*/ */
virtual ~DetectorImpl(); virtual ~DetectorImpl();
template <class CT> struct NonDeduced { using type = CT; }; template <class CT> struct NonDeduced {
using type = CT;
};
template <typename RT, typename... CT> template <typename RT, typename... CT>
Result<RT> Parallel(RT (Module::*somefunc)(CT...), Result<RT> Parallel(RT (Module::*somefunc)(CT...),
std::vector<int> positions, std::vector<int> positions,

View File

@ -356,29 +356,15 @@ TEST_CASE("powerindex", "[.cmd]") {
TEST_CASE("powervalues", "[.cmd]") { TEST_CASE("powervalues", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("powervalues", {}, -1, GET));
auto det_type = det.getDetectorType().squash(); REQUIRE_THROWS(proxy.Call("powervalues", {}, -1, PUT));
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("powervalues", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("powervalues", {}, -1, PUT));
} else {
REQUIRE_THROWS(proxy.Call("powervalues", {}, -1, GET));
}
} }
TEST_CASE("slowadcvalues", "[.cmd]") { TEST_CASE("slowadcvalues", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("slowadcvalues", {}, -1, GET));
auto det_type = det.getDetectorType().squash(); REQUIRE_THROWS(proxy.Call("slowadcvalues", {}, -1, PUT));
if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_NOTHROW(proxy.Call("slowadcvalues", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("slowadcvalues", {}, -1, PUT));
} else {
REQUIRE_THROWS(proxy.Call("slowadcvalues", {}, -1, GET));
}
} }
TEST_CASE("slowadclist", "[.cmd]") { TEST_CASE("slowadclist", "[.cmd]") {

View File

@ -689,11 +689,10 @@ TEST_CASE("confadc", "[.cmd]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::GOTTHARD2) { if (det_type == defs::GOTTHARD2) {
const int ndet = det.size(); int ndet = det.size();
const int nchip = 10; int nchip = 10;
const int nadc = 32; int nadc = 32;
std::vector<std::vector<std::vector<int>>> prev_val( int prev_val[ndet][nchip][nadc];
ndet, std::vector<std::vector<int>>(nchip, std::vector<int>(nadc)));
for (int i = 0; i != ndet; ++i) { for (int i = 0; i != ndet; ++i) {
for (int j = 0; j != nchip; ++j) { for (int j = 0; j != nchip; ++j) {
for (int k = 0; k != nadc; ++k) { for (int k = 0; k != nadc; ++k) {

View File

@ -23,7 +23,7 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU) { if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
SECTION("vb_comp") { test_dac(defs::VB_COMP, "vb_comp", 1220); } SECTION("vb_comp") { test_dac(defs::VB_COMP, "vb_comp", 1220); }
SECTION("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); } SECTION("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); }
SECTION("vin_com") { test_dac(defs::VIN_COM, "vin_com", 1053); } SECTION("vin_com") { test_dac(defs::VIN_COM, "vin_com", 1053); }
@ -163,7 +163,7 @@ TEST_CASE("chipversion", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU) { if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
REQUIRE_NOTHROW(proxy.Call("chipversion", {}, -1, GET)); REQUIRE_NOTHROW(proxy.Call("chipversion", {}, -1, GET));
} else { } else {
REQUIRE_THROWS(proxy.Call("chipversion", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("chipversion", {}, -1, GET));
@ -705,34 +705,6 @@ TEST_CASE("sync", "[.cmd]") {
proxy.Call("sync", {}, -1, GET, oss); proxy.Call("sync", {}, -1, GET, oss);
REQUIRE(oss.str() == "sync 1\n"); REQUIRE(oss.str() == "sync 1\n");
} }
// setting sync when running
{
auto prev_timing =
det.getTimingMode().tsquash("inconsistent timing mode in test");
auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test");
auto prev_exptime =
det.getExptime().tsquash("inconsistent exptime in test");
auto prev_period =
det.getPeriod().tsquash("inconsistent period in test");
det.setTimingMode(defs::AUTO_TIMING);
det.setNumberOfFrames(10000);
det.setExptime(std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1000));
det.setSynchronization(1);
det.startDetector();
REQUIRE_THROWS(proxy.Call("sync", {"0"}, -1, PUT));
{
std::ostringstream oss;
proxy.Call("sync", {}, -1, GET, oss);
REQUIRE(oss.str() == "sync 1\n");
}
det.stopDetector();
det.setTimingMode(prev_timing);
det.setNumberOfFrames(prev_frames);
det.setExptime(prev_exptime);
det.setPeriod(prev_period);
}
det.setSynchronization(prev_val); det.setSynchronization(prev_val);
} else { } else {
REQUIRE_THROWS(proxy.Call("sync", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("sync", {}, -1, GET));

View File

@ -18,92 +18,5 @@ using test::GET;
using test::PUT; using test::PUT;
/* dacs */ /* dacs */
TEST_CASE("Setting and reading back moench dacs", "[.cmd][.dacs]") {
// vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds,
// ibias_sfp
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::MOENCH) {
SECTION("vbp_colbuf") {
test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300);
}
SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 1000); }
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); }
SECTION("vb_sda") { test_dac(defs::VB_SDA, "vb_sda", 680); }
SECTION("vcasc_sfp") { test_dac(defs::VCASC_SFP, "vcasc_sfp", 1428); }
SECTION("vout_cm") { test_dac(defs::VOUT_CM, "vout_cm", 1200); }
SECTION("vipre_cds") { test_dac(defs::VIPRE_CDS, "vipre_cds", 800); }
SECTION("ibias_sfp") { test_dac(defs::IBIAS_SFP, "ibias_sfp", 900); }
// eiger
REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vrpreamp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vrshaper", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vtgstv", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_ll", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_lr", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcal", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_rl", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcmp_rr", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("rxb_rb", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("rxb_lb", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcn", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vishaper", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("iodelay", {}, -1, GET));
// gotthard
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
// REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
// REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
// mythen3
REQUIRE_THROWS(proxy.Call("vrpreamp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vrshaper", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vrshaper_n", {}, -1, GET));
// REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vishaper", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcal_n", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcal_p", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
// gotthard2
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
// jungfrau
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
}
}
} // namespace sls } // namespace sls

View File

@ -2064,7 +2064,7 @@ TEST_CASE("defaultdac", "[.cmd]") {
det.setDefaultDac(it, prev_val[i], {i}); det.setDefaultDac(it, prev_val[i], {i});
} }
} }
if (det_type == defs::JUNGFRAU) { if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
std::vector<defs::dacIndex> daclist = { std::vector<defs::dacIndex> daclist = {
defs::VREF_PRECH, defs::VREF_DS, defs::VREF_COMP}; defs::VREF_PRECH, defs::VREF_DS, defs::VREF_COMP};
for (auto it : daclist) { for (auto it : daclist) {
@ -2417,11 +2417,8 @@ TEST_CASE("scan", "[.cmd]") {
notImplementedInd = defs::VCASCP_PB; notImplementedInd = defs::VCASCP_PB;
break; break;
case defs::JUNGFRAU: case defs::JUNGFRAU:
ind = defs::VB_COMP;
notImplementedInd = defs::VSVP;
break;
case defs::MOENCH: case defs::MOENCH:
ind = defs::VIN_CM; ind = defs::VB_COMP;
notImplementedInd = defs::VSVP; notImplementedInd = defs::VSVP;
break; break;
case defs::GOTTHARD: case defs::GOTTHARD:
@ -3475,7 +3472,7 @@ TEST_CASE("lock", "[.cmd]") {
TEST_CASE("execcommand", "[.cmd]") { TEST_CASE("execcommand", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("execcommand", {"ls *.txt"}, -1, PUT)); REQUIRE_NOTHROW(proxy.Call("execcommand", {"ls"}, -1, PUT));
} }
TEST_CASE("framecounter", "[.cmd]") { TEST_CASE("framecounter", "[.cmd]") {

View File

@ -196,24 +196,4 @@ TEST_CASE("String conversions") {
"[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]"); "[{one: 1}, {one: 1, three: 3, two: 2}, {one: 1}]");
} }
TEST_CASE("Any element is equal") {
Result<int> r{1, 2, 3, 4, 5};
REQUIRE(r.any(3));
REQUIRE_FALSE(r.any(9));
}
TEST_CASE("Result contains only the specified elements") {
Result<int> r{1, 1, 1};
REQUIRE(r.contains_only(1));
REQUIRE(r.contains_only(1, 1));
}
TEST_CASE("Only with multiple values") {
Result<int> r{1, 1, 2, 1, 2, 1, 1};
REQUIRE_FALSE(r.contains_only(1));
REQUIRE_FALSE(r.contains_only(2));
REQUIRE(r.contains_only(1, 2));
REQUIRE(r.contains_only(2, 1));
}
} // namespace sls } // namespace sls

View File

@ -103,13 +103,4 @@ template <typename T> struct is_vector : public std::false_type {};
template <typename T> template <typename T>
struct is_vector<std::vector<T>> : public std::true_type {}; struct is_vector<std::vector<T>> : public std::true_type {};
template <class...> struct Conjunction : std::true_type {};
template <class B1> struct Conjunction<B1> : B1 {};
template <class B1, class... Bn>
struct Conjunction<B1, Bn...>
: std::conditional<bool(B1::value), Conjunction<Bn...>, B1>::type {};
template <typename T, typename... Ts>
using AllSame =
typename std::enable_if<Conjunction<std::is_same<T, Ts>...>::value>::type;
} // namespace sls } // namespace sls

View File

@ -1,13 +1,13 @@
// SPDX-License-Identifier: LGPL-3.0-or-other // SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package // Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */ /** API versions */
#define RELEASE "8.0.0" #define RELEASE "developer"
#define APILIB "8.0.0 0x231108" #define APILIB "developer 0x230224"
#define APIRECEIVER "8.0.0 0x231108" #define APIRECEIVER "developer 0x230224"
#define APICTB "8.0.0 0x231109" #define APICTB "developer 0x230922"
#define APIGOTTHARD "8.0.0 0x231109" #define APIGOTTHARD "developer 0x230922"
#define APIGOTTHARD2 "8.0.0 0x231109" #define APIGOTTHARD2 "developer 0x230922"
#define APIJUNGFRAU "8.0.0 0x231109" #define APIMYTHEN3 "developer 0x230922"
#define APIMYTHEN3 "8.0.0 0x231109" #define APIMOENCH "developer 0x230922"
#define APIMOENCH "8.0.0 0x231109" #define APIEIGER "developer 0x230922"
#define APIEIGER "8.0.0 0x231109" #define APIJUNGFRAU "developer 0x230928"

View File

@ -4,7 +4,7 @@
This file is used to start up simulators, receivers and run all the tests on them and finally kill the simulators and receivers. This file is used to start up simulators, receivers and run all the tests on them and finally kill the simulators and receivers.
''' '''
import argparse import argparse
import os, sys, subprocess, time, colorama, signal import os, sys, subprocess, time, colorama, signal, psutil
from colorama import Fore from colorama import Fore
from slsdet import Detector, detectorType, detectorSettings from slsdet import Detector, detectorType, detectorSettings
@ -21,37 +21,29 @@ class RuntimeException (Exception):
def Log(color, message): def Log(color, message):
print('\n' + color + message, flush=True) print('\n' + color + message, flush=True)
def checkIfProcessRunning(processName): def checkIfProcessRunning(processName):
cmd = "ps -ef | grep " + processName '''
print(cmd) Check if there is any running process that contains the given name processName.
res=subprocess.getoutput(cmd) https://gist.github.com/Sanix-Darker/8cbed2ff6f8eb108ce2c8c51acd2aa5a
print(res) '''
# eg. of output # Iterate over the all the running process
#l_user 250506 243295 0 14:38 pts/5 00:00:00 /bin/sh -c ps -ef | grep slsReceiver for proc in psutil.process_iter():
#l_user 250508 250506 0 14:38 pts/5 00:00:00 grep slsReceiver try:
# Check if process name contains the given name string.
print('how many') if processName.lower() in proc.name().lower():
cmd = "ps -ef | grep " + processName + " | wc -l" return True
print(cmd) except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
res=subprocess.getoutput(cmd) pass
print(res) return False;
if res == '2':
return False
return True
def killProcess(name): def killProcess(name):
if checkIfProcessRunning(name): if checkIfProcessRunning(name):
Log(Fore.GREEN, 'killing ' + name) Log(Fore.GREEN, 'killing ' + name)
p = subprocess.run(['killall', name]) p = subprocess.run(['killall', name])
if p.returncode != 0: if p.returncode != 0:
raise RuntimeException('killall failed for ' + name) raise RuntimeException('error in killall ' + name)
else:
print('process not running : ' + name)
def cleanup(name): def cleanup(name, d):
''' '''
kill both servers, receivers and clean shared memory kill both servers, receivers and clean shared memory
''' '''
@ -59,27 +51,18 @@ def cleanup(name):
killProcess(name + 'DetectorServer_virtual') killProcess(name + 'DetectorServer_virtual')
killProcess('slsReceiver') killProcess('slsReceiver')
killProcess('slsMultiReceiver') killProcess('slsMultiReceiver')
cleanSharedmemory() d.freeSharedMemory()
def cleanSharedmemory():
Log(Fore.GREEN, 'Cleaning up shared memory...')
try:
p = subprocess.run(['sls_detector_get', 'free'], stdout=fp, stderr=fp)
except:
Log(Fore.RED, 'Could not free shared memory')
raise
def startProcessInBackground(name): def startProcessInBackground(name):
try: try:
# in background and dont print output # in background and dont print output
p = subprocess.Popen(name.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, restore_signals=False) p = subprocess.Popen(name.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
Log(Fore.GREEN, 'Starting up ' + name + ' ...') Log(Fore.GREEN, 'Starting up ' + name + ' ...')
except: except:
Log(Fore.RED, 'Could not start ' + name) Log(Fore.RED, 'Could not start ' + name)
raise raise
def startServer(name): def startServer(name):
startProcessInBackground(name + 'DetectorServer_virtual') startProcessInBackground(name + 'DetectorServer_virtual')
# second half # second half
if name == 'eiger': if name == 'eiger':
@ -96,7 +79,6 @@ def startReceiver(name):
time.sleep(2) time.sleep(2)
def loadConfig(name, rx_hostname, settingsdir): def loadConfig(name, rx_hostname, settingsdir):
Log(Fore.GREEN, 'Loading config')
try: try:
d = Detector() d = Detector()
if name == 'eiger': if name == 'eiger':
@ -124,36 +106,25 @@ def loadConfig(name, rx_hostname, settingsdir):
Log(Fore.RED, 'Could not load config for ' + name) Log(Fore.RED, 'Could not load config for ' + name)
raise raise
def startCmdTests(name, fp, fname): def startCmdTests(name, fp):
Log(Fore.GREEN, 'Cmd Tests for ' + name) try:
cmd = 'tests --abort [.cmd] -s -o ' + fname p = subprocess.run(['tests', '--abort', '[.cmd]'], stdout=fp, stderr=fp)
p = subprocess.run(cmd.split(), stdout=fp, stderr=fp, check=True, text=True) if p.returncode != 0:
p.check_returncode() raise Exception
except:
with open (fname, 'r') as f: Log(Fore.RED, 'Cmd tests failed for ' + name)
for line in f: raise
if "FAILED" in line:
msg = 'Cmd tests failed for ' + name + '!!!'
Log(Fore.RED, msg)
raise Exception(msg)
Log(Fore.GREEN, 'Cmd Tests successful for ' + name)
def startGeneralTests(fp, fname):
Log(Fore.GREEN, 'General Tests')
cmd = 'tests --abort -s -o ' + fname
p = subprocess.run(cmd.split(), stdout=fp, stderr=fp, check=True, text=True)
p.check_returncode()
with open (fname, 'r') as f:
for line in f:
if "FAILED" in line:
msg = 'General tests failed !!!'
Log(Fore.RED, msg)
raise Exception(msg)
Log(Fore.GREEN, 'General Tests successful')
def startNormalTests(d, fp):
try:
Log(Fore.BLUE, '\nNormal tests')
p = subprocess.run(['tests', '--abort' ], stdout=fp, stderr=fp)
if p.returncode != 0:
raise Exception
d.freeSharedMemory()
except:
Log(Fore.RED, 'Normal tests failed')
raise
# parse cmd line for rx_hostname and settingspath using the argparse library # parse cmd line for rx_hostname and settingspath using the argparse library
@ -178,51 +149,46 @@ if args.servers is None:
else: else:
servers = args.servers servers = args.servers
Log(Fore.WHITE, 'rx_hostname: ' + args.rx_hostname + '\settingspath: \'' + args.settingspath + '\'')
Log(Fore.WHITE, 'Arguments:\nrx_hostname: ' + args.rx_hostname + '\nsettingspath: \'' + args.settingspath + '\'')
# handle zombies (else killing slsReceivers will fail)
# dont care about child process success
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
# redirect to file # redirect to file
prefix_fname = '/tmp/slsDetectorPackage_virtual_test'
original_stdout = sys.stdout original_stdout = sys.stdout
original_stderr = sys.stderr original_stderr = sys.stderr
fname = prefix_fname + '_log.txt' fname = '/tmp/slsDetectorPackage_virtual_test.txt'
Log(Fore.BLUE, '\nLog File: ' + fname) Log(Fore.BLUE, 'Tests -> ' + fname)
with open(fname, 'w') as fp: with open(fname, 'w') as fp:
# general tests
file_results = prefix_fname + '_results_general.txt'
Log(Fore.BLUE, 'General tests (results: ' + file_results + ')')
sys.stdout = fp sys.stdout = fp
sys.stderr = fp sys.stderr = fp
Log(Fore.BLUE, 'General tests (results: ' + file_results + ')')
startGeneralTests(fp, file_results) d = Detector()
# TODO: redirect Detector object print out also to file
startNormalTests(d, fp)
for server in servers: for server in servers:
try: try:
# print to terminal for progress # print to terminal for progress
sys.stdout = original_stdout sys.stdout = original_stdout
sys.stderr = original_stderr sys.stderr = original_stderr
file_results = prefix_fname + '_results_cmd_' + server + '.txt' Log(Fore.BLUE, server + ' tests')
Log(Fore.BLUE, 'Cmd tests for ' + server + ' (results: ' + file_results + ')')
sys.stdout = fp sys.stdout = fp
sys.stderr = fp sys.stderr = fp
Log(Fore.BLUE, 'Cmd tests for ' + server + ' (results: ' + file_results + ')')
# cmd tests for det # cmd tests for det
cleanup(server) Log(Fore.BLUE, 'Cmd Tests for ' + server)
cleanup(server, d)
startServer(server) startServer(server)
startReceiver(server) startReceiver(server)
loadConfig(server, args.rx_hostname, args.settingspath) loadConfig(server, args.rx_hostname, args.settingspath)
startCmdTests(server, fp, file_results) startCmdTests(server, fp)
cleanup(server) cleanup(server, d)
except: except:
Log(log.RED, 'Exception caught. Cleaning up.') cleanup(server, d)
cleanup(server)
sys.stdout = original_stdout
sys.stderr = original_stderr
Log(Fore.RED, 'Cmd tests failed for ' + server + '!!!')
raise raise