Compare commits

..

1 Commits
8.0.2 ... pip

Author SHA1 Message Date
acf2ab4295 moved .so into package 2023-08-24 11:50:33 +02:00
164 changed files with 1794 additions and 3715 deletions

View File

@ -2,7 +2,7 @@
# Copyright (C) 2021 Contributors to the SLS Detector Package
cmake_minimum_required(VERSION 3.14)
project(slsDetectorPackage)
set(PROJECT_VERSION 8.0.2)
set(PROJECT_VERSION 7.0.0)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
@ -33,7 +33,7 @@ else()
# Standard behaviour use libzmq included in this repo (libs/libzmq)
FetchContent_Declare(
libzmq
URL ${CMAKE_CURRENT_SOURCE_DIR}/libs/libzmq/libzmq-4.3.4.tar.gz
URL ${CMAKE_SOURCE_DIR}/libs/libzmq/libzmq-4.3.4.tar.gz
URL_HASH MD5=cc20b769ac10afa352e5ed2769bb23b3
)
endif()
@ -294,7 +294,7 @@ if (SLS_USE_INTEGRATION_TESTS)
endif (SLS_USE_INTEGRATION_TESTS)
if (SLS_USE_PYTHON)
find_package (Python 3.6 COMPONENTS Interpreter Development)
find_package (Python 3.6 COMPONENTS Interpreter Development.Module)
if(SLS_FETCH_PYBIND11_FROM_GITHUB)
FetchContent_Declare(
pybind11

View File

@ -1,13 +1,21 @@
SLS Detector Package Bug Fix Release 8.0.2 released on 18.09.2024
=================================================================
SLS Detector Package Major Release 7.x.x released on xx.xx.2023
===============================================================
This document describes the differences between v8.0.2 and v8.0.1
This document describes the differences between v7.x.x and v7.0.2
CONTENTS
--------
1 Resolved Issues
1 New, Changed or Resolved Features
1.1 Compilation
1.2 Callback
1.3 Python
1.4 Client
1.5 Detector Server
1.6 Simulator
1.7 Receiver
1.8 Gui
2 On-board Detector Server Compatibility
3 Firmware Requirements
4 Kernel Requirements
@ -16,108 +24,13 @@ This document describes the differences between v8.0.2 and v8.0.1
1 Resolved Issues
=================
1 New, Changed or Resolved Features
=====================================
Compilation
-----------
* Rapidjson compilation with gcc 14
Fixed a compile issue with gcc 14. Same fix in later commits to rapidjson.
Client
------
* getenv("HOME") returning nullptr
When this happens, especially for systemd, it segfaults. Protection
provided by using empty string in this case.
* [Mythen3] Bad channel list for multi module
Exception thrown when loading multi module bad channel file skipping
modules in between. Fixed.
* [Gotthard2] Stopping a blocking acquisition
A check added in v8.0.0 to catch slaves that might be in waiting forever
also catches Gotthard2 25um slaves that might only be in waiting
temporarily. This is fixed with a 50ms sleep before checking again
(upto 1s).
* [Moench] Acquire finished processing call back
New executable 'sls_detector_acquire_zmq' added to listen to all zmq
packets from post processor or external process to signal end of post
processing. Post processor refactoring of zmq socket creation added.
Gui / Callback
--------------
* [Gotthard2] Stopping a blocking acquisition
From the previous issue, call back for acquisition finished status gives
error for inconsistent states. Again, a check every 50ms upto 1s is
added to let go the temporarily waiting slave.
* Different file paths
Fixes file path resetting when different modules have different fpath set.
Receiver
--------
* HDF5 fill value
Fix the fill value to accomodate all datatypes.
Firmware
--------
* [Moench] Overflow with exptime of 0
Fixed overflow when subtracting 1 clock cycle from exptime.
On-board Detector Server
------------------------
* [Moench] Few changes in Server:
- Max shifts of adc clock changed from 240 to 200.
- Fixed overflow when subtracting 2 clock cycles from exptime of 0ms.
- Default readout speed to half speed from quarter.
- Change default ADC phase to 150 for full readout speed.
- Change default vipre_cds dac from 800 to 1280.
* [Mythen3] Change Clk divider from 10 (100MHz) to 20 (50MHz) at startup.
* [Jungfrau] Fix for HW v1.0 boards for unreliable ADC 2
Issues sometimes seen on some HW v 1.0 boards are fixed with phase
relationship of 120 degrees. HW v2.0 boards are not affected.
Documentation
-------------
* Updated troubleshooting documentaion to check links and disable firewall
* Excluded non UTF-8 encoded libzmq documents due to machine dependent
compilation issues.
- moench being made compatible with jungfrau 2.0 boards (jungfrau structure, away from ctb)
- eiger febl and feb in versions
- fix ctb slow adcs
@ -125,13 +38,13 @@ This document describes the differences between v8.0.2 and v8.0.1
==========================================
Eiger 8.0.0
Jungfrau 8.0.2
Mythen3 8.0.2
Gotthard2 8.0.0
Gotthard 8.0.0
Moench 8.0.2
Ctb 8.0.0
Eiger 7.0.0
Jungfrau 7.0.2
Mythen3 7.0.0
Gotthard2 7.0.0
Gotthard 7.0.0
Moench 7.0.0
Ctb 7.0.0
On-board Detector Server Upgrade
@ -139,6 +52,8 @@ This document describes the differences between v8.0.2 and v8.0.1
From v6.1.0 (without tftp):
Using command 'updatedetectorserver'
From 5.0.0 (with tftp):
Using command 'copydetectorserver'
Instructions available at
https://slsdetectorgroup.github.io/devdoc/serverupgrade.html
@ -150,22 +65,21 @@ This document describes the differences between v8.0.2 and v8.0.1
========================
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)
21.09.2023 (v2.5, HW v2.0) (updated in 8.0.0)
Jungfrau 04.11.2022 (v1.4, HW v1.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)
09.02.2018 (25 um Slave)
Moench 26.10.2023 (v0.3.2) (updated in 8.0.2,
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
@ -184,10 +98,10 @@ This document describes the differences between v8.0.2 and v8.0.1
Except Eiger,
upgrade
using command 'programfpga' or
Using command 'programfpga' or
udpate both server and firmware simultaneously
using command 'update'
Using command 'update'
Instructions available at

2
cmk.sh
View File

@ -26,7 +26,7 @@ CMAKE_PRE=""
CMAKE_POST=""
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
-b: Builds/Rebuilds CMake files normal mode
-c: Clean

View File

@ -2,6 +2,7 @@ python:
- 3.8
- 3.9
- 3.10
- 3.11
- 3.12
- 3.11
numpy:
- 1.17

View File

@ -18,6 +18,7 @@ requirements:
- {{compiler('cxx')}}
- cmake
- qt 5.*
- zeromq
- xorg-libx11
- xorg-libice
- xorg-libxext
@ -36,6 +37,7 @@ requirements:
host:
- libstdcxx-ng
- libgcc-ng
- zeromq
- xorg-libx11
- xorg-libice
- xorg-libxext
@ -46,6 +48,7 @@ requirements:
- expat
run:
- zeromq
- libstdcxx-ng
- libgcc-ng
@ -60,11 +63,15 @@ outputs:
- {{compiler('cxx')}}
- libstdcxx-ng
- libgcc-ng
- zeromq
host:
- zeromq
run:
- libstdcxx-ng
- libgcc-ng
- zeromq
- name: slsdet
@ -77,12 +84,10 @@ outputs:
- {{compiler('cxx')}}
- {{ pin_subpackage('slsdetlib', exact=True) }}
- setuptools
- pybind11=2.11
host:
- python
- {{ pin_subpackage('slsdetlib', exact=True) }}
- pybind11=2.11
run:

View File

@ -890,7 +890,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS = */docs/* */tests/* */python/* */manual */slsDetectorServers/* */libs/* */integrationTests *README* */slsDetectorGui/* */ctbGui/* */slsDetectorCalibration/* *TobiSchluter*
EXCLUDE_PATTERNS = */docs/* */tests/* */python/* */manual */slsDetectorServers/* */libs/* */integrationTests *README* */slsDetectorGui/* */ctbGui/* */slsDetectorCalibration/*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the

View File

@ -19,7 +19,7 @@ A minimal CMakeLists.txt could look like this:
.. code-block:: cmake
project(myDetectorIntegration)
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.12)
add_subdirectory(slsDetectorPackage)
#Add your executable
@ -43,7 +43,7 @@ should be needed, otherwise specify cmake prefix path.
.. code-block:: cmake
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.12)
project(myintegration)
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:
* 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)
-----------------------
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>`
* ZeroMQ version 4
-----------------------
GUI
-----------------------
* 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
@ -66,6 +54,4 @@ Packaged in libs/
* catch2 (unit testing)
* rapidjson (streaming from receiver)
* pybind11 (python bindings)
* qwt (gui plotting)
* libzmq (streaming to/from receiver)
* pybind11 (python bindings)

View File

@ -1,19 +1,16 @@
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
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.
Most, if not all, functions are called in parallel
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
:members:
:undoc-members:

View File

@ -1,4 +1,3 @@
.. _Cplusplus Api Examples:
@ -54,8 +53,8 @@ then set up the detector.
jungfrauDetectorServer_virtual
This launches a virtual Jungfrau detector server. As default it 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.
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 stop and status on 1953.
**Run example to configure**
@ -91,10 +90,7 @@ std::vector.
sls::Result<int> res1{1, 1, 1};
std::cout << "res1: " << res1 << '\n';
res1.squash();
# return -1 if different
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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# 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
# v6.1.1 - present (copies server from the full path provided)

View File

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

View File

@ -57,6 +57,7 @@ We have three different packages available:
Build from source
-------------------
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
.. 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:
@ -103,23 +118,20 @@ Instead of the cmake command, one can use ccmake to get a list of options to con
ccmake ..
# choose the options
# first press [c] - configure (maybe multiple times till you see [g])
# first press [c] - configure
# then press [g] - generate
=============================== ===============================
=============================== ===========================================
Example cmake options Comment
=============================== ===============================
=============================== ===========================================
-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_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
@ -130,9 +142,9 @@ Build using in-built cmk.sh script
The binaries are generated in slsDetectorPackage/build/bin directory.
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: ./cmk.sh [-b] [-c] [-d <HDF5 directory>] [e] [g] [-h] [i] [-j <Number of threads>]
[-k <CMake command>] [-l <Install directory>] [m] [n] [-p] [-q <Zmq hint directory>]
[r] [s] [t] [u] [z]
-[no option]: only make
-b: Builds/Rebuilds CMake files normal mode
-c: Clean
@ -147,6 +159,7 @@ Build using in-built cmk.sh script
-m: Manuals
-n: Manuals without compiling doxygen (only rst)
-p: Builds/Rebuilds Python API
-q: Zmq hint directory
-r: Build/Rebuilds only receiver
-s: Simulator
-t: Build/Rebuilds only text client
@ -163,13 +176,9 @@ Build using in-built cmk.sh script
# new build, python and compile in parallel:
./cmk.sh -cbpj5
#For rebuilding only certain sections
./cmk.sh -tg #only text client and gui
./cmk.sh -r #only receiver
#To use the system zmq (/usr/lib64) instead
./cmk.sh -cbj5 -q /usr/lib64
.. 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
@ -182,7 +191,7 @@ using this compiler
.. code-block:: bash
#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
# outside slsDetecorPackage folder
@ -191,11 +200,6 @@ using this compiler
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)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -224,9 +228,9 @@ Build slsDetectorGui (Qt5)
# create environment to compile
# 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
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
@ -242,9 +246,6 @@ Build slsDetectorGui (Qt5)
cd slsDetectorPackage
./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
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
@ -269,51 +270,3 @@ is to use conda
make docs # generate API docs and build Sphinx RST
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
hostname bchipxxx+bchipyyy+
# tcp port increases for each module (multi detector command)
rx_tcpport 2012
# connects to receivers at ports 2012 and 2014
rx_hostname mpc1922
rx_hostname mpc1922:2012+mpc1922:2013+
# increasing udp ports (multi detector command)
udp_dstport 50012
# sets differernt destination udp ports
0:udp_dstport 50012
1:udp_dstport 50014
# source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112

View File

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

View File

@ -52,13 +52,8 @@ Client Commands
# multi modules with custom ports
rx_hostname xxx:1955+xxx:1956+
# 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
# multi modules with custom ports on same rxr pc
0:rx_tcpport 1954
1:rx_tcpport 1955
2:rx_tcpport 1956

View File

@ -22,8 +22,6 @@ Common
* Check transeiver and fibers are compatible (all MMF 850nm or all SMF 1030nm)
* Check fiber
* Check fiber polarity (if short range, unplug the link anywhere, and look at the light/dark pattern: dark has to mate with light)
* For Jungfrau, check if the blue sfp light is blinking rapidly (even when it is not sending data). If so, most likely the link is down and something is wrong with the board. If it connected to a switch, then you do not see it with the ethtool command if link is down. One option is to connect it directly to a pc to see if link is down.
* With nc, try "nc -u -p 50001 -l" in receiving pc, and from another pc try "echo hallo | nc -u 10.1.2.172 50001" to send something to the recieving pc interface to see if the link is up and see if the other nc console receives the hallo.
#. Detector is not acquiring (Not Eiger)
* Take an acquisition with many images and using the following steps instead of acquire:
@ -49,20 +47,11 @@ Common
* Ensure that the interfaces (on NIC and the switch) used in receiver pc have MTU 9000 (jumbo frames) enabled.
#. Check if 'rx packets' counter in 'ifconfig' do not increment for interface.
#. Check if 'rx_frames' counter in 'ifconfig' do not increment for interface.
* If no, check switch configuration if present. Port counters of switch can also help to identify problem.
* If yes, but receiver software does not see it:
* Check no firewall (eg. firewalld) is present or add rules
.. code-block:: bash
# Stop and disable firewall
service firewalld stop
systemctl disable firewalld
# Check status
service firewalld status
* Check that selinux is disabled ( or add rules)
#. Source UDP IP in config file (Not Eiger)
@ -103,9 +92,6 @@ Common
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:
@ -435,20 +421,3 @@ Cannot get multi module data
* 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.
.. _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
# source udp ips must be same subnet at destintaion udp ips
# takes the same ip as hostname
udp_srcip auto
udp_srcip 192.168.1.112
# destination udp ip picked up from rx_hostname (if auto)
udp_dstip auto
@ -102,14 +101,12 @@ For Multiple Modules
virtual 2 1912
# or hostname localhost:1912+localhost:1914+
# increasing receiver tcp ports (multi detector command)
rx_tcpport 2012
# connects to receivers at ports 2012 and 2014
rx_hostname mpc1922:2012+mpc1922:2013+
# connects to reciever at port 2012 and 2013
rx_hostname mpc1922
# sets increasing destination udp ports
udp_dstport 50012
# sets differernt destination udp ports
0:udp_dstport 50012
1:udp_dstport 50014
# source udp ips must be same subnet at destintaion udp ips
0:udp_srcip 192.168.1.112

View File

@ -4,33 +4,27 @@ detsize 1024 512
# detector hostname for controls
hostname beb059+beb058+
# increasing receiver tcp port (multi detector command)
rx_tcpport 1991
# 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
# 1Gb receiver pc hostname with tcp port to configure receiver
rx_hostname x12sa-vcons:1991+x12sa-vcons:1992
# udp port first quadrant, first halfmodule
#0:udp_dstport 50011
0:udp_dstport 50011
# udp port second quadrant, first halfmodule
#0:udp_dstport2 50012
# udp port first quadrant, second halfmodule
#1:udp_dstport 50013
# udp port second quadrant, second halfmodule
#1:udp_dstport2 50014
0:udp_dstport2 50012
# udp IP of the receiver over 10Gb
0:udp_dstip 10.0.30.210
# first half module 10 Gb IP (same subnet as 0:udp_dstip)
0:udp_srcip 10.0.30.100
# 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,
1:udp_dstip 10.0.40.210

View File

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

View File

@ -4,18 +4,14 @@ detsize 1024 1024
# detector hostname
hostname bchip048+bchip052+
# increasing receiver ports 1954 and 1955 (multi detector command)
rx_tcpport 1954
# 1Gb receiver pc hostname
rx_hostname pcmoench01
# 1Gb receiver pc hostname (default tcpport: 1954)
rx_hostname pcmoench01:1954+pcmoench01:1955+
# 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)
0:udp_dstip 10.1.1.100
@ -23,11 +19,17 @@ udp_dstport 50004
# udp source ip (same subnet as 0:udp_dstip)
0:udp_srcip 10.1.1.10
# udp configurations for 2nd module
# udp destination port (receiver)
1:udp_dstport 50005
# udp destination ip (receiver)
1:udp_dstip 10.1.2.100
1:udp_dstip 10.1.1.100
# 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
fpath /external_pool/jungfrau_data/softwaretest
# disable file writing (default)
# disable file writing
fwrite 0

View File

@ -1,22 +0,0 @@
numfiles 1
nthreads 5,
fifosize 5000
nsigma 5
gainfile none
detectorMode counting
threshold 0
pedestalfile none
nframes 0
xMin 0
xMax 400
yMin 0
yMax 400
outdir ./
indir ./
flist none
fformat none
runmin 0
runmax -1
readnrows 400
eMin 0
eMax 16000

View File

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

View File

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

View File

@ -1,16 +0,0 @@
numinterfaces 1
rx_zmqip 10.1.2.102
rx_zmqport 1978
zmqip 129.129.202.57
zmqport 1979
nthreads 6
fifosize 5000
nsigma 5
gainfile none
nbinsx 5
nbinsy 5
etafile none
etabinsx 1000
etabinsy 1000
etamin -1
etamax 2

View File

@ -316,8 +316,7 @@ struct GenericStringRef {
GenericStringRef(const GenericStringRef& rhs) : s(rhs.s), length(rhs.length) {}
// Removed to fix failing build in GCC 14
// GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; }
//! implicit conversion to plain CharType pointer
operator const Ch *() const { return s; }

View File

@ -11,7 +11,6 @@ pybind11_add_module(_slsdet
src/current.cpp
src/duration.cpp
src/DurationWrapper.cpp
src/pedestal.cpp
)
target_link_libraries(_slsdet PUBLIC
@ -20,7 +19,7 @@ target_link_libraries(_slsdet PUBLIC
set_target_properties(_slsdet PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/slsdet
)
#Copy Python code
@ -28,7 +27,8 @@ set( PYTHON_FILES
slsdet/__init__.py
slsdet/adcs.py
slsdet/dacs.py
slsdet/powers.py
slsdet/voltages.py
slsdet/slowadcs.py
slsdet/decorators.py
slsdet/detector_property.py
slsdet/detector.py
@ -49,6 +49,7 @@ set( PYTHON_FILES
slsdet/temperature.py
slsdet/lookup.py
slsdet/utils.py
setup.py
)
@ -58,7 +59,6 @@ foreach(FILE ${PYTHON_FILES})
endforeach(FILE ${PYTHON_FILES})
configure_file( scripts/basic.py
${CMAKE_BINARY_DIR}/basic.py
)

View File

@ -1,12 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from slsdet import Detector, pedestalParameters
p = pedestalParameters()
p.frames = 10
p.loops= 20
d = Detector()
d.pedestalmode = p

View File

@ -7,50 +7,16 @@ Build upon the pybind11 example found here: https://github.com/pybind/python_exa
import os
import sys
from pathlib import Path
# sys.path.append('../libs/pybind')
from setuptools import setup, find_packages
from pybind11.setup_helpers import Pybind11Extension, build_ext
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer')
def get_conda_path():
"""
Keep this a function if we need some fancier logic later
"""
print('Prefix: ', os.environ['CONDA_PREFIX'])
return os.environ['CONDA_PREFIX']
#TODO migrate to CMake build or fetch files from cmake?
ext_modules = [
Pybind11Extension(
'_slsdet',
['src/main.cpp',
'src/enums.cpp',
'src/current.cpp',
'src/detector.cpp',
'src/network.cpp',
'src/pattern.cpp',
'src/scan.cpp',
'src/duration.cpp',
'src/DurationWrapper.cpp',
'src/pedestal.cpp',
]
,
include_dirs=[
os.path.join(get_conda_path(), 'include'),
],
libraries=['SlsDetector', 'SlsSupport', 'SlsReceiver'],
library_dirs=[
os.path.join(get_conda_path(), 'lib'),
],
language='c++'
),
]
setup(
name='slsdet',
version=__version__,
@ -60,7 +26,7 @@ setup(
description='Detector API for SLS Detector Group detectors',
long_description='',
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
ext_modules=ext_modules,
cmdclass={"build_ext": build_ext},
package_data={"":["*.so"]},
include_package_data=True,
zip_safe=False,
)

View File

@ -4,7 +4,8 @@
from .eiger import Eiger
from .ctb import Ctb
from .dacs import DetectorDacs, Dac
from .powers import DetectorPowers, Power
from .voltages import DetectorVoltages, Voltage
from .slowadcs import DetectorSlowAdcs, SlowAdc
from .detector import Detector
from .jungfrau import Jungfrau
from .mythen3 import Mythen3
@ -14,7 +15,7 @@ from .moench import Moench
from .pattern import Pattern, patternParameters
from .gaincaps import Mythen3GainCapsWrapper
import _slsdet
from . import _slsdet
xy = _slsdet.xy
defs = _slsdet.slsDetectorDefs
@ -26,5 +27,4 @@ IpAddr = _slsdet.IpAddr
MacAddr = _slsdet.MacAddr
scanParameters = _slsdet.scanParameters
currentSrcParameters = _slsdet.currentSrcParameters
DurationWrapper = _slsdet.DurationWrapper
pedestalParameters = _slsdet.pedestalParameters
DurationWrapper = _slsdet.DurationWrapper

View File

@ -3,8 +3,9 @@
from .detector import Detector, freeze
from .utils import element_if_equal
from .dacs import DetectorDacs, NamedDacs
from .powers import DetectorPowers, NamedPowers
import _slsdet
from .voltages import DetectorVoltages, NamedVoltages
from .slowadcs import DetectorSlowAdcs, NamedSlowAdcs
from . import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty
@ -16,12 +17,17 @@ class Ctb(Detector):
super().__init__(id)
self._frozen = False
self._dacs = NamedDacs(self)
self._powers = NamedPowers(self)
self._voltages = NamedVoltages(self)
self._slowadcs = NamedSlowAdcs(self)
@property
def dacs(self):
return self._dacs
@property
def powers(self):
return self._powers
def voltages(self):
return self._voltages
@property
def slowadcs(self):
return self._slowadcs

View File

@ -3,7 +3,7 @@
from .detector_property import DetectorProperty
from functools import partial
import numpy as np
import _slsdet
from . import _slsdet
from .detector import freeze
dacIndex = _slsdet.slsDetectorDefs.dacIndex
class Dac(DetectorProperty):

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from _slsdet import CppDetectorApi
from _slsdet import slsDetectorDefs
from _slsdet import IpAddr, MacAddr
from ._slsdet import CppDetectorApi
from ._slsdet import slsDetectorDefs
from ._slsdet import IpAddr, MacAddr
runStatus = slsDetectorDefs.runStatus
timingMode = slsDetectorDefs.timingMode
@ -15,7 +15,7 @@ defs = slsDetectorDefs
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
from .utils import Geometry, to_geo, element, reduce_time, is_iterable, hostname_list
from _slsdet import xy
from ._slsdet import xy
from .gaincaps import Mythen3GainCapsWrapper
from . import utils as ut
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
@ -182,7 +182,6 @@ class Detector(CppDetectorApi):
@port.setter
def port(self, value):
ut.validate_port(value)
ut.set_using_dict(self.setControlPort, value)
@property
@ -198,7 +197,6 @@ class Detector(CppDetectorApi):
@stopport.setter
def stopport(self, args):
ut.validate_port(args)
ut.set_using_dict(self.setStopPort, args)
@ -360,8 +358,7 @@ class Detector(CppDetectorApi):
@property
def settings(self):
"""
Detector settings.
Enum: detectorSettings
Detector settings. Enum: detectorSettings
Note
-----
@ -401,9 +398,6 @@ class Detector(CppDetectorApi):
def framesl(self):
"""
[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of frames left in acquisition.\n
Note
----
[Gotthard2] only in continuous auto mode.
:setter: Not Implemented
@ -479,8 +473,7 @@ class Detector(CppDetectorApi):
@element
def gaincaps(self):
"""
[Mythen3] Gain caps.
Enum: M3_GainCaps
[Mythen3] Gain caps. Enum: M3_GainCaps \n
Note
----
@ -578,6 +571,8 @@ class Detector(CppDetectorApi):
"""
Period between frames, accepts either a value in seconds or datetime.timedelta
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getPeriod
Example
@ -644,6 +639,9 @@ class Detector(CppDetectorApi):
"""
[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
Example
@ -868,7 +866,6 @@ class Detector(CppDetectorApi):
@rx_tcpport.setter
def rx_tcpport(self, port):
ut.validate_port(port)
ut.set_using_dict(self.setRxPort, port)
@property
@ -895,8 +892,7 @@ class Detector(CppDetectorApi):
@element
def rx_discardpolicy(self):
"""
Frame discard policy of receiver.
Enum: frameDiscardPolicy
Frame discard policy of receiver. Enum: frameDiscardPolicy
Note
-----
@ -970,8 +966,7 @@ class Detector(CppDetectorApi):
@property
@element
def fformat(self):
""" File format of data file in receiver.
Enum: fileFormat
""" File format of data file in receiver. Enum: fileFormat
Note
-----
@ -1150,14 +1145,11 @@ class Detector(CppDetectorApi):
@rx_zmqport.setter
def rx_zmqport(self, port):
if isinstance(port, int):
ut.validate_port(port)
self.setRxZmqPort(port, -1)
elif isinstance(port, dict):
ut.validate_port(port)
ut.set_using_dict(self.setRxZmqPort, port)
elif is_iterable(port):
for i, p in enumerate(port):
ut.validate_port(p)
self.setRxZmqPort(p, i)
else:
raise ValueError("Unknown argument type")
@ -1187,14 +1179,11 @@ class Detector(CppDetectorApi):
@zmqport.setter
def zmqport(self, port):
if isinstance(port, int):
ut.validate_port(port)
self.setClientZmqPort(port, -1)
elif isinstance(port, dict):
ut.validate_port(port)
ut.set_using_dict(self.setClientZmqPort, port)
elif is_iterable(port):
for i, p in enumerate(port):
ut.validate_port(p)
self.setClientZmqPort(p, i)
else:
raise ValueError("Unknown argument type")
@ -1504,7 +1493,6 @@ class Detector(CppDetectorApi):
@udp_dstport.setter
def udp_dstport(self, port):
ut.validate_port(port)
ut.set_using_dict(self.setDestinationUDPPort, port)
@property
@ -1526,7 +1514,6 @@ class Detector(CppDetectorApi):
@udp_dstport2.setter
def udp_dstport2(self, port):
ut.validate_port(port)
ut.set_using_dict(self.setDestinationUDPPort2, port)
@property
@ -1567,8 +1554,7 @@ class Detector(CppDetectorApi):
@property
@element
def status(self):
"""Gets detector status.
Enum: runStatus
"""Gets detector status. Enum: runStatus
Note
-----
@ -1582,8 +1568,7 @@ class Detector(CppDetectorApi):
@property
@element
def rx_status(self):
"""Gets receiver listener status.
Enum: runStatus
"""Gets receiver listener status. Enum: runStatus
Note
-----
@ -1677,11 +1662,6 @@ class Detector(CppDetectorApi):
def sync(self):
"""
[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()
@ -1812,7 +1792,6 @@ class Detector(CppDetectorApi):
def daclist(self):
"""
List of enums/names for every dac for this detector
:setter: Only implemented for Chiptestboard
"""
@ -1825,7 +1804,9 @@ class Detector(CppDetectorApi):
@property
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()
@ -1836,7 +1817,9 @@ class Detector(CppDetectorApi):
@property
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()
@ -1845,21 +1828,23 @@ class Detector(CppDetectorApi):
self.setSignalNames(value)
@property
def powerlist(self):
def voltagelist(self):
"""
[Chiptestboard] List of names for every power for this board. 5 power supply
List of names for every voltage for this board. 5 voltage supply
:setter: Only implemented for Chiptestboard
"""
return self.getPowerNames()
return self.getVoltageNames()
@powerlist.setter
def powerlist(self, value):
self.setPowerNames(value)
@voltagelist.setter
def voltagelist(self, value):
self.setVoltageNames(value)
@property
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()
@ -1877,16 +1862,16 @@ class Detector(CppDetectorApi):
}
@property
def powervalues(self):
"""[Chiptestboard] Gets the power values for every power for this detector."""
def voltagevalues(self):
"""Gets the voltage values for every voltage for this detector."""
return {
power.name.lower(): element_if_equal(np.array(self.getPower(power)))
for power in self.getPowerList()
voltage.name.lower(): element_if_equal(np.array(self.getVoltage(voltage)))
for voltage in self.getVoltageList()
}
@property
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 {
slowadc.name.lower(): element_if_equal(np.array(self.getSlowADC(slowadc)))
for slowadc in self.getSlowADCList()
@ -2041,7 +2026,6 @@ class Detector(CppDetectorApi):
@virtual.setter
def virtual(self, args):
n_detectors, starting_port = args
ut.validate_port(starting_port)
self.setVirtualDetectorServers(n_detectors, starting_port)
@ -2060,7 +2044,8 @@ class Detector(CppDetectorApi):
-----
To set default rate correction from trimbit file, use setDefaultRateCorrection
Known Issue:
Known Issue
------------
: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
@ -2084,8 +2069,7 @@ class Detector(CppDetectorApi):
@element
def readoutspeed(self):
"""
[Eiger][Jungfrau|Gotthard2] Readout speed of chip.
Enum: speedLevel
[Eiger][Jungfrau|Gotthard2] Readout speed of chip. Enum: speedLevel
Note
-----
@ -2174,8 +2158,7 @@ class Detector(CppDetectorApi):
@element
def timing(self):
"""
Set Timing Mode of detector.
Enum: timingMode
Set Timing Mode of detector. Enum: timingMode
Note
-----
@ -2235,11 +2218,13 @@ class Detector(CppDetectorApi):
@property
@element
def type(self):
""" Returns detector type.
Enum: detectorType
[EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2, CHIPTESTBOARD]
""" Returns detector type. Enum: detectorType
Note
----
:setter: Not implemented
Values: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2, CHIPTESTBOARD
"""
return self.getDetectorType()
@ -2500,6 +2485,9 @@ class Detector(CppDetectorApi):
"""
[Eiger] Measured sub frame period between last sub frame and previous one.
Note
-----
:setter: Not implemented
"""
return ut.reduce_time(self.getMeasuredSubFramePeriod())
@ -2777,8 +2765,7 @@ class Detector(CppDetectorApi):
@property
def gainmode(self):
"""
[Jungfrau] Detector gain mode.
Enum: gainMode
[Jungfrau] Detector gain mode. Enum: gainMode
Note
-----
@ -2867,32 +2854,15 @@ class Detector(CppDetectorApi):
@filtercells.setter
def filtercells(self, value):
ut.set_using_dict(self.setNumberOfFilterCells, value)
@property
@element
def pedestalmode(self):
"""
[Jungfrau] Enables or disables pedestal mode. Pass in a pedestalParameters object
see python/examples/use_pedestalmode.py
Note
----
The number of frames or triggers is overwritten by #pedestal_frames x pedestal_loops x 2. \n
In auto timing mode or in trigger mode with #frames > 1, #frames is overwritten and #triggers = 1, else #triggers is overwritten and #frames = 1. \n
One cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown).\n
Disabling pedestal mode will set back the normal mode values of #frames and #triggers."
"""
return self.getPedestalMode()
@pedestalmode.setter
def pedestalmode(self, value):
ut.set_using_dict(self.setPedestalMode, value)
@property
def maxclkphaseshift(self):
"""
[Gotthard2][Mythen3] Absolute maximum Phase shift of clocks.
[Gotthard2][Mythen3] Absolute maximum Phase shift of clocks.
Note
----
:setter: Not Implemented
Example
@ -2910,8 +2880,7 @@ class Detector(CppDetectorApi):
@element
def timingsource(self):
"""
[Gotthard2] Timing source.
Enum: timingSourceType
[Gotthard2] Timing source. Enum: timingSourceType
Note
-----
@ -2955,8 +2924,7 @@ class Detector(CppDetectorApi):
@property
@element
def burstmode(self):
"""[Gotthard2] Burst mode of detector.
Enum: burstMode
"""[Gotthard2] Burst mode of detector. Enum: burstMode
Note
----
@ -2974,6 +2942,9 @@ class Detector(CppDetectorApi):
"""
[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
:setter: Not Implemented
@ -3096,8 +3067,7 @@ class Detector(CppDetectorApi):
@property
def vetoalg(self):
"""[Gotthard2] Algorithm used for veto.
Enum: vetoAlgorithm, streamingInterface
"""[Gotthard2] Algorithm used for veto. Enum: vetoAlgorithm, streamingInterface
Note
----
@ -3271,8 +3241,7 @@ class Detector(CppDetectorApi):
@element
def romode(self):
"""
[CTB] Readout mode of detector.
Enum: readoutMode
[CTB] Readout mode of detector. Enum: readoutMode
Note
------
@ -3378,6 +3347,9 @@ class Detector(CppDetectorApi):
def maxdbitphaseshift(self):
"""[CTB][Jungfrau] Absolute maximum Phase shift of of the clock to latch digital bits.
Note
-----
:setter: Not Implemented
"""
return self.getMaxDBITPhaseShift()
@ -3422,6 +3394,9 @@ class Detector(CppDetectorApi):
def maxadcphaseshift(self):
"""[Jungfrau][Moench][CTB] Absolute maximum Phase shift of ADC clock.
Note
-----
:setter: Not Implemented
"""
return self.getMaxADCPhaseShift()
@ -3471,6 +3446,9 @@ class Detector(CppDetectorApi):
"""
[Ctb] Sync clock in MHz.
Note
-----
:setter: Not implemented
"""
return self.getSYNCClock()
@ -3478,7 +3456,10 @@ class Detector(CppDetectorApi):
@property
def pattern(self):
"""[Mythen3][Ctb] Loads ASCII pattern file directly to server (instead of executing line by line).
Note
----
:getter: Not Implemented
Example
@ -3833,80 +3814,83 @@ class Detector(CppDetectorApi):
@property
@element
def v_a(self):
"""[Ctb] Power supply a in mV."""
return self.getPower(dacIndex.V_POWER_A)
"""[Ctb] Voltage supply a in mV."""
return self.getVoltage(dacIndex.V_POWER_A)
@v_a.setter
def v_a(self, value):
value = ut.merge_args(dacIndex.V_POWER_A, value)
ut.set_using_dict(self.setPower, *value)
ut.set_using_dict(self.setVoltage, *value)
@property
@element
def v_b(self):
"""[Ctb] Power supply b in mV."""
return self.getPower(dacIndex.V_POWER_B)
"""[Ctb] Voltage supply b in mV."""
return self.getVoltage(dacIndex.V_POWER_B)
@v_b.setter
def v_b(self, value):
value = ut.merge_args(dacIndex.V_POWER_B, value)
ut.set_using_dict(self.setPower, *value)
ut.set_using_dict(self.setVoltage, *value)
@property
@element
def v_c(self):
"""[Ctb] Power supply c in mV."""
return self.getPower(dacIndex.V_POWER_C)
"""[Ctb] Voltage supply c in mV."""
return self.getVoltage(dacIndex.V_POWER_C)
@v_c.setter
def v_c(self, value):
value = ut.merge_args(dacIndex.V_POWER_C, value)
ut.set_using_dict(self.setPower, *value)
ut.set_using_dict(self.setVoltage, *value)
@property
@element
def v_d(self):
"""[Ctb] Power supply d in mV."""
return self.getPower(dacIndex.V_POWER_D)
"""[Ctb] Voltage supply d in mV."""
return self.getVoltage(dacIndex.V_POWER_D)
@v_d.setter
def v_d(self, value):
value = ut.merge_args(dacIndex.V_POWER_D, value)
ut.set_using_dict(self.setPower, *value)
ut.set_using_dict(self.setVoltage, *value)
@property
@element
def v_io(self):
"""[Ctb] Power supply io in mV. Minimum 1200 mV.
"""[Ctb] Voltage supply io in mV. Minimum 1200 mV.
Note
----
Must be the first power regulator to be set after fpga reset (on-board detector server start up).
"""
return self.getPower(dacIndex.V_POWER_IO)
return self.getVoltage(dacIndex.V_POWER_IO)
@v_io.setter
def v_io(self, value):
value = ut.merge_args(dacIndex.V_POWER_IO, value)
ut.set_using_dict(self.setPower, *value)
ut.set_using_dict(self.setVoltage, *value)
@property
@element
def v_limit(self):
"""[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."""
return self.getPower(dacIndex.V_LIMIT)
return self.getVoltage(dacIndex.V_LIMIT)
@v_limit.setter
def v_limit(self, value):
value = ut.merge_args(dacIndex.V_LIMIT, value)
ut.set_using_dict(self.setPower, *value)
ut.set_using_dict(self.setVoltage, *value)
@property
@element
def im_a(self):
"""[Ctb] Measured current of power supply a in mA.
Note
-----
:setter: Not implemented
"""
return self.getMeasuredCurrent(dacIndex.I_POWER_A)
@ -3916,6 +3900,9 @@ class Detector(CppDetectorApi):
def im_b(self):
"""[Ctb] Measured current of power supply b in mA.
Note
-----
:setter: Not implemented
"""
return self.getMeasuredCurrent(dacIndex.I_POWER_B)
@ -3925,6 +3912,9 @@ class Detector(CppDetectorApi):
def im_c(self):
"""[Ctb] Measured current of power supply c in mA.
Note
-----
:setter: Not implemented
"""
return self.getMeasuredCurrent(dacIndex.I_POWER_C)
@ -3934,6 +3924,9 @@ class Detector(CppDetectorApi):
def im_d(self):
"""[Ctb] Measured current of power supply d in mA.
Note
-----
:setter: Not implemented
"""
return self.getMeasuredCurrent(dacIndex.I_POWER_D)
@ -3943,6 +3936,9 @@ class Detector(CppDetectorApi):
def im_io(self):
"""[Ctb] Measured current of power supply io in mA.
Note
-----
:setter: Not implemented
"""
return self.getMeasuredCurrent(dacIndex.I_POWER_IO)
@ -3992,6 +3988,9 @@ class Detector(CppDetectorApi):
def exptimel(self):
"""[Gotthard] Exposure time left for current frame.
Note
-----
:getter: always returns in seconds. To get in DurationWrapper, use getExptimeLeft
:setter: Not Implemented
@ -4026,6 +4025,9 @@ class Detector(CppDetectorApi):
"""
[Gotthard2][Mythen3] Frequency of clock in Hz.
Note
----
:setter: Not implemented. Use clkdiv to set frequency
Example
@ -4045,9 +4047,7 @@ class Detector(CppDetectorApi):
@property
@element
def polarity(self):
"""[Mythen3] Set positive or negative polarity.
Enum: polarity
"""
"""[Mythen3] Set positive or negative polarity. Enum: polarity"""
return self.getPolarity()
@polarity.setter

View File

@ -11,7 +11,7 @@ Created on Wed Dec 6 11:51:18 2017
from .detector import Detector
from .temperature import Temperature, DetectorTemperature
from .dacs import DetectorDacs
import _slsdet
from . import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty

View File

@ -15,8 +15,9 @@ if dt === detectorType.EIGER:
"""
import _slsdet
for name, cls in _slsdet.slsDetectorDefs.__dict__.items():
from . import _slsdet
import slsdet._slsdet
for name, cls in slsdet._slsdet.slsDetectorDefs.__dict__.items():
if isinstance(cls, type):
exec(f'{name} = {cls.__module__}.{cls.__qualname__}')

View File

@ -1,6 +1,6 @@
import _slsdet
from . import _slsdet
gc = _slsdet.slsDetectorDefs.M3_GainCaps

View File

@ -9,7 +9,7 @@ This file contains the specialization for the Moench detector
from .detector import Detector, freeze
from .dacs import DetectorDacs
import _slsdet
from . import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty

View File

@ -11,7 +11,7 @@ from .detector import Detector, freeze
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
import _slsdet
from . import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty

View File

@ -11,7 +11,7 @@ from .detector import Detector, freeze
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
import _slsdet
from . import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty

View File

@ -9,7 +9,7 @@ This file contains the specialization for the Moench detector
from .detector import Detector, freeze
from .dacs import DetectorDacs
import _slsdet
from . import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty

View File

@ -11,7 +11,7 @@ from .detector import Detector, freeze
# from .adcs import Adc, DetectorAdcs
from .dacs import DetectorDacs
import _slsdet
from . import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex
gc_enums = _slsdet.slsDetectorDefs.M3_GainCaps
from .detector_property import DetectorProperty

View File

@ -1,8 +1,8 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
import _slsdet
from . import _slsdet
from _slsdet import Pattern
from ._slsdet import Pattern
class patternParameters(_slsdet.patternParameters):

View File

@ -1,195 +0,0 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from .detector_property import DetectorProperty
from functools import partial
import numpy as np
import _slsdet
from .detector import freeze
dacIndex = _slsdet.slsDetectorDefs.dacIndex
class Power(DetectorProperty):
"""
This class represents a power on the Chip Test Board. One instance handles all
powers with the same name for a multi detector instance. (TODO: Not needed for CTB)
.. note ::
This class is used to build up DetectorPowers and is in general
not directly accessible to the user.
"""
def __init__(self, name, enum, default, detector):
super().__init__(partial(detector.getPower, enum),
lambda x, y : detector.setPower(enum, x, y),
detector.size,
name)
self.default = default
def __repr__(self):
"""String representation for a single power in all modules"""
powerstr = ''.join([f'{item:5d}' for item in self.get()])
return f'{self.__name__:15s}:{powerstr}'
class NamedPowers:
"""
New implementation of the detector powers.
"""
_frozen = False
_direct_access = ['_detector', '_current', '_powernames']
def __init__(self, detector):
self._detector = detector
self._current = 0
#only get the powernames if we have modules attached
if detector.size() == 0:
self._powernames = ["VA", "VB", "VC", "VD", "VIO"]
else:
self._powernames = [n.replace(" ", "") for n in detector.getPowerNames()]
# Populate the powers
for i,name in enumerate(self._powernames):
#name, enum, low, high, default, detector
k = dacIndex(i + int(dacIndex.V_POWER_A))
setattr(self, name, Power(name, k, 0, detector))
self._frozen = True
# def __getattr__(self, name):
# return self.__getattribute__('_' + name)
def __setattr__(self, name, value):
if not self._frozen:
#durning init we need to be able to set up the class
super().__setattr__(name, value)
else:
#Later we restrict us to manipulate powers and a few fields
if name in self._direct_access:
super().__setattr__(name, value)
elif name in self._powernames:
return self.__getattribute__(name).__setitem__(slice(None, None), value)
else:
raise AttributeError(f'Power not found: {name}')
def __next__(self):
if self._current >= len(self._powernames):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattribute__(self._powernames[self._current-1])
# return self.__getattr__(self._powernames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== POWERS =========']
r_str += [repr(power) for power in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the powers into a numpy array with dimensions [npowers, nmodules]
"""
power_array = np.zeros((len(self._powernames), len(self._detector)))
for i, _d in enumerate(self):
power_array[i,:] = _d[:]
return power_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, power_array):
"""
Set the power from an numpy array with power values. [npowers, nmodules]
"""
power_array = power_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = power_array[i]
def from_array(self, power_array):
self.set_from_array(power_array)
class DetectorPowers:
_powers = []
_powernames = [_d[0] for _d in _powers]
_allowed_attr = ['_detector', '_current']
_frozen = False
def __init__(self, detector):
# We need to at least initially know which detector we are connected to
self._detector = detector
# Index to support iteration
self._current = 0
# Name the attributes?
for _d in self._powers:
setattr(self, '_'+_d[0], Power(*_d, detector))
self._frozen = True
def __getattr__(self, name):
return self.__getattribute__('_' + name)
@property
def powernames(self):
return [_d[0] for _d in _powers]
def __setattr__(self, name, value):
if name in self._powernames:
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
else:
if self._frozen == True and name not in self._allowed_attr:
raise AttributeError(f'Power not found: {name}')
super().__setattr__(name, value)
def __next__(self):
if self._current >= len(self._powers):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattr__(self._powernames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== POWERS =========']
r_str += [repr(power) for power in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the powers into a numpy array with dimensions [npowers, nmodules]
"""
power_array = np.zeros((len(self._powers), len(self._detector)))
for i, _d in enumerate(self):
power_array[i,:] = _d[:]
return power_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, power_array):
"""
Set the powers from an numpy array with power values. [npowers, nmodules]
"""
power_array = power_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = power_array[i]
def from_array(self, power_array):
self.set_from_array(power_array)
def set_default(self):
"""
Set all powers to their default values
"""
for _d in self:
_d[:] = _d.default

View File

@ -3,7 +3,7 @@
from .utils import element_if_equal
from .enums import dacIndex
from .defines import M3_MAX_PATTERN_LEVELS, MAX_PATTERN_LEVELS
from _slsdet import slsDetectorDefs
from ._slsdet import slsDetectorDefs
detectorType = slsDetectorDefs.detectorType
@ -60,27 +60,18 @@ class SlowAdcProxy:
def __getitem__(self, key):
dac_index = dacIndex(int(dacIndex.SLOW_ADC0)+key)
return element_if_equal(self.det.getSlowADC(dac_index))/1000 #TODO! Multi module?
return element_if_equal(self.det.getSlowADC(dac_index))
def __repr__(self):
rstr = ''
for i,name in enumerate(self.det.getSlowADCNames()):
for i in range(8):
r = element_if_equal(self.__getitem__(i))
if isinstance(r, list):
rstr += ' '.join(f'{item/1000} mV' for item in r)
rstr += ' '.join(f'{item} uV' for item in r)
else:
rstr += f'[{i}] {name}: {r/1000} mV\n'
rstr += f'{i}: {r} uV\n'
return rstr.strip('\n')
def __getattr__(self, name):
if name in self.det.getSlowADCNames():
i = self.det.getSlowADCIndex(name)
return element_if_equal(self.det.getSlowADC(i))
else:
raise ValueError(f"Could not find slow adc with name: {name}")
class ClkDivProxy:
"""

195
python/slsdet/slowadcs.py Executable file
View File

@ -0,0 +1,195 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from .detector_property import DetectorProperty
from functools import partial
import numpy as np
from . import _slsdet
from .detector import freeze
dacIndex = _slsdet.slsDetectorDefs.dacIndex
class SlowAdc(DetectorProperty):
"""
This class represents a slowadc on the Chip Test Board. One instance handles all
slowadcs with the same name for a multi detector instance. (TODO: Not needed for CTB)
.. note ::
This class is used to build up DetectorSlowAdcs and is in general
not directly accessible to the user.
"""
def __init__(self, name, enum, default, detector):
super().__init__(partial(detector.getVoltage, enum),
lambda x, y : detector.setVoltage(enum, x, y),
detector.size,
name)
self.default = default
def __repr__(self):
"""String representation for a single slowadc in all modules"""
slowadcstr = ''.join([f'{item:5d}' for item in self.get()])
return f'{self.__name__:15s}:{slowadcstr}'
class NamedSlowAdcs:
"""
New implementation of the detector slowadcs.
"""
_frozen = False
_direct_access = ['_detector', '_current', '_voltagenames']
def __init__(self, detector):
self._detector = detector
self._current = 0
#only get the voltagenames if we have modules attached
if detector.size() == 0:
self._voltagenames = ["VA", "VB", "VC", "VD", "VIO"]
else:
self._voltagenames = [n.replace(" ", "") for n in detector.getVoltageNames()]
# Populate the slowadcs
for i,name in enumerate(self._voltagenames):
#name, enum, low, high, default, detector
k = dacIndex(i + int(dacIndex.V_POWER_A))
setattr(self, name, SlowAdc(name, k, 0, detector))
self._frozen = True
# def __getattr__(self, name):
# return self.__getattribute__('_' + name)
def __setattr__(self, name, value):
if not self._frozen:
#durning init we need to be able to set up the class
super().__setattr__(name, value)
else:
#Later we restrict us to manipulate slowadcs and a few fields
if name in self._direct_access:
super().__setattr__(name, value)
elif name in self._voltagenames:
return self.__getattribute__(name).__setitem__(slice(None, None), value)
else:
raise AttributeError(f'SlowAdc not found: {name}')
def __next__(self):
if self._current >= len(self._voltagenames):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattribute__(self._voltagenames[self._current-1])
# return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== SLOW ADCS =========']
r_str += [repr(slowadc) for slowadc in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the slowadcs into a numpy array with dimensions [nslowadcs, nmodules]
"""
voltage_array = np.zeros((len(self._voltagenames), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the slowadc from an numpy array with slowadc values. [nslowadcs, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
class DetectorSlowAdcs:
_slowadcs = []
_voltagenames = [_d[0] for _d in _slowadcs]
_allowed_attr = ['_detector', '_current']
_frozen = False
def __init__(self, detector):
# We need to at least initially know which detector we are connected to
self._detector = detector
# Index to support iteration
self._current = 0
# Name the attributes?
for _d in self._slowadcs:
setattr(self, '_'+_d[0], SlowAdc(*_d, detector))
self._frozen = True
def __getattr__(self, name):
return self.__getattribute__('_' + name)
@property
def voltagenames(self):
return [_d[0] for _d in _slowadcs]
def __setattr__(self, name, value):
if name in self._voltagenames:
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
else:
if self._frozen == True and name not in self._allowed_attr:
raise AttributeError(f'SlowAdc not found: {name}')
super().__setattr__(name, value)
def __next__(self):
if self._current >= len(self._slowadcs):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== SLOW ADCS =========']
r_str += [repr(slowadc) for slowadc in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the slowadcs into a numpy array with dimensions [nslowadcs, nmodules]
"""
voltage_array = np.zeros((len(self._slowadcs), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the slowadcs from an numpy array with slowadc values. [nslowadcs, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
def set_default(self):
"""
Set all slowadcs to their default values
"""
for _d in self:
_d[:] = _d.default

View File

@ -6,7 +6,7 @@ but not directly used in controlling the detector
"""
from collections import namedtuple
import _slsdet #C++ lib
from . import _slsdet #C++ lib
import functools
import datetime as dt
import pathlib
@ -278,9 +278,3 @@ def hostname_list(args):
return hosts
else:
raise ValueError("hostname needs to be string or list of strings")
def validate_port(value):
if value <= 0 or value > 65535:
raise ValueError("port must be in range 1 - 65535")

195
python/slsdet/voltages.py Executable file
View File

@ -0,0 +1,195 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from .detector_property import DetectorProperty
from functools import partial
import numpy as np
from . import _slsdet
from .detector import freeze
dacIndex = _slsdet.slsDetectorDefs.dacIndex
class Voltage(DetectorProperty):
"""
This class represents a voltage on the Chip Test Board. One instance handles all
voltages with the same name for a multi detector instance. (TODO: Not needed for CTB)
.. note ::
This class is used to build up DetectorVoltages and is in general
not directly accessible to the user.
"""
def __init__(self, name, enum, default, detector):
super().__init__(partial(detector.getVoltage, enum),
lambda x, y : detector.setVoltage(enum, x, y),
detector.size,
name)
self.default = default
def __repr__(self):
"""String representation for a single voltage in all modules"""
voltagestr = ''.join([f'{item:5d}' for item in self.get()])
return f'{self.__name__:15s}:{voltagestr}'
class NamedVoltages:
"""
New implementation of the detector voltages.
"""
_frozen = False
_direct_access = ['_detector', '_current', '_voltagenames']
def __init__(self, detector):
self._detector = detector
self._current = 0
#only get the voltagenames if we have modules attached
if detector.size() == 0:
self._voltagenames = ["VA", "VB", "VC", "VD", "VIO"]
else:
self._voltagenames = [n.replace(" ", "") for n in detector.getVoltageNames()]
# Populate the voltages
for i,name in enumerate(self._voltagenames):
#name, enum, low, high, default, detector
k = dacIndex(i + int(dacIndex.V_POWER_A))
setattr(self, name, Voltage(name, k, 0, detector))
self._frozen = True
# def __getattr__(self, name):
# return self.__getattribute__('_' + name)
def __setattr__(self, name, value):
if not self._frozen:
#durning init we need to be able to set up the class
super().__setattr__(name, value)
else:
#Later we restrict us to manipulate voltages and a few fields
if name in self._direct_access:
super().__setattr__(name, value)
elif name in self._voltagenames:
return self.__getattribute__(name).__setitem__(slice(None, None), value)
else:
raise AttributeError(f'Voltage not found: {name}')
def __next__(self):
if self._current >= len(self._voltagenames):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattribute__(self._voltagenames[self._current-1])
# return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== VOLTAGES =========']
r_str += [repr(voltage) for voltage in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the voltages into a numpy array with dimensions [nvoltages, nmodules]
"""
voltage_array = np.zeros((len(self._voltagenames), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the voltage from an numpy array with voltage values. [nvoltages, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
class DetectorVoltages:
_voltages = []
_voltagenames = [_d[0] for _d in _voltages]
_allowed_attr = ['_detector', '_current']
_frozen = False
def __init__(self, detector):
# We need to at least initially know which detector we are connected to
self._detector = detector
# Index to support iteration
self._current = 0
# Name the attributes?
for _d in self._voltages:
setattr(self, '_'+_d[0], Voltage(*_d, detector))
self._frozen = True
def __getattr__(self, name):
return self.__getattribute__('_' + name)
@property
def voltagenames(self):
return [_d[0] for _d in _voltages]
def __setattr__(self, name, value):
if name in self._voltagenames:
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
else:
if self._frozen == True and name not in self._allowed_attr:
raise AttributeError(f'Voltage not found: {name}')
super().__setattr__(name, value)
def __next__(self):
if self._current >= len(self._voltages):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== VOLTAGES =========']
r_str += [repr(voltage) for voltage in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the voltages into a numpy array with dimensions [nvoltages, nmodules]
"""
voltage_array = np.zeros((len(self._voltages), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the voltages from an numpy array with voltage values. [nvoltages, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
def set_default(self):
"""
Set all voltages to their default values
"""
for _d in self:
_d[:] = _d.default

View File

@ -48,7 +48,7 @@ void init_det(py::module &m) {
Detector::setHostname,
py::arg());
CppDetectorApi.def("setVirtualDetectorServers",
(void (Detector::*)(int, uint16_t)) &
(void (Detector::*)(int, int)) &
Detector::setVirtualDetectorServers,
py::arg(), py::arg());
CppDetectorApi.def("getShmId",
@ -751,19 +751,19 @@ void init_det(py::module &m) {
Detector::setDestinationUDPMAC2,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getDestinationUDPPort",
(Result<uint16_t>(Detector::*)(sls::Positions) const) &
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getDestinationUDPPort,
py::arg() = Positions{});
CppDetectorApi.def("setDestinationUDPPort",
(void (Detector::*)(uint16_t, int)) &
(void (Detector::*)(int, int)) &
Detector::setDestinationUDPPort,
py::arg(), py::arg() = -1);
CppDetectorApi.def("getDestinationUDPPort2",
(Result<uint16_t>(Detector::*)(sls::Positions) const) &
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getDestinationUDPPort2,
py::arg() = Positions{});
CppDetectorApi.def("setDestinationUDPPort2",
(void (Detector::*)(uint16_t, int)) &
(void (Detector::*)(int, int)) &
Detector::setDestinationUDPPort2,
py::arg(), py::arg() = -1);
CppDetectorApi.def("reconfigureUDPDestination",
@ -844,12 +844,12 @@ void init_det(py::module &m) {
Detector::setRxHostname,
py::arg());
CppDetectorApi.def("getRxPort",
(Result<uint16_t>(Detector::*)(sls::Positions) const) &
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getRxPort,
py::arg() = Positions{});
CppDetectorApi.def(
"setRxPort", (void (Detector::*)(uint16_t, int)) & Detector::setRxPort,
py::arg(), py::arg() = -1);
CppDetectorApi.def("setRxPort",
(void (Detector::*)(int, int)) & Detector::setRxPort,
py::arg(), py::arg() = -1);
CppDetectorApi.def("getRxFifoDepth",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getRxFifoDepth,
@ -1032,12 +1032,11 @@ void init_det(py::module &m) {
Detector::setRxZmqStartingFrame,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getRxZmqPort",
(Result<uint16_t>(Detector::*)(sls::Positions) const) &
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getRxZmqPort,
py::arg() = Positions{});
CppDetectorApi.def("setRxZmqPort",
(void (Detector::*)(uint16_t, int)) &
Detector::setRxZmqPort,
(void (Detector::*)(int, int)) & Detector::setRxZmqPort,
py::arg(), py::arg() = -1);
CppDetectorApi.def(
"getRxZmqIP",
@ -1049,11 +1048,11 @@ void init_det(py::module &m) {
Detector::setRxZmqIP,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getClientZmqPort",
(Result<uint16_t>(Detector::*)(sls::Positions) const) &
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getClientZmqPort,
py::arg() = Positions{});
CppDetectorApi.def("setClientZmqPort",
(void (Detector::*)(uint16_t, int)) &
(void (Detector::*)(int, int)) &
Detector::setClientZmqPort,
py::arg(), py::arg() = -1);
CppDetectorApi.def(
@ -1270,16 +1269,6 @@ void init_det(py::module &m) {
(void (Detector::*)(int, sls::Positions)) &
Detector::setNumberOfFilterCells,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"getPedestalMode",
(Result<defs::pedestalParameters>(Detector::*)(sls::Positions) const) &
Detector::getPedestalMode,
py::arg() = Positions{});
CppDetectorApi.def(
"setPedestalMode",
(void (Detector::*)(const defs::pedestalParameters, sls::Positions)) &
Detector::setPedestalMode,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getROI",
(Result<defs::ROI>(Detector::*)(sls::Positions) const) &
Detector::getROI,
@ -1535,21 +1524,29 @@ void init_det(py::module &m) {
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getSYNCClock,
py::arg() = Positions{});
CppDetectorApi.def("getPowerList",
CppDetectorApi.def("getADCPipeline",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getADCPipeline,
py::arg() = Positions{});
CppDetectorApi.def("setADCPipeline",
(void (Detector::*)(int, sls::Positions)) &
Detector::setADCPipeline,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getVoltageList",
(std::vector<defs::dacIndex>(Detector::*)() const) &
Detector::getPowerList);
Detector::getVoltageList);
CppDetectorApi.def("getSlowADCList",
(std::vector<defs::dacIndex>(Detector::*)() const) &
Detector::getSlowADCList);
CppDetectorApi.def(
"getPower",
"getVoltage",
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
Detector::getPower,
Detector::getVoltage,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"setPower",
"setVoltage",
(void (Detector::*)(defs::dacIndex, int, sls::Positions)) &
Detector::setPower,
Detector::setVoltage,
py::arg(), py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getADCVpp",
(Result<int>(Detector::*)(bool, sls::Positions) const) &
@ -1617,9 +1614,9 @@ void init_det(py::module &m) {
Detector::setDBITClock,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"getMeasuredPower",
"getMeasuredVoltage",
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
Detector::getMeasuredPower,
Detector::getMeasuredVoltage,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"getMeasuredCurrent",
@ -1736,26 +1733,26 @@ void init_det(py::module &m) {
(std::string(Detector::*)(const int) const) &
Detector::getSignalName,
py::arg());
CppDetectorApi.def("setPowerNames",
CppDetectorApi.def("setVoltageNames",
(void (Detector::*)(const std::vector<std::string>)) &
Detector::setPowerNames,
Detector::setVoltageNames,
py::arg());
CppDetectorApi.def("getPowerNames",
CppDetectorApi.def("getVoltageNames",
(std::vector<std::string>(Detector::*)() const) &
Detector::getPowerNames);
Detector::getVoltageNames);
CppDetectorApi.def(
"getPowerIndex",
"getVoltageIndex",
(defs::dacIndex(Detector::*)(const std::string &) const) &
Detector::getPowerIndex,
Detector::getVoltageIndex,
py::arg());
CppDetectorApi.def(
"setPowerName",
"setVoltageName",
(void (Detector::*)(const defs::dacIndex, const std::string &)) &
Detector::setPowerName,
Detector::setVoltageName,
py::arg(), py::arg());
CppDetectorApi.def("getPowerName",
CppDetectorApi.def("getVoltageName",
(std::string(Detector::*)(const defs::dacIndex) const) &
Detector::getPowerName,
Detector::getVoltageName,
py::arg());
CppDetectorApi.def("setSlowADCNames",
(void (Detector::*)(const std::vector<std::string>)) &
@ -1894,14 +1891,6 @@ void init_det(py::module &m) {
sls::Positions)) &
Detector::setAdditionalJsonParameter,
py::arg(), py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getADCPipeline",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getADCPipeline,
py::arg() = Positions{});
CppDetectorApi.def("setADCPipeline",
(void (Detector::*)(int, sls::Positions)) &
Detector::setADCPipeline,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def(
"programFPGA",
(void (Detector::*)(const std::string &, const bool, sls::Positions)) &
@ -1989,19 +1978,19 @@ void init_det(py::module &m) {
Detector::setADCInvert,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getControlPort",
(Result<uint16_t>(Detector::*)(sls::Positions) const) &
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getControlPort,
py::arg() = Positions{});
CppDetectorApi.def("setControlPort",
(void (Detector::*)(uint16_t, sls::Positions)) &
(void (Detector::*)(int, sls::Positions)) &
Detector::setControlPort,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getStopPort",
(Result<uint16_t>(Detector::*)(sls::Positions) const) &
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getStopPort,
py::arg() = Positions{});
CppDetectorApi.def("setStopPort",
(void (Detector::*)(uint16_t, sls::Positions)) &
(void (Detector::*)(int, sls::Positions)) &
Detector::setStopPort,
py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getDetectorLock",

View File

@ -19,8 +19,6 @@ void init_pattern(py::module &);
void init_scan(py::module &);
void init_source(py::module &);
void init_duration(py::module &);
void init_pedestal(py::module &);
PYBIND11_MODULE(_slsdet, m) {
m.doc() = R"pbdoc(
C/C++ API
@ -39,7 +37,6 @@ PYBIND11_MODULE(_slsdet, m) {
init_scan(m);
init_source(m);
init_duration(m);
init_pedestal(m);
// init_experimental(m);
py::module io = m.def_submodule("io", "Submodule for io");

View File

@ -1,23 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "py_headers.h"
#include "sls/ToString.h"
#include "sls/sls_detector_defs.h"
namespace py = pybind11;
void init_pedestal(py::module &m) {
using src = slsDetectorDefs::pedestalParameters;
py::class_<src> pedestalParameters(m, "pedestalParameters");
pedestalParameters.def(py::init());
pedestalParameters.def_readwrite("enable", &src::enable);
pedestalParameters.def_readwrite("frames", &src::frames);
pedestalParameters.def_readwrite("loops", &src::loops);
pedestalParameters.def(pybind11::self == pybind11::self);
pedestalParameters.def("__repr__",
[](const src &a) { return sls::ToString(a); });
}

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.2

View File

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

View File

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

View File

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

View File

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

View File

@ -1,240 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef MOENCH03v2DATA_H
#define MOENCH03v2DATA_H
//#define MYROOT
#ifndef MYROOT
#include "sls/sls_detector_defs.h"
#endif
#ifdef MYROOT
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t bunchId;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t reserved;
uint32_t debug;
uint16_t roundRNumber;
uint8_t detType;
uint8_t version;
} sls_detector_header;
#define MAX_NUM_PACKETS 512
// using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
// using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];
struct sls_receiver_header {
sls_detector_header detHeader; /**< is the detector header */
uint8_t packetsMask[64]; /**< is the packets caught bit mask */
};
#endif
#include "slsDetectorData.h"
#ifdef RAWDATA
#define DATA_OFFSET sizeof(header)
#endif
#ifndef RAWDATA
#define DATA_OFFSET 0
#endif
class moench03v2Data : public slsDetectorData<uint16_t> {
private:
int iframe;
const int nRows;
double ghost[200][25];
// Single point of definition if we need to customize
#ifndef MYROOT
using header = sls::defs::sls_receiver_header;
#endif
#ifdef MYROOT
sls_receiver_header header;
#endif
public:
/**
Implements the slsReceiverData structure for the moench02 prototype read
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
1286 large etc.) \param c crosstalk parameter for the output buffer
*/
moench03v2Data(int nrows = 200)
: slsDetectorData<uint16_t>(400, nrows*2,2* 400*nrows*2 + DATA_OFFSET),
nRows(nrows) {
std::cout << "MOENCH width new firmware " << dataSize << std::endl;
int off=DATA_OFFSET;
for (int ix = 0; ix < 400; ix++) {
for (int iy = 0; iy < nRows*2; iy++) {
dataMap[iy][ix]=off+2*(iy*400+ix);
}
}
iframe = 0;
// cout << "data struct created" << endl;
};
/**
Returns the value of the selected channel for the given dataset as
double. \param data pointer to the dataset (including headers etc) \param
ix pixel number in the x direction \param iy pixel number in the y
direction \returns data for the selected channel, with inversion if
required as double
*/
double getValue(char *data, int ix, int iy = 0) override {
uint16_t val = getChannel(data, ix, iy) & 0x3fff;
return val;
};
virtual void calcGhost(char *data, int ix, int iy) {
double val = 0;
/* for (int ix=0; ix<25; ix++){ */
/* for (int iy=0; iy<200; iy++) { */
val = 0;
// cout << "** ";
for (int isc = 0; isc < 16; isc++) {
// for (int ii=0; ii<2; ii++) {
val += getChannel(data, ix + 25 * isc, iy);
// cout << "(" << isc << "," << val << " " ;
val += getChannel(data, ix + 25 * isc, 399 - iy);
// cout << val << " " ;
// }
}
ghost[iy][ix] = val; //-6224;
// cout << " --"<< endl;
/* } */
/* } */
// cout << "*" << endl;
}
virtual void calcGhost(char *data) {
for (int ix = 0; ix < 25; ix++) {
for (int iy = 0; iy < 200; iy++) {
calcGhost(data, ix, iy);
}
}
// cout << "*" << endl;
}
double getGhost(int ix, int iy) {
if (iy < 200)
return ghost[iy][ix % 25];
if (iy < 400)
return ghost[399 - iy][ix % 25];
return 0;
};
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
int getFrameNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.frameNumber;
#endif
#ifndef RAWDATA
return 1;
#endif
}
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.packetNumber;
#endif
#ifndef RAWDATA
return 0;
#endif
}
char *readNextFrame(std::ifstream &filebin) override {
int ff = -1, np = -1;
return readNextFrame(filebin, ff, np);
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff) {
int np = -1;
return readNextFrame(filebin, ff, np);
};
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
char *data = new char[dataSize];
char *d = readNextFrame(filebin, ff, np, data);
if (d == NULL) {
delete[] data;
data = NULL;
}
return data;
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np,
char *data) {
np = 0;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
// std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return data;
}
}
std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return nullptr;
}
/**
Loops over a memory slot until a complete frame is found (i.e. all
packets 0 to nPackets, same frame number). purely virtual func \param
data pointer to the memory to be analyzed \param ndata reference to the
amount of data found for the frame, in case the frame is incomplete at
the end of the memory slot \param dsize size of the memory slot to be
analyzed \returns pointer to the beginning of the last good frame (might
be incomplete if ndata smaller than dataSize), or NULL if no frame is
found
*/
char *findNextFrame(char *data, int &ndata, int dsize) override {
if (dsize < dataSize)
ndata = dsize;
else
ndata = dataSize;
return data;
}
// int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

View File

@ -1,240 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef MOENCH03v2DATA_H
#define MOENCH03v2DATA_H
//#define MYROOT
#ifndef MYROOT
#include "sls/sls_detector_defs.h"
#endif
#ifdef MYROOT
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t bunchId;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t reserved;
uint32_t debug;
uint16_t roundRNumber;
uint8_t detType;
uint8_t version;
} sls_detector_header;
#define MAX_NUM_PACKETS 512
// using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
// using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];
struct sls_receiver_header {
sls_detector_header detHeader; /**< is the detector header */
uint8_t packetsMask[64]; /**< is the packets caught bit mask */
};
#endif
#include "slsDetectorData.h"
#ifdef RAWDATA
#define DATA_OFFSET sizeof(header)
#endif
#ifndef RAWDATA
#define DATA_OFFSET 0
#endif
class moench03v2Data : public slsDetectorData<uint16_t> {
private:
int iframe;
const int nRows;
double ghost[200][25];
// Single point of definition if we need to customize
#ifndef MYROOT
using header = sls::defs::sls_receiver_header;
#endif
#ifdef MYROOT
sls_receiver_header header;
#endif
public:
/**
Implements the slsReceiverData structure for the moench02 prototype read
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
1286 large etc.) \param c crosstalk parameter for the output buffer
*/
moench03v2Data(int nrows = 200)
: slsDetectorData<uint16_t>(400, nrows*2,2* 400*nrows*2 + DATA_OFFSET),
nRows(nrows) {
std::cout << "MOENCH width new firmware " << dataSize << std::endl;
int off=DATA_OFFSET;
for (int ix = 0; ix < 400; ix++) {
for (int iy = 0; iy < nRows*2; iy++) {
dataMap[iy][ix]=off+2*(iy*400+ix);
}
}
iframe = 0;
// cout << "data struct created" << endl;
};
/**
Returns the value of the selected channel for the given dataset as
double. \param data pointer to the dataset (including headers etc) \param
ix pixel number in the x direction \param iy pixel number in the y
direction \returns data for the selected channel, with inversion if
required as double
*/
double getValue(char *data, int ix, int iy = 0) override {
uint16_t val = getChannel(data, ix, iy) & 0x3fff;
return val;
};
virtual void calcGhost(char *data, int ix, int iy) {
double val = 0;
/* for (int ix=0; ix<25; ix++){ */
/* for (int iy=0; iy<200; iy++) { */
val = 0;
// cout << "** ";
for (int isc = 0; isc < 16; isc++) {
// for (int ii=0; ii<2; ii++) {
val += getChannel(data, ix + 25 * isc, iy);
// cout << "(" << isc << "," << val << " " ;
val += getChannel(data, ix + 25 * isc, 399 - iy);
// cout << val << " " ;
// }
}
ghost[iy][ix] = val; //-6224;
// cout << " --"<< endl;
/* } */
/* } */
// cout << "*" << endl;
}
virtual void calcGhost(char *data) {
for (int ix = 0; ix < 25; ix++) {
for (int iy = 0; iy < 200; iy++) {
calcGhost(data, ix, iy);
}
}
// cout << "*" << endl;
}
double getGhost(int ix, int iy) {
if (iy < 200)
return ghost[iy][ix % 25];
if (iy < 400)
return ghost[399 - iy][ix % 25];
return 0;
};
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
int getFrameNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.frameNumber;
#endif
#ifndef RAWDATA
return 1;
#endif
}
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.packetNumber;
#endif
#ifndef RAWDATA
return 0;
#endif
}
char *readNextFrame(std::ifstream &filebin) override {
int ff = -1, np = -1;
return readNextFrame(filebin, ff, np);
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff) {
int np = -1;
return readNextFrame(filebin, ff, np);
};
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
char *data = new char[dataSize];
char *d = readNextFrame(filebin, ff, np, data);
if (d == NULL) {
delete[] data;
data = NULL;
}
return data;
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np,
char *data) {
np = 0;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return data;
}
}
std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return nullptr;
}
/**
Loops over a memory slot until a complete frame is found (i.e. all
packets 0 to nPackets, same frame number). purely virtual func \param
data pointer to the memory to be analyzed \param ndata reference to the
amount of data found for the frame, in case the frame is incomplete at
the end of the memory slot \param dsize size of the memory slot to be
analyzed \returns pointer to the beginning of the last good frame (might
be incomplete if ndata smaller than dataSize), or NULL if no frame is
found
*/
char *findNextFrame(char *data, int &ndata, int dsize) override {
if (dsize < dataSize)
ndata = dsize;
else
ndata = dataSize;
return data;
}
// int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

View File

@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
#ifndef FF
if (argc < 9) {
cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile outfile runmin runmax ns [cmin cmax xmin xmax ymin ymax]" << endl;
<< " infile etafile outfile runmin runmax ns cmin cmax" << endl;
return 1;
}
#endif
@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
#ifdef FF
if (argc < 7) {
cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile runmin runmax [cmin cmax xmin xmax ymin ymax]" << endl;
<< " infile etafile runmin runmax cmin cmax" << endl;
return 1;
}
#endif
@ -65,30 +65,13 @@ int main(int argc, char *argv[]) {
nsubpix = atoi(argv[iarg++]);
cout << "Subpix: " << nsubpix << endl;
#endif
float cmin = 0;
float cmax=1000000;
if (argc>iarg)
cmin=atof(argv[iarg++]);
if (argc>iarg)
cmax= atof(argv[iarg++]);
float cmin = atof(argv[iarg++]);
float cmax = atof(argv[iarg++]);
cout << "Energy min: " << cmin << endl;
cout << "Energy max: " << cmax << endl;
int xmin=0, xmax=NC, ymin=0, ymax=NR;
if (argc>iarg)
xmin=atof(argv[iarg++]);
if (argc>iarg)
xmax= atof(argv[iarg++]);
if (argc>iarg)
ymin=atof(argv[iarg++]);
if (argc>iarg)
ymax= atof(argv[iarg++]);
// int etabins=500;
int etabins = 1000; // nsubpix*2*100;
double etamin = -0.25, etamax = 1.25;
double etamin = -1, etamax = 2;
// double etamin=-0.1, etamax=1.1;
// double eta3min = -2, eta3max = 2;
double sum, totquad;
@ -97,7 +80,7 @@ int main(int argc, char *argv[]) {
// double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y;
int ix, iy, isx, isy;
int nframes = 0, lastframe = -1, iframe, nphFrame;
int nframes = 0, lastframe = -1;
//double d_x, d_y, res = 5, xx, yy;
int nph = 0, totph = 0;
//badph = 0,
@ -115,7 +98,7 @@ int main(int argc, char *argv[]) {
// int nSubPixels = nsubpix;
#ifndef NOINTERPOLATION
eta2InterpolationPosXY *interp =
new eta2InterpolationPosXY(NC, NR, nsubpix, nsubpix, etabins, etabins, etamin, etamax);
new eta2InterpolationPosXY(NC, NR, nsubpix, nsubpix,etabins,etabins, etamin, etamax);
// eta2InterpolationCleverAdaptiveBins *interp=new
// eta2InterpolationCleverAdaptiveBins(NC, NR, nsubpix, etabins, etamin,
// etamax);
@ -124,8 +107,8 @@ int main(int argc, char *argv[]) {
noInterpolation *interp = new noInterpolation(NC, NR, nsubpix);
#endif
int quad;
#ifndef FF
int quad;
#ifndef NOINTERPOLATION
char fname[10000];
int ok;
@ -159,26 +142,19 @@ int main(int argc, char *argv[]) {
#endif
int irun;
for (irun = runmin; irun <= runmax; irun++) {
for (irun = runmin; irun < runmax; irun++) {
sprintf(infname, argv[1], irun);
#ifndef FF
sprintf(outfname, argv[3], irun);
#endif
f = fopen(infname, "r");
if (f) {
cout << infname << endl;
nframes = 0;
//f0 = -1;
//iff=0;
while (fread((void*)&iframe, 1, sizeof(int), f)) {
//n=0;
if (fread((void*)&nphFrame, 1, sizeof(int), f)) {
for (int iph=0; iph<nphFrame; iph++) {
//while (cl.read(f)) {
if (cl.read(f)) {
while (cl.read(f)) {
totph++;
if (lastframe != cl.iframe) {
lastframe = cl.iframe;
@ -189,28 +165,18 @@ int main(int argc, char *argv[]) {
nframes++;
}
// quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
// #ifndef FF
// quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
// totquad, sDum);
// #endif
// #ifdef FF
#ifndef FF
quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum);
/* cl.print();
cout << "(" << etax <<","<< etay <<")"<< quad<< endl;
*/
//#endif
#endif
#ifdef FF
interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum);
#endif
if (totquad > cmin && cl.x >= xmin && cl.x <= xmax &&
cl.y >= ymin && cl.y <= ymax &&
totquad < cmax) {
// if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
// sum < cmax) {
nph++;
if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
sum < cmax) {
nph++;
// if (sum>200 && sum<580) {
// interp->getInterpolatedPosition(cl.x,cl.y,
// totquad,quad,cl.get_cluster(),int_x, int_y);
@ -261,12 +227,9 @@ int main(int argc, char *argv[]) {
#ifdef FF
interp->writeFlatField(outfname);
#endif
}
}
}
}
}
}
}
fclose(f);
#ifdef FF

View File

@ -13,7 +13,7 @@
#ifndef MOENCH04
#ifndef RECT
#include "moench03v2Data.h"
#include "moench03T1ReceiverDataNew.h"
#endif
#endif
@ -41,147 +41,34 @@ using namespace std;
int main(int argc, char *argv[]) {
std::map<std::string, std::string> args = {
{"numfiles","1"},
{"nthreads","5"},
{"fifosize","5000"},
{"nsigma","5"},
{"gainfile","none"},
{"detectorMode","counting"},
{"threshold","0"},
{"pedestalfile","none"},
{"nframes","0"},
{"xMin","0"},
{"xMax","400"},
{"yMin","0"},
{"yMax","400"},
{"eMin","0"},
{"eMax","16000"},
{"outdir","./"},
{"indir","./"},
{"flist","none"},
{"fformat","none"},
{"runmin","0"},
{"runmax","-1"},
{"readnrows","400"}
};
//float *gm;
int ff, np;
// cout << " data size is " << dsize;
ifstream filebin;
if (argc < 4) {
std::string name, value,sline;
int ic=0;
ifstream flist;
flist.open (argv[1], std::ifstream::in);
if (flist.is_open()) {
cout << "Using config file " <<argv[1] << endl;
while (std::getline(flist,sline)){
if (sline.at(0)!='#') {
ic=sline.find(' ');
name = sline.substr(0,ic);
value = sline.substr(ic+1,sline.size()-ic);
args[name]=value;
}
}
flist.close();
} else {
if (argc < 4) {
cout << "Usage is " << argv[0]
<< "indir outdir fname(no extension) [runmin] [runmax] [pedfile (raw or tiff)] [threshold] "
"[nframes] [xmin xmax ymin ymax] [gainmap]"
"[nframes] [xmin xmax ymin ymax] [gainmap]"
<< endl;
cout << "threshold <0 means analog; threshold=0 means cluster finder; "
"threshold>0 means photon counting"
"threshold>0 means photon counting"
<< endl;
cout << "nframes <0 means sum everything; nframes=0 means one file per "
"run; nframes>0 means one file every nframes"
"run; nframes>0 means one file every nframes"
<< endl;
return EXIT_FAILURE;
}
} else {
args["indir"]=argv[1];
args["outdir"]=argv[1];
args["fformat"]=argv[3];
if (argc >= 5) {
args["runmin"] = argv[4];
}
args["runmax"] = args["runmin"];
if (argc >= 6) {
args["runmax"] = argv[5];
}
if (argc >= 7) {
args["pedestalfile"] = argv[6];
}
if (argc >= 8) {
args["threshold"] = argv[7];
}
if (argc >= 9) {
args["nframes"] = argv[8];
}
if (argc >= 13) {
args["xMin"] = argv[9];
args["xMax"] = argv[10];
args["yMin"] = argv[11];
args["yMax"] = argv[12];
}
if (argc > 13) {
args["gainfile"] = argv[13];
}
if (atof(args["threshold"].c_str())<0) {
args["detectorMode"]="analog";
}
return 1;
}
for (auto const& x : args)
{
std::cout << x.first // string (key)
<< ':'
<< x.second // string's value
<< std::endl;
}
string indir=args["indir"];
string outdir = args["outdir"];
string fformat= args["fformat"];
int runmin = atoi(args["runmin"].c_str());
int runmax = atoi(args["runmin"].c_str());
string pedfile =args["pedestalfile"];
double thr = atof(args["threshold"].c_str());
double thr1 = 1;
int nframes = atoi(args["nframes"].c_str());
int xmin = atoi(args["xMin"].c_str()), xmax = atoi(args["xMax"].c_str()), ymin = atoi(args["yMin"].c_str()), ymax = atoi(args["yMax"].c_str());
string gainfname=args["gainfile"];
int fifosize = atoi(args["fifosize"].c_str());
int nthreads = atoi(args["nthreads"].c_str());
int nsigma = atoi(args["nsigma"].c_str());
int nrows = atoi(args["readnrows"].c_str());
float eMin = atof(args["eMin"].c_str());
float eMax = atof(args["eMax"].c_str());
int fifosize = 1000;
int nthreads = 10;
int csize = 3;
int nped = 1000;
int cf = 0;
int numberOfPackets=nrows/8;
int nsigma = 5;
int nped = 10000;
int cf = 0;
int numberOfPackets=40;
#ifdef RECT
cout << "Should be rectangular but now it will crash! No data structure defined!" << endl;
#endif
#ifndef MOENCH04
moench03v2Data *decoder = new moench03v2Data(100);
moench03T1ReceiverDataNew *decoder = new moench03T1ReceiverDataNew();
cout << "MOENCH03!" << endl;
#endif
@ -190,7 +77,7 @@ int main(int argc, char *argv[]) {
moench04CtbZmq10GbData *decoder = new moench04CtbZmq10GbData(5000,0);
cout << "MOENCH04!" << endl;
#endif
#ifdef MOENCH04_DGS
moench04CtbZmq10GbData *decoder = new moench04CtbZmq10GbData(5000,5000);
cout << "MOENCH04 DGS!" << endl;
@ -199,11 +86,63 @@ int main(int argc, char *argv[]) {
#endif
//Read detector size from decoder
int nx , ny;
decoder->getDetectorSize(nx, ny);
//Read detector size from decoder
//float *gm;
int ff, np;
// cout << " data size is " << dsize;
ifstream filebin;
char *indir = argv[1];
char *outdir = argv[2];
char *fformat = argv[3];
int runmin = 0;
// cout << "argc is " << argc << endl;
if (argc >= 5) {
runmin = atoi(argv[4]);
}
int runmax = runmin;
if (argc >= 6) {
runmax = atoi(argv[5]);
}
char *pedfile = NULL;
if (argc >= 7) {
pedfile = argv[6];
}
double thr = 0;
double thr1 = 1;
if (argc >= 8) {
thr = atof(argv[7]);
}
int nframes = 0;
if (argc >= 9) {
nframes = atoi(argv[8]);
}
int xmin = 0, xmax = nx, ymin = 0, ymax = ny;
if (argc >= 13) {
xmin = atoi(argv[9]);
xmax = atoi(argv[10]);
ymin = atoi(argv[11]);
ymax = atoi(argv[12]);
}
char *gainfname = NULL;
if (argc > 13) {
gainfname = argv[13];
cout << "Gain map file name is: " << gainfname << endl;
}
char ffname[10000];
char fname[10000];
char imgfname[10000];
@ -212,6 +151,17 @@ int main(int argc, char *argv[]) {
std::time_t end_time;
FILE *of = NULL;
cout << "input directory is " << indir << endl;
cout << "output directory is " << outdir << endl;
cout << "input file is " << fformat << endl;
cout << "runmin is " << runmin << endl;
cout << "runmax is " << runmax << endl;
if (pedfile)
cout << "pedestal file is " << pedfile << endl;
if (thr > 0)
cout << "threshold is " << thr << endl;
cout << "Nframes is " << nframes << endl;
uint32_t nnx, nny;
@ -232,62 +182,50 @@ int main(int argc, char *argv[]) {
singlePhotonDetector *filter = new singlePhotonDetector(
decoder, csize, nsigma, 1, cm, nped, 200, -1, -1, gainmap, gs);
//if (gainfname) {
if (gainfname) {
if (filter->readGainMap(gainfname.c_str()))
if (filter->readGainMap(gainfname))
cout << "using gain map " << gainfname << endl;
else
cout << "Could not open gain map " << gainfname << endl;
// } else
thr = 0.15 * thr;
} else
thr = 0.15 * thr;
filter->newDataSet();
//int dsize = decoder->getDataSize();
if (thr > 0) {
cout << "threshold is " << thr << endl;
filter->setThreshold(thr);
cf = 0;
cout << "threshold is " << thr << endl;
filter->setThreshold(thr);
cf = 0;
} else
cf = 1;
cf = 1;
filter->setROI(xmin, xmax, ymin, ymax);
filter->setEnergyRange(eMin, eMax);
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
char *buff;
// multiThreadedAnalogDetector *mt=new
// multiThreadedAnalogDetector(filter,nthreads,fifosize);
multiThreadedCountingDetector *mt =
new multiThreadedCountingDetector(filter, nthreads, fifosize);
if (args["detectorMode"]=="counting") {
mt->setDetectorMode(ePhotonCounting);
if (thr > 0) {
#ifndef ANALOG
mt->setDetectorMode(ePhotonCounting);
cout << "Counting!" << endl;
if (thr > 0) {
cf = 0;
}
} else {
mt->setDetectorMode(eAnalog);
cf = 0;
}
// #ifndef ANALOG
// mt->setDetectorMode(ePhotonCounting);
// cout << "Counting!" << endl;
// if (thr > 0) {
// cf = 0;
// }
// #endif
// //{
// #ifdef ANALOG
// mt->setDetectorMode(eAnalog);
// cout << "Analog!" << endl;
// cf = 0;
// // thr1=thr;
// #endif
// // }
#endif
//{
#ifdef ANALOG
mt->setDetectorMode(eAnalog);
cout << "Analog!" << endl;
cf = 0;
// thr1=thr;
#endif
// }
mt->StartThreads();
mt->popFree(buff);
@ -298,117 +236,84 @@ int main(int argc, char *argv[]) {
char froot[1000];
double *ped=new double[nx * ny];//, *ped1;
int pos,pos1;
//return 0;
if (pedfile.find(".raw") != std::string::npos) {
pos1=pedfile.rfind("/");
strcpy(froot,pedfile.substr(pos1).c_str());
pos=string(froot).find(".raw");
froot[pos]='\0';
}
cout << "PEDESTAL " << endl;
if (pedfile.find(".tif") == std::string::npos) {
sprintf(fname, "%s", pedfile.c_str());
if (pedfile) {
if (string(pedfile).find(".raw") != std::string::npos) {
pos1=string(pedfile).rfind("/");
strcpy(froot,pedfile+pos1);
pos=string(froot).find(".raw");
froot[pos]='\0';
}
cout << "PEDESTAL " << endl;
if (string(pedfile).find(".tif") == std::string::npos) {
sprintf(fname, "%s", pedfile);
cout << fname << endl;
std::time(&end_time);
//cout << "aaa" << std::ctime(&end_time) << endl;
mt->setFrameMode(ePedestal);
// sprintf(fn,fformat,irun);
filebin.open((const char *)(fname), ios::in | ios::binary);
// //open file
if (filebin.is_open()) {
ff = -1;
ff = -1;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) {
mt->pushData(buff);
if (np == numberOfPackets) {
mt->pushData(buff);
mt->nextThread();
mt->popFree(buff);
ifr++;
if (ifr % 100 == 0)
cout << ifr << " " << ff << " " << np << endl;
// break;
} else {
cout << ifr << " " << ff << " " << np << endl;
break;
}
if (ifr % 100 == 0)
cout << ifr << " " << ff << " " << np << endl;
} else
cout << ifr << " " << ff << " " << np << endl;
ff = -1;
}
filebin.close();
while (mt->isBusy()) {
;
;
}
sprintf(imgfname, "%s/%s_ped.tiff", outdir.c_str(),froot);
sprintf(imgfname, "%s/%s_ped.tiff", outdir,froot);
mt->writePedestal(imgfname);
sprintf(imgfname, "%s/%s_var.tiff", outdir.c_str(),froot);
sprintf(imgfname, "%s/%s_var.tiff", outdir,froot);
mt->writePedestalRMS(imgfname);
} else
cout << "Could not open pedestal file " << fname
<< " for reading " << endl;
} else {
float *pp = ReadFromTiff(pedfile.c_str(), nny, nnx);
if (pp && (int)nnx == nx && (int)nny == ny) {
for (int i = 0; i < nx * ny; i++) {
ped[i] = pp[i];
}
delete[] pp;
mt->setPedestal(ped);
cout << "Pedestal set from tiff file " << pedfile << endl;
} else {
cout << "Could not open pedestal tiff file " << pedfile
cout << "Could not open pedestal file " << fname
<< " for reading " << endl;
}
} else {
float *pp = ReadFromTiff(pedfile, nny, nnx);
if (pp && (int)nnx == nx && (int)nny == ny) {
for (int i = 0; i < nx * ny; i++) {
ped[i] = pp[i];
}
delete[] pp;
mt->setPedestal(ped);
cout << "Pedestal set from tiff file " << pedfile << endl;
} else {
cout << "Could not open pedestal tiff file " << pedfile
<< " for reading " << endl;
}
}
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
}
std::time(&end_time);
cout << std::ctime(&end_time) << endl;
ifr = 0;
int ifile = 0;
mt->setFrameMode(eFrame);
//t filelist=0;
ifstream flist;
flist.open (args["flist"].c_str(), std::ifstream::in);
if (flist.is_open()) {
cout << "Using file list" << endl;
runmin=0;
runmax=0;
while (flist.getline(ffname,10000)){
cout << ffname << endl;
runmax++;
}
runmax--;
flist.close();
cout << "Found " << runmax << " files " << endl;
flist.open (fformat, std::ifstream::in);
}
for (int irun = runmin; irun <= runmax; irun++) {
cout << "DATA ";
// sprintf(fn,fformat,irun);
// sprintf(ffname, "%s/%s.raw", indir, fformat);
// sprintf(fname, (const char*)ffname, irun);
// sprintf(ffname, "%s/%s.tiff", outdir, fformat);
// sprintf(imgfname, (const char*)ffname, irun);
// sprintf(ffname, "%s/%s.clust", outdir, fformat);
// sprintf(cfname, (const char*)ffname, irun);
if (flist.is_open()) {
flist.getline(ffname,10000);
cout << "file list " << ffname << endl;
} else {
//sprintf(ffname,(const char*)fformat,irun);
sprintf(ffname,args["fformat"].c_str(),irun);
cout << "loop " << ffname << endl;
}
cout << "ffname "<< ffname << endl;
sprintf(fname, "%s/%s.raw",indir.c_str(),ffname);
sprintf(imgfname, "%s/%s.tiff",outdir.c_str(),ffname);
sprintf(cfname, "%s/%s.clust",outdir.c_str(),ffname);
sprintf(ffname, "%s/%s.raw", indir, fformat);
sprintf(fname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
sprintf(imgfname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s.clust", outdir, fformat);
sprintf(cfname, (const char*)ffname, irun);
cout << fname << " ";
cout << imgfname << endl;
std::time(&end_time);
@ -418,7 +323,7 @@ int main(int argc, char *argv[]) {
// //open file
ifile = 0;
if (filebin.is_open()) {
if (cf != 0) { // cluster finder
if (thr <= 0 && cf != 0) { // cluster finder
if (of == NULL) {
of = fopen(cfname, "w");
if (of) {
@ -436,7 +341,7 @@ int main(int argc, char *argv[]) {
ff = -1;
ifr = 0;
while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) {
if (np == numberOfPackets) {
// //push
mt->pushData(buff);
// // //pop
@ -445,26 +350,21 @@ int main(int argc, char *argv[]) {
ifr++;
if (ifr % 100 == 0)
cout << ifr << " " << ff << " " << np << endl;
//break;
cout << ifr << " " << ff << endl;
if (nframes > 0) {
if (ifr % nframes == 0) {
// sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
// ifile);
// sprintf(imgfname, (const char*)ffname, irun);
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir.c_str(),ffname,ifile);
while (mt->isBusy())
;
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
ifile);
sprintf(imgfname, (const char*)ffname, irun);
mt->writeImage(imgfname, thr1);
mt->clearImage();
ifile++;
}
}
} else {
cout << "bp " << ifr << " " << ff << " " << np << endl;
//break;
}
} else {
cout << "bp " << ifr << " " << ff << " " << np << endl;
//break;
}
ff = -1;
}
cout << "--" << endl;
@ -474,17 +374,13 @@ int main(int argc, char *argv[]) {
}
if (nframes >= 0) {
if (nframes > 0) {
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir.c_str(),ffname,ifile);
// sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile);
//sprintf(imgfname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile);
sprintf(imgfname, (const char*)ffname, irun);
} else {
sprintf(imgfname, "%s/%s.tiff",outdir.c_str(),ffname);
// sprintf(ffname, "%s/%s.tiff", outdir, fformat);
// sprintf(imgfname, (const char*)ffname, irun);
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
sprintf(imgfname, (const char*)ffname, irun);
}
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
while (mt->isBusy())
;
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
mt->clearImage();
if (of) {
@ -499,16 +395,11 @@ int main(int argc, char *argv[]) {
cout << "Could not open " << fname << " for reading " << endl;
}
if (nframes < 0) {
//sprintf(ffname, "%s/%s.tiff", outdir, fformat);
// strcpy(imgfname, ffname);
sprintf(imgfname, "%s/%s_tot.tiff",outdir.c_str(),ffname);
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1);
}
if (flist.is_open()) {
flist.close();
sprintf(ffname, "%s/%s.tiff", outdir, fformat);
strcpy(imgfname, ffname);
cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
mt->writeImage(imgfname, thr1);
}
return 0;
}

View File

@ -13,8 +13,7 @@
#include "sls/sls_detector_defs.h"
#ifndef MOENCH04
//#ifndef RECT
#include "moench03v2Data.h"
//#include "moench03T1ZmqDataNew.h"
#include "moench03T1ZmqDataNew.h"
//#endif
//#ifdef RECT
//#include "moench03T1ZmqDataNewRect.h"
@ -32,7 +31,6 @@
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <rapidjson/document.h> //json header in zmq stream
@ -65,48 +63,36 @@ int main(int argc, char *argv[]) {
* trial.o [socket ip] [starting port number] [send_socket ip] [send port
* number]
*
*/
std::map<std::string, std::string> args = {
{"numinterfaces","1"},
{"rx_zmqip","10.1.2.102"},
{"rx_zmqport","7770"},
{"zmqip","129.129.202.153"},
{"zmqport","7780"},
{"nthreads","5"},
{"fifosize","5000"},
{"nsigma","5"},
{"gainfile","none"},
{"nbinsx","5"},
{"nbinsy","5"},
{"etafile","none"},
{"etabinsx","1000"},
{"etamin","-1"},
{"etamax","2"} };
FILE *of = NULL;
*/
FILE *of = NULL;
int fifosize = 5000;
int etabins = 1000, etabinsy = 1000; // nsubpix*2*100;
double etamin = -1, etamax = 2;
int nSubPixelsX = 2;
int emin, emax;
int nSubPixelsY = 2;
int nthreads = 5;
int fifosize = 5000;
uint32_t nSigma = 5;
string etafname;// = NULL;
string gainfname;// = NULL;
// help
if (argc < 3) {
cprintf(RED, "Help: ./trial [receive socket ip] [receive starting port "
"number] [send_socket ip] [send starting port number] "
"[nthreads] [nsubpix] [gainmap] [etafile]\n");
return EXIT_FAILURE;
}
// receive parameters
bool send = false;
char *socketip = argv[1];
uint32_t portnum = atoi(argv[2]);
// send parameters if any
string socketip2;// = 0;
uint32_t portnum2 = 0;
string socketip;// = 0;
uint32_t portnum = 0;
char *socketip2 = 0;
uint32_t portnum2 = 0;
sls::zmqHeader zHeader, outHeader;
zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
outHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
uint32_t nSigma = 5;
int ok;
@ -116,85 +102,48 @@ int main(int argc, char *argv[]) {
// time_t begin,end,finished;
int rms = 0;
send = true;
// help
if (argc < 5) {
std::string name, value,sline;
int ic=0;
ifstream flist;
flist.open (argv[1], std::ifstream::in);
if (flist.is_open()) {
cout << "Using config file " <<argv[1] << endl;
while (std::getline(flist,sline)){
if (sline.at(0)!='#') {
ic=sline.find(' ');
name = sline.substr(0,ic);
value = sline.substr(ic+1,sline.size()-ic);
args[name]=value;
}
if (argc > 4) {
socketip2 = argv[3];
portnum2 = atoi(argv[4]);
if (portnum2 > 0)
send = true;
}
cout << "\nrx socket ip : " << socketip << "\nrx port num : " << portnum;
if (send) {
cout << "\ntx socket ip : " << socketip2
<< "\ntx port num : " << portnum2;
}
int nthreads = 5;
if (argc > 5)
nthreads = atoi(argv[5]);
}
flist.close();
} else {
cprintf(RED, "Arguments are either: \n [config file] \n or the following list (deprecated): [receive socket ip] [receive starting port "
"number] [send_socket ip] [send starting port number] "
"[nthreads] [nsubpix] [gainmap] [etafile]\n");
return EXIT_FAILURE;
}
} else {
args["rx_zmqip"]=argv[1];
args["rx_zmqport"]=argv[2];
args["zmqip"]=argv[3];
args["zmqport"]=argv[4];
if (argc > 5)
args["nthreads"] = argv[5];
if (argc > 6) {
args["nbinsx"]=argv[6];
args["nbinsy"]=argv[6];
}
if (argc > 7) {
args["gainfile"]=argv[7];
}
if (argc > 8) {
args["etafilefile"]=argv[8];
}
cout << "Number of threads is: " << nthreads << endl;
if (argc > 6) {
nSubPixelsX = atoi(argv[6]);
nSubPixelsY = nSubPixelsX;
#ifdef RECT
nSubPixelsX = 2;
#endif
}
cout << "Number of subpixels is: " << nSubPixelsX << " " << nSubPixelsY
<< endl;
char *gainfname = NULL;
if (argc > 7) {
gainfname = argv[7];
cout << "Gain map file name is: " << gainfname << endl;
}
for (auto const& x : args)
{
std::cout << x.first // string (key)
<< ':'
<< x.second // string's value
<< std::endl;
}
socketip = args["rx_zmqip"];
portnum = atoi(args["rx_zmqport"].c_str());
socketip2 = args["zmqip"];
portnum2 = atoi(args["zmqport"].c_str());
nthreads = atoi(args["nthreads"].c_str());
nSubPixelsX =atoi(args["nbinsx"].c_str());
nSubPixelsY =atoi(args["nbinsy"].c_str());
gainfname = args["gainfile"];
etafname = args["etafilefile"];
if (atoi(args["numinterfaces"].c_str())>1){
cprintf(RED, "Sorry, at the moment only a single interface is supported instead of %d\n",atoi(args["numinterfaces"].c_str()));
return EXIT_FAILURE;
char *etafname = NULL;
if (argc > 8) {
etafname = argv[8];
cout << "Eta file name is: " << etafname << endl;
}
// slsDetectorData *det=new moench03T1ZmqDataNew();
#ifndef MOENCH04
cout << "This is a Moench03 v2" << endl;
//moench03T1ZmqDataNew *det = new moench03T1ZmqDataNew();
moench03v2Data *det = new moench03v2Data();
cout << "MOENCH03!" << endl;
cout << "This is a Moench03" << endl;
moench03T1ZmqDataNew *det = new moench03T1ZmqDataNew();
#endif
#ifdef MOENCH04
cout << "This is a Moench04" << endl;
@ -228,8 +177,8 @@ int main(int argc, char *argv[]) {
double *gmap = NULL;
uint32_t nnnx, nnny;
//if (gainfname) {
gm = ReadFromTiff(gainfname.c_str(), nnny, nnnx);
if (gainfname) {
gm = ReadFromTiff(gainfname, nnny, nnnx);
if (gm && nnnx == (uint)npx && nnny == (uint)npy) {
gmap = new double[npx * npy];
for (int i = 0; i < npx * npy; i++) {
@ -238,7 +187,7 @@ int main(int argc, char *argv[]) {
delete[] gm;
} else
cout << "Could not open gain map " << gainfname << endl;
//}
}
// analogDetector<uint16_t> *filter=new
// analogDetector<uint16_t>(det,1,NULL,1000);
@ -256,8 +205,8 @@ int main(int argc, char *argv[]) {
eta2InterpolationPosXY *interp = new eta2InterpolationPosXY(
npx, npy, nSubPixelsX, nSubPixelsY, etabins, etabinsy, etamin, etamax);
//if (etafname)
interp->readFlatField(etafname.c_str());
if (etafname)
interp->readFlatField(etafname);
interpolatingDetector *filter = new interpolatingDetector(
det, interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
@ -272,44 +221,84 @@ int main(int argc, char *argv[]) {
sls::ZmqSocket *zmqsocket = NULL;
#ifdef NEWZMQ
// receive socket
try {
zmqsocket = new sls::ZmqSocket(socketip.c_str(), portnum);
#endif
zmqsocket = new sls::ZmqSocket(socketip, portnum);
#ifdef NEWZMQ
} catch (...) {
cprintf(RED,
"Error: Could not create Zmq receiving socket on port %d with ip %s\n",
portnum, socketip.c_str());
"Error: Could not create Zmq socket on port %d with ip %s\n",
portnum, socketip);
delete zmqsocket;
return EXIT_FAILURE;
}
#endif
#ifndef NEWZMQ
if (zmqsocket->IsError()) {
cprintf(RED,
"Error: Could not create Zmq socket on port %d with ip %s\n",
portnum, socketip);
delete zmqsocket;
return EXIT_FAILURE;
}
#endif
if (zmqsocket->Connect()) {
cprintf(RED, "Error: Could not connect to zmq receiving socket %s\n",
cprintf(RED, "Error: Could not connect to socket %s\n",
(zmqsocket->GetZmqServerAddress()).c_str());
delete zmqsocket;
return EXIT_FAILURE;
} else
printf("Zmq receiving at %s\n", zmqsocket->GetZmqServerAddress().c_str());
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str());
// send socket
sls::ZmqSocket *zmqsocket2 = 0;
// cout << "zmq2 " << endl;
if (send) {
#ifdef NEWZMQ
// receive socket
try {
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str());
#endif
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2);
#ifdef NEWZMQ
} catch (...) {
cprintf(RED,
"Error: Could not create Zmq sending socket on port %d and "
"Error: Could not create Zmq socket server on port %d and "
"ip %s\n",
portnum2, socketip2.c_str());
portnum2, socketip2);
// delete zmqsocket2;
// zmqsocket2=NULL;
// delete zmqsocket;
// return EXIT_FAILURE;
send = false;
}
printf("Zmq sending socket at %s\n",
#endif
#ifndef NEWZMQ
if (zmqsocket2->IsError()) {
cprintf(RED,
"AAA Error: Could not create Zmq socket server on port %d "
"and ip %s\n",
portnum2, socketip2);
// delete zmqsocket2;
// delete zmqsocket;
// return EXIT_FAILURE;
send = false;
}
#endif
if (zmqsocket2->Connect()) {
cprintf(RED, "BBB Error: Could not connect to socket %s\n",
zmqsocket2->GetZmqServerAddress().c_str());
// delete zmqsocket2;
send = false;
// return EXIT_FAILURE;
} else
printf("Zmq Client at %s\n",
zmqsocket2->GetZmqServerAddress().c_str());
}
@ -733,25 +722,6 @@ int main(int argc, char *argv[]) {
cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax);
mt->setROI(xmin, xmax, ymin, ymax);
if (addJsonHeader.find("xMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMin")) >> xmin;
}
if (addJsonHeader.find("yMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMin")) >> ymin;
}
if (addJsonHeader.find("xMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMax")) >> xmax;
}
if (addJsonHeader.find("yMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMax")) >> ymax;
}
if (addJsonHeader.find("dynamicRange") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("dynamicRange")) >> dr;
dr = 32;
@ -851,7 +821,7 @@ int main(int argc, char *argv[]) {
// cout << acqIndex << " " << frameIndex << " " << subFrameIndex << "
// "<< detSpec1 << " " << timestamp << " " << packetNumber << endl;
// cprintf(GREEN, "frame\n");
if (packetNumber <= 50) {
if (packetNumber >= 40) {
//*((int*)buff)=frameIndex;
if (insubframe == 0)
f0 = frameIndex;

View File

@ -193,7 +193,6 @@ void qDrawPlot::SetupPlots() {
gainplot2d = new SlsQt2DPlot(boxPlot, true);
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
nPixelsY - 0.5, gainData);
gainplot2d->Update();
gainplot2d->hide();
connect(plot2d, SIGNAL(PlotZoomedSignal(const QRectF &)), this,
SLOT(Zoom2DGainPlot(const QRectF &)));
@ -1010,7 +1009,6 @@ void qDrawPlot::Update2dPlot() {
if (isGainDataExtracted) {
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
nPixelsY - 0.5, gainData);
gainplot2d->Update();
if (!gainplot2d->isVisible()) {
gainplot2d->setFixedWidth(plot2d->width() /
qDefs::DATA_GAIN_PLOT_RATIO);

View File

@ -803,9 +803,8 @@ void qTabMeasurement::GetNextFrameNumber() {
"Inconsistent starting frame number for all detectors.");
spinNextFrameNumber->setValue(retval);
}
CATCH_HANDLE("Could not get starting frame number.",
"qTabMeasurement::GetNextFrameNumber", spinNextFrameNumber,
&QSpinBox::setValue, -1)
CATCH_DISPLAY("Could not get starting frame number.",
"qTabMeasurement::GetNextFrameNumber")
connect(spinNextFrameNumber, SIGNAL(valueChanged(int)), this,
SLOT(SetNextFrameNumber(int)));
}
@ -839,8 +838,8 @@ void qTabMeasurement::UpdateProgress() {
int qTabMeasurement::VerifyOutputDirectoryError() {
try {
auto retval = det->getFilePath();
for (int i = 0; i < static_cast<int>(retval.size()); ++i) {
det->setFilePath(retval[i], {i});
for (auto &it : retval) {
det->setFilePath(it);
}
return slsDetectorDefs::OK;
}

View File

@ -1789,8 +1789,8 @@ int configureMAC() {
uint32_t dstip = udpDetails[0].dstip;
uint64_t srcmac = udpDetails[0].srcmac;
uint64_t dstmac = udpDetails[0].dstmac;
uint16_t srcport = udpDetails[0].srcport;
uint16_t dstport = udpDetails[0].dstport;
int srcport = udpDetails[0].srcport;
int dstport = udpDetails[0].dstport;
LOG(logINFOBLUE, ("Configuring MAC\n"));
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
@ -1802,10 +1802,10 @@ int configureMAC() {
LOG(logINFO, ("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %hu\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %hu\n",
"\tDest Port : %d\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
// 1 giga udp

View File

@ -1808,9 +1808,9 @@ int configureMAC() {
uint32_t dstip = udpDetails[iRxEntry].dstip;
uint64_t srcmac = udpDetails[iRxEntry].srcmac;
uint64_t dstmac = udpDetails[iRxEntry].dstmac;
uint16_t srcport = udpDetails[iRxEntry].srcport;
uint16_t dstport = udpDetails[iRxEntry].dstport;
uint16_t dstport2 = udpDetails[iRxEntry].dstport2;
int srcport = udpDetails[iRxEntry].srcport;
int dstport = udpDetails[iRxEntry].dstport;
int dstport2 = udpDetails[iRxEntry].dstport2;
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
@ -1824,11 +1824,11 @@ int configureMAC() {
LOG(logINFO,
("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %hu\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %hu\n"
"\tDest Port2 : %hu\n",
"\tDest Port : %d\n"
"\tDest Port2 : %d\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport, dstport2));
}

View File

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

View File

@ -1902,8 +1902,8 @@ void setFirstUDPDestination(int value) {
}
void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
uint64_t destmac, uint16_t destport, uint64_t sourcemac,
uint32_t sourceip, uint16_t sourceport) {
uint64_t destmac, uint32_t destport, uint64_t sourcemac,
uint32_t sourceip, uint32_t sourceport) {
// start addr
uint32_t addr = BASE_UDP_RAM;
@ -1995,10 +1995,10 @@ int configureMAC() {
uint64_t srcmac2 = udpDetails[iRxEntry].srcmac2;
uint64_t dstmac = udpDetails[iRxEntry].dstmac;
uint64_t dstmac2 = udpDetails[iRxEntry].dstmac2;
uint16_t srcport = udpDetails[iRxEntry].srcport;
uint16_t srcport2 = udpDetails[iRxEntry].srcport2;
uint16_t dstport = udpDetails[iRxEntry].dstport;
uint16_t dstport2 = udpDetails[iRxEntry].dstport2;
int srcport = udpDetails[iRxEntry].srcport;
int srcport2 = udpDetails[iRxEntry].srcport2;
int dstport = udpDetails[iRxEntry].dstport;
int dstport2 = udpDetails[iRxEntry].dstport2;
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
@ -2020,10 +2020,10 @@ int configureMAC() {
LOG(logINFO, ("\tData Interface \n"));
LOG(logINFO, ("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %hu\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %hu\n\n",
"\tDest Port : %d\n\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
if (getVetoStream()) {
@ -2039,10 +2039,10 @@ int configureMAC() {
LOG(logINFO,
("\tSource IP2 : %s\n"
"\tSource MAC2 : %s\n"
"\tSource Port2: %hu\n"
"\tSource Port2: %d\n"
"\tDest IP2 : %s\n"
"\tDest MAC2 : %s\n"
"\tDest Port2 : %hu\n\n",
"\tDest Port2 : %d\n\n",
src_ip2, src_mac2, srcport2, dst_ip2, dst_mac2, dstport2));
}
#ifdef VIRTUAL
@ -3323,27 +3323,6 @@ void *start_timer(void *arg) {
break;
}
// change gain and data for every frame
{
const int nchannels = NCHIP * NCHAN;
int gainVal = 0;
for (int i = 0; i < nchannels; ++i) {
if ((i % nchannels) < 400) {
gainVal = 1 + frameNr;
} else if ((i % nchannels) < 800) {
gainVal = 2 + frameNr;
} else {
gainVal = 3 + frameNr;
}
int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t)));
dataVal += frameNr;
int channelVal =
(dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST);
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
(uint16_t)channelVal;
}
}
// sleep for exposure time
struct timespec begin, end;
clock_gettime(CLOCK_REALTIME, &begin);

View File

@ -1425,8 +1425,8 @@ int configureMAC() {
uint32_t dstip = udpDetails[0].dstip;
uint64_t srcmac = udpDetails[0].srcmac;
uint64_t dstmac = udpDetails[0].dstmac;
uint16_t srcport = udpDetails[0].srcport;
uint16_t dstport = udpDetails[0].dstport;
int srcport = udpDetails[0].srcport;
int dstport = udpDetails[0].dstport;
LOG(logINFOBLUE, ("Configuring MAC\n"));
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
@ -1438,10 +1438,10 @@ int configureMAC() {
LOG(logINFO, ("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %hu\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %hu\n",
"\tDest Port : %d\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
#ifdef VIRTUAL

View File

@ -24,18 +24,16 @@
#define RUN_BUSY_OFST (0)
#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_START_FRAME_OFST (2)
#define WAITING_FOR_START_FRAME_MSK (0x00000001 << WAITING_FOR_START_FRAME_OFST)
#define ACQUIRING_FRAME_OFST (3) // Not used in software
#define ACQUIRING_FRAME_MSK (0x00000001 << ACQUIRING_FRAME_OFST)
#define WAITING_FOR_PERIOD_TO_ELAPSE_OFST (4) // Not used in software
#define WAITING_FOR_PERIOD_TO_ELAPSE_MSK (0x00000001 << WAITING_FOR_PERIOD_TO_ELAPSE_OFST)
#define STOPPED_OFST (8)
#define DELAYBEFORE_OFST (4) // Not used in software
#define DELAYBEFORE_MSK (0x00000001 << DELAYBEFORE_OFST) // Not used in software
#define DELAYAFTER_OFST (5) // Not used in software
#define DELAYAFTER_MSK (0x00000001 << DELAYAFTER_OFST) // Not used in software
#define STOPPED_OFST (15)
#define STOPPED_MSK (0x00000001 << STOPPED_OFST)
#define INTERNAL_STOP_OFST (9)
#define INTERNAL_STOP_MSK (0x00000001 << INTERNAL_STOP_OFST)
#define RUNMACHINE_BUSY_OFST (17)
#define RUNMACHINE_BUSY_MSK (0x00000001 << RUNMACHINE_BUSY_OFST)
/* Look at me register */
#define LOOK_AT_ME_REG (0x03 << MEM_MAP_SHIFT) // Not used in firmware or software
@ -257,17 +255,6 @@
#define PLL_CNTRL_ADDR_OFST (16)
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
/* Pedestal Mode Regiser */
#define PEDESTAL_MODE_REG (0x57 << MEM_MAP_SHIFT)
#define PEDESTAL_MODE_ITRTNS_OFST (0)
#define PEDESTAL_MODE_ITRTNS_MSK (0x0000FFFF << PEDESTAL_MODE_ITRTNS_OFST)
#define PEDESTAL_MODE_LNGTH_OFST (16)
#define PEDESTAL_MODE_LNGTH_MSK (0x000000FF << PEDESTAL_MODE_LNGTH_OFST)
#define PEDESTAL_MODE_ENBLE_OFST (31)
#define PEDESTAL_MODE_ENBLE_MSK (0x00000001 << PEDESTAL_MODE_ENBLE_OFST)
/* Config Register for chip 1.1 */
#define CONFIG_V11_REG (0x58 << MEM_MAP_SHIFT)

View File

@ -55,9 +55,6 @@ int32_t clkPhase[NUM_CLOCKS] = {};
int detPos[4] = {};
int chipConfigured = 0;
uint64_t normal_mode_frames = -1;
uint64_t normal_mode_triggers = -1;
int isInitCheckDone() { return initCheckDone; }
int getInitResult(char **mess) {
@ -488,7 +485,6 @@ void setupDetector() {
AD9257_SetDefines(ADC_SPI_REG, ADC_SPI_SRL_CS_OTPT_MSK,
ADC_SPI_SRL_CLK_OTPT_MSK, ADC_SPI_SRL_DT_OTPT_MSK,
ADC_SPI_SRL_DT_OTPT_OFST);
AD9257_Set_Jungfrau_Hardware_Version_1_0(isHardwareVersion_1_0());
AD9257_Disable();
AD9257_Configure();
@ -559,13 +555,6 @@ void setupDetector() {
setFlipRows(DEFAULT_FLIP_ROWS);
setReadNRows(MAX_ROWS_PER_READOUT);
}
#ifdef VIRTUAL
// setting pedestalmode depends on previous values
bus_w(PEDESTAL_MODE_REG,
bus_r(PEDESTAL_MODE_REG) & ~PEDESTAL_MODE_ENBLE_MSK);
#endif
setPedestalMode(DEFAULT_PEDESTAL_MODE, DEFAULT_PEDESTAL_FRAMES,
DEFAULT_PEDESTAL_LOOPS);
}
int resetToDefaultDacs(int hardReset) {
@ -986,9 +975,6 @@ int getNextFrameNumber(uint64_t *retval) {
}
void setNumFrames(int64_t val) {
if (getPedestalMode()) {
return;
}
if (val > 0) {
LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
@ -1000,9 +986,6 @@ int64_t getNumFrames() {
}
void setNumTriggers(int64_t val) {
if (getPedestalMode()) {
return;
}
if (val > 0) {
LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
@ -1456,9 +1439,6 @@ void setSynchronization(int enable) {
}
void setTiming(enum timingMode arg) {
if (getPedestalMode()) {
return;
}
switch (arg) {
case AUTO_TIMING:
LOG(logINFO, ("Set Timing: Auto\n"));
@ -1552,8 +1532,8 @@ int getPrimaryInterface() {
}
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
uint64_t destmac, uint16_t destport, uint64_t sourcemac,
uint32_t sourceip, uint16_t sourceport) {
uint64_t destmac, uint32_t destport, uint64_t sourcemac,
uint32_t sourceip, uint32_t sourceport) {
// start addr
uint32_t addr = (type == INNER ? RXR_ENDPOINT_INNER_START_REG
@ -1648,10 +1628,10 @@ int configureMAC() {
uint64_t srcmac2 = udpDetails[iRxEntry].srcmac2;
uint64_t dstmac = udpDetails[iRxEntry].dstmac;
uint64_t dstmac2 = udpDetails[iRxEntry].dstmac2;
uint16_t srcport = udpDetails[iRxEntry].srcport;
uint16_t srcport2 = udpDetails[iRxEntry].srcport2;
uint16_t dstport = udpDetails[iRxEntry].dstport;
uint16_t dstport2 = udpDetails[iRxEntry].dstport2;
int srcport = udpDetails[iRxEntry].srcport;
int srcport2 = udpDetails[iRxEntry].srcport2;
int dstport = udpDetails[iRxEntry].dstport;
int dstport2 = udpDetails[iRxEntry].dstport2;
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
@ -1675,10 +1655,10 @@ int configureMAC() {
: (selInterface ? "Not Used" : "Used")));
LOG(logINFO, ("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %hu\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %hu\n\n",
"\tDest Port : %d\n\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
LOG(logINFO,
@ -1688,10 +1668,10 @@ int configureMAC() {
LOG(logINFO,
("\tSource IP2 : %s\n"
"\tSource MAC2 : %s\n"
"\tSource Port2: %hu\n"
"\tSource Port2: %d\n"
"\tDest IP2 : %s\n"
"\tDest MAC2 : %s\n"
"\tDest Port2 : %hu\n\n",
"\tDest Port2 : %d\n\n",
src_ip2, src_mac2, srcport2, dst_ip2, dst_mac2, dstport2));
}
#ifdef VIRTUAL
@ -2533,82 +2513,6 @@ uint64_t getSelectCurrentSource() {
}
}
int getPedestalMode() {
return ((bus_r(PEDESTAL_MODE_REG) & PEDESTAL_MODE_ENBLE_MSK) >>
PEDESTAL_MODE_ENBLE_OFST);
}
void getPedestalParameters(uint8_t *frames, uint16_t *loops) {
uint32_t addr = PEDESTAL_MODE_REG;
*frames =
((bus_r(addr) & PEDESTAL_MODE_LNGTH_MSK) >> PEDESTAL_MODE_LNGTH_OFST);
*loops = ((bus_r(PEDESTAL_MODE_REG) & PEDESTAL_MODE_ITRTNS_MSK) >>
PEDESTAL_MODE_ITRTNS_OFST);
}
void setPedestalMode(int enable, uint8_t frames, uint16_t loops) {
int prevPedestalEnable = getPedestalMode();
uint32_t addr = PEDESTAL_MODE_REG;
if (enable) {
LOG(logINFOBLUE, ("Enabling pedestal mode [frames: %hhu, loops: %hu]\n",
frames, loops));
// frames
bus_w(addr, bus_r(addr) & ~PEDESTAL_MODE_LNGTH_MSK);
bus_w(addr, bus_r(addr) | ((frames << PEDESTAL_MODE_LNGTH_OFST) &
PEDESTAL_MODE_LNGTH_MSK));
// loops
bus_w(addr, bus_r(addr) & ~PEDESTAL_MODE_ITRTNS_MSK);
bus_w(addr, bus_r(addr) | ((loops << PEDESTAL_MODE_ITRTNS_OFST) &
PEDESTAL_MODE_ITRTNS_MSK));
// enable
bus_w(addr, bus_r(addr) | PEDESTAL_MODE_ENBLE_MSK);
// if it was switched off before, remember the #frames and #triggers
if (prevPedestalEnable == 0) {
normal_mode_frames = getNumFrames();
normal_mode_triggers = getNumTriggers();
LOG(logINFO, ("\tRemembering Normal mode #frames and "
"#triggers[%lld, %lld]\n",
normal_mode_frames, normal_mode_triggers));
}
// overwrite #frames and #triggers to new values
int64_t expFrames = -1;
int64_t expTriggers = -1;
enum timingMode timing = getTiming();
if (timing == AUTO_TIMING ||
(timing == TRIGGER_EXPOSURE && normal_mode_frames > 1)) {
expFrames = frames * loops * 2;
expTriggers = 1;
} else {
expFrames = 1;
expTriggers = frames * loops * 2;
}
LOG(logINFO, ("\tOverwriting [#frames: %lld, #triggers: %lld]\n",
expFrames, expTriggers));
set64BitReg(expFrames, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
set64BitReg(expTriggers, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
} else {
LOG(logINFOBLUE, ("Disabling pedestal mode\n"));
bus_w(addr, bus_r(addr) & ~PEDESTAL_MODE_ENBLE_MSK);
// if it was switched on before, reset the normal mode #frames and
// #triggers
if (prevPedestalEnable == 1) {
LOG(logINFO,
("\tResetting to Normal mode [#frames:%lld, #triggers:%lld\n",
normal_mode_frames, normal_mode_triggers));
set64BitReg(normal_mode_frames, SET_FRAMES_LSB_REG,
SET_FRAMES_MSB_REG);
set64BitReg(normal_mode_triggers, SET_CYCLES_LSB_REG,
SET_CYCLES_MSB_REG);
}
}
}
int getTenGigaFlowControl() {
return ((bus_r(CONFIG_REG) & CONFIG_ETHRNT_FLW_CNTRL_MSK) >>
CONFIG_ETHRNT_FLW_CNTRL_OFST);
@ -2728,7 +2632,6 @@ void *start_timer(void *arg) {
if (i % pixelsPerPacket == 0) {
++dataVal;
}
if ((i % 1024) < 300) {
gainVal = 1;
} else if ((i % 1024) < 600) {
@ -2769,28 +2672,6 @@ void *start_timer(void *arg) {
clock_gettime(CLOCK_REALTIME, &begin);
usleep(expUs);
// change gain and data for every frame
{
const int npixels = (NCHAN * NCHIP);
for (int i = 0; i < npixels; ++i) {
int gainVal = 0;
if ((i % 1024) < 300) {
gainVal = 1 + iframes;
} else if ((i % 1024) < 600) {
gainVal = 2 + iframes;
} else {
gainVal = 3 + iframes;
}
int dataVal =
*((uint16_t *)(imageData + i * sizeof(uint16_t)));
dataVal += iframes;
int pixelVal =
(dataVal & ~GAIN_VAL_MSK) | (gainVal << GAIN_VAL_OFST);
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
(uint16_t)pixelVal;
}
}
int srcOffset = 0;
int srcOffset2 = DATA_BYTES / 2;
int row0 = (numInterfaces == 1 ? detPos[1] : detPos[3]);
@ -2925,17 +2806,14 @@ int softwareTrigger(int block) {
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);
// wait to make sure its out of this state and even 'wait for start frame'
usleep(100);
#ifndef VIRTUAL
// block till frame sent out & back to wait for trigger (or not busy
// anymore)
// block till frame is sent out
if (block) {
uint32_t retval = bus_r(STATUS_REG);
while ((retval & RUN_BUSY_MSK) && !(retval & WAITING_FOR_TRIGGER_MSK)) {
enum runStatus s = getRunStatus();
while (s == RUNNING || s == TRANSMITTING) {
usleep(5000);
retval = bus_r(STATUS_REG);
s = getRunStatus();
}
}
LOG(logINFO, ("Ready for Next Trigger...\n"));
@ -2968,16 +2846,9 @@ enum runStatus getRunStatus() {
u_int32_t retval = bus_r(STATUS_REG);
LOG(logINFO, ("Status Register: %08x\n", retval));
// error
if (retval & INTERNAL_STOP_MSK) {
LOG(logINFOBLUE, ("Status: ERROR\n"));
s = ERROR;
}
// running
else if (retval & RUN_BUSY_MSK) {
if ((retval & WAITING_FOR_TRIGGER_MSK) ||
(retval & WAITING_FOR_START_FRAME_MSK)) {
if (retval & RUN_BUSY_MSK) {
if (retval & WAITING_FOR_TRIGGER_MSK) {
LOG(logINFOBLUE, ("Status: WAITING\n"));
s = WAITING;
} else {
@ -2988,13 +2859,19 @@ enum runStatus getRunStatus() {
// not running
else {
// stopped or idle
// stopped or error
if (retval & STOPPED_MSK) {
LOG(logINFOBLUE, ("Status: STOPPED\n"));
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"));
s = IDLE;
} else {
LOG(logERROR, ("Status: Unknown status %08x\n", retval));
s = ERROR;
}
}

View File

@ -5,8 +5,8 @@
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x230920 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x230921 // 2.0 pcb (version = 011)
#define REQRD_FRMWRE_VRSN_BOARD2 0x230516 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x230515 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \
@ -52,9 +52,6 @@
#define DEFAULT_FLIP_ROWS (0)
#define DEFAULT_FILTER_RESISTOR (1) // higher resistor
#define DEFAULT_FILTER_CELL (0)
#define DEFAULT_PEDESTAL_MODE (0)
#define DEFAULT_PEDESTAL_FRAMES (1)
#define DEFAULT_PEDESTAL_LOOPS (1)
#define HIGHVOLTAGE_MIN (60)
#define HIGHVOLTAGE_MAX (200)

View File

@ -481,6 +481,7 @@ void setupDetector() {
return;
}
setReadoutSpeed(DEFAULT_SPEED);
cleanFifos();
resetCore();
@ -494,7 +495,6 @@ void setupDetector() {
initReadoutConfiguration();
// Initialization of acquistion parameters
setReadoutSpeed(DEFAULT_SPEED);
setSettings(DEFAULT_SETTINGS);
setNumFrames(DEFAULT_NUM_FRAMES);
setNumTriggers(DEFAULT_NUM_CYCLES);
@ -699,12 +699,14 @@ int setExpTime(int64_t val) {
}
LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
val *= (1E-3 * CLK_RUN);
val -= ACQ_TIME_MIN_CLOCK;
if (val < 0) {
val = 0;
}
set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG);
// validate for tolerance
val += ACQ_TIME_MIN_CLOCK;
int64_t retval = getExpTime();
val /= (1E-3 * CLK_RUN);
if (val != retval) {
@ -714,7 +716,8 @@ int setExpTime(int64_t val) {
}
int64_t getExpTime() {
return get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) /
return (get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) +
ACQ_TIME_MIN_CLOCK) /
(1E-3 * CLK_RUN);
}
@ -1117,8 +1120,8 @@ int getPrimaryInterface() {
}
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
uint64_t destmac, uint16_t destport, uint64_t sourcemac,
uint32_t sourceip, uint16_t sourceport) {
uint64_t destmac, uint32_t destport, uint64_t sourcemac,
uint32_t sourceip, uint32_t sourceport) {
// start addr
uint32_t addr = (type == INNER ? RXR_ENDPOINT_INNER_START_REG
@ -1213,10 +1216,10 @@ int configureMAC() {
uint64_t srcmac2 = udpDetails[iRxEntry].srcmac2;
uint64_t dstmac = udpDetails[iRxEntry].dstmac;
uint64_t dstmac2 = udpDetails[iRxEntry].dstmac2;
uint16_t srcport = udpDetails[iRxEntry].srcport;
uint16_t srcport2 = udpDetails[iRxEntry].srcport2;
uint16_t dstport = udpDetails[iRxEntry].dstport;
uint16_t dstport2 = udpDetails[iRxEntry].dstport2;
int srcport = udpDetails[iRxEntry].srcport;
int srcport2 = udpDetails[iRxEntry].srcport2;
int dstport = udpDetails[iRxEntry].dstport;
int dstport2 = udpDetails[iRxEntry].dstport2;
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
@ -1240,10 +1243,10 @@ int configureMAC() {
: (selInterface ? "Not Used" : "Used")));
LOG(logINFO, ("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %hu\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %hu\n\n",
"\tDest Port : %d\n\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
LOG(logINFO,
@ -1253,10 +1256,10 @@ int configureMAC() {
LOG(logINFO,
("\tSource IP2 : %s\n"
"\tSource MAC2 : %s\n"
"\tSource Port2: %hu\n"
"\tSource Port2: %d\n"
"\tDest IP2 : %s\n"
"\tDest MAC2 : %s\n"
"\tDest Port2 : %hu\n\n",
"\tDest Port2 : %d\n\n",
src_ip2, src_mac2, srcport2, dst_ip2, dst_mac2, dstport2));
}
#ifdef VIRTUAL

View File

@ -5,7 +5,7 @@
#include "sls/sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN_BOARD2 0x444445 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x231026 // 2.0 pcb (version = 011)
#define REQRD_FRMWRE_VRSN 0x230710 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \
@ -58,10 +58,11 @@
/* Defines in the Firmware */
#define MAX_TIMESLOT_VAL (0x1F)
#define MAX_THRESHOLD_TEMP_VAL (127999) // millidegrees
#define ACQ_TIME_MIN_CLOCK (2)
#define ASIC_FILTER_MAX_RES_VALUE (1)
#define MAX_SELECT_CHIP10_VAL (63)
#define MAX_PHASE_SHIFTS (200)
#define MAX_PHASE_SHIFTS (240)
#define BIT16_MASK (0xFFFF)
#define ADC_DECMT_QUARTER_SPEED (0x3)
@ -70,7 +71,7 @@
#define ADC_PHASE_DEG_QUARTER_SPEED (0)
#define ADC_PHASE_DEG_HALF_SPEED (0)
#define ADC_PHASE_DEG_FULL_SPEED (150)
#define ADC_PHASE_DEG_FULL_SPEED (300)
#define ADC_OFST_QUARTER_SPEED (0x12)
#define ADC_OFST_HALF_SPEED (0x12)
@ -133,7 +134,7 @@ enum DACINDEX {
680, /* MO_VB_SDA */ \
1428, /* MO_VCASC_SFP */ \
1200, /* MO_VOUT_CM */ \
1280, /* MO_VIPRE_CDS */ \
800, /* MO_VIPRE_CDS */ \
900 /* MO_IBIAS_SFP */ \
};

View File

@ -479,11 +479,6 @@ void setupDetector() {
READOUT_PLL_VCO_FREQ_HZ, SYSTEM_PLL_VCO_FREQ_HZ);
ALTERA_PLL_C10_ResetPLL(READOUT_PLL);
ALTERA_PLL_C10_ResetPLL(SYSTEM_PLL);
// change startup clock divider in software
// because firmware only sets max clock divider
setClockDividerWithTimeUpdateOption(READOUT_C0, DEFAULT_READOUT_C0_STARTUP,
0);
// hv
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
// dac
@ -1968,8 +1963,8 @@ int configureMAC() {
uint32_t dstip = udpDetails[iRxEntry].dstip;
uint64_t srcmac = udpDetails[iRxEntry].srcmac;
uint64_t dstmac = udpDetails[iRxEntry].dstmac;
uint16_t srcport = udpDetails[iRxEntry].srcport;
uint16_t dstport = udpDetails[iRxEntry].dstport;
int srcport = udpDetails[iRxEntry].srcport;
int dstport = udpDetails[iRxEntry].dstport;
char src_mac[MAC_ADDRESS_SIZE], src_ip[INET_ADDRSTRLEN],
dst_mac[MAC_ADDRESS_SIZE], dst_ip[INET_ADDRSTRLEN];
@ -1981,10 +1976,10 @@ int configureMAC() {
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
LOG(logINFO, ("\tSource IP : %s\n"
"\tSource MAC : %s\n"
"\tSource Port : %hu\n"
"\tSource Port : %d\n"
"\tDest IP : %s\n"
"\tDest MAC : %s\n"
"\tDest Port : %hu\n",
"\tDest Port : %d\n",
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
}
#ifdef VIRTUAL
@ -2336,7 +2331,6 @@ int setClockDividerWithTimeUpdateOption(enum CLKINDEX ind, int val,
return FAIL;
}
if (val < 2 || val > getMaxClockDivider()) {
LOG(logERROR, ("Invalid clock divider %d\n", val));
return FAIL;
}
char *clock_names[] = {CLK_NAMES};

View File

@ -64,8 +64,6 @@
#define DEFAULT_SYSTEM_C2 (5) //(200000000) // smp_clk, 200 MHz const
#define DEFAULT_TRIMMING_RUN_CLKDIV (40) // (25000000) // 25 MHz
#define DEFAULT_READOUT_C0_STARTUP (20) //(50000000) // rdo_clk, 50 MHz
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
#define DEFAULT_ADIF_PIPELINE_VAL (8)

View File

@ -4,10 +4,6 @@
#include <inttypes.h>
#ifdef JUNGFRAUD
void AD9257_Set_Jungfrau_Hardware_Version_1_0(int val);
#endif
/**
* Set Defines
* @param reg spi register

View File

@ -42,10 +42,10 @@ single detector.
enum interfaceType { OUTER, INNER };
typedef struct udpStruct_s {
uint16_t srcport;
uint16_t srcport2;
uint16_t dstport;
uint16_t dstport2;
int srcport;
int srcport2;
int dstport;
int dstport2;
uint64_t srcmac;
uint64_t srcmac2;
uint64_t dstmac;
@ -467,8 +467,8 @@ void setFirstUDPDestination(int value);
void selectPrimaryInterface(int val);
int getPrimaryInterface();
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
uint64_t destmac, uint16_t destport, uint64_t sourcemac,
uint32_t sourceip, uint16_t sourceport);
uint64_t destmac, uint32_t destport, uint64_t sourcemac,
uint32_t sourceip, uint32_t sourceport);
#endif
#if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARD2D) || \
defined(MYTHEN3D) || defined(CHIPTESTBOARDD)
@ -516,7 +516,7 @@ void setDigitalIODelay(uint64_t pinMask, int delay);
// jungfrau/moench specific - powerchip, autocompdisable, clockdiv, asictimer,
// clock, pll, flashing firmware
#if defined(MOENCHD)
#if defined(MOENCHED)
void setADCPipeline(int val);
int getADCPipeline();
#endif
@ -556,9 +556,6 @@ int getCurrentSource();
int getFixCurrentSource();
int getNormalCurrentSource();
uint64_t getSelectCurrentSource();
int getPedestalMode();
void getPedestalParameters(uint8_t *frames, uint16_t *loops);
void setPedestalMode(int enable, uint8_t frames, uint16_t loops);
#endif
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter

View File

@ -327,5 +327,3 @@ int getRow();
int setRow(int);
int getColumn();
int setColumn(int);
int get_pedestal_mode(int);
int set_pedestal_mode(int);

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