Compare commits

..

38 Commits

Author SHA1 Message Date
f08006db46 more tests 2020-02-17 17:24:36 +01:00
d5df63ce49 test socket 2020-02-17 17:02:50 +01:00
64d59b1dff revert qt 2020-02-14 13:33:47 +01:00
a0bc843018 cleanup 2020-02-13 18:38:36 +01:00
6126a401d0 pinned qt and qwt 2020-02-13 18:16:54 +01:00
7665d7b33a rename shared lib 2020-02-13 17:37:27 +01:00
d3d8d7ba8e WIP 2020-02-13 17:13:56 +01:00
938d90bfb8 another one 2020-02-13 16:57:12 +01:00
990f32397b WIP 2020-02-13 15:08:36 +01:00
53b1456f1a disable test 2020-02-13 12:30:54 +01:00
fbb901c8cc WIP 2020-02-13 12:18:53 +01:00
7b7641fb53 path 2020-02-13 12:07:10 +01:00
4de49906d4 WIP 2020-02-13 11:41:36 +01:00
c9b5db4d7f Matrix in conda2 2020-02-13 11:08:41 +01:00
2e6378f241 Matrix in conda 2020-02-13 10:53:25 +01:00
692584ced8 WIP 2020-02-12 17:27:44 +01:00
4ae93dbc73 WIP 2020-02-12 11:54:41 +01:00
f37ceaf517 WIP 2020-02-12 11:41:54 +01:00
75a9002f2c WIP 2020-02-12 11:26:47 +01:00
cfec18e441 WIP 2020-02-12 11:13:26 +01:00
3ff7654c29 WIP 2020-02-12 11:02:29 +01:00
9781dbe49e WIP 2020-02-12 10:51:26 +01:00
e777c0fa79 WIP 2020-02-12 10:34:57 +01:00
9981632b2d fix 2020-02-12 09:18:59 +01:00
d8436da540 conda 2020-02-12 09:05:34 +01:00
4dc4c1ec0a build 2020-02-11 19:33:33 +01:00
6537aa1ceb gui 2020-02-11 18:49:27 +01:00
467be41ccb zlib 2020-02-11 18:41:28 +01:00
73a39fcafe WIP 2020-02-11 18:22:28 +01:00
041c9fefa0 WIP 2020-02-11 16:22:48 +01:00
4f4f3baefc Merge branch 'udp' of github.com:slsdetectorgroup/slsDetectorPackage into udp 2020-02-11 16:07:47 +01:00
3523de8ba9 WIP 2020-02-11 16:01:32 +01:00
e77a93021d WIP 2020-02-10 17:59:29 +01:00
4dc14bf9d6 fixed looking up interface 2020-02-06 08:51:34 +01:00
a5cdd687e6 reverted server 2020-02-05 19:07:35 +01:00
89175586b4 replaced socket 2020-02-05 19:04:25 +01:00
c3bbe45b68 WIP 2020-02-04 17:50:21 +01:00
8f64449117 initial fixing 2020-02-04 17:34:07 +01:00
407 changed files with 54572 additions and 64644 deletions

View File

@ -4,4 +4,3 @@ IndentWidth: 4
UseTab: Never UseTab: Never
ColumnLimit: 80 ColumnLimit: 80
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: false
AlignConsecutiveMacros: true

View File

@ -17,8 +17,7 @@ Checks: '*,
-google-runtime-references, -google-runtime-references,
-google-readability-todo, -google-readability-todo,
-google-readability-braces-around-statements, -google-readability-braces-around-statements,
-modernize-use-trailing-return-type, -modernize-use-trailing-return-type'
-readability-isolate-declaration'
HeaderFilterRegex: \.h HeaderFilterRegex: \.h
AnalyzeTemporaryDtors: false AnalyzeTemporaryDtors: false

View File

@ -1,42 +0,0 @@
---
name: Bug Report
about: Create a report to help us improve
title: New Bug Report
labels: action - Bug, priority - Unclassified, status - Pending
template: bug_report.md
---
<!-- Preview changes before submitting -->
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
<!-- This is a comment, the syntax is a bit different from c++ or bash -->
##### *Distribution:
<!-- RHEL7, RHEL6, Fedora, etc -->
##### *Detector type:
<!-- If applicable, Eiger, Jungfrau, Mythen3, Gotthard2, Gotthard, Moench, ChipTestBoard -->
##### *Software Package Version:
<!-- developer, 4.2.0, 4.1.1, etc -->
##### Priority:
<!-- Super Low, Low, Medium, High, Super High -->
##### *Describe the bug
<!-- A clear and concise description of what the bug is -->
##### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->
##### To Reproduce
<!-- Steps to reproduce the behavior: -->
<!-- 1. Go to '...' -->
<!-- 2. Click on '....' -->
<!-- 3. Scroll down to '....' -->
<!-- 4. See error -->
##### Screenshots
<!-- If applicable, add screenshots to help explain your problem. -->
##### Additional context
<!-- Add any other context about the problem here. -->

View File

@ -1,28 +0,0 @@
---
name: Change Request
about: Suggest a change to an existing feature
title: New Change Request
labels: action - Change, priority - Unclassified, status - Pending
template: change_request.md
---
<!-- Preview changes before submitting -->
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
<!-- This is a comment, the syntax is a bit different from c++ or bash -->
##### *Detector type:
<!-- If applicable, Eiger, Jungfrau, Mythen3, Gotthard2, Gotthard, Moench, ChipTestBoard -->
##### *Software Package Version:
<!-- developer, 4.2.0, 4.1.1, etc -->
##### Priority:
<!-- Super Low, Low, Medium, High, Super High -->
##### *State the change request:
<!-- A clear and concise description of what the change is to an existing feature -->
##### Is your change request related to a problem. Please describe:
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
##### Additional context:
<!-- Add any other context about the feature here -->

View File

@ -1 +0,0 @@
blank_issues_enabled: false

View File

@ -1,34 +0,0 @@
---
name: Feature Request
about: Suggest a feature, documentation or submit a question
title: New Feature Request
labels: action - Enhancement, priority - Unclassified, status - Pending
template: feature_request.md
---
<!-- Preview changes before submitting -->
<!-- Please fill out everything with an *, as this report will be discarded otherwise -->
<!-- This is a comment, the syntax is a bit different from c++ or bash -->
##### *Detector type:
<!-- If applicable, Eiger, Jungfrau, Mythen3, Gotthard2, Gotthard, Moench, ChipTestBoard -->
##### *Software Package Version:
<!-- developer, 4.2.0, 4.1.1, etc -->
##### Priority:
<!-- Super Low, Low, Medium, High, Super High -->
##### *State the feature:
<!-- A clear and concise description of what the feature is -->
##### Is your feature request related to a problem. Please describe:
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
##### Describe the solution you'd like:
<!-- A clear and concise description of what you want to happen -->
##### Describe alternatives you've considered:
<!-- A clear and concise description of any alternative solutions or features you've considered -->
##### Additional context:
<!-- Add any other context about the feature here -->

View File

@ -4,6 +4,12 @@ language: cpp
os: linux os: linux
# env:
# matrix:
# - CONDA_PY="3.7"
dist: bionic dist: bionic
install: install:
@ -33,6 +39,5 @@ deploy:
provider: script provider: script
script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \; script: find $HOME/miniconda/envs/testenv/conda-bld/${TRAVIS_OS_NAME}-64 -name "*.tar.bz2" -exec anaconda -t $CONDA_TOKEN upload --force {} \;
on: on:
branch: developer branch: udp
tags: true

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
project(slsDetectorPackage) project(slsDetectorPackage)
set(PROJECT_VERSION 5.0.0) set(PROJECT_VERSION 5.0.0)
include(CheckIPOSupported) include(CheckIPOSupported)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
cmake_policy(SET CMP0074 NEW) cmake_policy(SET CMP0074 NEW)
include(cmake/project_version.cmake) include(cmake/project_version.cmake)
@ -44,36 +44,6 @@ option(SLS_USE_PYTHON "Python bindings" OFF)
option(SLS_USE_CTBGUI "ctb GUI" OFF) option(SLS_USE_CTBGUI "ctb GUI" OFF)
option(SLS_BUILD_DOCS "docs" OFF) option(SLS_BUILD_DOCS "docs" OFF)
option(SLS_BUILD_EXAMPLES "examples" OFF) option(SLS_BUILD_EXAMPLES "examples" OFF)
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
option(SLS_DEVEL_HEADERS "install headers for devel" OFF)
option(SLS_USE_MOENCH "compile zmq and post processing for Moench" OFF)
# set(ClangFormat_BIN_NAME clang-format)
set(ClangFormat_EXCLUDE_PATTERNS "build/"
"libs/"
"slsDetectorCalibration/"
"ctbGui/"
"manual/"
"python/"
"sample/"
${CMAKE_BINARY_DIR})
find_package(ClangFormat)
#Enable LTO if available
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
# Use ld.gold if it is available and isn't disabled explicitly
option(SLS_USE_LD_GOLD "Use GNU gold linker" ON)
if (SLS_USE_LD_GOLD)
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
if ("${LD_VERSION}" MATCHES "GNU gold")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
else ()
message(WARNING "GNU gold linker isn't available, using the default system linker.")
endif ()
endif ()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@ -97,7 +67,6 @@ target_compile_options(slsProjectWarnings INTERFACE
-Wformat=2 -Wformat=2
-Wredundant-decls -Wredundant-decls
# -Wconversion # -Wconversion
-Wvla
-Wdouble-promotion -Wdouble-promotion
-Werror=return-type -Werror=return-type
@ -142,11 +111,6 @@ if(SLS_USE_SANITIZER)
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread) # target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
endif() endif()
if(SLS_TUNE_LOCAL)
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
endif()
#rapidjson #rapidjson
add_library(rapidjson INTERFACE) add_library(rapidjson INTERFACE)
target_include_directories(rapidjson INTERFACE target_include_directories(rapidjson INTERFACE
@ -195,7 +159,7 @@ endif (SLS_USE_RECEIVER)
if (SLS_USE_GUI) if (SLS_USE_GUI)
find_package(Qt4 REQUIRED) find_package(Qt4 REQUIRED)
find_package(Qwt 6.1 REQUIRED) find_package(Qwt 6 REQUIRED)
if (QT4_FOUND AND QWT_FOUND) if (QT4_FOUND AND QWT_FOUND)
add_subdirectory(slsDetectorGui) add_subdirectory(slsDetectorGui)
endif() endif()
@ -232,13 +196,10 @@ if(SLS_BUILD_DOCS)
endif(SLS_BUILD_DOCS) endif(SLS_BUILD_DOCS)
if(SLS_USE_MOENCH)
add_subdirectory(slsDetectorCalibration/moenchExecutables)
endif(SLS_USE_MOENCH)
if(SLS_MASTER_PROJECT) if(SLS_MASTER_PROJECT)
# Set install dir CMake packages # Set install dir CMake packages
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}") set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/sls)
# Set the list of exported targets # Set the list of exported targets
set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared) set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared)
# Generate and install package config file and version # Generate and install package config file and version

111
README.md
View File

@ -2,67 +2,90 @@
Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support) Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support)
### Binaries ### Binaries
Binaries for the slsDetectorPackage are available through conda. Documentation to obtain the binaries via the conda package is available for [lib](https://github.com/slsdetectorgroup/sls_detector_lib) and [gui](https://github.com/slsdetectorgroup/sls_detector_gui)
```
#Add conda channels
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda install slsdetlib #only shared lib and command line
conda install slsdet #python bindings (includes slsdetlib)
conda install slsdetgui #gui (includes qt4)
#Install specific version
conda install slsdet=2020.03.02.dev0 #developer version from 3 March 2020
```
### Source code ### Source code
One can also obtain the source code from this repository and compile. One can also obtain the source code from this repository and compile while realizing the setup dependencies as required.
``` ```
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
``` ```
#### Dependencies #### Setup dependencies
* Lib: c++11 compiler (gcc=>4.8), ZeroMQ 4 * Gui Client <br>
* Gui: Qt 4.8 and Qwt 6.0 Requirements: Qt 4.8 and Qwt 6.0
* Calibration wizards and ctbGUI: ROOT ```
* Optional: HDF5 export QTDIR=/usr/local/Trolltech/
export QWTDIR=/usr/local/qwt-6.0.1/
```
If either of them does not exist, the GUI client will not be built.
* Advanced user Calibration wizards<br>
Requirements: ROOT
```
export ROOTSYS=/usr/local/root-5.34
```
#### Compilation #### Compilation
Compiling can be done in two ways. Either with the convenience script Compiling can be done in two ways.
cmk.sh or directly with cmake for more control.
**1. Compile using script cmk.sh**<br> **1. Compile using script cmk.sh**<br>
After compiling, the libraries and executables will be found in `slsDetectorPackage/build/bin` directory<br> After compiling, the libraries and executables will be found in `slsDetectorPackage/build/bin` directory<br>
Usage: [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads> Usage: [-c] [-b] [-h] [-d HDF5 directory] [-j]<br>
-[no option]: only make * -[no option]: only make<br>
-c: Clean * -c: Clean<br>
-b: Builds/Rebuilds CMake files normal mode * -b: Builds/Rebuilds CMake files normal mode<br>
-p: Builds/Rebuilds Python API * -h: Builds/Rebuilds Cmake files with HDF5 package<br>
-h: Builds/Rebuilds Cmake files with HDF5 package * -d: HDF5 Custom Directory<br>
-d: HDF5 Custom Directory * -t: Build/Rebuilds only text client<br>
-t: Build/Rebuilds only text client * -r: Build/Rebuilds only receiver<br>
-r: Build/Rebuilds only receiver * -g: Build/Rebuilds only gui<br>
-g: Build/Rebuilds only gui * -j: Number of threads to compile through<br>
-s: Simulator * -e: Debug mode
-u: Chip Test Gui
-j: Number of threads to compile through Basic Option:
-e: Debug mode ./cmk.sh -b
-i: Builds tests
For only make:
./cmk.sh
For make clean;make:
./cmk.sh -c
For using hdf5 without custom dir /blabla:
./cmk.sh -h -d /blabla
For rebuilding cmake without hdf5
./cmk.sh -b
For using multiple cores to compile faster:
./cmk.sh -j9<br>
For rebuilding only certain sections<br>
./cmk.sh -tg #only text client and gui<br>
./cmk.sh -r #only receiver<br>
eg. Rebuild when you switch to a new build and compile in parallel:
./cmk.sh -bj5
**2. Compile without script**<br> **2. Compile without script**<br>
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory. This would create a debug build with address sanitizers. Use cmake to create out-of-source builds, by creating a build folder parallel to source directory.
``` ```
$ mkdir build $ cd ..
$ cd build $ mkdir slsDetectorPackage-build
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON $ cd slsDetectorPackage-build
$ make -j12 #or whatever number of threads wanted $ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=OFF
$ make
```
Use the following as an example to compile statically and using specific hdf5 folder
```
$ HDF5_ROOT=/opt/hdf5v1.10.0 cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_HDF5=ON
```
After compiling, the libraries and executables will be found at `bin` directory
```
$ ls bin/
gui_client libSlsDetector.a libSlsDetector.so libSlsReceiver.a libSlsReceiver.so
sls_detector_acquire sls_detector_get slsDetectorGui sls_detector_help sls_detector_put slsReceiver slsMultiReceiver
``` ```

View File

@ -1,39 +0,0 @@
# Find Clang format
if(NOT ClangFormat_BIN_NAME)
set(ClangFormat_BIN_NAME clang-format)
endif()
# if custom path check there first
if(ClangFormat_ROOT_DIR)
find_program(ClangFormat_BIN
NAMES
${ClangFormat_BIN_NAME}
PATHS
"${ClangFormat_ROOT_DIR}"
NO_DEFAULT_PATH)
endif()
find_program(ClangFormat_BIN NAMES ${ClangFormat_BIN_NAME})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
ClangFormat
DEFAULT_MSG
ClangFormat_BIN)
mark_as_advanced(
ClangFormat_BIN)
if(ClangFormat_FOUND)
exec_program(${ClangFormat_BIN} ${CMAKE_CURRENT_SOURCE_DIR} ARGS --version OUTPUT_VARIABLE CLANG_VERSION_TEXT)
string(REGEX MATCH "([0-9]+)\\.[0-9]+\\.[0-9]+" CLANG_VERSION ${CLANG_VERSION_TEXT})
if((${CLANG_VERSION} GREATER "9") OR (${CLANG_VERSION} EQUAL "9"))
# A CMake script to find all source files and setup clang-format targets for them
message(STATUS "found clang-format \"${CLANG_VERSION}\" adding formatting targets")
include(clang-format)
else()
message(STATUS "clang-format version \"${CLANG_VERSION}\" found but need at least 9. Not setting up format targets")
endif()
else()
message(STATUS "clang-format not found. Not setting up format targets")
endif()

View File

@ -1,47 +0,0 @@
# A CMake script to find all source files and setup clang-format targets for them
# Find all source files
set(ClangFormat_CXX_FILE_EXTENSIONS ${ClangFormat_CXX_FILE_EXTENSIONS} *.cpp *.h *.cxx *.hxx *.hpp *.cc *.ipp *.c)
file(GLOB_RECURSE ALL_SOURCE_FILES ${ClangFormat_CXX_FILE_EXTENSIONS})
# Don't include some common build folders
set(ClangFormat_EXCLUDE_PATTERNS ${ClangFormat_EXCLUDE_PATTERNS} "/CMakeFiles/" "cmake")
# get all project files file
foreach (SOURCE_FILE ${ALL_SOURCE_FILES})
foreach (EXCLUDE_PATTERN ${ClangFormat_EXCLUDE_PATTERNS})
string(FIND ${SOURCE_FILE} ${EXCLUDE_PATTERN} EXCLUDE_FOUND)
if (NOT ${EXCLUDE_FOUND} EQUAL -1)
list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
endif ()
endforeach ()
endforeach ()
#target for formatting soruce files
add_custom_target(format
COMMENT "Running clang-format to change files"
COMMAND ${ClangFormat_BIN}
-style=file
-i
${ALL_SOURCE_FILES}
)
#target to check format on source files
add_custom_target(format-check
COMMENT "Checking clang-format changes"
# Use ! to negate the result for correct output
COMMAND !
${ClangFormat_BIN}
-style=file
-output-replacements-xml
${ALL_SOURCE_FILES}
| grep -q "replacement offset"
)
# debug to check which file will be formatted
add_custom_target(
listformatfiles
COMMAND
echo ${ALL_SOURCE_FILES}
)

View File

@ -15,20 +15,17 @@ configure_package_config_file(
write_basic_package_version_file( write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion COMPATIBILITY SameMajorVersion)
)
install(FILES install(FILES
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
COMPONENT devel COMPONENT devel
DESTINATION ${CMAKE_INSTALL_DIR} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
)
if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES) if (PROJECT_LIBRARIES OR PROJECT_STATIC_LIBRARIES)
install( install(
EXPORT "${TARGETS_EXPORT_NAME}" EXPORT "${TARGETS_EXPORT_NAME}"
FILE ${PROJECT_NAME_LOWER}-targets.cmake FILE ${PROJECT_NAME_LOWER}-targets.cmake
DESTINATION ${CMAKE_INSTALL_DIR} DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME_LOWER})
)
endif () endif ()

69
cmk.sh
View File

@ -11,9 +11,6 @@ PYTHON=0
TESTS=0 TESTS=0
SIMULATOR=0 SIMULATOR=0
CTBGUI=0 CTBGUI=0
MANUALS=0
MANUALS_ONLY_RST=0
MOENCHZMQ=0
CLEAN=0 CLEAN=0
@ -22,7 +19,7 @@ CMAKE_PRE=""
CMAKE_POST="" CMAKE_POST=""
usage() { echo -e " usage() { echo -e "
Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [n] [-h] [z] [-d <HDF5 directory>] [-j] <Number of threads> Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
-[no option]: only make -[no option]: only make
-c: Clean -c: Clean
-b: Builds/Rebuilds CMake files normal mode -b: Builds/Rebuilds CMake files normal mode
@ -37,9 +34,6 @@ Usage: $0 [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [m] [n] [-h] [z] [-d <HDF5
-j: Number of threads to compile through -j: Number of threads to compile through
-e: Debug mode -e: Debug mode
-i: Builds tests -i: Builds tests
-m: Manuals
-n: Manuals without compiling doxygen (only rst)
-z: Moench zmq processor
Rebuild when you switch to a new build and compile in parallel: Rebuild when you switch to a new build and compile in parallel:
./cmk.sh -bj5 ./cmk.sh -bj5
@ -75,7 +69,7 @@ For rebuilding only certain sections
" ; exit 1; } " ; exit 1; }
while getopts ":bpchd:j:trgeisumnz" opt ; do while getopts ":bpchd:j:trgeisu" opt ; do
case $opt in case $opt in
b) b)
echo "Building of CMake files Required" echo "Building of CMake files Required"
@ -130,18 +124,6 @@ while getopts ":bpchd:j:trgeisumnz" opt ; do
echo "Compiling Options: Simulator" echo "Compiling Options: Simulator"
SIMULATOR=1 SIMULATOR=1
;; ;;
m)
echo "Compiling Manuals"
MANUALS=1
;;
n)
echo "Compiling Manuals (Only RST)"
MANUALS_ONLY_RST=1
;;
z)
echo "Compiling Moench Zmq Processor"
MOENCHZMQ=1
;;
u) u)
echo "Compiling Options: Chip Test Gui" echo "Compiling Options: Chip Test Gui"
CTBGUI=1 CTBGUI=1
@ -205,8 +187,8 @@ fi
#Debug #Debug
if [ $DEBUG -eq 1 ]; then if [ $DEBUG -eq 1 ]; then
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug " CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON " # CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
echo "Debug Option enabled" echo "Debug Option enabled"
fi fi
@ -216,18 +198,6 @@ if [ $SIMULATOR -eq 1 ]; then
echo "Simulator Option enabled" echo "Simulator Option enabled"
fi fi
#Manuals
if [ $MANUALS -eq 1 ]; then
CMAKE_POST+=" -DSLS_BUILD_DOCS=ON "
echo "Manuals Option enabled"
fi
#Moench zmq processor
if [ $MOENCHZMQ -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_MOENCH=ON "
echo "Moench Zmq Processor Option enabled"
fi
#Chip Test Gui #Chip Test Gui
if [ $CTBGUI -eq 1 ]; then if [ $CTBGUI -eq 1 ]; then
CMAKE_POST+=" -DSLS_USE_CTBGUI=ON " CMAKE_POST+=" -DSLS_USE_CTBGUI=ON "
@ -274,34 +244,11 @@ fi
#make #make
if [ $COMPILERTHREADS -gt 0 ]; then if [ $COMPILERTHREADS -gt 0 ]; then
if [ $MANUALS -eq 0 ] && [ $MANUALS_ONLY_RST -eq 0 ]; then BUILDCOMMAND="make -j$COMPILERTHREADS"
BUILDCOMMAND="make -j$COMPILERTHREADS" echo $BUILDCOMMAND
echo $BUILDCOMMAND eval $BUILDCOMMAND
eval $BUILDCOMMAND
else
if [ $MANUALS -eq 1 ]; then
BUILDCOMMAND="make docs -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
else
BUILDCOMMAND="make rst -j$COMPILERTHREADS"
echo $BUILDCOMMAND
eval $BUILDCOMMAND
fi
fi
else else
if [ $MANUALS -eq 0 ] && [ $MANUALS_ONLY_RST -eq 0 ]; then make
echo "make"
make
else
if [ $MANUALS -eq 1 ]; then
echo "make docs"
make docs
else
echo "make rst"
make rst
fi
fi
fi fi

View File

@ -5,20 +5,18 @@ mkdir $PREFIX/include
mkdir $PREFIX/include/slsDetectorPackage mkdir $PREFIX/include/slsDetectorPackage
#Shared and static libraries #Shared and static libraries
# cp build/bin/libSlsDetector.so $PREFIX/lib/. cp build/bin/libSlsDetector.so $PREFIX/lib/.
# cp build/bin/libSlsReceiver.so $PREFIX/lib/. cp build/bin/libSlsReceiver.so $PREFIX/lib/.
# cp build/bin/libSlsSupport.so $PREFIX/lib/. cp build/bin/libSlsSupport.so $PREFIX/lib/.
cp build/install/lib/* $PREFIX/lib/
#Binaries #Binaries
cp build/install/bin/sls_detector_acquire $PREFIX/bin/. cp build/bin/sls_detector_acquire $PREFIX/bin/.
cp build/install/bin/sls_detector_get $PREFIX/bin/. cp build/bin/sls_detector_get $PREFIX/bin/.
cp build/install/bin/sls_detector_put $PREFIX/bin/. cp build/bin/sls_detector_put $PREFIX/bin/.
cp build/install/bin/sls_detector_help $PREFIX/bin/. cp build/bin/sls_detector_help $PREFIX/bin/.
cp build/install/bin/slsReceiver $PREFIX/bin/. cp build/bin/slsReceiver $PREFIX/bin/.
cp build/install/bin/slsMultiReceiver $PREFIX/bin/. cp build/bin/slsMultiReceiver $PREFIX/bin/.
#Which headers do we need for development??
cp build/install/include/* $PREFIX/include/ cp build/install/include/* $PREFIX/include/slsDetectorPackage/
cp -r build/install/share/ $PREFIX/share # cp include/some_lib.h $PREFIX/include/.

View File

@ -1,13 +1,13 @@
package: package:
name: sls_detector_software name: sls_detector_software
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }} version: "udp"
source: source:
- path: .. - path: ..
build: build:
number: 0 number: 1
binary_relocation: True binary_relocation: True
rpaths: rpaths:
- lib/ - lib/
@ -37,7 +37,6 @@ requirements:
host: host:
- libstdcxx-ng - libstdcxx-ng
- libgcc-ng - libgcc-ng
- zeromq
- xorg-libx11 - xorg-libx11
- xorg-libice - xorg-libice
- xorg-libxext - xorg-libxext
@ -47,7 +46,6 @@ requirements:
- xorg-libxfixes - xorg-libxfixes
run: run:
- zeromq
- libstdcxx-ng - libstdcxx-ng
- libgcc-ng - libgcc-ng

View File

@ -29,10 +29,9 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "ctbMain.h" #include "ctbMain.h"
#include "moench03CtbData.h" #include "moench03CtbData.h"
//#include "moench03TCtbData.h" #include "moench03TCtbData.h"
//#include "moench03T1CtbData.h" #include "moench03T1CtbData.h"
#include "moench03CommonMode.h" #include "moench03CommonMode.h"
#include "moench03T1ZmqDataNew.h"
#include "moench02CtbData.h" #include "moench02CtbData.h"
//#include "jungfrau10ModuleData.h" //#include "jungfrau10ModuleData.h"
#include "moenchCommonMode.h" #include "moenchCommonMode.h"
@ -44,9 +43,6 @@
#include "moench04CtbZmq10GbData.h" #include "moench04CtbZmq10GbData.h"
#include "deserializer.h" #include "deserializer.h"
#include "detectorData.h" #include "detectorData.h"
#include "imageZmq16bit.h"
#include "imageZmq32bit.h"
using namespace std; using namespace std;
@ -236,10 +232,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
cbDetType->AddEntry("MOENCH02", MOENCH02); cbDetType->AddEntry("MOENCH02", MOENCH02);
cbDetType->AddEntry("MOENCH04", MOENCH04); cbDetType->AddEntry("MOENCH04", MOENCH04);
// cbDetType->AddEntry("JUNGFRAU1.0", 2); // cbDetType->AddEntry("JUNGFRAU1.0", 2);
cbDetType->AddEntry("MOENCH03",MOENCH03); //cbDetType->AddEntry("MOENCH03 T", iiii++);
cbDetType->AddEntry("IMAGE32BIT",IMAGE32B);
cbDetType->AddEntry("IMAGE16BIT",IMAGE16B);
//cbDetType->AddEntry("MOENCH03", iiii++); //cbDetType->AddEntry("MOENCH03", iiii++);
// cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301); // cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
// cbDetType->AddEntry("ADCSAR2", ADCSAR2); // cbDetType->AddEntry("ADCSAR2", ADCSAR2);
@ -278,7 +271,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
// cout << "off "<< endl; cout << "off "<< endl;
hframe=new TGHorizontalFrame(this, 800,50); hframe=new TGHorizontalFrame(this, 800,50);
@ -297,8 +290,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
TGNumberFormat::kNEANonNegative, TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,0,16535); TGNumberFormat::kNELLimitMinMax,0,16535);
hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1)); hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
eSerOff->MapWindow(); eSerOff->MapWindow();;
eSerOff->SetNumber(0); eSerOff->SetNumber(5);
e= eSerOff->TGNumberEntry::GetNumberEntry(); e= eSerOff->TGNumberEntry::GetNumberEntry();
eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)"); eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)");
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()"); e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()");
@ -344,53 +337,6 @@ hframe=new TGHorizontalFrame(this, 800,50);
hframe=new TGHorizontalFrame(this, 800,50);
AddFrame(hframe,new TGLayoutHints(kLHintsTop | kLHintsExpandX , 10,10,10,10));
hframe->MapWindow();
label=new TGLabel(hframe,"Image Pixels");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
label->MapWindow();
label->SetTextJustify(kTextLeft);
label=new TGLabel(hframe,"X: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
label->MapWindow();
label->SetTextJustify(kTextRight);
ePixX=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,0,16535);
hframe->AddFrame(ePixX,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
ePixX->MapWindow();
ePixX->SetNumber(400);
e= ePixX->TGNumberEntry::GetNumberEntry();
ePixX->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
label=new TGLabel(hframe,"Y: ");
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 5, 5, 5, 5));
label->MapWindow();
label->SetTextJustify(kTextRight);
ePixY=new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
TGNumberFormat::kNEANonNegative,
TGNumberFormat::kNELLimitMinMax,0,16535);
hframe->AddFrame(ePixY,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
ePixY->MapWindow();
ePixY->SetNumber(400);
e= ePixY->TGNumberEntry::GetNumberEntry();
ePixY->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeImagePixels(Long_t)");
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeImagePixels()");
hframe=new TGHorizontalFrame(this, 800,50); hframe=new TGHorizontalFrame(this, 800,50);
@ -664,9 +610,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
try { try {
myDet->registerDataCallback(&dataCallback, (void*)this); myDet->registerDataCallback(&dataCallback, (void*)this);
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition") } CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
try {
myDet->setRxZmqDataStream(true);
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
cout <<"Done" << endl; cout <<"Done" << endl;
// mgAdcs=new TMultiGraph(); // mgAdcs=new TMultiGraph();
@ -888,7 +832,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
// cout <<"global plot is " << globalPlot << endl; // cout <<"global plot is " << globalPlot << endl;
// cout << "*******************************************" <<endl; // cout << "*******************************************" <<endl;
cout <<"------Plot: "<< index << " prog:" << data->progressIndex << " nx:" << data->nx << " ny: " << data->ny << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl; // cout <<"------Plot: "<< index << " prog:" << data->progressIndex << " npoints:" << data->npoints << " npy: " << data->npy << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl;
if (globalPlot || cbGetPedestal->IsOn()) { if (globalPlot || cbGetPedestal->IsOn()) {
//#ifdef TESTADC //#ifdef TESTADC
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl; // cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
@ -915,11 +859,6 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
nx=eNumCount->GetIntNumber(); nx=eNumCount->GetIntNumber();
dr=eDynRange->GetIntNumber(); dr=eDynRange->GetIntNumber();
soff=eSerOff->GetIntNumber(); soff=eSerOff->GetIntNumber();
// cout <<"deserializer: " << endl;
// cout << "Number of chans:\t" << nx << endl;
// cout << "Serial Offset:\t" << soff << endl;
// cout << "Dynamic range:\t" << dr << endl;
} }
i=0; i=0;
@ -984,8 +923,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
for (int y=0; y<ny; y++) { for (int y=0; y<ny; y++) {
ped=0; ped=0;
aval=dataStructure->getValue(data->data,x,y); aval=dataStructure->getValue(data->data,x,y);
//aval=dataStructure->getChannel(data->data,x,y);
cout << x << " " <<y << " "<< aval << endl;
if (cbGetPedestal->IsOn()) { if (cbGetPedestal->IsOn()) {
if (photonFinder) { if (photonFinder) {
photonFinder->addToPedestal(aval,x,y); photonFinder->addToPedestal(aval,x,y);
@ -1157,19 +1095,7 @@ void ctbAcquisition::changePlot(){
if (rbPlotOff->IsOn()) { if (rbPlotOff->IsOn()) {
adcPlot=0; adcPlot=0;
dbitPlot=0; dbitPlot=0;
try {
myDet->registerDataCallback(nullptr, this);
} CATCH_DISPLAY ("Could not get unregister call back.", "ctbAcquisition::ctbAcquisition")
try {
myDet->setRxZmqDataStream(false);
} CATCH_DISPLAY ("Could not get unset RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
} else { } else {
try {
myDet->registerDataCallback(&dataCallback, (void*)this);
} CATCH_DISPLAY ("Could not get register call back.", "ctbAcquisition::ctbAcquisition")
try {
myDet->setRxZmqDataStream(true);
} CATCH_DISPLAY ("Could not get set RxZmqDataStream.", "ctbAcquisition::ctbAcquisition")
adcPlot=0; adcPlot=0;
dbitPlot=0; dbitPlot=0;
for (int ii=0; ii<NADCS; ii++) for (int ii=0; ii<NADCS; ii++)
@ -1274,9 +1200,6 @@ void ctbAcquisition::changeDetector(){
eNumCount->SetState(kFALSE); eNumCount->SetState(kFALSE);
eDynRange->SetState(kFALSE); eDynRange->SetState(kFALSE);
eSerOff->SetState(kFALSE); eSerOff->SetState(kFALSE);
ePixX->SetState(kFALSE);
ePixY->SetState(kFALSE);
deserializer=0; deserializer=0;
if (rb2D->IsOn() ) {//|| rbScan->IsOn() if (rb2D->IsOn() ) {//|| rbScan->IsOn()
switch (cbDetType->GetSelected()) { switch (cbDetType->GetSelected()) {
@ -1287,6 +1210,7 @@ void ctbAcquisition::changeDetector(){
// commonMode=new moench03CommonMode(); // commonMode=new moench03CommonMode();
break; break;
case MOENCH04: case MOENCH04:
try { try {
auto retval = myDet->getTenGiga().tsquash("Different values"); auto retval = myDet->getTenGiga().tsquash("Different values");
if (retval) { if (retval) {
@ -1299,54 +1223,6 @@ void ctbAcquisition::changeDetector(){
cout << "MOENCH 0.4!" << endl; cout << "MOENCH 0.4!" << endl;
commonMode=new moench03CommonMode(); commonMode=new moench03CommonMode();
break; break;
case MOENCH03:
//try {
// auto retval = myDet->getTenGiga().tsquash("Different values");
// if (retval) {
dataStructure=new moench03T1ZmqDataNew(nAnalogSamples);
// } else {
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
// }
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
cout << "MOENCH 0.3! USE JUNGFRAU MODULE!" << endl;
commonMode=new moench03CommonMode();
break;
case IMAGE32B:
//try {
// auto retval = myDet->getTenGiga().tsquash("Different values");
// if (retval) {
// if (deserializer) {
ePixX->SetState(kTRUE);
ePixY->SetState(kTRUE);
// }
dataStructure=new imageZmq32bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
// } else {
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
// }
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
cout << "Image 32bit, no channel shuffling" << endl;
commonMode=NULL;
break;
case IMAGE16B:
//try {
// auto retval = myDet->getTenGiga().tsquash("Different values");
// if (retval) {
// if (deserializer) {
ePixX->SetState(kTRUE);
ePixY->SetState(kTRUE);
// }
dataStructure=new imageZmq16bit(ePixX->GetIntNumber(),ePixY->GetIntNumber());
// } else {
// dataStructure=new moench04CtbZmqData(nAnalogSamples, nDigitalSamples);
// }
//} CATCH_DISPLAY ("Could not get ten giga enable.", "ctbAcquisition::changeDetector")
cout << "Image 16bit, no channel shuffling" << endl;
commonMode=NULL;
break;
// case 1: // case 1:
// cout << "************** T!!!!!!!!!!" << endl; // cout << "************** T!!!!!!!!!!" << endl;
@ -1410,7 +1286,6 @@ void ctbAcquisition::changeDetector(){
photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
//photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode //photonFinder=new singlePhotonDetector(dataStructure,csize,nsigma,1,cm); //sign is positive - should correct with ADC mask, no common mode
dataStructure->getDetectorSize(nx,ny); dataStructure->getDetectorSize(nx,ny);
} }
if (deserializer) { if (deserializer) {
ny=1; ny=1;
@ -1636,23 +1511,20 @@ void ctbAcquisition::update() {
if (dataStructure) { if (dataStructure) {
cout << cbDetType->GetSelected()<< endl; cout << cbDetType->GetSelected()<< endl;
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
// cout << "settings deserialiation parameters for MYTHEN" << endl; cout << "settings deserialiation parameters for MYTHEN" << endl;
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
// eSerOff->SetNumber( ms->setSerialOffset(-1)); eSerOff->SetNumber( ms->setSerialOffset(-1));
// eDynRange->SetNumber( ms->setDynamicRange(-1)); eDynRange->SetNumber( ms->setDynamicRange(-1));
// eNumCount->SetNumber( ms->setNumberOfCounters(-1)); eNumCount->SetNumber( ms->setNumberOfCounters(-1));
// } }
} }
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) { try {
dBitOffset = 0; dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
} else { } CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
try {
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::update")
}
try { try {
tenG = myDet->getTenGiga().tsquash("Different values"); tenG = myDet->getTenGiga().tsquash("Different values");
} CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update") } CATCH_DISPLAY ("Could not get ten giga enable", "ctbAcquisition::update")
@ -1738,13 +1610,9 @@ void ctbAcquisition::toggleAcquisition() {
setDigitalSamples(retval); setDigitalSamples(retval);
} CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::toggleAcquisition") } CATCH_DISPLAY ("Could not get number of digital samples", "ctbAcquisition::toggleAcquisition")
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
dBitOffset = 0;
} else {
try { try {
dBitOffset = myDet->getRxDbitOffset().tsquash("Different values"); dBitOffset = myDet->getRxDbitOffset().tsquash("Different values");
} CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition") } CATCH_DISPLAY ("Could not get receiver dbit offset", "ctbAcquisition::toggleAcquisition")
}
try { try {
roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values")); roMode = static_cast<int>(myDet->getReadoutMode().tsquash("Different values"));
@ -1981,18 +1849,14 @@ void ctbAcquisition::setDbitEnable(Int_t reg){
void ctbAcquisition::updateChans() { void ctbAcquisition::updateChans() {
// dbit list // dbit list
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) { try {
auto retval = myDet->getRxDbitList().tsquash("Different values");
dbitlist.clear(); dbitlist.clear();
} else { if (!retval.empty()) {
try { for (const auto &value : retval)
auto retval = myDet->getRxDbitList().tsquash("Different values"); dbitlist.push_back(value);
dbitlist.clear(); }
if (!retval.empty()) { } CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
for (const auto &value : retval)
dbitlist.push_back(value);
}
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbAcquisition::updateChans")
}
// adc mask // adc mask
try { try {
@ -2113,22 +1977,20 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
void ctbAcquisition::ChangeSerialOffset(){ void ctbAcquisition::ChangeSerialOffset(){
changeDetector();
// if (dataStructure) { // if (dataStructure) {
// cout << cbDetType->GetSelected()<< endl; // // cout << cbDetType->GetSelected()<< endl;
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){ // // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
// cout << "settings offsets for MYTHEN" << endl; // // cout << "settings offsets for MYTHEN" << endl;
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure; // // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
// ms->setSerialOffset(eSerOff->GetIntNumber()); // // ms->setSerialOffset(eSerOff->GetIntNumber());
// } // // }
// } // }
}; };
void ctbAcquisition::ChangeDynamicRange(){ void ctbAcquisition::ChangeDynamicRange(){
changeDetector();
// if (dataStructure) { // if (dataStructure) {
// cout << cbDetType->GetSelected()<< endl; // cout << cbDetType->GetSelected()<< endl;
@ -2142,7 +2004,6 @@ void ctbAcquisition::ChangeDynamicRange(){
}; };
void ctbAcquisition::ChangeNumberOfChannels(){ void ctbAcquisition::ChangeNumberOfChannels(){
changeDetector();
// if (dataStructure) { // if (dataStructure) {
// cout << cbDetType->GetSelected()<< endl; // cout << cbDetType->GetSelected()<< endl;
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){ // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
@ -2156,24 +2017,6 @@ void ctbAcquisition::ChangeNumberOfChannels(){
changePlot(); changePlot();
}; };
void ctbAcquisition::ChangeImagePixels(Long_t a){
ChangeImagePixels();
};
void ctbAcquisition::ChangeImagePixels(){
changeDetector();
// if (dataStructure) {
// cout << cbDetType->GetSelected()<< endl;
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
// cout << "settings number of channels for MYTHEN" << endl;
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
// ms->setNumberOfCounters(eNumCount->GetIntNumber());
// }
// }
// if (deserializer)
// changePlot();
};
void ctbAcquisition::ChangeHistoLimitsPedSub(Long_t a){ void ctbAcquisition::ChangeHistoLimitsPedSub(Long_t a){

View File

@ -42,7 +42,7 @@ using namespace std;
class ctbAcquisition : public TGGroupFrame { class ctbAcquisition : public TGGroupFrame {
enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE32B, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302}; enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302};
private: private:
@ -57,9 +57,6 @@ class ctbAcquisition : public TGGroupFrame {
TGNumberEntry *eNumCount; TGNumberEntry *eNumCount;
TGNumberEntry *ePixX;
TGNumberEntry *ePixY;
TGNumberEntry *eFitADC; TGNumberEntry *eFitADC;
TGNumberEntry *eBitPlot; TGNumberEntry *eBitPlot;
TGNumberEntry *eMinRaw; TGNumberEntry *eMinRaw;
@ -234,8 +231,7 @@ class ctbAcquisition : public TGGroupFrame {
void ChangeNumberOfChannels(Long_t); void ChangeNumberOfChannels(Long_t);
void ChangeDynamicRange(); void ChangeDynamicRange();
void ChangeDynamicRange(Long_t); void ChangeDynamicRange(Long_t);
void ChangeImagePixels();
void ChangeImagePixels(Long_t);
void canvasClicked(); void canvasClicked();
void FitADC(); void FitADC();

View File

@ -108,26 +108,15 @@ string ctbDac::getLabel() {
} }
int ctbDac::getMoenchDacId() {
slsDetectorDefs::dacIndex moenchDacIndices[8] = {slsDetectorDefs::VBP_COLBUF, slsDetectorDefs::VIPRE, slsDetectorDefs::VIN_CM, slsDetectorDefs::VB_SDA, slsDetectorDefs::VCASC_SFP, slsDetectorDefs::VOUT_CM, slsDetectorDefs::VIPRE_CDS, slsDetectorDefs::IBIAS_SFP};
if (id >= 8) {
return id;
}
return static_cast<int>(moenchDacIndices[id]);
}
void ctbDac::setValue(Long_t a) {setValue();} void ctbDac::setValue(Long_t a) {setValue();}
void ctbDac::setValue() { void ctbDac::setValue() {
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl; cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
try { try {
int sid = id; myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
sid = getMoenchDacId();
}
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(sid), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue") } CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
getValue(); getValue();
@ -139,11 +128,7 @@ void ctbDac::setOn(Bool_t b) {
setValue(); setValue();
} else { } else {
try { try {
int sid = id; myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), -100, false);
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
sid = getMoenchDacId();
}
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(sid), -100, false);
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn") } CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
} }
getValue(); getValue();
@ -151,11 +136,7 @@ void ctbDac::setOn(Bool_t b) {
int ctbDac::getValue() { int ctbDac::getValue() {
try { try {
int sid = id; int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn()).tsquash("Different values");
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) {
sid = getMoenchDacId();
}
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(sid), dacsUnit->IsOn()).tsquash("Different values");
cout << "dac " << id << " " << val << endl; cout << "dac " << id << " " << val << endl;
dacsValue->SetText(to_string(val).c_str()); dacsValue->SetText(to_string(val).c_str());
if (val >= 0) { if (val >= 0) {

View File

@ -45,7 +45,7 @@ class ctbDac : public TGHorizontalFrame {
int setLabel(char *tit, int mv); int setLabel(char *tit, int mv);
string getLabel(); string getLabel();
int getMoenchDacId();
ClassDef(ctbDac,0) ClassDef(ctbDac,0)
@ -54,6 +54,8 @@ int getMoenchDacId();
class ctbDacs : public TGGroupFrame { class ctbDacs : public TGGroupFrame {
private: private:
ctbDac *dacs[NDACS+2]; ctbDac *dacs[NDACS+2];
sls::Detector* myDet; sls::Detector* myDet;

View File

@ -71,10 +71,10 @@ class ctbDefs {
std::string exceptionMessage, std::string exceptionMessage,
std::string source) { std::string source) {
// because sls_detector_exceptions cannot be included // because sls_detector_exceptions cannot be included
if (exceptionMessage.find("hared memory") != std::string::npos) { if (exceptionMessage.find("hared memory")) {
throw; throw;
} }
if (exceptionMessage.find("annot connect") != std::string::npos) { if (exceptionMessage.find("annot connect")) {
throw; throw;
} }
cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str()); cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str());

View File

@ -259,10 +259,8 @@ ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
cout << "connect mtab" << endl; cout << "connect mtab" << endl;
try{
setReadoutMode(pat->getReadoutMode());
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
setReadoutMode(pat->getReadoutMode());
setADCEnable(adcs->setEnable()); setADCEnable(adcs->setEnable());
setAnalogSamples(pat->getAnalogSamples()); setAnalogSamples(pat->getAnalogSamples());
setDigitalSamples(pat->getDigitalSamples()); setDigitalSamples(pat->getDigitalSamples());

View File

@ -1036,41 +1036,32 @@ void ctbPattern::readoutModeChanged(int flags) {
} }
int ctbPattern::getReadoutMode() { int ctbPattern::getReadoutMode() {
int retval=slsDetectorDefs::ANALOG_ONLY; try{
auto retval = myDet->getReadoutMode().tsquash("Different values");
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) { switch(retval) {
try{ case slsDetectorDefs::ANALOG_AND_DIGITAL:
retval = myDet->getReadoutMode().tsquash("Different values"); cout << "analog and digital" << endl;
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode") cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kTRUE);
switch(retval) { break;
case slsDetectorDefs::ANALOG_AND_DIGITAL: case slsDetectorDefs::DIGITAL_ONLY:
cout << "analog and digital" << endl; cout << "digital only" << endl;
cbAnalog->SetOn(kTRUE); cbAnalog->SetOn(kFALSE);
cbDigital->SetOn(kTRUE); cbDigital->SetOn(kTRUE);
break; break;
case slsDetectorDefs::DIGITAL_ONLY: case slsDetectorDefs::ANALOG_ONLY:
cout << "digital only" << endl; cout << "analog only" << endl;
cbAnalog->SetOn(kFALSE); cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kTRUE); cbDigital->SetOn(kFALSE);
break; break;
case slsDetectorDefs::ANALOG_ONLY: default:
cout << "analog only" << endl; throw("unknown readout flag");
cbAnalog->SetOn(kTRUE); }
cbDigital->SetOn(kFALSE);
break;
default:
throw("unknown readout flag");
}
} else {
cbAnalog->SetOn(kTRUE);
cbDigital->SetOn(kFALSE);
}
Emit("readoutModeChanged(int)",static_cast<int>(retval)); Emit("readoutModeChanged(int)",static_cast<int>(retval));
return retval; return retval;
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
return -1;
} }
int ctbPattern::getAnalogSamples() { int ctbPattern::getAnalogSamples() {
@ -1085,16 +1076,12 @@ int ctbPattern::getAnalogSamples() {
} }
int ctbPattern::getDigitalSamples() { int ctbPattern::getDigitalSamples() {
int retval=0; try{
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) { auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
try{ eDigitalSamples->SetNumber((Double_t)retval);
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values"); Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
} CATCH_DISPLAY ("Could not get number of digital samples.", "ctbPattern::getDigitalSamples") return eDigitalSamples->GetNumber();
} } CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
eDigitalSamples->SetNumber((Double_t)retval);
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
return eDigitalSamples->GetNumber();
return -1; return -1;
} }

View File

@ -374,43 +374,33 @@ void ctbSignals::update() {
} CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update") } CATCH_DISPLAY ("Could not get patternIOcontrol.", "ctbSignals::update")
if (myDet->getDetectorType().squash() == slsDetectorDefs::MOENCH) { try {
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
// enable all // enable all
for (int is=0; is<64; is++) { if (dbitlist.empty()) {
signals[is]->setDbitList(1); for (int is=0; is<64; is++) {
signals[is]->setDbitList(1);
}
} }
eDbitOffset->SetNumber(0); else {
} // disable all
for (int is=0; is<64; is++) {
// ctb signals[is]->setDbitList(0);
else {
try {
auto dbitlist = myDet->getRxDbitList().tsquash("Different values");
// enable all
if (dbitlist.empty()) {
for (int is=0; is<64; is++) {
signals[is]->setDbitList(1);
}
} }
else { // enable selected
// disable all for (const auto &value : dbitlist) {
for (int is=0; is<64; is++) { signals[value]->setDbitList(1);
signals[is]->setDbitList(0);
}
// enable selected
for (const auto &value : dbitlist) {
signals[value]->setDbitList(1);
}
} }
}
} CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbSignals::update") } CATCH_DISPLAY ("Could not get receiver dbit list.", "ctbSignals::update")
try {
auto val = myDet->getRxDbitOffset().tsquash("Different values");
eDbitOffset->SetNumber(val);
} CATCH_DISPLAY ("Could not get receiver dbit offset.", "ctbSignals::update")
try {
auto val = myDet->getRxDbitOffset().tsquash("Different values");
eDbitOffset->SetNumber(val);
} CATCH_DISPLAY ("Could not get receiver dbit offset.", "ctbSignals::update")
}
} }

View File

@ -21,7 +21,6 @@ if [ -f "$infile" ]
then then
gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ; gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
echo compiling echo compiling
echo gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
$exe ; $exe ;
echo cleaning echo cleaning
rm $exe rm $exe

View File

@ -1,75 +1,69 @@
find_package(Doxygen REQUIRED) find_package(Doxygen)
find_package(Sphinx REQUIRED) find_package(Sphinx)
if (DOXYGEN_FOUND AND SPHINX_FOUND)
message(${CMAKE_PROJECT_SORURCE_DIR}/slsDetectorSoftware/src)
# Utility to generate command line documentation
add_executable(gendoc src/gendoc.cpp)
# This is a bit hacky, but better than exposing stuff?
target_include_directories(gendoc PRIVATE ${PROJECT_SOURCE_DIR}/slsDetectorSoftware/src)
target_link_libraries(gendoc PRIVATE
slsDetectorShared
)
set_target_properties(gendoc PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
# Utility to generate command line documentation #Doxygen
add_executable(gendoc src/gendoc.cpp) set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
# This is a bit hacky, but better than exposing stuff? set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
target_include_directories(gendoc PRIVATE ${PROJECT_SOURCE_DIR}/slsDetectorSoftware/src) configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
target_link_libraries(gendoc PRIVATE
slsDetectorShared
)
set_target_properties(gendoc PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
#Sphinx
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR})
set(SPHINX_SOURCE_FILES
src/commandline.rst
src/container_utils.rst
src/dependencies.rst
src/detector.rst
src/index.rst
src/installation.rst
src/pydetector.rst
src/pyenums.rst
src/pyexamples.rst
src/receiver.rst
src/result.rst
src/type_traits.rst
src/ToString.rst
)
#Doxygen foreach(filename ${SPHINX_SOURCE_FILES})
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${filename}
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) "${SPHINX_BUILD}/${filename}")
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) endforeach(filename ${SPHINX_SOURCE_FILES})
#Sphinx configure_file(
set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src) "${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}) "${SPHINX_BUILD}/conf.py"
@ONLY)
set(SPHINX_SOURCE_FILES add_custom_target(docs
src/commandline.rst gendoc
src/container_utils.rst COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
src/consuming.rst COMMAND ${SPHINX_EXECUTABLE} -a -b html
src/dependencies.rst -Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
src/detector.rst -c "${SPHINX_BUILD}"
src/index.rst ${SPHINX_BUILD}/src
src/installation.rst ${SPHINX_BUILD}/html
src/pydetector.rst COMMENT "Generating documentation with Sphinx")
src/pyenums.rst
src/pyexamples.rst
src/receiver.rst
src/result.rst
src/type_traits.rst
src/ToString.rst
src/examples.rst
) else (DOXYGEN_FOUND AND SPHINX_FOUND)
message("Doxygen and Sphinx are needed to build documentation")
foreach(filename ${SPHINX_SOURCE_FILES}) endif (DOXYGEN_FOUND AND SPHINX_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${filename}
"${SPHINX_BUILD}/${filename}")
endforeach(filename ${SPHINX_SOURCE_FILES})
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in"
"${SPHINX_BUILD}/conf.py"
@ONLY)
add_custom_target(docs
gendoc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
COMMAND ${SPHINX_EXECUTABLE} -a -b html
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
-c "${SPHINX_BUILD}"
${SPHINX_BUILD}/src
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")
add_custom_target(rst
COMMAND ${SPHINX_EXECUTABLE} -a -b html
-Dbreathe_projects.slsDetectorPackage=${CMAKE_CURRENT_BINARY_DIR}/xml
-c "${SPHINX_BUILD}"
${SPHINX_BUILD}/src
${SPHINX_BUILD}/html
COMMENT "Generating documentation with Sphinx")

View File

@ -21,7 +21,7 @@ print(sys.path)
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = 'slsDetectorPackage' project = 'slsDetectorPackage'
copyright = '2020, PSD Detector Group' copyright = '2019, PSD Detector Group'
author = 'PSD Detector Group' author = 'PSD Detector Group'
version = '@PROJECT_VERSION@' version = '@PROJECT_VERSION@'

View File

@ -1,116 +0,0 @@
Consuming slsDetectorPackage
===============================
Depending on how you want to build your integration with
slsDetectorPackage there are a few different ways to
consume our package. The recommended way is to use one of the
CMake approaches.
CMake: slsDetectorPackage as submodule in your project
---------------------------------------
If you are using CMake to build your integration and want to build everything
in one go, we support adding slsDetectorPackage as a subfolder in your cmake project.
A minimal CMakeLists.txt could look like this:
.. code-block:: cmake
project(myDetectorIntegration)
cmake_minimum_required(VERSION 3.12)
add_subdirectory(slsDetectorPackage)
#Add your executable
add_executable(example main.cpp)
target_compile_features(example PRIVATE cxx_std_11)
#Link towards slsDetectorShared
target_link_libraries(example slsDetectorShared)
A fully working example can be found at:
https://github.com/slsdetectorgroup/cmake-subfolder-example
CMake: find_package(slsDetectorPackage)
------------------------------------------
If you have compiled and installed slsDetectorPackage we also support
find_package in CMake. If installed in a system wide location no path
should be needed, otherwise specify cmake prefix path.
.. code-block:: cmake
cmake_minimum_required(VERSION 3.12)
project(myintegration)
find_package(slsDetectorPackage 5.0 REQUIRED)
add_executable(example main.cpp)
target_link_libraries(example slsDetectorShared)
Then assuming the slsDetectorPackage is installed in /path/to/sls/install
you should be able to configure and build your project in this way.
.. code-block:: bash
cmake ../path/to/your/source -DCMAKE_PREFIX_PATH=/path/to/sls/install
make
A minimal example is available at: https://github.com/slsdetectorgroup/minimal-cmake
CMake: find_package and conda
----------------------------------
.. note::
conda can also be used for installing dependencies such as zmq, Qt4 etc.
find_package(slsDetectorPackage) also works if you have installed slsDetectorPackage using conda.
The only difference is that you point CMake to $CONDA_PREFIX
.. code-block:: bash
#assuming myenv contains slsdetlib
conda activate myenv
cmake ../path/to/your/source -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
make
Depending on your system compiler you might also have to install gxx_linux-64 to compiled.
No tools minimal approach
-----------------------------
While not recommended it is still possible to specify the include and library paths
manually when invoking g++. This can sometimes be handy for a quick try.
.. code-block:: cpp
#include "Detector.h"
#include <iostream>
int main(){
sls::Detector det;
//Get all values and print them
std::cout << "Hostname: " << det.getHostname() << "\n";
std::cout << "Type: " << det.getDetectorType() << "\n";
std::cout << "Udp ip: " << det.getSourceUDPIP() << "\n";
//Get mac addr
const int module = 0;
auto mac = det.getSourceUDPMAC()[module];
std::cout << "Mac addr of module "<< module << " is " << mac.str() << '\n';
}
.. code-block:: bash
g++ -I/install/path/include/ -L/install/path/lib64/ myapp.cpp -lSlsDetector -lSlsSupport -Wl,-rpath=../install/path/lib64

View File

@ -13,7 +13,7 @@ To use the basic building blocks, meaning sls_detector_get/put and
the shared libraries these are needed: the shared libraries these are needed:
* Linux, preferably recent kernel (currently no cross platform support) * Linux, preferably recent kernel (currently no cross platform support)
* CMake > 3.12 * CMake > 3.9
* C++11 compatible compiler. (We test with gcc and clang) * C++11 compatible compiler. (We test with gcc and clang)
* ZeroMQ version 4 * ZeroMQ version 4
@ -24,7 +24,7 @@ GUI
The GUI is currently using Qt4 but watch out for an upgrade to 5. The GUI is currently using Qt4 but watch out for an upgrade to 5.
* Qt 4.8 * Qt 4.8
* Qwt 6.1 * Qwt 6
----------------------- -----------------------
Python bindings Python bindings
@ -42,7 +42,7 @@ The documentation that you are reading now is built with
* Doxygen (to extract C++ classes etc.) * Doxygen (to extract C++ classes etc.)
* Breathe (Sphinx plugin to handle doxygen xml) * Breathe (Sphinx plugin to handle doxygen xml)
* Sphinx with sphinx_rtd_theme * Sphinx
----------------------- -----------------------
Packaged in libs/ Packaged in libs/

View File

@ -1,115 +0,0 @@
Examples
===========
Setup
------------
The examples here assume that you have compiled and installed slsDetectorPackage
to ~/sls/install and that the option for SLS_USE_SIMULATOR was enabled. This also builds
the virtual detector servers that we will be using for testing.
We also add ~/sls/detector/install/bin to the path for convenience.
Compile examples
-------------------
The source code of the examples is available at:
https://github.com/slsdetectorgroup/api-examples
.. code-block:: bash
git clone https://github.com/slsdetectorgroup/api-examples.git
mkdir build && cd build
cmake ../api-examples -DCMAKE_PREFIX_PATH=~/sls/detector/install
make
Below follows a short description of what is included in the examples.
Running a config file [e1]
-----------------------------
.. code-block:: cpp
#include "Detector.h"
...
sls::Detector det;
det.loadConfig("path/to/config/file.config");
To configure the connection between PC and detector the easiest
is to run a config file. For this example we first launch a virtual Jungfrau server and
then set up the detector.
**Launch a virtual detector server**
.. code-block:: bash
jungfrauDetectorServer_virtual
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**
.. code-block:: bash
./e1-config one_det_no_receiver.config
- 12:01:06.371 INFO: Shared memory deleted /slsDetectorPackage_multi_0_sls_0
- 12:01:06.371 INFO: Shared memory deleted /slsDetectorPackage_multi_0
- 12:01:06.372 INFO: Shared memory created /slsDetectorPackage_multi_0
- 12:01:06.376 INFO: Loading configuration file: one_det_no_receiver.config
- 12:01:06.376 INFO: Adding detector localhost
- 12:01:06.377 INFO: Shared memory created /slsDetectorPackage_multi_0_sls_0
- 12:01:06.377 INFO: Checking Detector Version Compatibility
- 12:01:06.378 INFO: Detector connecting - updating!
hostname [localhost]
Jungfrau detector with 1 modules configured
Using the return type sls::Result [e2]
-----------------------------------------
Since many our detectors have multiple modules we cannot return
a single value when reading from the Detector. Hostname, Ip and also
for example exposure time can differ between modules.
Therefore we return Result<T> which is a thin wrapper around
std::vector.
.. code-block:: cpp
sls::Result<int> res1{1, 1, 1};
std::cout << "res1: " << res1 << '\n';
res1.squash();
res1.squash(-1);
Setting exposure time [e3]
-----------------------------------------
For setting times, like exposure time, period, delay etc.
we use std::chrono::duration.
Example 3 shows how to set and read exposure time as well
as converting to floating point.
.. code-block:: cpp
#include "Detector.h"
#include <chrono>
...
std::chrono::microseconds t0{500};
det.setExptime(t0);

View File

@ -9,6 +9,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "CmdProxy.h" #include "CmdProxy.h"
#include "Detector.h" #include "Detector.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
@ -51,4 +52,5 @@ int main() {
auto help = replace_all(tmp, "\n\t", "\n\t\t"); auto help = replace_all(tmp, "\n\t", "\n\t\t");
fs << '\t' << cmd << usage << help << "\n"; fs << '\t' << cmd << usage << help << "\n";
} }
} }

View File

@ -6,18 +6,12 @@
Welcome to slsDetectorPackage's documentation! Welcome to slsDetectorPackage's documentation!
============================================== ==============================================
.. note ::
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:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:caption: Installation: :caption: Installation:
installation installation
dependencies dependencies
consuming
.. toctree:: .. toctree::
:caption: C++ API :caption: C++ API
@ -26,7 +20,6 @@ Welcome to slsDetectorPackage's documentation!
detector detector
result result
receiver receiver
examples
.. toctree:: .. toctree::
:caption: Python API :caption: Python API

View File

@ -1,114 +1,5 @@
.. note ::
The default branch of our git repository is developer. It contains the
latest development version. It is expected to compile and work but
features might be added or tweaked. In some cases the API might also change
without being communicated. If absolute stability of the API is needed please
use one of the release versions.
.. warning ::
Before building from source make sure that you have the
:doc:`dependencies <../dependencies>` installed. If installing using conda, conda will
manage the dependencies.
Installation Installation
============================================== ==============================================
Build from source using CMake get the source etc.
---------------------------------
Note that on some systems, for example RH7, cmake v3+ is available under the cmake3 alias.
It is also required to clone with the option --recursive to get the git submodules used
in the package.
.. code-block:: bash
git clone --recursive https://github.com/slsdetectorgroup/slsDetectorPackage.git
mkdir build && cd build
cmake ../slsDetectorPackage -DCMAKE_INSTALL_PREFIX=/your/install/path
make -j12 #or whatever number of cores you are using to build
make install
The easiest way to configure options is to use the ccmake utility.
.. code-block:: bash
#from the build directory
ccmake .
Install binaries using conda
--------------------------------
Conda is not only useful to manage python environments but can also
be used as a user space package manager.
We have three different packages available:
* **slsdetlib**, shared libraries and command line utilities
* **slsdetgui**, GUI
* **slsdet**, Python bindings
.. code-block:: bash
#Add channels for dependencies and our library
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
conda config --set channel_priority strict
#cerate an environment with our library, then activate
conda create -n myenv slsdetlib=2020.07.23.dev0
conda activate myenv
#ready to use
sls_detector_get exptime
etc ...
.. code-block:: bash
#List available versions
conda search slsdet
Build from source on old distributions
-----------------------------------------
If your linux distribution doesn't come with a C++11 compiler (gcc>4.8) then
it's possible to install a newer gcc using conda and build the slsDetectorPackage
using this compiler
.. code-block:: bash
#Create an environment with the dependencies
conda create -n myenv gxx_linux-64 cmake zmq
conda activate myenv
cmake ../slsDetectorPackage -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
make -j12
Build this documentation
-------------------------------
The documentation for the slsDetectorPackage is build using a combination
of Doxygen, Sphinx and Breathe. The easiest way to install the dependencies
is to use conda
.. code-block:: bash
conda create -n myenv python sphinx sphinx_rtd_theme
Then enable the option SLS_BUILD_DOCS to create the targets
.. code-block:: bash
make docs # generate API docs and build Sphinx RST
make rst # rst only, saves time in case the API did not change

View File

@ -1,9 +1,9 @@
Detector Detector
===================================================== =====================================================
.. py:currentmodule:: slsdet .. py:currentmodule:: sls_detector
.. autoclass:: Detector .. autoclass:: ExperimentalDetector
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:

View File

@ -4,55 +4,9 @@ Enums
These enums are defined in slsDetectorDefs in the C++ package and These enums are defined in slsDetectorDefs in the C++ package and
exposed to Python through pybind11. exposed to Python through pybind11.
.. py:currentmodule:: slsdet .. py:currentmodule:: sls_detector
.. autoclass:: runStatus .. autoclass:: runStatus
:members:
:undoc-members: :undoc-members:
:show-inheritance:
.. autoclass:: detectorType
:undoc-members:
.. autoclass:: frameDiscardPolicy
:undoc-members:
.. autoclass:: fileFormat
:undoc-members:
.. autoclass:: dimension
:undoc-members:
.. autoclass:: externalSignalFlag
:undoc-members:
.. autoclass:: timingMode
:undoc-members:
.. autoclass:: dacIndex
:undoc-members:
.. autoclass:: detectorSettings
:undoc-members:
.. autoclass:: clockIndex
:undoc-members:
.. autoclass:: speedLevel
:undoc-members:
.. autoclass:: readoutMode
:undoc-members:
.. autoclass:: masterFlags
:undoc-members:
.. autoclass:: frameModeType
:undoc-members:
.. autoclass:: detectorModeType
:undoc-members:
.. autoclass:: burstMode
:undoc-members:
.. autoclass:: timingSourceType
:undoc-members:

View File

@ -74,7 +74,7 @@ But lets start looking at the at the manual way:
:: ::
import time import time
from slsdet import Eiger from sls_detector import Eiger
d = Eiger() d = Eiger()
n = 10 n = 10
@ -114,7 +114,7 @@ hang around until the main process exits.
import time import time
from multiprocessing import Process from multiprocessing import Process
from slsdet import Eiger from sls_detector import Eiger
def acquire(): def acquire():
""" """

View File

@ -1,6 +1,6 @@
Receiver Receiver
============================================== ==============================================
.. doxygenclass:: Receiver .. doxygenclass:: slsReceiver
:members: :members:
.. :undoc-members: .. :undoc-members:

View File

@ -12,7 +12,7 @@ hostname bchip007
0:rx_udpip 129.129.202.98 0:rx_udpip 129.129.202.98
0:rx_hostname pc6898 0:rx_hostname pc6898
0:outdir /bigRAID/datadir_gotthard/rec_test_data 0:outdir /bigRAID/datadir_gotthard/rec_test_data
0:highvoltage 120 0:vhighvoltage 120
master -1 master -1
sync none sync none
outdir /bigRAID/datadir_gotthard/rec_test_data outdir /bigRAID/datadir_gotthard/rec_test_data

View File

@ -1,129 +0,0 @@
#Gain index ADU value (12 bit)
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655
1 3655

View File

@ -1,129 +1,132 @@
#G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain #G1 Energy #G2 Energy #G1 Energy #G2 Energy
100 100 100 10 1 0.1 300 7000 300 7000
100 100 100 10 1 0.1 300 7000
100 100 100 10 1 0.1 300 7000 #G0 pedestal G1 pedestal G2 pedestal G0 gain G1 gain G2 gain (for every channel) ADU
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1 300 7000 100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1
100 100 100 10 1 0.1

View File

@ -1,29 +0,0 @@
hostname strip3
udp_srcip 10.1.1.184
udp_dstip 10.1.1.107
udp_dstport2 50084
udp_srcip2 10.1.1.185
udp_dstip2 10.1.1.107
rx_hostname pc12365:1954
#udp_dstmac 3c:fd:fe:d2:a4:25
fpath /tmp
fname run
fwrite 0
bursts 10
frames 2700
burstperiod 100ms
numinterfaces 2
veto 1
#fixing data looks
# Sampling pipeline 1 clk
reg 0x120 0x00000010
clkphase 1 135 deg

View File

@ -6,12 +6,12 @@ hostname bchip074+bchip075+
0:extsig:0 trigger_in_rising_edge 0:extsig:0 trigger_in_rising_edge
0:rx_tcpport 1954 0:rx_tcpport 1954
0:rx_udpport 50001 0:rx_udpport 50001
0:highvoltage 0 0:vhighvoltage 0
1:extsig:0 trigger_in_rising_edge 1:extsig:0 trigger_in_rising_edge
1:rx_tcpport 1955 1:rx_tcpport 1955
1:rx_udpport 50002 1:rx_udpport 50002
1:highvoltage 0 1:vhighvoltage 0
############################################################################## ##############################################################################
######### #########
@ -53,5 +53,5 @@ settings veryhighgain
exptime 0.000005 exptime 0.000005
period 0.0001 period 0.0001
highvoltage 90 vhighvoltage 90

View File

@ -6,7 +6,7 @@ hostname localhost
rx_hostname localhost rx_hostname localhost
#powerchip 1 #powerchip 1
#highvoltage 200 #vhighvoltage 200
#extsig:0 trigger_in_rising_edge #extsig:0 trigger_in_rising_edge
#timing trigger #timing trigger

View File

@ -17,7 +17,7 @@ hostname bchip048+bchip052+
rx_hostname pcmoench01 rx_hostname pcmoench01
powerchip 1 powerchip 1
highvoltage 200 vhighvoltage 200
#extsig:0 trigger_in_rising_edge #extsig:0 trigger_in_rising_edge
#timing trigger #timing trigger

View File

@ -1,14 +1,4 @@
initialchecks 0 hostname bchip085+
#############################################
### edit with hostname or IP address of your detector
############################################
hostname bchip181+
runclk 40
adcclk 20
dbitclk 40
patword 0000 0000000000000000 patword 0000 0000000000000000
patword 0001 0000000000000000 patword 0001 0000000000000000
@ -418,84 +408,84 @@ patnloop1 0
patloop2 0400 0400 patloop2 0400 0400
patnloop2 0 patnloop2 0
patwait0 00aa patwait0 00aa
patwaittime0 10000 patwaittime0 40000
patwait1 0400 patwait1 0400
patwaittime1 0 patwaittime1 0
patwait2 0400 patwait2 0400
patwaittime2 0 patwaittime2 0
#0:rx_tcpport 1977 ####mcp2011
#0:rx_udpip 10.1.1.102
#0:detectorip 10.1.1.19
#0:rx_udpport 32410
####gui listening to
#zmqip 129.129.202.131
#zmqport 30001
####data streaming out of
#rx_zmqip 10.1.2.103
#rx_zmqport 30003
#0:rx_hostname mpc2011
############################################# ####mx-test-1
### edit with 10 Gbs IP of your server 0:rx_udpip 10.1.1.100
############################################ 0:detectorip 10.1.1.19
0:udp_dstip 10.1.1.102 0:rx_udpport 32410
#0:udp_dstip 129.129.202.136 ####gui listening to (on receiver pc)
############################################# zmqip 129.129.202.92
### edit with any number in the subnet of your server (first 3 numbers as above) zmqport 30001
############################################ ####data streaming out of
0:udp_srcip 10.1.1.19 rx_zmqip 10.1.1.100
#0:udp_srcip 129.129.202.13 rx_zmqport 30003
0:rx_hostname pcmoench01
0:udp_dstport 33410
#############################################
### edit with 10 Gbs IP of your server
############################################
#zmqip 129.129.202.110
#rx_zmqip 10.1.1.102
#rx_zmqport 30001
#############################################
### edit with 1 Gbs IP of PC where you will run the GUI
############################################
#zmqip 129.129.202.110
#zmqport 50001
#############################################
### edit with hostname or 1Gbs IP address of your server
############################################
rx_hostname mpc2011
tengiga 1
#turn on datastream from commandline
rx_datastream 1 rx_datastream 1
rx_readfreq 1
r_readfreq 1
#0:configuremac -1
rx_datastream 1
r_readfreq 1
dac 6 800 dac:6 800
dac 0 1300 dac:0 1300
dac 4 1428 dac:4 1428
dac 1 1000 dac:1 1000
dac 7 900 dac:7 900
dac 3 680 dac:3 680
dac 2 1400 dac:2 1400
dac 5 1200 dac:5 1200
adcinvert 4a342593 adcinvert 4a342593
#0xb5cbda6c samples 5000
asamples 5000 adcphase 90
dsamples 0 adcpipeline 15
adcphase 30 deg
adcpipeline 14
adcreg 14 40 adcreg 14 40
powerchip 1
vhighvoltage 90
period 0.005
frames 1000
period 0.001
#############################################
### edit with directory you want to write to
############################################
fpath /tmp/
fwrite 0
romode analog
#rx_jsonaddheader frameMode
rx_jsonpara frameMode newpedestal
#rx_jsonaddheader detectorMode
rx_jsonpara detectorMode analog
#flags newpedestal
#flags analog
reg 0x5e 0x00010000
#powerchip 1
highvoltage 90 frames 100
period 0.1
outdir /scratch/
enablefwrite 0

View File

@ -1,63 +0,0 @@
initialchecks 0
#############################################
### edit with hostname or IP address of your detector
############################################
hostname bchip181+
#############################################
### edit with hostname or 1Gbs IP address of your server
############################################
rx_hostname mpc2011
rx_tcpport 1954
#############################################
### edit with 10 Gbs IP of your server
############################################
udp_dstip 10.1.1.102
#############################################
### edit with any number in the subnet of your server (first 3 numbers as above)
############################################
udp_srcip 10.1.1.19
udp_dstport 32411
#############################################
### edit with 10 Gbs IP of your server
############################################
rx_zmqip 10.1.1.102
rx_zmqport 50003
#############################################
### edit with 1 Gbs IP of PC where you will run the GUI
############################################
zmqip 129.129.202.136
zmqport 50001
tengiga 1
rx_datastream 1
frames 100000
period 0.0006
#############################################
### edit with directory you want to write to
############################################
fpath /mnt/moench_data/scratch/
fwrite 0
rx_datastream 1
rx_jsonpara frameMode frame
rx_jsonpara detectorMode counting
rx_discardpolicy discardpartial
adcpipeline 15
powerchip 1
highvoltage 90
#adcreg 0x14 0x40

View File

@ -19,7 +19,7 @@ hostname bchip007+bchip009+
0:rx_udpip 10.1.1.1 0:rx_udpip 10.1.1.1
0:rx_hostname 129.129.202.134 0:rx_hostname 129.129.202.134
0:outdir /data/speedt 0:outdir /data/speedt
0:highvoltage 120 0:vhighvoltage 120
#1:hostname bchip009 #1:hostname bchip009
@ -37,7 +37,7 @@ hostname bchip007+bchip009+
1:rx_udpip 10.1.2.1 1:rx_udpip 10.1.2.1
1:rx_hostname 129.129.202.134 1:rx_hostname 129.129.202.134
1:outdir /data/speedt 1:outdir /data/speedt
1:highvoltage 120 1:vhighvoltage 120
master -1 master -1

View File

@ -1,5 +1,5 @@
#include "DetectorImpl.h"
#include "catch.hpp" #include "catch.hpp"
#include "DetectorImpl.h"
#include "string_utils.h" #include "string_utils.h"
#include "tests/globals.h" #include "tests/globals.h"
#include <iostream> #include <iostream>

68
integrationTests/test-integrationDectector.cpp Normal file → Executable file
View File

@ -2,9 +2,9 @@
#include "catch.hpp" #include "catch.hpp"
#include "ClientSocket.h" #include "ClientSocket.h"
#include "DetectorImpl.h"
#include "Module.h"
#include "logger.h" #include "logger.h"
#include "DetectorImpl.h"
#include "slsDetector.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "Timer.h" #include "Timer.h"
@ -23,10 +23,10 @@
// extern dt type; // extern dt type;
TEST_CASE("Single detector no receiver", "[.integration][.single]") { TEST_CASE("Single detector no receiver", "[.integration][.single]") {
auto t = Module::getTypeFromDetector(test::hostname); auto t = slsDetector::getTypeFromDetector(test::hostname);
CHECK(t == test::type); CHECK(t == test::type);
Module d(t); slsDetector d(t);
CHECK(d.getDetectorTypeAsEnum() == t); CHECK(d.getDetectorTypeAsEnum() == t);
CHECK(d.getDetectorTypeAsString() == test::detector_type); CHECK(d.getDetectorTypeAsString() == test::detector_type);
@ -51,7 +51,7 @@ TEST_CASE("Set control port then create a new object with this control port",
int new_cport = 1993; int new_cport = 1993;
int new_sport = 2000; int new_sport = 2000;
{ {
Module d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
CHECK(d.getControlPort() == old_cport); CHECK(d.getControlPort() == old_cport);
d.setControlPort(new_cport); d.setControlPort(new_cport);
@ -60,7 +60,7 @@ TEST_CASE("Set control port then create a new object with this control port",
d.freeSharedMemory(); d.freeSharedMemory();
} }
{ {
Module d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
d.setControlPort(new_cport); d.setControlPort(new_cport);
d.setStopPort(new_sport); d.setStopPort(new_sport);
@ -73,23 +73,24 @@ TEST_CASE("Set control port then create a new object with this control port",
d.freeSharedMemory(); d.freeSharedMemory();
} }
Module d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
CHECK(d.getStopPort() == DEFAULT_PORTNO + 1); CHECK(d.getStopPort() == DEFAULT_PORTNO + 1);
d.freeSharedMemory(); d.freeSharedMemory();
} }
TEST_CASE("single EIGER detector no receiver basic set and get", TEST_CASE("single EIGER detector no receiver basic set and get",
"[.integration][eiger]") { "[.integration][eiger]") {
// TODO! this test should take command line arguments for config // TODO! this test should take command line arguments for config
SingleDetectorConfig c; SingleDetectorConfig c;
// Read type by connecting to the detector // Read type by connecting to the detector
auto type = Module::getTypeFromDetector(c.hostname); auto type = slsDetector::getTypeFromDetector(c.hostname);
CHECK(type == c.type_enum); CHECK(type == c.type_enum);
// Create Module of said type and set hostname and detector online // Create slsDetector of said type and set hostname and detector online
Module d(type); slsDetector d(type);
CHECK(d.getDetectorTypeAsEnum() == type); CHECK(d.getDetectorTypeAsEnum() == type);
CHECK(d.getDetectorTypeAsString() == c.type_string); CHECK(d.getDetectorTypeAsString() == c.type_string);
@ -129,8 +130,10 @@ TEST_CASE("single EIGER detector no receiver basic set and get",
d.freeSharedMemory(); d.freeSharedMemory();
} }
TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") { TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
Module d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
// Check that detector server is unlocked then lock // Check that detector server is unlocked then lock
@ -151,12 +154,13 @@ TEST_CASE("Locking mechanism and last ip", "[.integration][.single]") {
d.freeSharedMemory(); d.freeSharedMemory();
} }
TEST_CASE("Set settings", "[.integration][.single]") { TEST_CASE("Set settings", "[.integration][.single]"){
Module d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD); CHECK(d.setSettings(defs::STANDARD) == defs::STANDARD);
} }
TEST_CASE("Timer functions", "[.integration][cli]") { TEST_CASE("Timer functions", "[.integration][cli]") {
// FRAME_NUMBER, /**< number of real time frames: total number of // FRAME_NUMBER, /**< number of real time frames: total number of
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME, // acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
@ -181,7 +185,7 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
// MEASURED_SUBPERIOD, /**< measured subperiod */ // MEASURED_SUBPERIOD, /**< measured subperiod */
// MAX_TIMERS // MAX_TIMERS
Module d(test::type); slsDetector d(test::type);
d.setHostname(test::hostname); d.setHostname(test::hostname);
// Number of frames // Number of frames
@ -200,7 +204,8 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
if (test::type != dt::EIGER) { if (test::type != dt::EIGER) {
auto delay = 10000; auto delay = 10000;
d.setDelayAfterTrigger(delay); d.setDelayAfterTrigger(delay);
CHECK(d.getDelayAfterTrigger() == delay); CHECK(d.getDelayAfterTrigger() ==
delay);
} }
auto triggers = 2; auto triggers = 2;
@ -213,15 +218,16 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
CHECK(d.getSubExptime() == subtime); CHECK(d.getSubExptime() == subtime);
} }
// for (int i =0; i!=frames; ++i) // for (int i =0; i!=frames; ++i)
d.startAndReadAll(); d.startAndReadAll();
d.freeSharedMemory(); d.freeSharedMemory();
} }
// TEST_CASE("Aquire", "[.integration][eiger]"){ // TEST_CASE("Aquire", "[.integration][eiger]"){
// SingleDetectorConfig c; // SingleDetectorConfig c;
// auto type = Module::getTypeFromDetector(c.hostname); // auto type = slsDetector::getTypeFromDetector(c.hostname);
// Module d(type); // slsDetector d(type);
// d.setHostname(c.hostname); // d.setHostname(c.hostname);
// auto period = 1000000000; // auto period = 1000000000;
@ -376,8 +382,8 @@ TEST_CASE("Chiptestboard Loading Patterns", "[.ctbintegration]") {
} }
} }
TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
"[.ctbintegration][dbit]") { TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert", "[.ctbintegration][dbit]") {
SingleDetectorConfig c; SingleDetectorConfig c;
// pick up multi detector from shm id 0 // pick up multi detector from shm id 0
@ -397,7 +403,7 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
// dbit list // dbit list
std::vector<int> list = m.getReceiverDbitList(); std::vector <int> list = m.getReceiverDbitList();
list.clear(); list.clear();
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)
list.push_back(i); list.push_back(i);
@ -408,14 +414,14 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
list.push_back(64); list.push_back(64);
CHECK_THROWS_AS(m.setReceiverDbitList(list), sls::RuntimeError); CHECK_THROWS_AS(m.setReceiverDbitList(list), sls::RuntimeError);
CHECK_THROWS_WITH(m.setReceiverDbitList(list), CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be between 0 and 63")); Catch::Matchers::Contains("be between 0 and 63"));
list.clear(); list.clear();
for (int i = 0; i < 65; ++i) for (int i = 0; i < 65; ++i)
list.push_back(i); list.push_back(i);
CHECK(list.size() == 65); CHECK(list.size() == 65);
CHECK_THROWS_WITH(m.setReceiverDbitList(list), CHECK_THROWS_WITH(m.setReceiverDbitList(list),
Catch::Matchers::Contains("be greater than 64")); Catch::Matchers::Contains("be greater than 64"));
list.clear(); list.clear();
m.setReceiverDbitList(list); m.setReceiverDbitList(list);
@ -435,7 +441,7 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
m.setExternalSamplingSource(62); m.setExternalSamplingSource(62);
CHECK(m.getExternalSamplingSource() == 62); CHECK(m.getExternalSamplingSource() == 62);
CHECK_THROWS_WITH(m.setExternalSamplingSource(64), CHECK_THROWS_WITH(m.setExternalSamplingSource(64),
Catch::Matchers::Contains("be 0-63")); Catch::Matchers::Contains("be 0-63"));
CHECK(m.getExternalSamplingSource() == 62); CHECK(m.getExternalSamplingSource() == 62);
m.setExternalSampling(1); m.setExternalSampling(1);
CHECK(m.getExternalSampling() == 1); CHECK(m.getExternalSampling() == 1);
@ -444,23 +450,20 @@ TEST_CASE("Chiptestboard Dbit offset, list, sampling, advinvert",
m.setExternalSampling(1); m.setExternalSampling(1);
CHECK(m.getExternalSampling() == 1); CHECK(m.getExternalSampling() == 1);
CHECK(m.readRegister(0x7b) == 0x1003E); CHECK(m.readRegister(0x7b) == 0x1003E);
} }
TEST_CASE("Eiger or Jungfrau startingfnum", TEST_CASE("Eiger or Jungfrau startingfnum", "[.eigerintegration][.jungfrauintegration][startingfnum]") {
"[.eigerintegration][.jungfrauintegration][startingfnum]") {
SingleDetectorConfig c; SingleDetectorConfig c;
// pick up multi detector from shm id 0 // pick up multi detector from shm id 0
DetectorImpl m(0); DetectorImpl m(0);
// ensure ctb detector type, hostname and online // ensure ctb detector type, hostname and online
REQUIRE( REQUIRE(((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) || (m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::JUNGFRAU)));
((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER) ||
(m.getDetectorTypeAsEnum() ==
slsDetectorDefs::detectorType::JUNGFRAU)));
REQUIRE(m.getHostname() == c.hostname); REQUIRE(m.getHostname() == c.hostname);
CHECK(m.setNumberOfFrames(1) == 1); CHECK(m.setNumberOfFrames(1) == 1);
// starting fnum // starting fnum
uint64_t val = 8; uint64_t val = 8;
@ -495,8 +498,7 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
DetectorImpl m(0); DetectorImpl m(0);
// ensure detector type, hostname // ensure detector type, hostname
REQUIRE( REQUIRE((m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
(m.getDetectorTypeAsEnum() == slsDetectorDefs::detectorType::EIGER));
REQUIRE(m.getHostname() == c.hostname); REQUIRE(m.getHostname() == c.hostname);
m.setDynamicRange(16); m.setDynamicRange(16);

6
integrationTests/test-integrationMulti.cpp Normal file → Executable file
View File

@ -1,5 +1,5 @@
#include "DetectorImpl.h"
#include "catch.hpp" #include "catch.hpp"
#include "DetectorImpl.h"
#include "string_utils.h" #include "string_utils.h"
#include "tests/globals.h" #include "tests/globals.h"
#include <iostream> #include <iostream>
@ -24,6 +24,8 @@ TEST_CASE("Initialize a multi detector", "[.integration][.multi]") {
d.freeSharedMemory(); d.freeSharedMemory();
} }
TEST_CASE("Set and read timers", "[.integration][.multi]") { TEST_CASE("Set and read timers", "[.integration][.multi]") {
DetectorImpl d(0, true, true); DetectorImpl d(0, true, true);
@ -55,6 +57,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
// PROGRESS, /**< fraction of measurement elapsed - only get! */ // PROGRESS, /**< fraction of measurement elapsed - only get! */
// MEASUREMENTS_NUMBER, // MEASUREMENTS_NUMBER,
// FRAMES_FROM_START, // FRAMES_FROM_START,
// FRAMES_FROM_START_PG, // FRAMES_FROM_START_PG,
// SAMPLES, // SAMPLES,
@ -75,6 +78,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime)); CHECK(d.setSubFrameExposureDeadTime(-1) == Approx(subframe_deadtime));
} }
if (test::type == dt::EIGER) { if (test::type == dt::EIGER) {
// 32bit is needed for subframe exposure // 32bit is needed for subframe exposure
d.setDynamicRange(32); d.setDynamicRange(32);

View File

@ -99,7 +99,7 @@ If one desires to set the zmqport manually, he offset has to be taken into accou
{\tt{slsMultiReceiver}} uses two or more receivers in one single terminal: {\tt{./slsMultiReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased. {\tt{slsMultiReceiver}} uses two or more receivers in one single terminal: {\tt{./slsMultiReceiver startTCPPort numReceivers withCallback}}, where startTCPPort assumes the other ports are consecutively increased.
The command {\tt{r\_framesperfile}} (\tt{\textcolor{red}{rx\_framesperfile}}) sets the number of frames written in the same file. By default now it is 10000. It can be changes. It needs to be lowered particularly if one wants to parallelize the following conversion of the files. The command {\tt{r\_framesperfile}} sets the number of frames written in the same file. By default now it is 10000. It can be changes. It needs to be lowered particularly if one wants to parallelize the following conversion of the files.
\subsection{Mandatory setup - Client} \subsection{Mandatory setup - Client}
@ -122,23 +122,7 @@ To do that:
sls_detector_put 0-config mydetector.config sls_detector_put 0-config mydetector.config
\end{verbatim} \end{verbatim}
In the config file, if client, receiver and detector are using \textbf{1GbE} the following lines are mandatory (see slsDetectorsPackage/examples/eiger\_1Gb.config). It has been adapted to the the new 5.0 major release change: In the config file, if client, receiver and detector are using \textbf{1GbE} the following lines are mandatory (see slsDetectorsPackage/examples/eiger\_1Gb.config):
\begin{verbatim}
detsize 1024 512 #detector geometry, long side of the module first
hostname beb059+beb058+ #1Gb detector hostname for controls
#1Gb receiver pc hostname to be inserted immediately and tcp\_ports to be stated immediately
rx_hostname x12sa-vcons:1991+pc1875:1992+
0:udp_dstport 50011 #udp port first quadrant, first halfmodule
0:udp_dstport2 50012 #udp port second quadrant, first halfmodule
1:udp_dstport 50013 #udp port first quadrant, second halfmodule
1:udp_dstport2 50014 #udp port second quadrant, second halfmodule
0:udp_srcip 129.129.202.237
0:udp_dstip auto
1:udp_srcip 129.129.202.236
1:udp_dstip auto
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M
\end{verbatim}
In the old 3.x and 4.x release it was:
\begin{verbatim} \begin{verbatim}
detsizechan 1024 512 #detector geometry, long side of the module first detsizechan 1024 512 #detector geometry, long side of the module first
hostname beb059+beb058+ #1Gb detector hostname for controls hostname beb059+beb058+ #1Gb detector hostname for controls
@ -154,39 +138,21 @@ threaded 1
\end{verbatim} \end{verbatim}
In the config file, if client, receiver and detector commands are on 1Gb, but detector data to receiver are sent using \textbf{10GbE} the following lines are mandatory (see slsDetectorsPackage/examples/eiger\_10Gb.config): In the config file, if client, receiver and detector commands are on 1Gb, but detector data to receiver are sent using \textbf{10GbE} the following lines are mandatory (see slsDetectorsPackage/examples/eiger\_10Gb.config):
It has been adapted to the the new 5.0 major release change:
\begin{verbatim}
detsize 1024 512
hostname beb059+beb058+
rx_hostname pc1875:1955+pc1875:1956+
0:udp_dstport 50011
0:udp_dstport2 50012
0:udp_dstip 10.0.30.210
0:udp_srcip 10.0.30.100
1:flippeddatax 1
1:udp_dstport 50013
1:udp_dstport2 50014
1:udp_dstip 0.0.40.210
1:udp_srcip 10.0.40.101
fpath /sls/X12SA/data/x12saop/Data10/Eiger0.5M
\end{verbatim}
In the old 3.x and 4.x release it was:
\begin{verbatim} \begin{verbatim}
detsizechan 1024 512 #detector geometry, long side of the module first detsizechan 1024 512 #detector geometry, long side of the module first
hostname beb059+beb058+ #1Gb detector hostname for controls hostname beb059+beb058+ #1Gb detector hostname for controls
0:rx_tcpport 1955 #tcpport for the first halfmodule 0:rx_tcpport 1991 #tcpport for the first halfmodule
0:rx_udpport 50011 #udp port first quadrant, first halfmodule 0:rx_udpport 50011 #udp port first quadrant, first halfmodule
0:rx_udpport2 50012 #udp port second quadrant, first halfmodule 0:rx_udpport2 50012 #udp port second quadrant, first halfmodule
0:rx_udpip 10.0.30.210 #udp IP of the receiver over 10Gb 0:rx_udpip 10.0.30.210 #udp IP of the receiver over 10Gb
0:detectorip 10.0.30.100 #first half module 10 Gb IP 0:detectorip 10.0.30.100 #first half module 10 Gb IP
1:flippeddatax 1 1:rx_tcpport 1992 #tcpport for the second halfmodule
1:rx_tcpport 1956 #tcpport for the second halfmodule
1:rx_udpport 50013 #udp port first quadrant, second halfmodule 1:rx_udpport 50013 #udp port first quadrant, second halfmodule
1:rx_udpport2 50014 #udp port second quadrant, second halfmodule 1:rx_udpport2 50014 #udp port second quadrant, second halfmodule
1:rx_udpip 10.0.40.210 #udp IP of the receiver over 10Gb, 1:rx_udpip 10.0.40.210 #udp IP of the receiver over 10Gb,
can be the same or different from 0:rx_udpip can be the same or different from 0:rx_udpip
1:detectorip 10.0.40.101 #second half module 10 Gb IP 1:detectorip 10.0.40.101 #second half module 10 Gb IP
rx_hostname pc1875 #1Gb receiver pc hostname rx_hostname x12sa-vcons #1Gb receiver pc hostname
outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M outdir /sls/X12SA/data/x12saop/Data10/Eiger0.5M
threaded 1 threaded 1
\end{verbatim} \end{verbatim}
@ -206,25 +172,23 @@ configuremac 0
rx_udpmac xx:xx:... rx_udpmac xx:xx:...
\end{verbatim} \end{verbatim}
Now we will give general communication commands. Commands with a diffent name in the \textcolor{red}{5.x} realease will be highlighted in \textcolor{red}{red}.
One can configure all the detector settings in a parameter file {\tt{setup.det}}, which is loaded by doing: One can configure all the detector settings in a parameter file {\tt{setup.det}}, which is loaded by doing:
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-parameters setup.det sls_detector_put 0-parameters setup.det
\end{verbatim} \end{verbatim}
Note that the parameter file for any realease before 4.1.1 has not the possibility to understand parameters to be set differently for different half modules, i.e. {\tt{0:txndelay\_left xxxxx},\tt{1:txndelay\_left yyyyy}}.
In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{highvoltage 150}}. Other detector functionality, which are rarely changed can be setup here. In the case of \E, the proper bias voltage of the sensor has to be setup, i.e. the {\tt{setup.det}} file needs to contain the line {\tt{vhighvoltage 150}}. Other detector functionality, which are rarely changed can be setup here.
Other important settings that are configured in the {\tt{setup.det}} file are: Other important settings that are configured in the {\tt{setup.det}} file are:
\begin{itemize} \begin{itemize}
\item {\tt{tengiga 0/1}}, which sets whether the detector is enabled to send data through the 1~or the 10~Gb Ethernet. \item {\tt{tengiga 0/1}}, which sets whether the detector is enabled to send data through the 1~or the 10~Gb Ethernet.
\item {\tt{flags parallel/nonparallel}} or {\tt{\textcolor{red}{parallel 1/0}}}, which sets whether the detector is set in parallel acquisition and readout or in sequential mode. This changes the readout time of the chip and affects the frame rate capability (faster is {\tt{parallel}}). \item {\tt{flags parallel/nonparallel}}, which sets whether the detector is set in parallel acquisition and readout or in sequential mode. This changes the readout time of the chip and affects the frame rate capability (faster is {\tt{parallel}}, with higher noise but needed when the frame rate is $>2$~kHz.
\item {\tt{dr 32/16/8/4}} sets the detector in autosumming mode (32 bit counter or not autosumming, 12 bit out of the chip). This is strictly connected to what is required for the readout clock of chip. See next point. \item {\tt{dr 32/16/8/4}} sets the detector in autosumming mode (32 bit counter or not autosumming, 12 bit out of the chip). This is strictly connected to what is required for the readout clock of chip. See next point.
\item {\tt{clkdivider 0/1/2}} or {\tt{\textcolor{red}{speed full\_speed/half\_speed/quart\_speed}}}. Changes the readout clock: 200, 100, 50~MHz (also referred to as full, half, quarter speed). Note that autosumming mode ({\tt{dr 32}} only works at \tt{clkdivider 2}=\tt{quart\_speed}). By selecting Refer to readout timing specifications in~section\ref{timing} for how to set the detector. \item {\tt{clkdivider 0/1/2}}. Changes the readout clock: 200, 100, 50~MHz (also referred to as full, half, quarter speed). Note that autosumming mode ({\tt{dr 32}} only works at {clkdivider 2}=quarter speed). By selecting Refer to readout timing specifications in~section\ref{timing} for how to set the detector.
\item {\tt{flags continuous/storeinram}}. Allows to take frame continuously or storing them on memory. Users should use the {\tt{continuous}} flags. Enabling the {\tt{stroreinram}} flag makes the data to be sent out all at the end of the acquisition. Refer to readout timing specifications in section~\ref{timing} for how to set the detector. Examples will be given in section~\ref{}. \item {\tt{flags continuous/storeinram}}. Allows to take frame continuously or storing them on memory. Users should use the {\tt{continuous}} flags. Enabling the {\tt{stroreinram}} flag makes the data to be sent out all at the end of the acquisition. Refer to readout timing specifications in section~\ref{timing} for how to set the detector. Examples will be given in section~\ref{}.
\end{itemize} \end{itemize}
One should notice that, by default, by choosing the option {\tt{dr 32}}, then the software automatically sets the detector to {\tt{clkdivider 2}} ({\tt{\textcolor{red}{quart\_speed}}}). By choosing the option {\tt{dr 16}}, the software automatically sets the detector to {\tt{clkdivider 1}} ({\tt{\textcolor{red}{speed quart\_speed}}}). From release 5.x, One should notice that, by default, by choosing the option {\tt{dr 32}}, then the software automatically sets the detector to {\tt{clkdivider 2}}. By choosing the option {\tt{dr 16}}, the software automatically sets the detector to {\tt{clkdivider 1}}. One needs to choose {\tt{clkdivider 0}} after setting the {\tt{dr 16}} option to have the fastest frame rate.
We would recommend expert users (beamline people) to write their parameters file for the users.
\section{API versioning} \label{api} \section{API versioning} \label{api}
The eigerDetectorServer running on the boards has a versioning API scheme that will make it crash if used with a wrong firmware. The eigerDetectorServer running on the boards has a versioning API scheme that will make it crash if used with a wrong firmware.
@ -245,18 +209,10 @@ Killing and starting the server on the boards allows you to check the firmware v
\section{Setting up the threshold} \section{Setting up the threshold}
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-settingsdir /path
sls_detector_put 0-trimen N xxxx yyyy zzzz sls_detector_put 0-trimen N xxxx yyyy zzzz
sls_detector_put 0-settings standard sls_detector_put 0-settings standard
sls_detector_put 0-threshold energy_in_eV standard sls_detector_put 0-threshold energy_in_eV standard
\end{verbatim} \end{verbatim}
or in \textcolor{red}{5.x}:
\begin{verbatim}
sls_detector_put 0-settingspath /path}
sls_detector_put 0-trimen N xxxx yyyy zzzz}
sls_detector_put 0-threshold energy_in_eV standard
\end{verbatim}
The first line requires to specify how many ({\tt{N}}) and at which energies in eV {\{tt{xxxx}}, {\tt{yyyy}}, {\tt{zzzz}} and so on) trimmed files were generated (to allow for an interpolation). This line should normally be included into the {\tt{mydetector.config}} file and should be set for you by one of the detector group. The first line requires to specify how many ({\tt{N}}) and at which energies in eV {\{tt{xxxx}}, {\tt{yyyy}}, {\tt{zzzz}} and so on) trimmed files were generated (to allow for an interpolation). This line should normally be included into the {\tt{mydetector.config}} file and should be set for you by one of the detector group.
NORMALLY, in this new calibration scheme, only {\tt{settings standard}} will be provided to you, unless specific cases to be discussed. NORMALLY, in this new calibration scheme, only {\tt{settings standard}} will be provided to you, unless specific cases to be discussed.
The threshold at 6000 eV , for example would be set as:{\tt{sls\_detector\_put 0-threshold 6000 standard}}. The threshold at 6000 eV , for example would be set as:{\tt{sls\_detector\_put 0-threshold 6000 standard}}.
@ -287,11 +243,11 @@ In this acquisition 10 consecutive 1~s frames will be acquired. Note that {\tt{p
You need to setup where the files will be written to You need to setup where the files will be written to
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-outdir /scratch (\textcolor{red}{0-fpath}) sls_detector_put 0-outdir /scratch
sls_detector_put 0-fname run sls_detector_put 0-fname run
sls_detector_put 0-index 0 (\textcolor{red}{0-findex}) sls_detector_put 0-index 0
\end{verbatim} \end{verbatim}
this way your files will all be named /scratch/run\_dj\_i.raw where $j$ is relative to each specific half module, $i$ in the {\tt{index}} starts from 0 when starting the detector the first time and is automatically incremented. The next acquisition {\tt{index}} will be 1. One can reset the {\tt{index}} (\tt{\textcolor{red}{findex}}) to what wished. this way your files will all be named /scratch/run\_dj\_i.raw where $j$ is relative to each specific half module, $i$ in the {\tt{index}} starts from 0 when starting the detector the first time and is automatically incremented. The next acquisition {\tt{index}} will be 1. One can reset the {\tt{index}} to what wished.
To acquire simply type: To acquire simply type:
\begin{verbatim} \begin{verbatim}
@ -310,13 +266,12 @@ sls_detector_get receiver
There is a more complex way of performing an acquisition, that is useful for debugging and in case one wants a non blocking behavior: There is a more complex way of performing an acquisition, that is useful for debugging and in case one wants a non blocking behavior:
You can then reset to zero the number of frames caught (in releases<5.0), then start the receiver and the detector: You can then reset to zero the number of frames caught, then start the receiver and the detector:
\begin{enumerate} \begin{enumerate}
\item {\tt{sls\_detector\_put 0-resetframescaught 0}} \item {\tt{sls\_detector\_put 0-resetframescaught 0}}
\item {\tt{sls\_detector\_put 0-receiver start}} \item {\tt{sls\_detector\_put 0-receiver start}}
\item {\tt{sls\_detector\_put 0-status start}} \item {\tt{sls\_detector\_put 0-status start}}
\end{enumerate} \end{enumerate}
In release \textcolor{red}{5.0} it is not needed to reset the frames caughts.
You can poll the detector status using: You can poll the detector status using:
\begin{verbatim} \begin{verbatim}
@ -391,11 +346,8 @@ col : 257 pixels
\end{verbatim} \end{verbatim}
\section{Readout timing- maximum frame rate}\label{timing} \section{Readout timing- maximum frame rate}\label{timing}
IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the {\tt{textcolor}{red}{speed} at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} ({\tt{ IMPORTANT: to have faster readout and smaller dead time, one can configure {\tt{clkdivider}}, i.e. the speed at which the data are read, i.e. 200/100/50~MHz for {\tt{clkdivider 0/1/2}} and the dead time between frames through {\tt{flags parallel}}, i.e. acquire and read at the same time or acquire and then read out.
\textcolor{red}{speed full\_speed/half\_speed/quart\_speed}}) and the dead time between frames through {\tt{flags parallel}} or {\tt{\textcolor{red}{parallel 1}}}, i.e. acquire and read at the same time or acquire and then read out. The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT.
The configuration of this timing variables allows to achieve different frame rates. NOTE THAT IN EIGER, WHATEVER YOU DO, THE FRAME RATE LIMITATIONS COME FROM THE NETWORK BOTTLENECK AS THE HARDWARE GOES FASTER THAN THE DATA OUT. WE recconmmend using the detector in \tt{dr 4/8/16}, \tt{\textcolor{red}{speed full\_speed}}, \tt{parallel 1} or \tt{dr 32}, \tt{\textcolor{red}{speed quart\_speed}}, \tt{parallel 1. All those options are now the defaults options starting from version 5.x.
In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}. The time to send out the frame out of the board In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from the boards (independent on how the chip is set), the continuous frame rates are listed in table~\ref{tcont}. The time to send out the frame out of the board
\begin{table} \begin{table}
@ -407,16 +359,16 @@ In the case of REAL CONTINUOUS readout, i.e. continuous acquire and readout from
\hline \hline
1 & 32 & \textbf{128} & 7820 & \\ 1 & 32 & \textbf{128} & 7820 & \\
\hline \hline
10 & 4 & \textbf{7813} & 98 & 105/128\\ 10 & 4 & \textbf{10240} & 98 & 105/128\\
\hline \hline
10 & 8 & \textbf{4000} & 196 & 210/250\\ 10 & 8 & \textbf{5120} & 196 & 210/250\\
\hline \hline
10 & 16 & \textbf{2000} & 391 & 420/490\\ 10 & 16 & \textbf{2560} & 391 & 420/490\\
\hline \hline
10 & 32 & \textbf{1023} & 782 & 840/977\\ 10 & 32 & \textbf{1280} & 782 & 840/977\\
\hline \hline
\end{tabular} \end{tabular}
\caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1023~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.} \caption{Frame rate limits for the CONTINUOS streaming out of images, i.e. the data rate out is just below 1Gb/s or 10Gb/s. 1280~Hz for 32-bit, 10GbE is obtained from the 10GbE limitation. The maximum achievable frame rate is 977~Hz.}
\label{tcont}\end{table} \label{tcont}\end{table}
Note that in the {\tt{continuous}} flag mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuous one can be achieved. Still, this extra buffering is possible till the memories are not saturated. The number of images that can be stored on the DDR2 on board memories are listed in table~\ref{timgs}. Note that in the {\tt{continuous}} flag mode, some buffering is still done on the memories, so a higher frame rate than the proper real continuous one can be achieved. Still, this extra buffering is possible till the memories are not saturated. The number of images that can be stored on the DDR2 on board memories are listed in table~\ref{timgs}.
\begin{table} \begin{table}
@ -431,11 +383,11 @@ dynamic range & images\\
16 & 7600\\ 16 & 7600\\
\hline \hline
\end{tabular} \end{tabular}
\caption{Amount of images that can be stored on board. As while we store them, we start to send them out, the effective number of images could be larger than this, but it will depend on the network setup (how fast you stream out images).} \caption{Amount of images that can be stored on board. As while we store them, we start to send them out, the effective number of images could be larger than this, but it will depend on the network setup (how fats you stream out images).}
\label{timgs} \label{timgs}
\end{table} \end{table}
The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}} ({\tt{\textcolor{red}{parallel 1}}}),{\tt{clkdivider 0}} ({\tt{\textcolor{red}{speed full\_speed}}}), \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit, internally, to be \textbf{2~kHz} ({\tt{clkdivider 2}}). The maximum frame rate achievable with 10~GbE, {\tt{dr 16}}, {\tt{flags continuous}}, {\tt{flags parallel}},{\tt{clkdivider 0}}, \textbf{6.1~kHz}. This is currently limited by the connection between the Front End Board and the Backend board. We expect the 32 bit mode limit, internally, to be \textbf{2~kHz} ({\tt{clkdivider 2}}).
In dynamic range {\tt{dr 8}} the frame rate is \textbf{11~kHz} and for{\tt{dr 4}} is \textbf{22~kHz}. For 4 and 8 bit mode the frame rate are directly limited by the speed of the detector chip and not by the readout boards. In dynamic range {\tt{dr 8}} the frame rate is \textbf{11~kHz} and for{\tt{dr 4}} is \textbf{22~kHz}. For 4 and 8 bit mode the frame rate are directly limited by the speed of the detector chip and not by the readout boards.
\subsection{Minimum time between frames and Maximum frame rate} \subsection{Minimum time between frames and Maximum frame rate}
@ -506,23 +458,6 @@ where the 'minimum time between frames' and the minimum period will be discussed
\textbf{From software version 4.0.0, there is a very useful function {\tt{sls\_detector\_get measuredperiod}} which return the measured period AFTER the acquisition. This is important to check that the settings to obtain the targeted frame rate was correct.} \textbf{From software version 4.0.0, there is a very useful function {\tt{sls\_detector\_get measuredperiod}} which return the measured period AFTER the acquisition. This is important to check that the settings to obtain the targeted frame rate was correct.}
In release \textcolor{red}{5.0} in 4-bit modes one can set a sort of ROI in the detector such to read half of the module (the central part) or a quarter of it with almost double or four times the frame rate. By default the \tt{\textcolor{red}{readnlines}} is set to \tt{256} meaning the whole chip. With \tt{\textcolor{red}{readnlines 128}} or \tt{\textcolor{red}{readnlines 64}} one sets to read half/quarter rows from the chip. In table~\ref{table:hfrpartial} the maximum frame rates, exposure time and period for the partial readout.\\
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
readnlines & \# pixels & Active area (cm$^2$) & Max frame rate (kHz) & Period ($\mu$s) & Dead time ($\mu$s) & \# buffered images\\
\hline
256 &1024 $\times$ 512 & 8 $\times$ 3.8 & 22.7 & 44.0 &4.1 & 30k\\
\hline
128 &1024 $\times$ 256 & 8 $\times$ 1.9 & 42.1 & 23.7 &4.2 & 60k\\
\hline
64 & 1024 $\times$ 128 & 8 $\times$ 0.95 & 73.5 & 13.6 &4.2 & 120k\\
\hline
\end{tabular}
\label{table:hfrpartial}
\textbf{If you run too fast, the detector could become noisier (see problem shooting), it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise. \textbf{If you run too fast, the detector could become noisier (see problem shooting), it is important to match the detector settings to your frame rate. This can be done having more parameters files and load the one suitable with your experiment.} We experienced that with low energy settings could not reach 6~kHz and no noise.
In 16 bit mode, it could make sense, in case of noise and low threshold to either reduce the frame rate: In 16 bit mode, it could make sense, in case of noise and low threshold to either reduce the frame rate:
\begin{equation} \begin{equation}
@ -643,10 +578,10 @@ The number of subframes composing a single 32bit acquisition can be calculated a
\end{equation} \end{equation}
This also means that {\tt{exptime}}$<${\tt{subexptime}} will be rounded to{\tt{subexptime}}. If you want shorter acquisitions, either reduce the {\tt{subexptime}} or switch two 16-bit mode (you can always sum offline if needed). This also means that {\tt{exptime}}$<${\tt{subexptime}} will be rounded to{\tt{subexptime}}. If you want shorter acquisitions, either reduce the {\tt{subexptime}} or switch two 16-bit mode (you can always sum offline if needed).
From release 4.0.0, an extra {\tt{flag overflow/nooverflow}} is added (\tt{\textcolor{red}{overflow 0/1}}), with {\tt{nooverflow}} (\tt{\textcolor{red}{overflow 0}}) default: From release 4.0.0, an extra {\tt{flag overflow/nooverflow}} is added, with {\tt{nooverflow}} default:
\begin{itemize} \begin{itemize}
\item {\tt{nooverflow}} (\tt{\textcolor{red}{overflow 0}}): the internal 12-bit result is summed, even if there was saturation of the 12-bit counter (4095) in any of the subframes. Note that if there is saturation for every subframe, you might get as a result a value of the counter equal to (4095$\times$~number~of~subframes), which you need to correctly identify. On the other hand if the saturation occurred only one time, you will get something "close'' to the real number. \item {\tt{nooverflow}}: the internal 12-bit result is summed, even if there was saturation of the 12-bit counter (4095) in any of the subframes. Note that if there is saturation for every subframe, you might get as a result a value of the counter equal to (4095$\times$~number~of~subframes), which you need to correctly identify. On the other hand if the saturation occurred only one time, you will get something "close'' to the real number.
\item {\tt{overflow}} (\tt{\textcolor{red}{overflow 1}})): In this case, even if a pixel saturate only 1 time in a subframe, you will be returned as a value of the counter for that pixel: $2^{32}-1$, i.e. 4294967295. \item {\tt{overflow}}: In this case, even if a pixel saturate only 1 time in a subframe, you will be returned as a value of the counter for that pixel: $2^{32}-1$, i.e. 4294967295.
\end{itemize} \end{itemize}
The UDP header will contain, after you receive the data, the effective number of subframe per image (see section~\ref{UDP}) as "SubFrame Num or Exp Time", i.e. the number of subframes recorded (32 bit eiger). The UDP header will contain, after you receive the data, the effective number of subframe per image (see section~\ref{UDP}) as "SubFrame Num or Exp Time", i.e. the number of subframes recorded (32 bit eiger).
@ -674,19 +609,18 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating] sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
sls_detector_put 0-frames x sls_detector_put 0-frames x
sls_detector_put 0-cycles y (\textcolor{red}{triggers}) sls_detector_put 0-triggers y
sls_detector_acquire 0- sls_detector_acquire 0-
\end{verbatim} \end{verbatim}
No timeout is expected between the start of the acquisition and the arrival of the first trigger. No timeout is expected between the start of the acquisition and the arrival of the first trigger.
Here are the implemented options so far: Here are the implemented options so far:
\begin{itemize} \begin{itemize}
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of {\tt{cycles}} (\textcolor{red}{triggers}) to 1. Set number of frames using {\tt{frames}}. \item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of triggers (i.e. triggers) to 1 using {\tt{triggers}}. Set number of frames using {\tt{frames}}.
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} ({\tt{\textcolor{red}{triggers}}}) can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series. \item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{triggers}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} ({\tt{\textcolor{red}{triggers}}}) needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout. \item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{triggers}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} (\tt{\textcolor{red}{triggers}}) allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime. \item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{triggers}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
ATTENTION: From release 4.1.1 with the {\tt{trigger}} option it is possible to have software triggers as a debugging tool (instead of the hardware trigger signal. One should start the acquisition (with the blocking {\tt{sls\_detector\_acquire}} if wanted and with another client one can send the softare trigger {\tt{sls\_detector\_put status trigger}}. This option allows for example to perform a motor scan (moving a motor in between single images) and still writing all images to the same file.
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime. When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}. However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
@ -694,13 +628,13 @@ However, from 4.1.0, in gating mode, an option to immediately terminate the subf
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal. Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} (\tt{\textcolor{red}{triggers}}) configurable at the same time. We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{triggers}} configurable at the same time.
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with: There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
\begin{verbatim} \begin{verbatim}
sls_detector_put 0-timing [trigger/burst_trigger] sls_detector_put 0-timing [trigger/burst_trigger]
sls_detector_put 0-frames x sls_detector_put 0-frames x
sls_detector_put 0-cycles y (\textcolor{red}{triggers}) sls_detector_put 0-triggers y
sls_detector_status trigger sls_detector_status trigger
\end{verbatim} \end{verbatim}
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}. Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
@ -780,8 +714,8 @@ If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector get
Here is a list of parameters that should be reset: Here is a list of parameters that should be reset:
\begin{enumerate} \begin{enumerate}
\item \textbf{resetframescaught} (only for releases < 5.x) should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this. \item \textbf{resetframescaught} should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles} (\tt{\textcolor{red}{triggers}}). See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} (\tt{\textcolor{red}{trigger}}) is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice. \item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{triggers}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{triggers} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
\end{enumerate} \end{enumerate}
@ -810,7 +744,7 @@ Extremely advanced options allow to:
\begin{itemize} \begin{itemize}
\item Activate the flow control for 10~Gb/s~E (by default the 1~Gb/s~E is always active and cannot be switched off: \item Activate the flow control for 10~Gb/s~E (by default the 1~Gb/s~E is always active and cannot be switched off:
\begin{verbatim} \begin{verbatim}
./sls_detector_put flowcontrol_10g 1 (\textcolor{red}{flowcontrol10g}) ./sls_detector_put flowcontrol_10g 1
\end{verbatim} \end{verbatim}
\item Delay the transmission of the left port. This delay option is useful in the case of many simultaneous receivers running, such that it reduces the throughput to the receivers all at the same time. To be used board by board (i.e {\tt{X:, Y:,etc..}} with different units: \item Delay the transmission of the left port. This delay option is useful in the case of many simultaneous receivers running, such that it reduces the throughput to the receivers all at the same time. To be used board by board (i.e {\tt{X:, Y:,etc..}} with different units:
\begin{verbatim} \begin{verbatim}
@ -903,7 +837,7 @@ NOTE THAT THIS SETTINGS WILL BE LOST IF YOU REBOOT THE COMPUTER.
Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable) Very important is to activate the flow control in 10Gb (in 1Gb it is on by default and not configurable)
\begin{verbatim} \begin{verbatim}
./sls_detector_put flowcontrol_10g 1 (\textcolor{red}{flowcontrol10g 1}) ./sls_detector_put flowcontrol_10g 1
\end{verbatim} \end{verbatim}
You ned to check that flow control is setup on the reeceiving interfaces. Check with: You ned to check that flow control is setup on the reeceiving interfaces. Check with:
\begin{verbatim} \begin{verbatim}
@ -1054,14 +988,13 @@ Packets Caught Mask : 64 bytes
Note that if one wants to reconstruct the real time the detector was acquiring in 32 bit (autosumming mode), one would have to multiply the SubExptime (ns) for the SubFrame Number. Note that if one wants to reconstruct the real time the detector was acquiring in 32 bit (autosumming mode), one would have to multiply the SubExptime (ns) for the SubFrame Number.
\subsection{Offline image reconstruction} \subsection{Offline image reconstruction}
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. However, it can be retrieved from \\ The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
{\tt{git clone https://github.com/slsdetectorgroup/slsImageReconstruction.git slsImageReconstruction}}.\\ {\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
Checkout the {\tt{v3.1}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. There is a {\tt{developer}} branch that has newer updates but needs to be tested. Checkout the {\tt{developer}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code.
Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5}. \textbf{tiff} and \textbf{root} format. The detector writes 2 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted. Three possible conversions are possible: into \textbf{cbf}, \textbf{hdf5} and \textbf{root} format. The detector writes 4 raw files per receiver. An offline image reconstruction executable has been written to collate the possible files together and produce output files. By default an interpolation between the values of the large pixels is performed. Gap pixels between modules are also inserted.
Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in \\ Note that the number of images per file in the 3.1.X release is hardcoded and needs to match whatever you are using in {\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
{\tt{slsDetectorsPackage/slsReceiverSoftware/include/sls\_receiver\_defs.h}}:
\begin{verbatim} \begin{verbatim}
#define EIGER_MAX_FRAMES_PER_FILE 2000 #define EIGER_MAX_FRAMES_PER_FILE 2000
\end{verbatim} \end{verbatim}
@ -1110,12 +1043,11 @@ cbfMaker9M [file_name_with_dir]
contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side), the 1.5M OMNY geometry (3 modules next to each other on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\ contain the hardcoded geometry for the 1.5M (3 modules horizontal on the long side), the 1.5M OMNY geometry (3 modules next to each other on the long side) and for the 9M at cSAXS: 6(short side)$\times$3 (long side) modules.\\
Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time. Missing packets in a frame and border pixels ($\times 2$ and $\times 4$ are given with value $-1$ at the present time.
From the new {{v4.1.1}} all the define that you see below need only to be modified in the Makefile.
Make sure the following options are uncommented in the {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} file. Make sure the following options are uncommented in the {\tt{slsImageReconstruction/src/main\_csaxs.cpp}} file.
\begin{verbatim} \begin{verbatim}
#define MYCBF #define MYCBF
##following line only if you need to process with BUBBLE ##following line only if you need to process with
##BUBBLE (Material Science / uXAS beamlines).
#define MSHeader #define MSHeader
\end{verbatim} \end{verbatim}
Compile it with: Compile it with:
@ -1164,10 +1096,6 @@ To use it any geometry:\\
eg. eg.
{\tt image /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\ {\tt image /scratch/run\_63\_d0\_f000000000000\_3.raw 3072 512 1 2 ``Eiger'' 0}.\\
With new new software, the new options to run the cbfMaker/hdf5Maker executablesare:
./hdf5Maker -f [filename] -d [outdirname] -x [npix\_x] -y [npix\_y] -v (v flags that longedge is vertical, no argument) -n [name\_of\_hdf5\_dataset] -m (mask\_hot\_pixels, need to be in file maskpix.txt in the samedir as executable, no argument) -g [0,no filling/1,division/2,interpolation/3,interpolate,alternative]
\subsection{Read temperatures/HV from boards} \subsection{Read temperatures/HV from boards}
With an updated kernel on the linux boards (ask to the SLS detector group for specifications), it is possible to monitor the temperature on the boards: With an updated kernel on the linux boards (ask to the SLS detector group for specifications), it is possible to monitor the temperature on the boards:
@ -1192,10 +1120,10 @@ In 500k--2M pixel systems there is a hardware temperature safety switch, which w
The HV can also be set and read through the software: The HV can also be set and read through the software:
\begin{verbatim} \begin{verbatim}
./sls_detector_put vhighvoltage 150 (\textcolor{red}{highvoltage}) ./sls_detector_put vhighvoltage 150
./sls_detector_get vhighvoltage (\textcolor{red}{highvoltage}) ./sls_detector_get vhighvoltage
\end{verbatim} \end{verbatim}
Note that the get {\tt{vhighvoltage}}(\tt{\textcolor{red}{highvoltage}}) would return the measured HV from the master module only. If getting the highvoltage for individual halfmodules, only the master will have a value different from -999. Note that the get {\tt{vhighvoltage}} would return the measured HV from the master module only. If getting the vhighvoltage for individual halfmodules, only the master will have a value different from -999.
\appendix \appendix
@ -1277,21 +1205,13 @@ do the same for the other boards. You can program in parallel many boards, but y
There are two ways to pulse the detector: There are two ways to pulse the detector:
\begin{itemize} \begin{itemize}
\item \textbf{Pulse digitally:} when you are interested to the output readout and do not care about the analog response from the pixels: \item \textbf{Pulse digitally:} when you are interested to the output readout and do not care about the analog response from the pixels:
\begin{verbatim} \begin{verbatim}
sls_detector_put vthreshold 4000 sls_detector_put vthreshold 4000
sls_detector_put vtr 4000 sls_detector_put vtr 4000
sls_detector_put pulsechip N #to pulse N sls_detector_put pulsechip N #to pulse N
sls_detector_put pulsechip -1 #to get out of testing mode sls_detector_put pulsechip -1 #to get out of testing mode
\end{verbatim} \end{verbatim}
Note that the answer will be $2 \cdot \textrm{{\tt{N}}} +2$ in this case. Note that the answer will be $2 \cdot \textrm{{\tt{N}}} +2$ in this case.
Or in \textcolor{red}{5.x}:
\begin{verbatim}
sls_detector_put vthreshold 4000
sls_detector_put vtrim 4000
sls_detector_put pulsechip N #to pulse N
sls_detector_put pulsechip -1 #to get out of testing mode
\end{verbatim}
Note that the answer will be $2 \cdot \textrm{{\tt{N}}} +4$ in this case.
\item \textbf{Pulse analogically:} You want to really check the analogical part of the detector, not just the readout. \item \textbf{Pulse analogically:} You want to really check the analogical part of the detector, not just the readout.
@ -1310,25 +1230,8 @@ sls_detector_put resmat 0
sls_detector_acquire sls_detector_acquire
\end{verbatim} \end{verbatim}
You read {\tt{N}} in every pixel if you are setup correctly. You read {\tt{N}} in every pixel if you are setup correctly.
or in realese \textcolor{red}{5.x}:
\begin{verbatim}
sls_detector_put vcal 3600
sls_detector_put vthreshold 1700
sls_detector_put vrpreamp 3100
for i in $(seq 0 7) ;
do px=$((-255+i));
sls_detector_put pulse 0 $px 0;
for j in $(seq 0 255) ; do
sls_detector_put pulsenmove 100 0 1;
done;
done;
sls_detector_put partialreset 1
\end{verbatim}
\end{itemize} \end{itemize}
\section{Load a noise pattern with shape} \section{Load a noise pattern with shape}
For debug purposes, we have created a noise pattern with a shape. If you reconstruct correctly your image, you should be able to read ".EIGER'' in the same direction for both the top and bottom in normal human readable orientation. For debug purposes, we have created a noise pattern with a shape. If you reconstruct correctly your image, you should be able to read ".EIGER'' in the same direction for both the top and bottom in normal human readable orientation.
To load the special noise file look at {\tt{settingsdir/eiger/standard/eigernoise.sn0xx}} in the package. To load the special noise file look at {\tt{settingsdir/eiger/standard/eigernoise.sn0xx}} in the package.
@ -1351,10 +1254,10 @@ We have also been requested if we could speed up the threshold scan. At the mome
\begin{verbatim} \begin{verbatim}
./sls_detector_put exptime 0.01 ./sls_detector_put exptime 0.01
./sls_detector_put timing trigger ./sls_detector_put timing trigger
./sls_detector_put enablefwrite 0 (\textcolor{red}{fwrite} 0) ./sls_detector_put enablefwrite 0
./sls_detector_put resetframescaught 0 (\textcolor{red}{not needed anymore}) ./sls_detector_put resetframescaught 0
./sls_detector_put index 0 (\textcolor{red}{findex} 0) ./sls_detector_put index 0
./sls_detector_put cycles 21 (\textcolor{red}{triggers} 21) ./sls_detector_put triggers 21
./sls_detector_put receiver start ./sls_detector_put receiver start
./sls_detector_put status start ./sls_detector_put status start
for i in $(seq 0 20); for i in $(seq 0 20);
@ -1472,7 +1375,7 @@ Environment variable SLSDETNAME can be set for using 2 different detectors from
\subsection{Measure the HV} \subsection{Measure the HV}
For every system: For every system:
\begin{itemize} \begin{itemize}
\item Software-wise measure it (now the software returns the measured value), with {\tt{sls\_detector\_get highvoltage}}. The returned value is the HV (for proper Eiger setting is approximately 150~V) if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:highvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned. \item Software-wise measure it (now the software returns the measured value), with {\tt{sls\_detector\_get vhighvoltage}}. The returned value is the HV (for proper Eiger setting is approximately 150~V) if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:vhighvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
\item Hardware-wise (opening the detector) measure value of HV on C14 on the power distribution board. Check also that the small HV connector cable is really connected. \item Hardware-wise (opening the detector) measure value of HV on C14 on the power distribution board. Check also that the small HV connector cable is really connected.
\end{itemize} \end{itemize}
@ -1523,7 +1426,7 @@ Scroll up in the terminal till you find:\\
There is also an easier way, that is that only the master module will return the real value of the HV. If you have more than 1 detector system, then you will have more than 1 physical master, as the HV needs to be applied to all the systems. There is also an easier way, that is that only the master module will return the real value of the HV. If you have more than 1 detector system, then you will have more than 1 physical master, as the HV needs to be applied to all the systems.
\begin{verbatim} \begin{verbatim}
for i in $(seq 0 36); do sls_detector_put $i:highvoltage; done for i in $(seq 0 36); do sls_detector_put $i:vhighvoltage; done
\end{verbatim} \end{verbatim}
Only the master will return to you a sensible number (150 normally). the others will return -999. Only the master will return to you a sensible number (150 normally). the others will return -999.
@ -1612,8 +1515,8 @@ frames number
where {\tt{number}} is a string to be interpreted as an integer. where {\tt{number}} is a string to be interpreted as an integer.
\item \begin{verbatim} \item \begin{verbatim}
sls_detector_get cycles sls_detector_get triggers
cycles number triggers number
\end{verbatim} \end{verbatim}
where {\tt{number}} is a string to be interpreted as an integer. where {\tt{number}} is a string to be interpreted as an integer.
@ -1684,10 +1587,10 @@ ratecorr number
where {\tt{number}} is a string that should be interpreted as a float in s. 0.000000 means correction off. Values above zero are the value of $\tau$ in ns. where {\tt{number}} is a string that should be interpreted as a float in s. 0.000000 means correction off. Values above zero are the value of $\tau$ in ns.
\item \begin{verbatim} \item \begin{verbatim}
sls_detector_get highvoltage sls_detector_get vhighvoltage
highvoltage number vhighvoltage number
\end{verbatim} \end{verbatim}
where {\tt{number}} is a string that should be interpreted as an int and for proper Eiger setting is approximately 150~V if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:highvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned. where {\tt{number}} is a string that should be interpreted as an int and for proper Eiger setting is approximately 150~V if it is correctly set. If two master modules are presents (multi systems), the average is returned (still to be tested). If one asks for the individual $n$ half module bias voltage through {\tt{sls\_detector\_get n:vhighvoltage}}, if the $n$ module is a master, the actual voltage will be returned. If it is a slave, -999 will be returned.
\item \begin{verbatim} \item \begin{verbatim}
sls_detector_get busy sls_detector_get busy

View File

@ -142,7 +142,7 @@
"vpreamp"; // sets/get vpreamp value (advanced! Mythen) "vpreamp"; // sets/get vpreamp value (advanced! Mythen)
"vshaper1"; // sets/get vshaper1 value (advanced! Mythen) "vshaper1"; // sets/get vshaper1 value (advanced! Mythen)
"vshaper2"; // sets/get vshaper2 value (advanced! Mythen) "vshaper2"; // sets/get vshaper2 value (advanced! Mythen)
"highvoltage"; // sets/get highvoltage value (advanced! Chiptest board and Eiger) "vhighvoltage"; // sets/get vhighvoltage value (advanced! Chiptest board and Eiger)
"vapower"; // sets/get vapower value (advanced! Chiptest board) "vapower"; // sets/get vapower value (advanced! Chiptest board)
"vddpower"; // sets/get vddpower value (advanced! Chiptest board) "vddpower"; // sets/get vddpower value (advanced! Chiptest board)
"vshpower"; // sets/get vshpower value (advanced! Chiptest board) "vshpower"; // sets/get vshpower value (advanced! Chiptest board)

View File

@ -335,7 +335,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp n] Sets the DAC value of the preamp feedback to n. \item[vpreamp n] Sets the DAC value of the preamp feedback to n.
\item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n. \item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n.
\item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n. \item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n.
\item[highvoltage n] Sets the DAC value of the high voltage to n (in V). \item[vhighvoltage n] Sets the DAC value of the high voltage to n (in V).
\item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n. \item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n. \item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024). \item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024).
@ -648,7 +648,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp] Returns the DAC value of the preamp feedback to n. \item[vpreamp] Returns the DAC value of the preamp feedback to n.
\item[vshaper1] Returns the DAC value of the shaper1 feedback to n. \item[vshaper1] Returns the DAC value of the shaper1 feedback to n.
\item[vshaper2] Returns the DAC value of the shaper2 feedback to n. \item[vshaper2] Returns the DAC value of the shaper2 feedback to n.
\item[highvoltage] Returns the DAC value of the high voltage to n. \item[vhighvoltage] Returns the DAC value of the high voltage to n.
\item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n. \item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n. \item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024). \item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024).
@ -714,7 +714,7 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
sls_detector_put parameters setup.det sls_detector_put parameters setup.det
\end{verbatim} \end{verbatim}
In the case of \E, the parameter file ({\tt{setup.det}} needs to setup the proper bias voltage of the sensor, i.e. needs to contain the line {\tt{highvoltage 150}}. In the case of \E, the parameter file ({\tt{setup.det}} needs to setup the proper bias voltage of the sensor, i.e. needs to contain the line {\tt{vhighvoltage 150}}.
\subsection{Standard acquisition} \subsection{Standard acquisition}

View File

@ -322,7 +322,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp n] Sets the DAC value of the preamp feedback to n. \item[vpreamp n] Sets the DAC value of the preamp feedback to n.
\item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n. \item[vshaper1 n] Sets the DAC value of the shaper1 feedback to n.
\item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n. \item[vshaper2 n] Sets the DAC value of the shaper2 feedback to n.
\item[highvoltage n] CHIPTEST BOARD ONLY - Sets the DAC value of the high voltage to n. \item[vhighvoltage n] CHIPTEST BOARD ONLY - Sets the DAC value of the high voltage to n.
\item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n. \item[vapower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n. \item[vddpower n] CHIPTEST BOARD ONLY - Sets the DAC value of the analog voltage to n.
\item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024). \item[vshpower n] CHIPTEST BOARD ONLY - Sets the comparator power supply in dac units (0-1024).
@ -594,7 +594,7 @@ Advanced settings changing the analog or digital performance of the acquisition.
\item[vpreamp] Returns the DAC value of the preamp feedback to n. \item[vpreamp] Returns the DAC value of the preamp feedback to n.
\item[vshaper1] Returns the DAC value of the shaper1 feedback to n. \item[vshaper1] Returns the DAC value of the shaper1 feedback to n.
\item[vshaper2] Returns the DAC value of the shaper2 feedback to n. \item[vshaper2] Returns the DAC value of the shaper2 feedback to n.
\item[highvoltage] CHIPTEST BOARD ONLY - Returns the DAC value of the high voltage to n. \item[vhighvoltage] CHIPTEST BOARD ONLY - Returns the DAC value of the high voltage to n.
\item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n. \item[vapower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n. \item[vddpower] CHIPTEST BOARD ONLY - Returns the DAC value of the analog voltage to n.
\item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024). \item[vshpower] CHIPTEST BOARD ONLY - Returns the comparator power supply in dac units (0-1024).

View File

@ -12,7 +12,6 @@ target_link_libraries(_slsdet PUBLIC
slsDetectorShared slsDetectorShared
slsReceiverShared slsReceiverShared
slsSupportLib slsSupportLib
${ZeroMQ_LIBRARIES}
) )

View File

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

View File

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

View File

@ -3,9 +3,9 @@ import sys
import numpy as np import numpy as np
sys.path.append(os.path.join(os.getcwd(), 'bin')) sys.path.append(os.path.join(os.getcwd(), 'bin'))
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
from slsdet import dacIndex, readoutMode from sls_detector import dacIndex, readoutMode
from slsdet.lookup import view, find from sls_detector.lookup import view, find
d = Detector() d = Detector()
# e = Eiger() # e = Eiger()

View File

@ -4,18 +4,17 @@ out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.ge
cmd = out.stdout.splitlines() cmd = out.stdout.splitlines()
cmd.pop(0) cmd.pop(0)
from slsdet import Detector, Eiger, Ctb from sls_detector import Detector, Eiger, Ctb
pycmd = dir(Detector)+dir(Eiger)+dir(Ctb) pycmd = dir(Detector)+dir(Eiger)+dir(Ctb)
#Add commands that we should not expect as direct commands in python
pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim', pycmd += ['vrf', 'vtr', 'vrs', 'vtgstv', 'vsvn', 'vtrim',
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb', 'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds', 'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc', 'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl', 'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr' 'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
, 'vcmp_rl', 'vcmp_rr', 'daclist', 'dacvalues', 'vcal', 'vcas'] , 'vcmp_rl', 'vcmp_rr']
missing = [] missing = []
for c in cmd: for c in cmd:

View File

@ -11,10 +11,6 @@ import subprocess
from parse import remove_comments from parse import remove_comments
def single_line_enum(line):
sub = line[line.find('{')+1:line.find('}')]
return sub.strip().split(',')
def extract_enums(lines): def extract_enums(lines):
line_iter = iter(lines) line_iter = iter(lines)
enums = {} enums = {}
@ -22,27 +18,19 @@ def extract_enums(lines):
m = re.search("(?<=enum )\w+(?= {)", line) m = re.search("(?<=enum )\w+(?= {)", line)
if m: if m:
enum_name = m.group() enum_name = m.group()
print(enum_name) # print(enum_name)
# print(line)
fields = [] fields = []
while True:
l = next(line_iter)
if '};' in l:
break
m = re.search("\w+", l)
try:
# print('\t', m.group())
fields.append(m.group())
#deal with single line enums except:
if '};' in line: pass
fields = single_line_enum(line)
else:
#deal with multi line enums
while True:
l = next(line_iter)
if '};' in l:
break
m = re.search("\w+", l)
try:
# print('\t', m.group())
fields.append(m.group())
except:
pass
fields = [f.strip() for f in fields]
enums[enum_name] = fields enums[enum_name] = fields
return enums return enums

View File

@ -18,13 +18,7 @@ fpath = "../../slsDetectorSoftware/src/Detector.cpp"
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument("-p", "--build_path", help="Path to the build database", type = str, default=default_build_path)
"-p",
"--build_path",
help="Path to the build database",
type=str,
default=default_build_path,
)
cargs = parser.parse_args() cargs = parser.parse_args()
db = cindex.CompilationDatabase.fromDirectory(cargs.build_path) db = cindex.CompilationDatabase.fromDirectory(cargs.build_path)
@ -32,7 +26,7 @@ index = cindex.Index.create()
args = db.getCompileCommands(fpath) args = db.getCompileCommands(fpath)
args = list(iter(args).__next__().arguments)[0:-1] args = list(iter(args).__next__().arguments)[0:-1]
args = args + "-x c++ --std=c++11".split() args = args + "-x c++ --std=c++11".split()
syspath = system_include_paths("clang++") syspath = system_include_paths('clang++')
incargs = ["-I" + inc for inc in syspath] incargs = ["-I" + inc for inc in syspath]
args = args + incargs args = args + incargs
@ -45,9 +39,6 @@ ag = []
lines = [] lines = []
ag2 = []
cn = []
def get_arguments(node): def get_arguments(node):
args = [a.type.spelling for a in node.get_arguments()] args = [a.type.spelling for a in node.get_arguments()]
@ -55,25 +46,9 @@ def get_arguments(node):
"py::arg() = Positions{}" if item == "sls::Positions" else "py::arg()" "py::arg() = Positions{}" if item == "sls::Positions" else "py::arg()"
for item in args for item in args
] ]
args = ", ".join(args) args = ', '.join(args)
if args: if args:
args = f", {args}" args = f', {args}'
return args
def get_fdec(node):
args = [a.type.spelling for a in node.get_arguments()]
if node.result_type.spelling:
return_type = node.result_type.spelling
else:
return_type = 'void'
if node.is_const_method():
const = 'const'
else:
const = ''
args = ", ".join(args)
args = f'({return_type}(Detector::*)({args}){const})'
return args return args
@ -87,37 +62,23 @@ def visit(node):
): ):
m.append(child) m.append(child)
args = get_arguments(child) args = get_arguments(child)
fs = get_fdec(child) lines.append(f'.def(\"{child.spelling}\", &Detector::{child.spelling}{args})')
lines.append(
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
)
cn.append(child)
for child in node.get_children(): for child in node.get_children():
visit(child) visit(child)
# .def("setRxHostname",
# (void (Detector::*)(const std::string &, Positions)) &
# Detector::setRxHostname,
# py::arg(), py::arg() = Positions{})
# .def("setRxHostname",
# (void (Detector::*)(const std::vector<std::string> &)) &
# Detector::setRxHostname,
# py::arg())
visit(tu.cursor) visit(tu.cursor)
with open("../src/detector_in.cpp") as f: with open('../src/detector_in.cpp') as f:
data = f.read() data = f.read()
s = "".join(lines) s = ''.join(lines)
s += ";" s += ';'
text = data.replace("[[FUNCTIONS]]", s) text = data.replace('[[FUNCTIONS]]', s)
warning = "/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n" warning = '/* WARINING This file is auto generated any edits might be overwritten without warning */\n\n'
with open("../src/detector.cpp", "w") as f: with open('../src/detector.cpp', 'w') as f:
f.write(warning) f.write(warning)
f.write(text) f.write(text)
# run clang format on the output # run clang format on the output
subprocess.run(["clang-format", "../src/detector.cpp", "-i"]) subprocess.run(['clang-format', '../src/detector.cpp', '-i'])

31
python/scripts/list_tested_cmd.py Executable file → Normal file
View File

@ -1,19 +1,11 @@
"""
Utility to find and list which command line functions have tests and
where the tests are located
"""
#local import for for parsing c++
import parse import parse
from pathlib import Path
#General python stuff
import os import os
import locale import locale
import argparse import argparse
import subprocess
from pathlib import Path
#Realative path from this dir
path = Path('../../slsDetectorSoftware/tests/') path = Path('../../slsDetectorSoftware/tests/')
import subprocess
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None) parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
args = parser.parse_args() args = parser.parse_args()
@ -23,12 +15,15 @@ tested = []
for fname in files: for fname in files:
with open(path/fname) as f: with open(path/fname) as f:
data = f.read() data = f.read()
data = parse.remove_comments(data) data = parse.remove_comments(data)
data = data.splitlines() data = data.splitlines()
for line in data: for line in data:
if 'TEST_CASE' in line or 'SECTION' in line: if 'TEST_CASE' in line or 'SECTION' in line:
cmd = line.split("\"")[1] cmd = line.split("\"")[1]
tested.append([cmd, fname]) tested.append(cmd)
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding()) out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
all_cmd = out.stdout.splitlines() all_cmd = out.stdout.splitlines()
@ -38,18 +33,18 @@ all_cmd.pop(0)
if args.startswith is not None: if args.startswith is not None:
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)] all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
tested = [cmd for cmd in tested if cmd[0].startswith(args.startswith)] tested = [cmd for cmd in tested if cmd.startswith(args.startswith)]
tn = [cmd[0] for cmd in tested]
not_tested = [cmd for cmd in all_cmd if cmd not in tn]
misnamed = [cmd for cmd in tn if cmd not in all_cmd] not_tested = [cmd for cmd in all_cmd if cmd not in tested]
tested = [cmd for cmd in tested if cmd[0] in all_cmd] misnamed = [cmd for cmd in tested if cmd not in all_cmd]
tested = [cmd for cmd in tested if cmd in all_cmd]
print("\nThe following commands are tested:") print("\nThe following commands are tested:")
for cmd in tested: for cmd in tested:
print(f'{cmd[0]:>18} : {cmd[1]}') print(cmd)
print("\nThe following commands are NOT tested:") print("\nThe following commands are NOT tested:")
for cmd in not_tested: for cmd in not_tested:

View File

@ -1,5 +1,5 @@
""" """
Setup file for slsdet Setup file for sls_detector
Build upon the pybind11 example found here: https://github.com/pybind/python_example Build upon the pybind11 example found here: https://github.com/pybind/python_example
""" """
from setuptools import setup, Extension, find_packages from setuptools import setup, Extension, find_packages
@ -8,7 +8,7 @@ import sys
import setuptools import setuptools
import os import os
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer') __version__ = 'udp'
def get_conda_path(): def get_conda_path():
@ -45,7 +45,7 @@ ext_modules = [
# get_pybind_include(), # get_pybind_include(),
# get_pybind_include(user=True), # get_pybind_include(user=True),
os.path.join('../libs/pybind11/include'), os.path.join('../libs/pybind11/include'),
os.path.join(get_conda_path(), 'include'), os.path.join(get_conda_path(), 'include/slsDetectorPackage'),
], ],
libraries=['SlsDetector', 'SlsReceiver', 'zmq'], libraries=['SlsDetector', 'SlsReceiver', 'zmq'],

View File

@ -27,7 +27,7 @@ dr 32
threaded 1 threaded 1
tengiga 0 tengiga 0
highvoltage 150 vhighvoltage 150
iodelay 660 iodelay 660
#gappixels 1 #gappixels 1

View File

@ -1 +1 @@
highvoltage 200 vhighvoltage 200

View File

@ -13,25 +13,11 @@ import _slsdet
defs = _slsdet.slsDetectorDefs defs = _slsdet.slsDetectorDefs
runStatus = _slsdet.slsDetectorDefs.runStatus runStatus = _slsdet.slsDetectorDefs.runStatus
speedLevel = _slsdet.slsDetectorDefs.speedLevel speedLevel = _slsdet.slsDetectorDefs.speedLevel
detectorType = _slsdet.slsDetectorDefs.detectorType
frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
fileFormat = _slsdet.slsDetectorDefs.fileFormat
dimension = _slsdet.slsDetectorDefs.dimension
externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
timingMode = _slsdet.slsDetectorDefs.timingMode timingMode = _slsdet.slsDetectorDefs.timingMode
dacIndex = _slsdet.slsDetectorDefs.dacIndex dacIndex = _slsdet.slsDetectorDefs.dacIndex
detectorType = _slsdet.slsDetectorDefs.detectorType
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
clockIndex = _slsdet.slsDetectorDefs.clockIndex
readoutMode = _slsdet.slsDetectorDefs.readoutMode readoutMode = _slsdet.slsDetectorDefs.readoutMode
masterFlags = _slsdet.slsDetectorDefs.masterFlags
frameModeType = _slsdet.slsDetectorDefs.frameModeType
detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
burstMode = _slsdet.slsDetectorDefs.burstMode
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
IpAddr = _slsdet.IpAddr IpAddr = _slsdet.IpAddr
MacAddr = _slsdet.MacAddr MacAddr = _slsdet.MacAddr

View File

@ -1,29 +1,23 @@
from _slsdet import CppDetectorApi from _slsdet import CppDetectorApi
from _slsdet import slsDetectorDefs from _slsdet import slsDetectorDefs
from _slsdet import IpAddr, MacAddr
runStatus = slsDetectorDefs.runStatus runStatus = slsDetectorDefs.runStatus
timingMode = slsDetectorDefs.timingMode
speedLevel = slsDetectorDefs.speedLevel speedLevel = slsDetectorDefs.speedLevel
dacIndex = slsDetectorDefs.dacIndex dacIndex = slsDetectorDefs.dacIndex
detectorType = slsDetectorDefs.detectorType
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask 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 from .utils import Geometry, to_geo, element
from . import utils as ut
from .registers import Register, Adc_register from .registers import Register, Adc_register
import datetime as dt import datetime as dt
from functools import wraps from functools import wraps
from collections import namedtuple from collections import namedtuple
import socket
def freeze(cls): def freeze(cls):
cls._frozen = False cls._frozen = False
def frozensetattr(self, key, value): def frozensetattr(self, key, value):
if self._frozen and not key in dir(self): if self._frozen and not hasattr(self, key):
raise AttributeError( raise AttributeError(
"Class {} is frozen. Cannot set {} = {}".format( "Class {} is frozen. Cannot set {} = {}".format(
cls.__name__, key, value cls.__name__, key, value
@ -63,16 +57,23 @@ class Detector(CppDetectorApi):
self._register = Register(self) self._register = Register(self)
self._adc_register = Adc_register(self) self._adc_register = Adc_register(self)
# CONFIGURATION # CONFIGURATION
def __len__(self): def __len__(self):
return self.size() return self.size()
def __repr__(self): def __repr__(self):
return "{}(id = {})".format(self.__class__.__name__, self.getShmId()) return '{}(id = {})'.format(self.__class__.__name__,
self.getShmId())
def free(self): def free(self):
self.freeSharedMemory() self.freeSharedMemory()
@property @property
def config(self): def config(self):
return NotImplementedError("config is set only") return NotImplementedError("config is set only")
@ -108,7 +109,7 @@ class Detector(CppDetectorApi):
@property @property
def server_version(self): def server_version(self):
# TODO! handle hex print #TODO! handle hex print
return element_if_equal(self.getDetectorServerVersion()) return element_if_equal(self.getDetectorServerVersion())
@property @property
@ -160,48 +161,58 @@ class Detector(CppDetectorApi):
def frames(self, n_frames): def frames(self, n_frames):
self.setNumberOfFrames(n_frames) self.setNumberOfFrames(n_frames)
@property
def triggers(self):
return element_if_equal(self.getNumberOfTriggers())
@triggers.setter
def triggers(self, n_triggers):
self.setNumberOfTriggers(n_triggers)
@property @property
def exptime(self): def exptime(self):
if self.type == detectorType.MYTHEN3: res = self.getExptime()
res = self.getExptimeForAllGates() return element_if_equal([it.total_seconds() for it in res])
else:
res = self.getExptime()
return reduce_time(res)
@exptime.setter @exptime.setter
def exptime(self, t): def exptime(self, t):
self.setExptime(t) if isinstance(t, dt.timedelta):
self.setExptime(t)
else:
self.setExptime(dt.timedelta(seconds=t))
@property
def subexptime(self):
res = self.getSubExptime()
return element_if_equal([it.total_seconds() for it in res])
@subexptime.setter
def subexptime(self, t):
if isinstance(t, dt.timedelta):
self.setSubExptime(t)
else:
self.setSubExptime(dt.timedelta(seconds=t))
@property
def subdeadtime(self):
res = self.getSubDeadTime()
return element_if_equal([it.total_seconds() for it in res])
@subdeadtime.setter
def subdeadtime(self, t):
if isinstance(t, dt.timedelta):
self.setSubDeadTime(t)
else:
self.setSubDeadTime(dt.timedelta(seconds=t))
@property @property
def period(self): def period(self):
res = self.getPeriod() res = self.getPeriod()
return reduce_time(res) return element_if_equal([it.total_seconds() for it in res])
@period.setter @period.setter
def period(self, t): def period(self, t):
self.setPeriod(t) if isinstance(t, dt.timedelta):
self.setPeriod(t)
else:
self.setPeriod(dt.timedelta(seconds=t))
@property
@element
def delay(self):
return ut.reduce_time(self.getDelayAfterTrigger())
@delay.setter
def delay(self, t):
self.setDelayAfterTrigger(t)
@property
@element
def delayl(self):
return ut.reduce_time(self.getDelayAfterTriggerLeft())
# Time # Time
@ -209,6 +220,7 @@ class Detector(CppDetectorApi):
def rx_framescaught(self): def rx_framescaught(self):
return element_if_equal(self.getFramesCaught()) return element_if_equal(self.getFramesCaught())
@property @property
def startingfnum(self): def startingfnum(self):
return element_if_equal(self.getStartingFrameNumber()) return element_if_equal(self.getStartingFrameNumber())
@ -216,7 +228,10 @@ class Detector(CppDetectorApi):
@startingfnum.setter @startingfnum.setter
def startingfnum(self, value): def startingfnum(self, value):
self.setStartingFrameNumber(value) self.setStartingFrameNumber(value)
# TODO! add txdelay
#TODO! add txdelay
@property @property
def use_receiver(self): def use_receiver(self):
@ -282,16 +297,9 @@ class Detector(CppDetectorApi):
@property @property
def rx_lastclient(self): def rx_lastclient(self):
return element_if_equal(self.getRxLastClientIP()) return element_if_equal(self.getRxLastClientIP())
# FILE
@property
@element
def numinterfaces(self):
return self.getNumberofUDPInterfaces()
@numinterfaces.setter #FILE
def numinterfaces(self, value):
self.setNumberofUDPInterfaces(value)
@property @property
def fformat(self): def fformat(self):
@ -407,15 +415,14 @@ class Detector(CppDetectorApi):
def zmqip(self, ip): def zmqip(self, ip):
self.setClientZmqIp(ip) self.setClientZmqIp(ip)
@property @property
def udp_dstip(self): def udp_dstip(self):
return element_if_equal(self.getDestinationUDPIP()) return element_if_equal(self.getDestinationUDPIP())
@udp_dstip.setter @udp_dstip.setter
def udp_dstip(self, ip): def udp_dstip(self, ip):
if ip == "auto": self.getDestinationUDPIP(ip)
ip = socket.gethostbyname(self.rx_hostname)
self.setDestinationUDPIP(IpAddr(ip))
@property @property
def udp_dstip2(self): def udp_dstip2(self):
@ -423,9 +430,7 @@ class Detector(CppDetectorApi):
@udp_dstip2.setter @udp_dstip2.setter
def udp_dstip2(self, ip): def udp_dstip2(self, ip):
if ip == "auto": self.getDestinationUDPIP2(ip)
ip = socket.gethostbyname(self.rx_hostname)
self.setDestinationUDPIP2(IpAddr(ip))
@property @property
def udp_dstmac(self): def udp_dstmac(self):
@ -433,7 +438,7 @@ class Detector(CppDetectorApi):
@udp_dstmac.setter @udp_dstmac.setter
def udp_dstmac(self, mac): def udp_dstmac(self, mac):
self.setDestinationUDPMAC(MacAddr(mac)) self.getDestinationUDPMAC2(mac)
@property @property
def udp_dstmac2(self): def udp_dstmac2(self):
@ -441,7 +446,8 @@ class Detector(CppDetectorApi):
@udp_dstmac2.setter @udp_dstmac2.setter
def udp_dstmac2(self, mac): def udp_dstmac2(self, mac):
self.setDestinationUDPMAC2(MacAddr(mac)) self.getDestinationUDPMAC2(mac)
@property @property
def udp_srcip(self): def udp_srcip(self):
@ -449,7 +455,7 @@ class Detector(CppDetectorApi):
@udp_srcip.setter @udp_srcip.setter
def udp_srcip(self, ip): def udp_srcip(self, ip):
self.setSourceUDPIP(IpAddr(ip)) self.setSourceUDPIP(ip)
@property @property
def udp_srcip2(self): def udp_srcip2(self):
@ -481,7 +487,7 @@ class Detector(CppDetectorApi):
@src_udpmac.setter @src_udpmac.setter
def src_udpmac(self, mac): def src_udpmac(self, mac):
self.setSourceUDPMAC(MacAddr(mac)) self.setSourceUDPMAC(mac)
@property @property
def src_udpip2(self): def src_udpip2(self):
@ -489,7 +495,7 @@ class Detector(CppDetectorApi):
@src_udpip2.setter @src_udpip2.setter
def src_udpip2(self, ip): def src_udpip2(self, ip):
self.setSourceUDPIP(IpAddr(ip)) self.setSourceUDPIP(ip)
@property @property
def src_udpip(self): def src_udpip(self):
@ -497,7 +503,8 @@ class Detector(CppDetectorApi):
@src_udpip.setter @src_udpip.setter
def src_udpip(self, ip): def src_udpip(self, ip):
self.setSourceUDPIP(IpAddr(ip)) self.setSourceUDPIP(ip)
@property @property
def src_udpmac2(self): def src_udpmac2(self):
@ -505,14 +512,14 @@ class Detector(CppDetectorApi):
@src_udpmac2.setter @src_udpmac2.setter
def src_udpmac2(self, mac): def src_udpmac2(self, mac):
self.setSourceUDPMAC2(MacAddr(mac)) self.setSourceUDPMAC2(mac)
@property @property
def highvoltage(self): def vhighvoltage(self):
return element_if_equal(self.getHighVoltage()) return element_if_equal(self.getHighVoltage())
@highvoltage.setter @vhighvoltage.setter
def highvoltage(self, v): def vhighvoltage(self, v):
self.setHighVoltage(v) self.setHighVoltage(v)
@property @property
@ -535,6 +542,8 @@ class Detector(CppDetectorApi):
def rx_status(self): def rx_status(self):
return element_if_equal(self.getReceiverStatus()) return element_if_equal(self.getReceiverStatus())
@property @property
def rx_udpsocksize(self): def rx_udpsocksize(self):
return element_if_equal(self.getRxUDPSocketBufferSize()) return element_if_equal(self.getRxUDPSocketBufferSize())
@ -549,7 +558,7 @@ class Detector(CppDetectorApi):
@property @property
def trimbits(self): def trimbits(self):
return NotImplementedError("trimbits are set only") return NotImplementedError('trimbits are set only')
@trimbits.setter @trimbits.setter
def trimbits(self, fname): def trimbits(self, fname):
@ -583,6 +592,7 @@ class Detector(CppDetectorApi):
def adcreg(self): def adcreg(self):
return self._adc_register return self._adc_register
@property @property
def led(self): def led(self):
return element_if_equal(self.getLEDEnable()) return element_if_equal(self.getLEDEnable())
@ -601,12 +611,13 @@ class Detector(CppDetectorApi):
self.setRateCorrection(tau) self.setRateCorrection(tau)
@property @property
def speed(self): def clkdivider(self):
return element_if_equal(self.getSpeed()) res = [int(value) for value in self.getSpeed()]
return element_if_equal(res)
@speed.setter @clkdivider.setter
def speed(self, value): def clkdivider(self, value):
self.setSpeed(value) self.setSpeed(speedLevel(value))
@property @property
def frameindex(self): def frameindex(self):
@ -638,7 +649,9 @@ class Detector(CppDetectorApi):
@property @property
def vthreshold(self): def vthreshold(self):
return element_if_equal(self.getDAC(dacIndex.VTHRESHOLD, False)) return element_if_equal(self.getDAC(dacIndex.THRESHOLD))
@property @property
def type(self): def type(self):
@ -652,27 +665,10 @@ class Detector(CppDetectorApi):
def rx_missingpackets(self): def rx_missingpackets(self):
return element_if_equal(self.getNumMissingPackets()) return element_if_equal(self.getNumMissingPackets())
""" """
Some Eiger stuff, does this have to be here or can we move it to subclass? Some Eiger stuff, does this have to be here or can we move it to subclass?
""" """
@property
def subexptime(self):
res = self.getSubExptime()
return reduce_time(res)
@subexptime.setter
def subexptime(self, t):
self.setSubExptime(t)
@property
def subdeadtime(self):
res = self.getSubDeadTime()
reduce_time(res)
@subdeadtime.setter
def subdeadtime(self, t):
self.setSubDeadTime(t)
@property @property
def partialreset(self): def partialreset(self):
return element_if_equal(self.getPartialReset()) return element_if_equal(self.getPartialReset())
@ -732,116 +728,19 @@ class Detector(CppDetectorApi):
return element_if_equal([it.total_seconds() for it in res]) return element_if_equal([it.total_seconds() for it in res])
"""
Jungfrau specific
"""
@property @property
@element def storeinram(self):
def auto_comp_disable(self): return element_if_equal(self.getStoreInRamMode())
return self.getAutoCompDisable()
@auto_comp_disable.setter @storeinram.setter
def auto_comp_disable(self, value): def storeinram(self, value):
self.setAutoCompDisable(value) self.setStoreInRamMode(value)
@property
@element
def storagecells(self):
return self.getNumberOfAdditionalStorageCells()
@storagecells.setter
def storagecells(self, n_cells):
self.setNumberOfAdditionalStorageCells(n_cells)
@property
@element
def storagecell_start(self):
return self.getStorageCellStart()
@storagecell_start.setter
def storagecell_start(self, value):
self.setStorageCellStart(value)
@property
@element
def storagecell_delay(self):
return ut.reduce_time(self.getStorageCellDelay())
@storagecell_delay.setter
def storagecell_delay(self, t):
self.setStorageCellDelay(t)
@property
@element
def temp_threshold(self):
return self.getThresholdTemperature()
@temp_threshold.setter
def temp_threshold(self, value):
self.setThresholdTemperature(value)
@property
@element
def temp_event(self):
return self.getTemperatureEvent()
@temp_event.setter
def temp_event(self, value):
if value != 0:
raise ValueError("Value needs to be 0 for reset. Setting not allowed")
self.resetTemperatureEvent()
@property
@element
def temp_control(self):
return self.getTemperatureControl()
@temp_control.setter
def temp_control(self, value):
self.setTemperatureControl(value)
@property
@element
def selinterface(self):
return self.getSelectedUDPInterface()
@selinterface.setter
def selinterface(self, i):
self.selectUDPInterface(i)
"""
Gotthard2
"""
@property
@element
def veto(self):
return self.getVeto()
@veto.setter
def veto(self, value):
self.setVeto(value)
""" """
Mythen3 specific Mythen3 specific
""" """
@property
def gatedelay(self):
return reduce_time(self.getGateDelayForAllGates())
@gatedelay.setter
def gatedelay(self, value):
if is_iterable(value):
if len(value) == 3:
for i, v in enumerate(value):
self.setGateDelay(i, v)
else:
self.setGateDelay(-1, value)
@property @property
def counters(self): def counters(self):
mask = self.getCounterMask() mask = self.getCounterMask()
@ -851,6 +750,7 @@ class Detector(CppDetectorApi):
else: else:
return [get_set_bits(m) for m in mask] return [get_set_bits(m) for m in mask]
@counters.setter @counters.setter
def counters(self, values): def counters(self, values):
self.setCounterMask(list_to_bitmask(values)) self.setCounterMask(list_to_bitmask(values))
@ -969,10 +869,18 @@ class Detector(CppDetectorApi):
@property @property
def pattern(self): def pattern(self):
# TODO! Clean fix #TODO! Clean fix
print("Set only") print("Set only")
return 0 return 0
@property
def patclkctrl(self):
return element_if_equal(self.getPatternClockControl())
@patclkctrl.setter
def patclkctrl(self, mask):
self.setPatternClockControl(mask)
# patioctrl # patioctrl
@property @property
def patioctrl(self): def patioctrl(self):
@ -1050,6 +958,7 @@ class Detector(CppDetectorApi):
def patwaittime2(self, nclk): def patwaittime2(self, nclk):
self.setPatternWaitTime(2, nclk) self.setPatternWaitTime(2, nclk)
@property @property
def patloop0(self): def patloop0(self):
return element_if_equal(self.getPatternLoopAddresses(0)) return element_if_equal(self.getPatternLoopAddresses(0))
@ -1098,6 +1007,7 @@ class Detector(CppDetectorApi):
def patnloop2(self, n): def patnloop2(self, n):
self.setPatternLoopCycles(2, n) self.setPatternLoopCycles(2, n)
@property @property
@element @element
def v_a(self): def v_a(self):

View File

@ -60,23 +60,23 @@ class EigerDacs(DetectorDacs):
""" """
Eiger specific dacs Eiger specific dacs
""" """
_dacs = [('vsvp', dacIndex.VSVP,0, 4000, 0), _dacs = [('vsvp', dacIndex.SVP,0, 4000, 0),
('vtrim', dacIndex.VTRIM,0, 4000, 2500), ('vtr', dacIndex.VTR,0, 4000, 2500),
('vrpreamp', dacIndex.VRPREAMP,0, 4000, 3300), ('vrf', dacIndex.VRF,0, 4000, 3300),
('vrshaper', dacIndex.VRSHAPER,0, 4000, 1400), ('vrs', dacIndex.VRS,0, 4000, 1400),
('vsvn', dacIndex.VSVN,0, 4000, 4000), ('vsvn', dacIndex.SVN,0, 4000, 4000),
('vtgstv', dacIndex.VTGSTV,0, 4000, 2556), ('vtgstv', dacIndex.VTGSTV,0, 4000, 2556),
('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500), ('vcmp_ll', dacIndex.VCMP_LL,0, 4000, 1500),
('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500), ('vcmp_lr', dacIndex.VCMP_LR,0, 4000, 1500),
('vcal', dacIndex.VCAL,0, 4000, 4000), ('vcall', dacIndex.CAL,0, 4000, 4000),
('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500), ('vcmp_rl', dacIndex.VCMP_RL,0, 4000, 1500),
('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100), ('rxb_rb', dacIndex.RXB_RB,0, 4000, 1100),
('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100), ('rxb_lb', dacIndex.RXB_LB,0, 4000, 1100),
('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500), ('vcmp_rr', dacIndex.VCMP_RR,0, 4000, 1500),
('vcp', dacIndex.VCP,0, 4000, 200), ('vcp', dacIndex.VCP,0, 4000, 200),
('vcn', dacIndex.VCN,0, 4000, 2000), ('vcn', dacIndex.VCN,0, 4000, 2000),
('vishaper', dacIndex.VISHAPER,0, 4000, 1550), ('vis', dacIndex.VIS,0, 4000, 1550),
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)] ('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
_dacnames = [_d[0] for _d in _dacs] _dacnames = [_d[0] for _d in _dacs]
# # noinspection PyProtectedMember # # noinspection PyProtectedMember

View File

@ -1,9 +1,9 @@
from .detector import Detector from .detector import Detector
def view(name, det = Detector): def view(name):
names = find(name, det) names = find(name)
for n in names: for n in names:
print(n) print(n)
def find(name, det = Detector): def find(name):
return [n for n in dir(det) if name.lower() in n.lower()] return [n for n in dir(Detector) if name in n]

View File

@ -13,32 +13,49 @@ import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty from .detector_property import DetectorProperty
# vcassh 1200,
# vth2 2800,
# vshaper 1280,
# vshaperneg 2800,
# vipre_out 1220,
# vth3 2800,
# vth1 2800,
# vicin 1708,
# vcas 1800,
# vpreamp 1100,
# vpl 1100,
# vipre 2624,
# viinsh 1708,
# vph 1712,
# vtrim 2800,
# vdcsh 800
# @freeze # @freeze
class Mythen3Dacs(DetectorDacs): class Mythen3Dacs(DetectorDacs):
""" """
Jungfrau specific DACs Jungfrau specific DACs
""" """
_dacs = [('vcassh', dacIndex.VCASSH, 0, 4000, 1220), _dacs = [('vcassh', dacIndex.CASSH, 0, 4000, 1220),
('vth2', dacIndex.VTH2, 0, 4000, 2800), ('vth2', dacIndex.VTH2, 0, 4000, 2800),
('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280), ('vshaper', dacIndex.SHAPER1, 0, 4000, 1280),
('vrshaper_n', dacIndex.VRSHAPER_N, 0, 4000, 2800), ('vshaperneg', dacIndex.SHAPER2, 0, 4000, 2800),
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220), ('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
('vth3', dacIndex.VTH3, 0, 4000, 2800), ('vth3', dacIndex.VTH3, 0, 4000, 2800),
('vth1', dacIndex.VTH1, 0, 4000, 2800), ('vth1', dacIndex.THRESHOLD, 0, 4000, 2800),
('vicin', dacIndex.VICIN, 0, 4000, 1708), ('vicin', dacIndex.VICIN, 0, 4000, 1708),
('vcas', dacIndex.VCAS, 0, 4000, 1800), ('vcas', dacIndex.CAS, 0, 4000, 1800),
('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100), ('vpreamp', dacIndex.PREAMP, 0, 4000, 1100),
('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100), ('vpl', dacIndex.VPL, 0, 4000, 1100),
('vipre', dacIndex.VIPRE, 0, 4000, 2624), ('vipre', dacIndex.VIPRE, 0, 4000, 2624),
('vishaper', dacIndex.VISHAPER, 0, 4000, 1708), ('viinsh', dacIndex.VIINSH, 0, 4000, 1708),
('vcal_p', dacIndex.VCAL_P, 0, 4000, 1712), ('vph', dacIndex.CALIBRATION_PULSE, 0, 4000, 1712),
('vtrim', dacIndex.VTRIM, 0, 4000, 2800), ('vtrim', dacIndex.TRIMBIT_SIZE, 0, 4000, 2800),
('vdcsh', dacIndex.VDCSH, 0, 4000, 800), ('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
] ]
_dacnames = [_d[0] for _d in _dacs] _dacnames = [_d[0] for _d in _dacs]
#vthreshold??
@freeze @freeze

View File

@ -7,17 +7,10 @@ but not directly used in controlling the detector
from collections import namedtuple from collections import namedtuple
import _slsdet #C++ lib import _slsdet #C++ lib
import functools import functools
import datetime as dt
Geometry = namedtuple('Geometry', ['x', 'y']) Geometry = namedtuple('Geometry', ['x', 'y'])
def is_iterable(item):
try:
iter(item)
except TypeError:
return False
return True
def get_set_bits(mask): def get_set_bits(mask):
""" """
Return a list of the set bits in a python integer Return a list of the set bits in a python integer
@ -48,9 +41,6 @@ def all_equal(mylist):
def element_if_equal(mylist): def element_if_equal(mylist):
"""If all elements are equal return only one element""" """If all elements are equal return only one element"""
if not is_iterable(mylist):
return mylist
if all_equal(mylist): if all_equal(mylist):
if len(mylist) == 0: if len(mylist) == 0:
return None return None
@ -59,15 +49,6 @@ def element_if_equal(mylist):
else: else:
return mylist return mylist
def reduce_time(mylist):
res = element_if_equal(element_if_equal(mylist))
if isinstance(res, dt.timedelta):
return res.total_seconds()
elif isinstance(res[0], list):
return [[item.total_seconds() for item in subl] for subl in res]
else:
return [r.total_seconds() for r in res]
def element(func): def element(func):
""" """
Wrapper to return either list or element Wrapper to return either list or element
@ -88,8 +69,3 @@ def eiger_register_to_time(register):
exponent = register & 0b111 exponent = register & 0b111
return clocks*10**exponent / 100e6 return clocks*10**exponent / 100e6
def make_timedelta(t):
if isinstance(t, dt.timedelta):
return t
else:
return dt.timedelta(seconds=t)

20
python/sphinx/Makefile Executable file
View File

@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = sls_detector_tools
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

134
python/sphinx/code_quality.rst Executable file
View File

@ -0,0 +1,134 @@
Code quality
=============================
For usability and reliability of the software the code needs to be high quality. For this
project it means meeting the four criteria described below. Any addition should pass all of
them.
--------------------------------
Look, read and feel like Python
--------------------------------
When using classes and functions from the
package it should feel like you are using Python tools and be forces
to write C++ style code with Python syntax.
::
with xray_box.shutter_open():
for th in threshold:
d.vthreshold = th
d.acq()
should be preferred over
::
N = len(threshold)
xray_box.open_shutter()
for i in range(N):
d.dacs.set_dac('vthreshold', threshold[i])
d.acq()
xray_box.close_shutter()
even if the difference might seem small.
--------------------
Have documentation
--------------------
Classes and functions should be documented with doc-strings
in the source code. Preferably with examples. The syntax to be used
is numpy-sphinx.
::
def function(arg):
"""
This is a function that does something
Parameters
----------
arg: int
An argument
Returns
--------
value: double
Returns a value
"""
return np.sin(arg+np.pi)
---------------------------------
Pass static analysis with pylint
---------------------------------
Yes, anything less than 9/10 just means that you are lazy. If
there is a good reason why to diverge, then we can always
add an exception.
Currently the following additions are made:
* good-names: x, y, ax, im etc.
* function arguments 10
* Whitelist: numpy, _sls
-----------------------
Tested code
-----------------------
Last but not least... *actually last just because of the long list included.*
All code that goes in should have adequate tests. If a new function does not
have a minimum of one test it does not get added.
**Unit-tests with pytest and mocker**
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 3 79%
sls_detector/detector.py 461 115 75%
sls_detector/eiger.py 150 64 57%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 208 70%
========= 78 passed in 0.60 seconds =========
**Simple integration tests**
These tests require a detector connected. Performs simple tasks like setting
exposure time and reading back to double check the value
::
----------- coverage: platform linux, python 3.6.4-final-0 -----------
Name Stmts Miss Cover
------------------------------------------------
sls_detector/__init__.py 4 0 100%
sls_detector/decorators.py 14 0 100%
sls_detector/detector.py 461 103 78%
sls_detector/eiger.py 150 20 87%
sls_detector/errors.py 7 0 100%
sls_detector/jungfrau.py 59 26 56%
------------------------------------------------
TOTAL 695 149 79%
========= 67 passed, 1 skipped in 16.66 seconds =========
**Complex integration test**
Typical measurements. Might require X-rays. Tests are usually evaluated from
plots

370
python/sphinx/command_line.rst Executable file
View File

@ -0,0 +1,370 @@
Command line to Python
=========================
If you are already familiar with the command line interface to the
slsDetectorSoftware here is a quick reference translating to Python commands
.. note ::
Commands labeled Mythen only or Gotthard only are currently not implemented in the
Python class. If you need this functionallity please contact the SLS Detector Group
.. py:currentmodule:: sls_detector
.. |ro| replace:: *(read only)*
.. |free| replace:: :py:func:`Detector.free_shared_memory`
.. |sub| replace:: :py:attr:`Detector.sub_exposure_time`
.. |mg| replace:: Mythen and Gotthard only
.. |g| replace:: Gotthard only
.. |m| replace:: Mythen only
.. |msp| replace:: :py:attr:`Detector.measured_subperiod`
.. |new_chiptest| replace:: New chip test board only
.. |chiptest| replace:: Chip test board only
.. |dr| replace:: :py:attr:`Detector.dynamic_range`
.. |j| replace:: Jungfrau only
.. |te| replace:: :py:attr:`Detector.trimmed_energies`
.. |temp_fpgaext| replace:: :py:attr:`Detector.temp`.fpgaext
.. |epa| replace:: :py:func:`Eiger.pulse_all_pixels`
.. |rfc| replace:: :py:func:`Detector.reset_frames_caught`
.. |rfi| replace:: :py:attr:`Detector.receiver_frame_index`
.. |ron| replace:: :py:attr:`Detector.receiver_online`
.. |flipy| replace:: :py:attr:`Detector.flipped_data_y`
.. |flipx| replace:: :py:attr:`Detector.flipped_data_x`
.. |adcr| replace:: :py:func:`DetectorApi.writeAdcRegister`
.. |sb| replace:: :py:func:`DetectorApi.setBitInRegister`
.. |cb| replace:: :py:func:`DetectorApi.clearBitInRegister`
.. |tempth| replace:: :py:attr:`Jungfrau.temperature_threshold`
.. |tempev| replace:: :py:attr:`Jungfrau.temperature_event`
.. |tempco| replace:: :py:attr:`Jungfrau.temperature_control`
.. |depr| replace:: *Deprecated/Internal*
.. |nimp| replace:: *Not implemented*
.. |rudp| replace:: :py:attr:`Detector.rx_realudpsocksize`
.. |lci| replace:: :py:attr:`Detector.last_client_ip`
.. |rlci| replace:: :py:attr:`Detector.receiver_last_client_ip`
.. |fdp| replace:: :py:attr:`Detector.frame_discard_policy`
.. |apic| replace:: :py:attr:`Detector.api_compatibility`
------------------------
Commands
------------------------
===================== ===================================== ================== =========
Command Python Implementation Tests
===================== ===================================== ================== =========
sls_detector_acquire :py:func:`Detector.acq` OK OK
test |depr| \- \-
help help(Detector.acq) \- \-
exitserver |depr| \- \-
exitreceiver |depr| \- \-
flippeddatay |flipy| OK \-
digitest |depr| \- \-
bustest |depr| \- \-
digibittest Which detector? \- \-
reg :py:attr:`Detector.register` OK \-
adcreg |adcr| OK \-
setbit |sb| OK \-
clearbit |cb| OK \-
getbit |nimp| \- \-
r_compression Not implemented in receiver \- \-
acquire :py:func:`Detector.acq` OK \-
busy :py:attr:`Detector.busy` OK Partial
status :py:attr:`Detector.status` OK |ro| \-
status start :py:func:`Detector.start_detector` OK \-
status stop :py:func:`Detector.stop_detector` OK \-
data |depr| \- \-
frame |depr| \- \-
readctr |g| \- \-
resetctr |g| \- \-
resmat :py:attr:`Eiger.eiger_matrix_reset` OK OK
free |free| OK \-
hostname :py:attr:`Detector.hostname` OK OK
add |nimp| \- \-
replace |nimp| \- \-
user |nimp| \- \-
master |nimp| \- \-
sync Which detector? \- \-
online :py:attr:`Detector.online` OK \-
checkonline |nimp| \- \-
activate :py:attr:`Eiger.active` \- \-
nmod :py:attr:`Detector.n_modules` OK \-
maxmod |depr| \- \-
dr |dr| OK OK
roi |g| \- \-
detsizechan :py:attr:`Detector.image_size` OK \-
roimask |nimp| \- \-
flippeddatax |flipx| OK \-
tengiga :py:attr:`Eiger.tengiga` OK \-
gappixels :py:attr:`Eiger.add_gappixels` OK \-
flags :py:attr:`Detector.flags` OK \-
extsig |mg| \- \-
programfpga |j| \- \-
resetfpga |j| \- \-
powerchip :py:attr:`Jungfrau.powerchip` \- \-
led |nimp| \- \-
auto_comp_disable |j| \- \-
pulse Used in |epa| OK \-
pulsenmove Used in |epa| OK \-
pulsechip :py:func:`Eiger.pulse_chip` OK \-
checkdetversion |apic| \- \-
checkrecversion |apic| \- \-
moduleversion |m| \- \-
detectornumber :py:attr:`Detector.detector_number` OK \-
modulenumber |m| \- \-
detectorversion :py:attr:`Detector.firmware_version` OK OK
softwareversion :py:attr:`Detector.server_version` \- \-
thisversion :py:attr:`Detector.client_version` Reads date \-
receiverversion :py:attr:`Detector.receiver_version` Reads date \-
timing :py:attr:`Detector.timing_mode` OK \-
exptime :py:attr:`Detector.exposure_time` OK OK
subexptime |sub| OK OK
period :py:attr:`Detector.period` OK OK
subdeadtime :py:attr:`Eiger.sub_deadtime` OK OK
delay :py:attr:`Jungfrau.delay` OK \-
gates :py:attr:`Jungfrau.n_gates` OK \-
frames :py:attr:`Detector.n_frames` OK OK
cycles :py:attr:`Detector.n_cycles` OK \-
probes :py:attr:`Jungfrau.n_probes` OK \-
measurements :py:attr:`Detector.n_measurements` OK \-
samples Chip test board only (new?) \- \-
storagecells :py:attr:`Jungfrau.n_storagecells` OK \-
storagecell_start :py:attr:`Jungfrau.storagecell_start` OK \-
exptimel |mg| \- \-
periodl |mg| \- \-
delayl |mg| \- \-
gatesl |mg| \- \-
framesl |mg| \- \-
cyclesl |mg| \- \-
probesl |mg| \- \-
now |nimp| \- \-
timestamp |m| \- \-
nframes |nimp| \- \-
measuredperiod :py:attr:`Detector.measured_period` OK \-
measuredsubperiod |msp| \- \-
clkdivider :py:attr:`Detector.readout_clock` OK OK
setlength |m| \- \-
waitstates |m| \- \-
totdivider |m| \- \-
totdutycycle |m| \- \-
phasestep |g| \- \-
oversampling |new_chiptest| \- \-
adcclk |new_chiptest| \- \-
adcphase |new_chiptest| \- \-
adcpipeline |new_chiptest| \- \-
dbitclk |new_chiptest| \- \-
dbitphase |new_chiptest| \- \-
dbitpipeline |new_chiptest| \- \-
config :py:func:`Detector.load_config` OK \-
rx_printconfig |nimp| \- \-
parameters :py:func:`Detector.load_parameters` OK \-
setup |nimp| \- \-
flatfield |nimp| \- \-
ffdir |nimp| \- \-
ratecorr :py:attr:`Detector.rate_correction` OK \-
badchannels |nimp| \- \-
angconv |m| \- \-
globaloff |nimp| \- \-
fineoff |nimp| \- \-
binsize |nimp| \- \-
angdir |nimp| \- \-
moveflag |nimp| \- \-
samplex |nimp| \- \-
sampley |nimp| \- \-
threaded :py:attr:`Detector.threaded` OK \-
darkimage |nimp| \- \-
gainimage |nimp| \- \-
settingsdir :py:attr:`Detector.settings_path` OK \-
trimdir |nimp| \- \-
caldir |nimp| \- \-
trimen :py:attr:`Detector.trimmed_energies` OK \-
settings :py:attr:`Detector.settings` OK \-
threshold :py:attr:`Detector.threshold` OK \-
thresholdnotb |nimp| \- \-
trimbits :py:func:`Detector.load_trimbits` OK \-
trim |nimp| \- \-
trimval :py:attr:`Detector.trimbits` OK OK
pedestal |nimp| \- \-
vthreshold :py:attr:`Detector.vthreshold` OK \-
vcalibration |nimp| \- \-
vtrimbit |nimp| \- \-
vpreamp |nimp| \- \-
vshaper1 |nimp| \- \-
vshaper2 |nimp| \- \-
vhighvoltage :py:attr:`Detector.high_voltage` OK \-
vapower |nimp| \- \-
vddpower |nimp| \- \-
vshpower |nimp| \- \-
viopower |nimp| \- \-
vref_ds :py:attr:`Jungfrau.dacs.vref_ds` OK \-
vcascn_pb |nimp| \- \-
vcascp_pb |nimp| \- \-
vout_cm |nimp| \- \-
vcasc_out |nimp| \- \-
vin_cm |nimp| \- \-
vref_comp |nimp| \- \-
ib_test_c |nimp| \- \-
dac0 |nimp| \- \-
dac1 |nimp| \- \-
dac2 |nimp| \- \-
dac3 |nimp| \- \-
dac4 |nimp| \- \-
dac5 |nimp| \- \-
dac6 |nimp| \- \-
dac7 |nimp| \- \-
vsvp :py:attr:`Eiger.dacs.vsvp` OK \-
vsvn :py:attr:`Eiger.dacs.vsvn` OK \-
vtr :py:attr:`Eiger.dacs.vtr` OK \-
vrf :py:attr:`Eiger.dacs.vrf` OK \-
vrs :py:attr:`Eiger.dacs.vrs` OK \-
vtgstv :py:attr:`Eiger.dacs.vtgstv` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcmp_ll :py:attr:`Eiger.dacs.vcmp_ll` OK \-
vcall :py:attr:`Eiger.dacs.vcall` OK \-
vcmp_rl :py:attr:`Eiger.dacs.vcmp_rl` OK \-
vcmp_rr :py:attr:`Eiger.dacs.vcmp_rr` OK \-
rxb_rb :py:attr:`Eiger.dacs.rxb_rb` OK \-
rxb_lb :py:attr:`Eiger.dacs.rxb_lb` OK \-
vcp :py:attr:`Eiger.dacs.vcp` OK \-
vcn :py:attr:`Eiger.dacs.vcn` OK \-
vis :py:attr:`Eiger.dacs.vis` OK \-
iodelay :py:attr:`Eiger.dacs.iodelay` OK \-
dac |nimp| \- \-
adcvpp |nimp| \- \-
v_a |nimp| \- \-
v_b |nimp| \- \-
v_c |nimp| \- \-
v_d |nimp| \- \-
v_io |nimp| \- \-
v_chip |nimp| \- \-
v_limit |nimp| \- \-
vIpre |nimp| \- \-
VcdSh |nimp| \- \-
Vth1 |nimp| \- \-
Vth2 |nimp| \- \-
Vth3 |nimp| \- \-
VPL |nimp| \- \-
Vtrim |nimp| \- \-
vIbias |nimp| \- \-
vIinSh |nimp| \- \-
cas |nimp| \- \-
casSh |nimp| \- \-
vIbiasSh |nimp| \- \-
vIcin |nimp| \- \-
vIpreOut |nimp| \- \-
temp_adc |nimp| \- \-
temp_fpga :py:attr:`Detector.temp`.fpga OK \-
temp_fpgaext |temp_fpgaext| OK \-
temp_10ge :py:attr:`Detector.temp`.t10ge OK \-
temp_dcdc :py:attr:`Detector.temp`.dcdc OK \-
temp_sodl :py:attr:`Detector.temp`.sodl OK \-
temp_sodr :py:attr:`Detector.temp`.sodr OK \-
adc |nimp| \- \-
temp_fpgafl :py:attr:`Detector.temp`.fpgafl OK \-
temp_fpgafr :py:attr:`Detector.temp`.fpgafr OK \-
i_a |nimp| \- \-
i_b |nimp| \- \-
i_c |nimp| \- \-
i_d |nimp| \- \-
i_io |nimp| \- \-
vm_a |nimp| \- \-
vm_b |nimp| \- \-
vm_c |nimp| \- \-
vm_d |nimp| \- \-
vm_io |nimp| \- \-
temp_threshold |tempth| \- \-
temp_control |tempco| \- \-
temp_event |tempev| \- \-
outdir :py:attr:`Detector.file_path` OK OK
fname :py:attr:`Detector.file_name` OK OK
index :py:attr:`Detector.file_index` OK OK
enablefwrite :py:attr:`Detector.file_write` OK OK
overwrite :py:attr:`Detector.file_overwrite` OK \-
currentfname |nimp| \- \-
fileformat :py:attr:`Detector.file_format` OK \-
positions |depr| \- \-
startscript |depr| \- \-
startscriptpar |depr| \- \-
stopscript |depr| \- \-
stopscriptpar |depr| \- \-
scriptbefore |depr| \- \-
scriptbeforepar |depr| \- \-
scriptafter |depr| \- \-
scriptafterpar |depr| \- \-
headerafter |depr| \- \-
headerbefore |depr| \- \-
headerbeforepar |depr| \- \-
headerafterpar |depr| \- \-
encallog |depr| \- \-
angcallog |depr| \- \-
scan0script |depr| \- \-
scan0par |depr| \- \-
scan0prec |depr| \- \-
scan0steps |depr| \- \-
scan0range |depr| \- \-
scan1script |depr| \- \-
scan1par |depr| \- \-
scan1prec |depr| \- \-
scan1steps |depr| \- \-
scan1range |depr| \- \-
rx_hostname :py:attr:`Detector.rx_hostname` OK \-
rx_udpip :py:attr:`Detector.rx_udpip` OK \-
rx_udpmac :py:attr:`Detector.rx_udpmac` OK \-
rx_udpport :py:attr:`Detector.rx_udpport` OK \-
rx_udpport2 :py:attr:`Detector.rx_udpport` OK \-
rx_udpsocksize :py:attr:`Detector.rx_udpsocksize` OK \-
rx_realudpsocksize |rudp| OK
detectormac :py:attr:`Detector.detector_mac` OK \-
detectorip :py:attr:`Detector.detector_ip` OK \-
txndelay_left :py:attr:`Eiger.delay`.left OK \-
txndelay_right :py:attr:`Eiger.delay`.right OK \-
txndelay_frame :py:attr:`Eiger.delay`.frame OK \-
flowcontrol_10g :py:attr:`Eiger.flowcontrol_10g` OK \-
zmqport :py:attr:`Detector.client_zmqport` Read \-
rx_zmqport :py:attr:`Detector.rx_zmqport` Read \-
rx_datastream :py:attr:`Detector.rx_datastream` OK \-
zmqip :py:attr:`Detector.client_zmqip` OK \-
rx_zmqip :py:attr:`Detector.rx_zmqip` Read \-
rx_jsonaddheader :py:attr:`Detector.rx_jsonaddheader` OK \-
configuremac :py:attr:`Detector.config_network` OK \-
rx_tcpport :py:attr:`Detector.rx_tcpport`
port |nimp| \- \-
stopport |nimp| \- \-
lock :py:attr:`Detector.lock` OK \-
lastclient :py:attr:`Detector.last_client_ip` OK \-
receiver start :py:func:`Detector.start_receiver` OK \-
receiver stop :py:func:`Detector.stop_receiver` \- \-
r_online |ron| OK \-
r_checkonline |nimp| \- \-
framescaught :py:attr:`Detector.frames_caught` OK \-
resetframescaught |rfc| OK \-
frameindex |rfi| OK \-
r_lock :py:attr:`Detector.lock_receiver` OK \-
r_lastclient |rlci| OK \-
r_readfreq |nimp| \- \-
rx_fifodepth :py:attr:`Detector.rx_fifodepth` OK \-
r_silent |nimp| \- \-
r_framesperfile :py:attr:`Detector.n_frames_per_file` OK \-
r_discardpolicy |fdp| OK \-
r_padding :py:attr:`Detector.file_padding` OK \-
adcinvert |chiptest| \- \-
adcdisable |chiptest| \- \-
pattern |chiptest| \- \-
patword |chiptest| \- \-
patioctrl |chiptest| \- \-
patclkctrl |chiptest| \- \-
patlimits |chiptest| \- \-
patloop0 |chiptest| \- \-
patnloop0 |chiptest| \- \-
patwait0 |chiptest| \- \-
patwaittime0 |chiptest| \- \-
patloop1 |chiptest| \- \-
patnloop1 |chiptest| \- \-
patwait1 |chiptest| \- \-
patwaittime1 |chiptest| \- \-
patloop2 |chiptest| \- \-
patnloop2 |chiptest| \- \-
patwait2 |chiptest| \- \-
patwaittime2 |chiptest| \- \-
dut_clk |chiptest| \- \-
===================== ===================================== ================== =========

178
python/sphinx/conf.py Executable file
View File

@ -0,0 +1,178 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# sls_detector_tools documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 1 10:17:29 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.autosummary']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'sls_detector'
copyright = '2019, Sls Detector Group'
author = 'Erik Frojdh'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '4.0.1'
# The full version, including alpha/beta/rc tags.
release = '4.0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "sphinx_rtd_theme"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
'donate.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'sls_detector_doc'
napoleon_use_ivar = True
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'sls_detector.tex', 'sls_detector Documentation',
'Erik Frojdh', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'sls_detector_tools', 'sls_detector_tools Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'py_sls', 'py_sls Documentation',
author, 'py_sls', 'One line description of project.',
'Miscellaneous'),
]

12
python/sphinx/cpp_api.rst Executable file
View File

@ -0,0 +1,12 @@
C++ API
=====================================================
.. py:currentmodule:: _slsdet
.. autoclass:: DetectorApi
:members:
:undoc-members:

View File

@ -0,0 +1,67 @@
Error handling
=========================
Check input in Python
----------------------
As far as possible we try to check the input on the Python side
before calling the slsDeteectorsSoftware. Errors should not pass
silently but raise an exception
::
#Trimbit range for Eiger is 0-63
detector.trimbits = 98
(...)
ValueError: Trimbit setting 98 is outside of range:0-63
Errors in slsDetectorsSoftware
-------------------------------
The slsDetectorsSoftware uses a mask to record errors from the different
detectors. If an error is found we raise a RuntimeError at the end of the
call using the error message from slsDetectorsSoftware
.. todo ::
Implement this for all functions
::
detector.settings = 'bananas'
(...)
RuntimeError: Detector 0:
Could not set settings.
Detector 1:
Could not set settings.
Detector 2:
Could not set settings.
Using decorators
-------------------
Using decorators we can reset the error mask before the command and then
check it after the command
.. code-block:: python
#add decorator to check the error mask
@error_handling
def some_function():
a = 1+1
return a
Communication with the detector is usually the biggest overhead so
this does not impact performance.
::
%timeit d.exposure_time
>> 1.52 ms ± 5.42 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
%timeit d.decorated_exposure_time
>> 1.53 ms ± 3.18 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

122
python/sphinx/getting_started.rst Executable file
View File

@ -0,0 +1,122 @@
Getting started
================
------------------------
Setting up the detector
------------------------
All configuration of the detector can either be done from the Python
API (including loading config file) or externally. The detector setup is
discovered from the shared memory when launching a new script. Because the
detector usually should remain online longer than a specific script it is
recommended to run the receivers seperate.
---------------------------------
Setting and getting attributes
---------------------------------
Most of the detector and software setting are implemented as attributes
in the Detector class. When something is assigned it is also set
in the detector and when the attribute is called using dot notation it
it looked up from the detector.
::
#Currently Eiger and Jungfrau but Detector should work for all
from sls_detector import Eiger()
d = Eiger()
d.file_write = True
d.vthreshold = 1500
d.frame_index
>> 12
d.file_name
>> 'run'
---------------------------------
Working with DACs
---------------------------------
The following examples assumes an Eiger500k detector. But the same syntax
works for other detector sizes and models.
::
d.dacs
>>
========== DACS =========
vsvp : 0, 0
vtr : 4000, 4000
vrf : 2000, 2300
vrs : 1400, 1400
vsvn : 4000, 4000
vtgstv : 2556, 2556
vcmp_ll : 1500, 1500
vcmp_lr : 1500, 1500
vcall : 3500, 3600
vcmp_rl : 1500, 1500
rxb_rb : 1100, 1100
rxb_lb : 1100, 1100
vcmp_rr : 1500, 1500
vcp : 1500, 1500
vcn : 2000, 2000
vis : 1550, 1550
iodelay : 660, 660
#Read dac values to a variable
vrf = d.dacs.vrf[:]
#Set a dac in a module
d.dacs.vrf[0] = 1500
d.dacs.vrf[0]
>> 1500
#Set vrf to the same value in all moduels
d.dacs.vrf = 1500
#Set a dac using an iterable
d.dacs.vrf = [1500, 1600]
d.dacs.vrf
>> vrf : 1500, 1600
#Set dacs iterating on index and values
d.dacs.vrf[0,1] = 1300,1400
---------------------------------
Operating multiple detectors
---------------------------------
Operating multiple detectors is supported by assigning an id when creating the object. If no id is
set it defaults to 0.
::
d0 = Eiger() #id is now 0
d1 = Jungfrau(1)
#Or explicitly
d1 = Jungfrau(id = 0)
The detectors now operate independently of each other but can be synchronized using a hardware trigger.
::
from sls_detector import Eiger
d0 = Eiger(0)
d1 = Eiger(1)
d0.load_config('/some/path/T45.config')
d1.load_config('/some/path/T62.config')
d0.n_frames = 1
d0.exposure_time = 1
d0.timing_mode = 'trigger'
d1.n_frames = 5
d1.exposure_time = 0.2
d1.timing_mode = 'trigger'

30
python/sphinx/index.rst Executable file
View File

@ -0,0 +1,30 @@
sls_detector - Python interface for the slsDetectorsPackage
==============================================================
sls_detector provide Python bindings to the slsDetectorsPackage using mainly the
DetectorImpl API. This module contains two parts, a compiled C module to
expose the API and a Python class to offer a more Pythonic interface.
.. toctree::
:maxdepth: 3
:caption: Contents:
installation
getting_started
code_quality
command_line
examples
error-handling
sls_detector
cpp_api
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

90
python/sphinx/installation.rst Executable file
View File

@ -0,0 +1,90 @@
Installation
=========================
The easiest way to install the Python API and the slsDetectorPackage is using conda. But other
methods are also available.
---------------------
Install using conda
---------------------
If you don't have it installed get the latest version of `Miniconda`_
.. _Miniconda: https://conda.io/miniconda.html
::
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
Install sls_detector and sls_detector_lib using:
::
#Add conda channels
conda config --add channels conda-forge
conda config --add channels slsdetectorgroup
#Install latest version
conda install sls_detector
#Install specific version
conda install sls_detector=3.0.1
------------------------------
Local build using conda-build
------------------------------
Needs the `sls_detector_lib`_ installed in order to automatically find headers
and shared libraries. Make sure that the branch of sls_detector matches the lib
version installed.
.. _sls_detector_lib: https://github.com/slsdetectorgroup/sls_detector_lib
::
#Clone source code
git clone https://github.com/slsdetectorgroup/sls_detector.git
#Checkout the branch needed
git checkout 3.0.1
#Build and install the local version
conda-build sls_detector
conda install --use-local sls_detector
-----------------------
Developer build
-----------------------
IF you if you are developing and are making constant changes to the code it's a bit cumbersome
to build with conda and install. Then an easier way is to build the C/C++ parts in the package
directory and temporary add this to the path
::
#in path/to/sls_detector
python setup.py build_ext --inplace
Then in your Python script
::
import sys
sys.path.append('/path/to/sls_detector')
from sls_detector import Detector
--------------
Prerequisites
--------------
All dependencies are manged trough conda but for a stand alone build you would need
* gcc 4.8+
* Qwt 6
* Qt 4.8
* numpy
* slsDetectorPackage

6
python/sphinx/makedocs.sh Executable file
View File

@ -0,0 +1,6 @@
make clean
make html
rm -rf ../docs/
mv _build/html/ ../docs/
touch ../docs/.nojekyll
rm -rf _build

8
python/sphinx/modules.rst Executable file
View File

@ -0,0 +1,8 @@
sls_detector
==================
.. toctree::
:maxdepth: 4
sls_detector

33
python/sphinx/sls_detector.rst Executable file
View File

@ -0,0 +1,33 @@
Python classes
=====================================================
.. py:currentmodule:: sls_detector
Detector
----------
.. autoclass:: Detector
:members:
:undoc-members:
:show-inheritance:
Eiger
-------
.. autoclass:: Eiger
:members:
:undoc-members:
:show-inheritance:
Jungfrau
----------
.. autoclass:: Jungfrau
:members:
:undoc-members:
:show-inheritance:

File diff suppressed because it is too large Load Diff

View File

@ -8,17 +8,10 @@
#include "network_utils.h" #include "network_utils.h"
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "typecaster.h" #include "typecaster.h"
#include "TimeHelper.h"
#include <array>
#include <chrono>
namespace py = pybind11; namespace py = pybind11;
void init_det(py::module &m) { void init_det(py::module &m) {
using sls::Detector; using sls::Detector;
using sls::Positions; using sls::Positions;
using sls::Result;
using sls::defs;
using sls::ns;
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi"); py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
CppDetectorApi CppDetectorApi

View File

@ -17,6 +17,8 @@ void init_enums(py::module &m) {
xy.def_readwrite("y", &slsDetectorDefs::xy::y); xy.def_readwrite("y", &slsDetectorDefs::xy::y);
py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType") py::enum_<slsDetectorDefs::detectorType>(Defs, "detectorType")
.value("GET_DETECTOR_TYPE",
slsDetectorDefs::detectorType::GET_DETECTOR_TYPE)
.value("GENERIC", slsDetectorDefs::detectorType::GENERIC) .value("GENERIC", slsDetectorDefs::detectorType::GENERIC)
.value("EIGER", slsDetectorDefs::detectorType::EIGER) .value("EIGER", slsDetectorDefs::detectorType::EIGER)
.value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD) .value("GOTTHARD", slsDetectorDefs::detectorType::GOTTHARD)
@ -38,6 +40,8 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy") py::enum_<slsDetectorDefs::frameDiscardPolicy>(Defs, "frameDiscardPolicy")
.value("GET_FRAME_DISCARD_POLICY",
slsDetectorDefs::frameDiscardPolicy::GET_FRAME_DISCARD_POLICY)
.value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD) .value("NO_DISCARD", slsDetectorDefs::frameDiscardPolicy::NO_DISCARD)
.value("DISCARD_EMPTY_FRAMES", .value("DISCARD_EMPTY_FRAMES",
slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES) slsDetectorDefs::frameDiscardPolicy::DISCARD_EMPTY_FRAMES)
@ -48,6 +52,7 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat") py::enum_<slsDetectorDefs::fileFormat>(Defs, "fileFormat")
.value("GET_FILE_FORMAT", slsDetectorDefs::fileFormat::GET_FILE_FORMAT)
.value("BINARY", slsDetectorDefs::fileFormat::BINARY) .value("BINARY", slsDetectorDefs::fileFormat::BINARY)
.value("HDF5", slsDetectorDefs::fileFormat::HDF5) .value("HDF5", slsDetectorDefs::fileFormat::HDF5)
.value("NUM_FILE_FORMATS", .value("NUM_FILE_FORMATS",
@ -60,64 +65,59 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag") py::enum_<slsDetectorDefs::externalSignalFlag>(Defs, "externalSignalFlag")
.value("GET_EXTERNAL_SIGNAL_FLAG",
slsDetectorDefs::externalSignalFlag::GET_EXTERNAL_SIGNAL_FLAG)
.value("SIGNAL_OFF", slsDetectorDefs::externalSignalFlag::SIGNAL_OFF)
.value("GATE_IN_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_HIGH)
.value("GATE_IN_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_IN_ACTIVE_LOW)
.value("TRIGGER_IN_RISING_EDGE", .value("TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE) slsDetectorDefs::externalSignalFlag::TRIGGER_IN_RISING_EDGE)
.value("TRIGGER_IN_FALLING_EDGE", .value("TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE) slsDetectorDefs::externalSignalFlag::TRIGGER_IN_FALLING_EDGE)
.value("INVERSION_ON", .value("RO_TRIGGER_IN_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::INVERSION_ON) slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_RISING_EDGE)
.value("INVERSION_OFF", .value("RO_TRIGGER_IN_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::INVERSION_OFF) slsDetectorDefs::externalSignalFlag::RO_TRIGGER_IN_FALLING_EDGE)
.value("GATE_OUT_ACTIVE_HIGH",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_HIGH)
.value("GATE_OUT_ACTIVE_LOW",
slsDetectorDefs::externalSignalFlag::GATE_OUT_ACTIVE_LOW)
.value("TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_RISING_EDGE)
.value("TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::TRIGGER_OUT_FALLING_EDGE)
.value("RO_TRIGGER_OUT_RISING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_RISING_EDGE)
.value("RO_TRIGGER_OUT_FALLING_EDGE",
slsDetectorDefs::externalSignalFlag::RO_TRIGGER_OUT_FALLING_EDGE)
.value("OUTPUT_LOW", slsDetectorDefs::externalSignalFlag::OUTPUT_LOW)
.value("OUTPUT_HIGH", slsDetectorDefs::externalSignalFlag::OUTPUT_HIGH)
.value(
"MASTER_SLAVE_SYNCHRONIZATION",
slsDetectorDefs::externalSignalFlag::MASTER_SLAVE_SYNCHRONIZATION)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode") py::enum_<slsDetectorDefs::timingMode>(Defs, "timingMode")
.value("GET_TIMING_MODE", slsDetectorDefs::timingMode::GET_TIMING_MODE)
.value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING) .value("AUTO_TIMING", slsDetectorDefs::timingMode::AUTO_TIMING)
.value("TRIGGER_EXPOSURE", .value("TRIGGER_EXPOSURE",
slsDetectorDefs::timingMode::TRIGGER_EXPOSURE) slsDetectorDefs::timingMode::TRIGGER_EXPOSURE)
.value("GATED", slsDetectorDefs::timingMode::GATED) .value("GATED", slsDetectorDefs::timingMode::GATED)
.value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER) .value("BURST_TRIGGER", slsDetectorDefs::timingMode::BURST_TRIGGER)
.value("TRIGGER_GATED", slsDetectorDefs::timingMode::TRIGGER_GATED)
.value("NUM_TIMING_MODES",
slsDetectorDefs::timingMode::NUM_TIMING_MODES)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex") py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
.value("DAC_0", slsDetectorDefs::dacIndex::DAC_0) .value("THRESHOLD", slsDetectorDefs::dacIndex::THRESHOLD)
.value("DAC_1", slsDetectorDefs::dacIndex::DAC_1) .value("CALIBRATION_PULSE",
.value("DAC_2", slsDetectorDefs::dacIndex::DAC_2) slsDetectorDefs::dacIndex::CALIBRATION_PULSE)
.value("DAC_3", slsDetectorDefs::dacIndex::DAC_3) .value("TRIMBIT_SIZE", slsDetectorDefs::dacIndex::TRIMBIT_SIZE)
.value("DAC_4", slsDetectorDefs::dacIndex::DAC_4) .value("PREAMP", slsDetectorDefs::dacIndex::PREAMP)
.value("DAC_5", slsDetectorDefs::dacIndex::DAC_5) .value("SHAPER1", slsDetectorDefs::dacIndex::SHAPER1)
.value("DAC_6", slsDetectorDefs::dacIndex::DAC_6) .value("SHAPER2", slsDetectorDefs::dacIndex::SHAPER2)
.value("DAC_7", slsDetectorDefs::dacIndex::DAC_7) .value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
.value("DAC_8", slsDetectorDefs::dacIndex::DAC_8) .value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
.value("DAC_9", slsDetectorDefs::dacIndex::DAC_9)
.value("DAC_10", slsDetectorDefs::dacIndex::DAC_10)
.value("DAC_11", slsDetectorDefs::dacIndex::DAC_11)
.value("DAC_12", slsDetectorDefs::dacIndex::DAC_12)
.value("DAC_13", slsDetectorDefs::dacIndex::DAC_13)
.value("DAC_14", slsDetectorDefs::dacIndex::DAC_14)
.value("DAC_15", slsDetectorDefs::dacIndex::DAC_15)
.value("DAC_16", slsDetectorDefs::dacIndex::DAC_16)
.value("DAC_17", slsDetectorDefs::dacIndex::DAC_17)
.value("VSVP", slsDetectorDefs::dacIndex::VSVP)
.value("VTRIM", slsDetectorDefs::dacIndex::VTRIM)
.value("VRPREAMP", slsDetectorDefs::dacIndex::VRPREAMP)
.value("VRSHAPER", slsDetectorDefs::dacIndex::VRSHAPER)
.value("VSVN", slsDetectorDefs::dacIndex::VSVN)
.value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
.value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
.value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
.value("VCAL", slsDetectorDefs::dacIndex::VCAL)
.value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
.value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
.value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
.value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
.value("VCP", slsDetectorDefs::dacIndex::VCP)
.value("VCN", slsDetectorDefs::dacIndex::VCN)
.value("VISHAPER", slsDetectorDefs::dacIndex::VISHAPER)
.value("VTHRESHOLD", slsDetectorDefs::dacIndex::VTHRESHOLD)
.value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
.value("VREF_DS", slsDetectorDefs::dacIndex::VREF_DS) .value("VREF_DS", slsDetectorDefs::dacIndex::VREF_DS)
.value("VCASCN_PB", slsDetectorDefs::dacIndex::VCASCN_PB) .value("VCASCN_PB", slsDetectorDefs::dacIndex::VCASCN_PB)
.value("VCASCP_PB", slsDetectorDefs::dacIndex::VCASCP_PB) .value("VCASCP_PB", slsDetectorDefs::dacIndex::VCASCP_PB)
@ -126,46 +126,25 @@ void init_enums(py::module &m) {
.value("VIN_CM", slsDetectorDefs::dacIndex::VIN_CM) .value("VIN_CM", slsDetectorDefs::dacIndex::VIN_CM)
.value("VREF_COMP", slsDetectorDefs::dacIndex::VREF_COMP) .value("VREF_COMP", slsDetectorDefs::dacIndex::VREF_COMP)
.value("IB_TESTC", slsDetectorDefs::dacIndex::IB_TESTC) .value("IB_TESTC", slsDetectorDefs::dacIndex::IB_TESTC)
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP) .value("SVP", slsDetectorDefs::dacIndex::SVP)
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT) .value("SVN", slsDetectorDefs::dacIndex::SVN)
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM) .value("VTR", slsDetectorDefs::dacIndex::VTR)
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH) .value("VRF", slsDetectorDefs::dacIndex::VRF)
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF) .value("VRS", slsDetectorDefs::dacIndex::VRS)
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS) .value("VTGSTV", slsDetectorDefs::dacIndex::VTGSTV)
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC) .value("VCMP_LL", slsDetectorDefs::dacIndex::VCMP_LL)
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE) .value("VCMP_LR", slsDetectorDefs::dacIndex::VCMP_LR)
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC) .value("CAL", slsDetectorDefs::dacIndex::CAL)
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS) .value("VCMP_RL", slsDetectorDefs::dacIndex::VCMP_RL)
.value("VREF_RSTORE", slsDetectorDefs::dacIndex::VREF_RSTORE) .value("VCMP_RR", slsDetectorDefs::dacIndex::VCMP_RR)
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST) .value("RXB_RB", slsDetectorDefs::dacIndex::RXB_RB)
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE) .value("RXB_LB", slsDetectorDefs::dacIndex::RXB_LB)
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1) .value("VCP", slsDetectorDefs::dacIndex::VCP)
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC) .value("VCN", slsDetectorDefs::dacIndex::VCN)
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS) .value("VIS", slsDetectorDefs::dacIndex::VIS)
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS) .value("IO_DELAY", slsDetectorDefs::dacIndex::IO_DELAY)
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
.value("VCASSH", slsDetectorDefs::dacIndex::VCASSH)
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
.value("VRSHAPER_N", slsDetectorDefs::dacIndex::VRSHAPER_N)
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
.value("VTH1", slsDetectorDefs::dacIndex::VTH1)
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
.value("VCAS", slsDetectorDefs::dacIndex::VCAS)
.value("VCAL_N", slsDetectorDefs::dacIndex::VCAL_N)
.value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
.value("VCAL_P", slsDetectorDefs::dacIndex::VCAL_P)
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
.value("VBP_COLBUF", slsDetectorDefs::dacIndex::VBP_COLBUF)
.value("VB_SDA", slsDetectorDefs::dacIndex::VB_SDA)
.value("VCASC_SFP", slsDetectorDefs::dacIndex::VCASC_SFP)
.value("VIPRE_CDS", slsDetectorDefs::dacIndex::VIPRE_CDS)
.value("IBIAS_SFP", slsDetectorDefs::dacIndex::IBIAS_SFP)
.value("ADC_VPP", slsDetectorDefs::dacIndex::ADC_VPP) .value("ADC_VPP", slsDetectorDefs::dacIndex::ADC_VPP)
.value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE) .value("HIGH_VOLTAGE", slsDetectorDefs::dacIndex::HIGH_VOLTAGE)
.value("TEMPERATURE_ADC", slsDetectorDefs::dacIndex::TEMPERATURE_ADC)
.value("TEMPERATURE_FPGA", slsDetectorDefs::dacIndex::TEMPERATURE_FPGA)
.value("TEMPERATURE_FPGAEXT", .value("TEMPERATURE_FPGAEXT",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT) slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT)
.value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE) .value("TEMPERATURE_10GE", slsDetectorDefs::dacIndex::TEMPERATURE_10GE)
@ -176,7 +155,35 @@ void init_enums(py::module &m) {
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2) slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2)
.value("TEMPERATURE_FPGA3", .value("TEMPERATURE_FPGA3",
slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3) slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3)
.value("TRIMBIT_SCAN", slsDetectorDefs::dacIndex::TRIMBIT_SCAN) .value("VIPRE", slsDetectorDefs::dacIndex::VIPRE)
.value("VIINSH", slsDetectorDefs::dacIndex::VIINSH)
.value("VDCSH", slsDetectorDefs::dacIndex::VDCSH)
.value("VTH2", slsDetectorDefs::dacIndex::VTH2)
.value("VPL", slsDetectorDefs::dacIndex::VPL)
.value("VTH3", slsDetectorDefs::dacIndex::VTH3)
.value("CASSH", slsDetectorDefs::dacIndex::CASSH)
.value("CAS", slsDetectorDefs::dacIndex::CAS)
.value("VICIN", slsDetectorDefs::dacIndex::VICIN)
.value("VIPRE_OUT", slsDetectorDefs::dacIndex::VIPRE_OUT)
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
.value("VREF_RSTORE", slsDetectorDefs::dacIndex::VREF_RSTORE)
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
.value("VB_DS", slsDetectorDefs::dacIndex::VB_DS)
.value("VB_COMP", slsDetectorDefs::dacIndex::VB_COMP)
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A) .value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B) .value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
.value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C) .value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C)
@ -201,6 +208,7 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings") py::enum_<slsDetectorDefs::detectorSettings>(Defs, "detectorSettings")
.value("GET_SETTINGS", slsDetectorDefs::detectorSettings::GET_SETTINGS)
.value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD) .value("STANDARD", slsDetectorDefs::detectorSettings::STANDARD)
.value("FAST", slsDetectorDefs::detectorSettings::FAST) .value("FAST", slsDetectorDefs::detectorSettings::FAST)
.value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN) .value("HIGHGAIN", slsDetectorDefs::detectorSettings::HIGHGAIN)
@ -216,18 +224,6 @@ void init_enums(py::module &m) {
.value("FORCESWITCHG2", .value("FORCESWITCHG2",
slsDetectorDefs::detectorSettings::FORCESWITCHG2) slsDetectorDefs::detectorSettings::FORCESWITCHG2)
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN) .value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
.value("G2_HIGHCAP_HIGHGAIN",
slsDetectorDefs::detectorSettings::G2_HIGHCAP_HIGHGAIN)
.value("G2_HIGHCAP_LOWGAIN",
slsDetectorDefs::detectorSettings::G2_HIGHCAP_LOWGAIN)
.value("G2_LOWCAP_HIGHGAIN",
slsDetectorDefs::detectorSettings::G2_LOWCAP_HIGHGAIN)
.value("G2_LOWCAP_LOWGAIN",
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED) .value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
.value("UNINITIALIZED", .value("UNINITIALIZED",
slsDetectorDefs::detectorSettings::UNINITIALIZED) slsDetectorDefs::detectorSettings::UNINITIALIZED)
@ -253,13 +249,21 @@ void init_enums(py::module &m) {
.value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED) .value("QUARTER_SPEED", slsDetectorDefs::speedLevel::QUARTER_SPEED)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::portType>(Defs, "portType")
.value("CONTROL_PORT", slsDetectorDefs::portType::CONTROL_PORT)
.value("STOP_PORT", slsDetectorDefs::portType::STOP_PORT)
.value("DATA_PORT", slsDetectorDefs::portType::DATA_PORT)
.export_values();
py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags") py::enum_<slsDetectorDefs::masterFlags>(Defs, "masterFlags")
.value("GET_MASTER", slsDetectorDefs::masterFlags::GET_MASTER)
.value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER) .value("NO_MASTER", slsDetectorDefs::masterFlags::NO_MASTER)
.value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER) .value("IS_MASTER", slsDetectorDefs::masterFlags::IS_MASTER)
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE) .value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType") py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
.value("GET_FRAME_MODE", slsDetectorDefs::frameModeType::GET_FRAME_MODE)
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL) .value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL) .value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD) .value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
@ -267,6 +271,8 @@ void init_enums(py::module &m) {
.export_values(); .export_values();
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType") py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
.value("GET_DETECTOR_MODE",
slsDetectorDefs::detectorModeType::GET_DETECTOR_MODE)
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING) .value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
.value("INTERPOLATING", .value("INTERPOLATING",
slsDetectorDefs::detectorModeType::INTERPOLATING) slsDetectorDefs::detectorModeType::INTERPOLATING)
@ -277,13 +283,5 @@ void init_enums(py::module &m) {
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF) .value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL) .value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL) .value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
.export_values();
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
.value("TIMING_INTERNAL",
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
.value("TIMING_EXTERNAL",
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
.export_values(); .export_values();
} }

View File

@ -15,11 +15,10 @@ using sls::IpAddr;
using sls::MacAddr; using sls::MacAddr;
void init_network(py::module &m) { void init_network(py::module &m) {
py::class_ <IpAddr>(m, "IpAddr") py::class_ <IpAddr> IpAddr(m, "IpAddr");
.def(py::init()) IpAddr.def(py::init())
.def(py::init<const std::string&>()) .def(py::init<const std::string&>())
.def(py::init<uint32_t>()) .def(py::init<uint32_t>())
.def(py::init<const IpAddr&>())
.def("hex", &IpAddr::hex) .def("hex", &IpAddr::hex)
.def("uint32", &IpAddr::uint32) .def("uint32", &IpAddr::uint32)
.def(py::self == py::self) .def(py::self == py::self)
@ -27,11 +26,10 @@ void init_network(py::module &m) {
.def("str", &IpAddr::str); .def("str", &IpAddr::str);
py::class_ <MacAddr>(m, "MacAddr") py::class_ <MacAddr> MacAddr(m, "MacAddr");
.def(py::init()) MacAddr.def(py::init())
.def(py::init<const std::string&>()) .def(py::init<const std::string&>())
.def(py::init<uint64_t>()) .def(py::init<uint64_t>())
.def(py::init<const MacAddr&>())
.def("hex", &MacAddr::hex) .def("hex", &MacAddr::hex)
.def(py::self == py::self) .def(py::self == py::self)
.def("uint64", &MacAddr::uint64) .def("uint64", &MacAddr::uint64)

View File

@ -164,18 +164,18 @@ def test_cannot_set_fw_version(d):
def test_get_high_voltage_call_signature(d, mocker): def test_get_high_voltage_call_signature(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDac') m = mocker.patch('_slsdet.DetectorApi.getDac')
d.high_voltage d.high_voltage
m.assert_called_once_with('highvoltage', -1) m.assert_called_once_with('vhighvoltage', -1)
def test_get_high_voltage(d, mocker): def test_get_high_voltage(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getDac') m = mocker.patch('_slsdet.DetectorApi.getDac')
m.return_value = 80 m.return_value = 80
assert d.high_voltage == 80 assert d.high_voltage == 80
#self._api.setDac('highvoltage', -1, voltage) #self._api.setDac('vhighvoltage', -1, voltage)
def test_set_high_voltage(d, mocker): def test_set_high_voltage(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.setDac') m = mocker.patch('_slsdet.DetectorApi.setDac')
d.high_voltage = 80 d.high_voltage = 80
m.assert_called_once_with('highvoltage', -1, 80) m.assert_called_once_with('vhighvoltage', -1, 80)
def test_decode_hostname_two_names(d, mocker): def test_decode_hostname_two_names(d, mocker):
m = mocker.patch('_slsdet.DetectorApi.getHostname') m = mocker.patch('_slsdet.DetectorApi.getHostname')

View File

@ -170,18 +170,18 @@ def test_set_counters_single(d, mocker):
# def test_get_high_voltage_call_signature(d, mocker): # def test_get_high_voltage_call_signature(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDac') # m = mocker.patch('_slsdet.DetectorApi.getDac')
# d.high_voltage # d.high_voltage
# m.assert_called_once_with('highvoltage', -1) # m.assert_called_once_with('vhighvoltage', -1)
# def test_get_high_voltage(d, mocker): # def test_get_high_voltage(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getDac') # m = mocker.patch('_slsdet.DetectorApi.getDac')
# m.return_value = 80 # m.return_value = 80
# assert d.high_voltage == 80 # assert d.high_voltage == 80
# #self._api.setDac('highvoltage', -1, voltage) # #self._api.setDac('vhighvoltage', -1, voltage)
# def test_set_high_voltage(d, mocker): # def test_set_high_voltage(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.setDac') # m = mocker.patch('_slsdet.DetectorApi.setDac')
# d.high_voltage = 80 # d.high_voltage = 80
# m.assert_called_once_with('highvoltage', -1, 80) # m.assert_called_once_with('vhighvoltage', -1, 80)
# def test_decode_hostname_two_names(d, mocker): # def test_decode_hostname_two_names(d, mocker):
# m = mocker.patch('_slsdet.DetectorApi.getHostname') # m = mocker.patch('_slsdet.DetectorApi.getHostname')

View File

@ -5,28 +5,7 @@ Testing functions from utils.py
""" """
import pytest import pytest
from slsdet.utils import * from sls_detector.utils import *
import datetime as dt
def test_iterable():
assert is_iterable(5) == False
assert is_iterable('abc') == True
assert is_iterable([]) == True
assert is_iterable(5.9) == False
def test_reduce_time_to_single_value_from_list():
t = 3*[dt.timedelta(seconds = 1)]
assert reduce_time(t) == 1
def test_reduce_time_to_single_value_from_list_of_lists():
t = 3*[dt.timedelta(seconds = 3.3)]
tt = 5*t
assert reduce_time(tt) == 3.3
def test_reduce_time_when_sublist_is_different():
t = [dt.timedelta(seconds = 1), dt.timedelta(seconds = 2), dt.timedelta(seconds = 1)]
tt = [t for i in range(4)]
assert reduce_time(tt) == [1,2,1]
def test_convert_zero(): def test_convert_zero():
@ -81,16 +60,3 @@ def test_list_to_mask():
assert(list_to_bitmask([1]) == 2) assert(list_to_bitmask([1]) == 2)
assert(list_to_bitmask([3]) == 8) assert(list_to_bitmask([3]) == 8)
assert(list_to_bitmask([1,1,1]) == 2) assert(list_to_bitmask([1,1,1]) == 2)
def test_make_timedelta_from_double():
t = 1.7
r = make_timedelta(t)
assert t == r.total_seconds()
assert r == dt.timedelta(seconds=t)
def test_make_timedelta_from_timedelta():
t = dt.timedelta(minutes=1)
r = make_timedelta(t)
assert 60 == r.total_seconds()
assert r == dt.timedelta(minutes=1)

View File

@ -1,35 +1,36 @@
add_executable(using_logger using_logger.cpp) add_executable(a api.cpp)
target_link_libraries(using_logger target_link_libraries(a
slsDetectorShared
slsSupportLib slsSupportLib
pthread pthread
rt rt
) )
set_target_properties(using_logger PROPERTIES set_target_properties(a PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
) )
# add_executable(result useResult.cpp) add_executable(result useResult.cpp)
# target_link_libraries(result target_link_libraries(result
# slsDetectorShared slsDetectorShared
# ) )
# set_target_properties(result PROPERTIES set_target_properties(result PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# ) )
# add_executable(udp udp.cpp) add_executable(udp udp.cpp)
# target_link_libraries(udp target_link_libraries(udp
# slsDetectorShared slsDetectorShared
# slsSupportLib slsSupportLib
# pthread pthread
# rt rt
# fmt fmt
# ) )
# set_target_properties(udp PROPERTIES set_target_properties(udp PROPERTIES
# RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# ) )

View File

@ -1,42 +0,0 @@
#include "logger.h"
#include <iostream>
#include <chrono>
int main() {
//compare old and new
std::cout << "Compare output between old and new:\n";
LOG(logINFO) << "Some info message";
LOG(logERROR) << "This is an error";
LOG(logWARNING) << "While this is only a warning";
//Logging level can be configure at runtime
std::cout << "\n\n";
std::cout << "The default macro controlled level is: "
<< sls::Logger::ToString(LOG_MAX_REPORTING_LEVEL) << '\n';
sls::Logger::ReportingLevel() = logERROR;
LOG(logINFO) << "Now this is not written";
LOG(logWARNING) << "and also not this";
sls::Logger::ReportingLevel() = logINFO;
LOG(logINFO) << "But now we can see it";
//The output can be redirected to another buffer
std::ostringstream local;
auto clog_buff = std::clog.rdbuf();
std::clog.rdbuf(local.rdbuf());
LOG(logINFOBLUE) << "A message";
LOG(logWARNING) << "And another one";
std::clog.rdbuf(clog_buff); // restore
std::cout << "local buf:\n" << local.str();
LOG(logINFO) << "After reset we should print directly";
LOG(logINFOBLUE) << "some infoBLUE text";
LOG(logINFOGREEN) << "some infoGREEN text";
LOG(logINFORED) << "some infoRED text";
}

View File

@ -14,27 +14,27 @@ class MovingStat
/** constructor /** constructor
\param nn number of samples parameter to be used \param nn number of samples parameter to be used
*/ */
MovingStat(int nn) : n(nn), m_n(0), m_newM(0),m_newM2(0) {} MovingStat(int nn=1000) : n(nn), m_n(0) {}
// void setPointers(double *me, double *va) {mean=me; var=va;}
/** /**
clears the moving average number of samples parameter, mean and standard deviation clears the moving average number of samples parameter, mean and standard deviation
*/ */
void Clear() void Clear()
{ {
m_n = 0; m_n = 0;
m_newM=0; m_newM=0;
m_newM2=0; m_newM2=0;
} }
/** /**
clears the moving average number of samples parameter, mean and standard deviation clears the moving average number of samples parameter, mean and standard deviation
*/ */
void Set(double val, double rms=0, int m=-1) void Set(double val, double rms=0, int m=-1)
{ {
if (m>=0) m_n = m; else m_n = n; if (m>0) m_n = m; else m_n = n;
m_newM=val*m_n; m_newM=val*m_n;
SetRMS(rms);
// cout << "set " << val << " " << m << " " << m_n << " " << m_newM << endl; // cout << "set " << val << " " << m << " " << m_n << " " << m_newM << endl;
SetRMS(rms);
} }
/** /**
clears the moving average number of samples parameter, mean and standard deviation clears the moving average number of samples parameter, mean and standard deviation
@ -42,15 +42,12 @@ class MovingStat
void SetRMS(double rms) void SetRMS(double rms)
{ {
if (rms<=0) { if (rms<=0) {
if (m_n>0) m_newM2=m_newM*m_newM/n;
m_newM2=m_newM*m_newM/m_n;
else
m_newM2=0;
//m_n=0; //m_n=0;
} else { } else {
if (m_n>0) { if (m_n>0)
m_newM2=(m_n*rms*rms+m_newM*m_newM/m_n); m_newM2=(m_n*rms*rms+m_newM*m_newM/m_n);
} else { else {
m_newM2=(m_n*rms*rms+m_newM*m_newM/n); m_newM2=(m_n*rms*rms+m_newM*m_newM/n);
m_n=0; m_n=0;
} }
@ -105,11 +102,10 @@ class MovingStat
m_newM = x; m_newM = x;
m_newM2 = x*x; m_newM2 = x*x;
m_n++; m_n++;
} else {
m_newM = m_newM + x - m_newM/m_n;
m_newM2 = m_newM2 + x*x - m_newM2/m_n;
} }
else {
m_newM = m_newM + x - m_newM/m_n;
m_newM2 = m_newM2 + x*x - m_newM2/m_n;
}
} }
@ -126,9 +122,7 @@ class MovingStat
inline double Mean() const inline double Mean() const
{ {
// cout << "get " << m_n << " " << m_newM << " " << m_newM/m_n << endl; // cout << "get " << m_n << " " << m_newM << " " << m_newM/m_n << endl;
return (m_n > 0) ? m_newM/m_n : 0.0;
return (m_n > 0) ? m_newM/m_n : 0.0;
} }
/** returns the squared mean, 0 if no elements are inside /** returns the squared mean, 0 if no elements are inside
@ -144,7 +138,7 @@ class MovingStat
*/ */
inline double Variance() const inline double Variance() const
{ {
return (m_n > 0) ? m_newM2/m_n-m_newM/m_n*m_newM/m_n : 0.0; return ( (m_n > 1) ? (M2()-Mean()*Mean()) : 0.0 );
} }
/** returns the standard deviation, 0 if no elements are inside /** returns the standard deviation, 0 if no elements are inside
@ -152,8 +146,7 @@ class MovingStat
*/ */
inline double StandardDeviation() const inline double StandardDeviation() const
{ {
return ( (Variance() > 0) ? sqrt( Variance() ) : -1 );
return sqrt(Variance());//
} }
private: private:

View File

@ -68,15 +68,10 @@ template <class dataType> class analogDetector {
det->getDetectorSize(nx,ny); det->getDetectorSize(nx,ny);
stat=new pedestalSubtraction*[ny]; stat=new pedestalSubtraction*[ny];
/* pedMean=new double*[ny]; */
/* pedVariance=new double*[ny]; */
for (int i=0; i<ny; i++) { for (int i=0; i<ny; i++) {
stat[i]=new pedestalSubtraction[nx]; stat[i]=new pedestalSubtraction[nx];
/* pedMean[i]=new double[nx]; */ for (int ix=0; ix<nx; ix++) {
/* pedVariance[i]=new double[nx]; */
for (ix=0; ix<nx; ++ix) {
stat[i][ix].SetNPedestals(nped); stat[i][ix].SetNPedestals(nped);
/* stat[i][ix].setPointers(&(pedMean[iy][ix]),&(pedVariance[iy][ix])); */
} }
} }
image=new int[nx*ny]; image=new int[nx*ny];
@ -100,16 +95,7 @@ template <class dataType> class analogDetector {
/** /**
destructor. Deletes the pdestalSubtraction array and the image destructor. Deletes the pdestalSubtraction array and the image
*/ */
virtual ~analogDetector() { virtual ~analogDetector() {for (int i=0; i<ny; i++) delete [] stat[i]; delete [] stat; delete [] image;
for (int i=0; i<ny; i++) {
delete [] stat[i];
/* delete [] pedMean[i]; */
/* delete [] pedVariance[i]; */
};
/* delete [] pedMean; */
/* delete [] pedVariance; */
delete [] stat;
delete [] image;
#ifdef ROOTSPECTRUM #ifdef ROOTSPECTRUM
delete hs; delete hs;
#ifdef ROOTCLUST #ifdef ROOTCLUST
@ -146,23 +132,16 @@ template <class dataType> class analogDetector {
stat=new pedestalSubtraction*[ny]; stat=new pedestalSubtraction*[ny];
/* pedMean=new double*[ny]; */
/* pedVariance=new double*[ny]; */
for (int i=0; i<ny; i++) { for (int i=0; i<ny; i++) {
stat[i]=new pedestalSubtraction[nx]; stat[i]=new pedestalSubtraction[nx];
/* pedMean[i]=new double[nx]; */
/* pedVariance[i]=new double[nx]; */
} }
int nped=orig->SetNPedestals(); int nped=orig->SetNPedestals();
//cout << nped << " " << orig->getPedestal(ix,iy) << orig->getPedestalRMS(ix,iy) << endl; //cout << nped << " " << orig->getPedestal(ix,iy) << orig->getPedestalRMS(ix,iy) << endl;
for (iy=0; iy<ny; ++iy) { for (int iy=0; iy<ny; iy++) {
for (ix=0; ix<nx; ++ix) { for (int ix=0; ix<nx; ix++) {
//stat[iy][ix].setPointers(&(pedMean[iy][ix]),&(pedVariance[iy][ix]));
stat[iy][ix].SetNPedestals(nped); stat[iy][ix].SetNPedestals(nped);
setPedestal(ix,iy,orig->getPedestal(ix,iy),orig->getPedestalRMS(ix,iy),orig->GetNPedestals(ix,iy)); setPedestal(ix,iy,orig->getPedestal(ix,iy),orig->getPedestalRMS(ix,iy),orig->GetNPedestals(ix,iy));
/* if (ix==50 && iy==50) */
/* cout << "clone ped " << " " << ix << " " << iy << " " << getPedestal(ix,iy) << " " << getPedestalRMS(ix,iy)<< " " << GetNPedestals(ix,iy) << endl; */
} }
} }
image=new int[nx*ny]; image=new int[nx*ny];
@ -220,7 +199,7 @@ template <class dataType> class analogDetector {
\param nns reference to number of subpixels for interpolating detector, will always be 1 in this case \param nns reference to number of subpixels for interpolating detector, will always be 1 in this case
\returns number of pixels of the detector image \returns number of pixels of the detector image
*/ */
virtual int getImageSize(int &nnx, int &nny, int &nnsx, int &nnsy){nnx=nx; nny=ny; nnsx=1; nnsy=1; return nx*ny;}; virtual int getImageSize(int &nnx, int &nny, int &nns){nnx=nx; nny=ny; nns=1; return nx*ny;};
/** /**
Returns data size of the detector image matrix Returns data size of the detector image matrix
\param nnx reference to pixel size in x \param nnx reference to pixel size in x
@ -252,8 +231,8 @@ template <class dataType> class analogDetector {
if (gm) { if (gm) {
if (gmap) delete [] gmap; if (gmap) delete [] gmap;
gmap=new double[nnx*nny]; gmap=new double[nnx*nny];
for (iy=0; iy<nny; ++iy) { for (int iy=0; iy<nny; iy++) {
for (ix=0; ix<nnx; ++ix) { for (int ix=0; ix<nnx; ix++) {
gmap[iy*nnx+ix]=gm[iy*nnx+ix]; gmap[iy*nnx+ix]=gm[iy*nnx+ix];
// cout << gmap[iy*nnx+ix] << " " ; // cout << gmap[iy*nnx+ix] << " " ;
} }
@ -272,8 +251,8 @@ template <class dataType> class analogDetector {
void *ret; void *ret;
if (gmap) { if (gmap) {
gm=new float[nx*ny]; gm=new float[nx*ny];
for (iy=0; iy<ny; ++iy) { for (int iy=0; iy<ny; iy++) {
for (ix=0; ix<nx; ++ix) { for (int ix=0; ix<nx; ix++) {
gm[iy*nx+ix]=gmap[iy*nx+ix]; gm[iy*nx+ix]=gmap[iy*nx+ix];
} }
} }
@ -288,8 +267,8 @@ template <class dataType> class analogDetector {
virtual void newDataSet(){ virtual void newDataSet(){
iframe=-1; iframe=-1;
for (iy=0; iy<ny; ++iy) for (int iy=0; iy<ny; iy++)
for (ix=0; ix<nx; ++ix) { for (int ix=0; ix<nx; ix++) {
stat[iy][ix].Clear(); stat[iy][ix].Clear();
image[iy*nx+ix]=0; image[iy*nx+ix]=0;
} }
@ -306,17 +285,15 @@ template <class dataType> class analogDetector {
}; };
/** resets the commonModeSubtraction and increases the frame index */ /** resets the commonModeSubtraction and increases the frame index */
virtual void newFrame(){iframe++; if (cmSub) cmSub->newFrame(); det->newFrame();}; virtual void newFrame(){iframe++; if (cmSub) cmSub->newFrame();};
/** resets the commonModeSubtraction and increases the frame index */ /** resets the commonModeSubtraction and increases the frame index */
virtual void newFrame(char *data){ virtual void newFrame(char *data){
iframe++; iframe++;
if (cmSub) cmSub->newFrame(); if (cmSub) cmSub->newFrame();
det->newFrame();
// det->getData(data);
calcGhost(data); calcGhost(data);
// cout << getId() << " Calc ghost " << getGhost(15,15) << endl; // cout << getId() << " Calc ghost " << getGhost(15,15) << endl;
}; };
/** sets the commonModeSubtraction algorithm to be used /** sets the commonModeSubtraction algorithm to be used
@ -382,8 +359,8 @@ template <class dataType> class analogDetector {
// cout << "+"<< getId() << endl; // cout << "+"<< getId() << endl;
if (cmSub) { if (cmSub) {
//cout << "*" << endl; //cout << "*" << endl;
for (iy=ymin; iy<ymax; ++iy) { for (int iy=ymin; iy<ymax; iy++) {
for (ix=xmin; ix<xmax; ++ix) { for (int ix=xmin; ix<xmax; ix++) {
// if (getNumpedestals(ix,iy)>0) // if (getNumpedestals(ix,iy)>0)
// if (det->isGood(ix,iy)) { // if (det->isGood(ix,iy)) {
addToCommonMode(data, ix, iy); addToCommonMode(data, ix, iy);
@ -426,10 +403,8 @@ template <class dataType> class analogDetector {
if (ix>=0 && ix<nx && iy>=0 && iy<ny) { if (ix>=0 && ix<nx && iy>=0 && iy<ny) {
if (cmSub && cm>0) { if (cmSub && cm>0) {
return stat[iy][ix].getPedestal()+getCommonMode(ix,iy); return stat[iy][ix].getPedestal()+getCommonMode(ix,iy);
//return pedMean[iy][ix]+getCommonMode(ix,iy);
} } else return stat[iy][ix].getPedestal();
//return pedMean[iy][ix];
return stat[iy][ix].getPedestal();
} else return -1; } else return -1;
}; };
@ -447,7 +422,7 @@ template <class dataType> class analogDetector {
g=gmap[iy*nx+ix]; g=gmap[iy*nx+ix];
if (g==0) g=-1.; if (g==0) g=-1.;
} }
// return sqrt(pedVariance[iy][ix])/g;
return stat[iy][ix].getPedestalRMS()/g;//divide by gain? return stat[iy][ix].getPedestalRMS()/g;//divide by gain?
} }
return -1; return -1;
@ -466,11 +441,10 @@ template <class dataType> class analogDetector {
\returns pedestal value \returns pedestal value
*/ */
virtual double* getPedestal(double *ped){ virtual double* getPedestal(double *ped){
if (ped==NULL) { if (ped==NULL)
ped=new double[nx*ny]; ped=new double[nx*ny];
} for (int iy=0; iy<ny; iy++) {
for (iy=0; iy<ny; ++iy) { for (int ix=0; ix<nx; ix++) {
for (ix=0; ix<nx; ++ix) {
ped[iy*nx+ix]=stat[iy][ix].getPedestal(); ped[iy*nx+ix]=stat[iy][ix].getPedestal();
//cout << ped[iy*nx+ix] << " " ; //cout << ped[iy*nx+ix] << " " ;
} }
@ -485,11 +459,10 @@ template <class dataType> class analogDetector {
\returns pedestal rms \returns pedestal rms
*/ */
virtual double* getPedestalRMS(double *ped=NULL){ virtual double* getPedestalRMS(double *ped=NULL){
if (ped==NULL) { if (ped==NULL)
ped=new double[nx*ny]; ped=new double[nx*ny];
} for (int iy=0; iy<ny; iy++) {
for (iy=0; iy<ny; ++iy) { for (int ix=0; ix<nx; ix++) {
for (ix=0; ix<nx; ++ix) {
ped[iy*nx+ix]=stat[iy][ix].getPedestalRMS(); ped[iy*nx+ix]=stat[iy][ix].getPedestalRMS();
} }
} }
@ -528,8 +501,8 @@ template <class dataType> class analogDetector {
*/ */
virtual void setPedestal(double *ped, double *rms=NULL, int m=-1){ virtual void setPedestal(double *ped, double *rms=NULL, int m=-1){
double rr=0; double rr=0;
for (iy=ymin; iy<ymax; ++iy) { for (int iy=ymin; iy<ymax; iy++) {
for (ix=xmin; ix<xmax; ++ix) { for (int ix=xmin; ix<xmax; ix++) {
if (rms) rr=rms[iy*nx+ix]; if (rms) rr=rms[iy*nx+ix];
stat[iy][ix].setPedestal(ped[iy*nx+ix],rr, m); stat[iy][ix].setPedestal(ped[iy*nx+ix],rr, m);
// cout << ix << " " << iy << " " << ped[iy*nx+ix] << " " << stat[iy][ix].getPedestal() << endl; // cout << ix << " " << iy << " " << ped[iy*nx+ix] << " " << stat[iy][ix].getPedestal() << endl;
@ -558,8 +531,8 @@ template <class dataType> class analogDetector {
\param rms pointer to array of pedestal rms \param rms pointer to array of pedestal rms
*/ */
virtual void setPedestalRMS(double *rms){ virtual void setPedestalRMS(double *rms){
for (iy=ymin; iy<ymax; ++iy) { for (int iy=ymin; iy<ymax; iy++) {
for (ix=xmin; ix<xmax; ++ix) { for (int ix=xmin; ix<xmax; ix++) {
stat[iy][ix].setPedestalRMS(rms[iy*nx+ix]); stat[iy][ix].setPedestalRMS(rms[iy*nx+ix]);
}; };
}; };
@ -599,8 +572,8 @@ template <class dataType> class analogDetector {
#endif #endif
gm=new float[nx*ny]; gm=new float[nx*ny];
for (iy=0; iy<ny; ++iy) { for (int iy=0; iy<ny; iy++) {
for (ix=0; ix<nx; ++ix) { for (int ix=0; ix<nx; ix++) {
gm[iy*nx+ix]=image[iy*nx+ix]; gm[iy*nx+ix]=image[iy*nx+ix];
#ifdef ROOTSPECTRUM #ifdef ROOTSPECTRUM
hmap->SetBinContent(ix+1, iy+1,image[iy*nx+ix]); hmap->SetBinContent(ix+1, iy+1,image[iy*nx+ix]);
@ -647,8 +620,8 @@ template <class dataType> class analogDetector {
TH2F *hmap=new TH2F("hmap","hmap",nx, -0.5,nx-0.5, ny, -0.5, ny-0.5); TH2F *hmap=new TH2F("hmap","hmap",nx, -0.5,nx-0.5, ny, -0.5, ny-0.5);
#endif #endif
for (iy=0; iy<ny; ++iy) { for (int iy=0; iy<ny; iy++) {
for (ix=0; ix<nx; ++ix) { for (int ix=0; ix<nx; ix++) {
/* if (cmSub) */ /* if (cmSub) */
/* gm[iy*nx+ix]=stat[iy][ix].getPedestal()-cmSub->getCommonMode(); */ /* gm[iy*nx+ix]=stat[iy][ix].getPedestal()-cmSub->getCommonMode(); */
/* else */ /* else */
@ -694,15 +667,15 @@ template <class dataType> class analogDetector {
if (gm) { if (gm) {
for (iy=0; iy<nny; ++iy) { for (int iy=0; iy<nny; iy++) {
for (ix=0; ix<nnx; ++ix) { for (int ix=0; ix<nnx; ix++) {
stat[iy][ix].setPedestal(gm[iy*nx+ix],-1,-1); stat[iy][ix].setPedestal(gm[iy*nx+ix],-1,-1);
} }
} }
delete [] gm; delete [] gm;
return 1; return 1;
} }
return 0; return NULL;
} }
/** /**
@ -719,15 +692,15 @@ template <class dataType> class analogDetector {
if (gm) { if (gm) {
for (iy=0; iy<nny; ++iy) { for (int iy=0; iy<nny; iy++) {
for (ix=0; ix<nnx; ++ix) { for (int ix=0; ix<nnx; ix++) {
image[iy*nx+ix]=gm[iy*nx+ix]; image[iy*nx+ix]=gm[iy*nx+ix];
} }
} }
delete [] gm; delete [] gm;
return 1; return 1;
} }
return 0; return NULL;
} }
@ -745,9 +718,9 @@ template <class dataType> class analogDetector {
float *gm=NULL; float *gm=NULL;
void *ret; void *ret;
gm=new float[nx*ny]; gm=new float[nx*ny];
for (iy=0; iy<ny; ++iy) { for (int iy=0; iy<ny; iy++) {
for (ix=0; ix<nx; ++ix) { for (int ix=0; ix<nx; ix++) {
gm[iy*nx+ix]=stat[iy][ix].getPedestalRMS(); gm[iy*nx+ix]=stat[iy][ix].getPedestalRMS();
} }
} }
ret=WriteToTiff(gm, imgname, ny, nx); ret=WriteToTiff(gm, imgname, ny, nx);
@ -767,8 +740,8 @@ template <class dataType> class analogDetector {
if (nnx>nx) nnx=nx; if (nnx>nx) nnx=nx;
if (nny>ny) nny=ny; if (nny>ny) nny=ny;
if (gm) { if (gm) {
for (iy=0; iy<nny; ++iy) { for (int iy=0; iy<nny; iy++) {
for (ix=0; ix<nnx; ++ix) { for (int ix=0; ix<nnx; ix++) {
stat[iy][ix].setPedestalRMS(gm[iy*nx+ix]); stat[iy][ix].setPedestalRMS(gm[iy*nx+ix]);
} }
} }
@ -804,13 +777,11 @@ template <class dataType> class analogDetector {
//cout << xmin << " " << xmax << endl; //cout << xmin << " " << xmax << endl;
// cout << ymin << " " << ymax << endl; // cout << ymin << " " << ymax << endl;
for (iy=ymin; iy<ymax; ++iy) { for (int iy=ymin; iy<ymax; iy++) {
for (ix=xmin; ix<xmax; ++ix) { for (int ix=xmin; ix<xmax; ix++) {
if (det->isGood(ix,iy)) { if (det->isGood(ix,iy)) {
// addToPedestal(data,ix,iy,1); // addToPedestal(data,ix,iy,1);
addToPedestal(data,ix,iy,cm); addToPedestal(data,ix,iy,cm);
/* if (ix==50 && iy==50) */
/* cout<< "*ped* " << id << " " << ix << " " << iy << " " << det->getChannel(data,ix,iy) << " " << stat[iy][ix].getPedestal() << " " << stat[iy][ix].getPedestalRMS() <<" " << stat[iy][ix]. GetNPedestals() << endl; */
//if (ix==10 && iy==10) //if (ix==10 && iy==10)
// cout <<ix << " " << iy << " " << getPedestal(ix,iy)<< endl; // cout <<ix << " " << iy << " " << getPedestal(ix,iy)<< endl;
#ifdef ROOTSPECTRUM #ifdef ROOTSPECTRUM
@ -934,8 +905,8 @@ template <class dataType> class analogDetector {
//calcGhost(data); //calcGhost(data);
for (iy=ymin; iy<ymax; ++iy) { for (int iy=ymin; iy<ymax; iy++) {
for (ix=xmin; ix<xmax; ++ix) { for (int ix=xmin; ix<xmax; ix++) {
if (det->isGood(ix,iy)) if (det->isGood(ix,iy))
val[iy*nx+ix]+=subtractPedestal(data, ix, iy,cm); val[iy*nx+ix]+=subtractPedestal(data, ix, iy,cm);
} }
@ -981,8 +952,8 @@ template <class dataType> class analogDetector {
hs->Fill(val,(iy-ymin)*(xmax-xmin)+(ix-xmin)); hs->Fill(val,(iy-ymin)*(xmax-xmin)+(ix-xmin));
#ifdef ROOTCLUST #ifdef ROOTCLUST
double v3=0,v5=0,v7=0,v9=0; double v3=0,v5=0,v7=0,v9=0;
for (int iix=-4; iix<5; i++ix) for (int iix=-4; iix<5; iix++)
for (int iiy=-4; iiy<5; i++iy) { for (int iiy=-4; iiy<5; iiy++) {
if (det) if (det)
val= (dataSign*det->getValue(data, ix+iix, iy+iiy)-getPedestal(ix+iix,iy+iiy,cm))/g; val= (dataSign*det->getValue(data, ix+iix, iy+iiy)-getPedestal(ix+iix,iy+iiy,cm))/g;
else else
@ -1076,8 +1047,8 @@ template <class dataType> class analogDetector {
//calcGhost(data); //calcGhost(data);
addToCommonMode(data); addToCommonMode(data);
for (iy=ymin; iy<ymax; ++iy) { for (int iy=ymin; iy<ymax; iy++) {
for (ix=xmin; ix<xmax; ++ix) { for (int ix=xmin; ix<xmax; ix++) {
if (det->isGood(ix,iy)) if (det->isGood(ix,iy))
nph[iy*nx+ix]+=getNPhotons(data, ix, iy); nph[iy*nx+ix]+=getNPhotons(data, ix, iy);
} }
@ -1091,8 +1062,8 @@ template <class dataType> class analogDetector {
*/ */
virtual void clearImage(){ virtual void clearImage(){
for (iy=0; iy<ny; ++iy) { for (int iy=0; iy<ny; iy++) {
for (ix=0; ix<nx; ++ix) { for (int ix=0; ix<nx; ix++) {
image[iy*nx+ix]=0; image[iy*nx+ix]=0;
} }
} }
@ -1122,8 +1093,8 @@ template <class dataType> class analogDetector {
int SetNPedestals(int i=-1) { int SetNPedestals(int i=-1) {
int ix=0, iy=0; int ix=0, iy=0;
if (i>0) if (i>0)
for (iy=0; iy<ny; ++iy) for (iy=0; iy<ny; iy++)
for (ix=0; ix<nx; ++ix) for (ix=0; ix<nx; ix++)
stat[iy][ix].SetNPedestals(i); stat[iy][ix].SetNPedestals(i);
return stat[0][0].SetNPedestals(); return stat[0][0].SetNPedestals();
}; };
@ -1158,8 +1129,8 @@ template <class dataType> class analogDetector {
newFrame(data); newFrame(data);
//calcGhost(data); //calcGhost(data);
addToCommonMode(data); addToCommonMode(data);
for (iy=ymi; iy<yma; ++iy) for (int iy=ymi; iy<yma; iy++)
for (ix=xmi; ix<xma; ++ix) for (int ix=xmi; ix<xma; ix++)
if (det->isGood(ix,iy)) { if (det->isGood(ix,iy)) {
if (ix>=0 && ix<nx && iy>=0 && iy<ny) if (ix>=0 && ix<nx && iy>=0 && iy<ny)
val+=getNPhotons(data, ix, iy); val+=getNPhotons(data, ix, iy);
@ -1262,8 +1233,6 @@ FILE *getFilePointer(){return myFile;};
int nx; /**< Size of the detector in x direction */ int nx; /**< Size of the detector in x direction */
int ny; /**< Size of the detector in y direction */ int ny; /**< Size of the detector in y direction */
pedestalSubtraction **stat; /**< pedestalSubtraction class */ pedestalSubtraction **stat; /**< pedestalSubtraction class */
/* double **pedMean; /\**< pedestalSubtraction class *\/ */
/* double **pedVariance; /\**< pedestalSubtraction class *\/ */
commonModeSubtraction *cmSub;/**< commonModeSubtraction class */ commonModeSubtraction *cmSub;/**< commonModeSubtraction class */
int dataSign; /**< sign of the data i.e. 1 if photon is positive, -1 if negative */ int dataSign; /**< sign of the data i.e. 1 if photon is positive, -1 if negative */
int iframe; /**< frame number (not from file but incremented within the dataset every time newFrame is called */ int iframe; /**< frame number (not from file but incremented within the dataset every time newFrame is called */
@ -1281,7 +1250,6 @@ FILE *getFilePointer(){return myFile;};
frameMode fMode; /**< current detector frame mode */ frameMode fMode; /**< current detector frame mode */
detectorMode dMode; /**< current detector frame mode */ detectorMode dMode; /**< current detector frame mode */
FILE *myFile; /**< file pointer to write to */ FILE *myFile; /**< file pointer to write to */
int ix, iy;
#ifdef ROOTSPECTRUM #ifdef ROOTSPECTRUM
TH2F *hs; TH2F *hs;
#ifdef ROOTCLUST #ifdef ROOTCLUST

View File

@ -1,7 +1,6 @@
#ifndef DESERIALIZER_H #ifndef DESERIALIZER_H
#define DESERIALIZER_H #define DESERIALIZER_H
#include <vector> #include <vector>
#include "slsDetectorData.h"
class deserializer : public slsDetectorData<int> { class deserializer : public slsDetectorData<int> {
@ -53,13 +52,7 @@ class deserializer : public slsDetectorData<int> {
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) { static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
// off=0; // off=0;
//int iarg; //int iarg;
int64_t word, *wp;
cout <<"** deserializer: " << endl;
cout << "** Number of chans:\t" << nch << endl;
cout << "** Serial Offset:\t" << off << endl;
cout << "** Dynamic range:\t" << dr << endl;
int64_t word, *wp, ww,one=1, bit ;
int* val=new int[nch]; int* val=new int[nch];
int ioff=0; int ioff=0;
int idr=0; int idr=0;
@ -74,61 +67,38 @@ class deserializer : public slsDetectorData<int> {
} }
wp=(int64_t*)ptr; wp=(int64_t*)ptr;
int nw=nch/nb; for (iw=0; iw<nch/nb; iw) {
cout << "** Number of bits:\t" << nb << endl;
cout << "** Samples:\t" << nw << endl;
for (ib=0; ib<nb; ib++) {
cout << dbl[ib] << " " ;
}
cout << endl;
for (ib=0; ib<nch; ib++) {
val[ib]=0;
}
for (iw=0; iw<nw; iw) {
word=*wp;; word=*wp;;
if (ioff<off) { if (ioff<off) {
ioff++; ioff++;
// cout <<"*"; // cout <<"*";
} else { } else {
//if (idr<16) { //if (idr<16) {
//ib=0; ib=0;
// cout << hex << "*************" << word << endl; for (const auto &bit : dbl) {
for (ib=0; ib<nb; ib++) { ich=iw+nch/nb*(ib);
// for (const auto &bit : dbl) { if (word&(1<<bit) && ich<nch) {
ich=iw+nch*ib/nb;
/* if (ich>1060) */
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
bit=dbl[ib];
ww=one<<bit;
if (word&(ww) && ich<nch) {
//cout << "+" ; //cout << "+" ;
val[ich]|=(1<<idr); val[ich]|=(1<<idr);
} } //else {
/* if (ich>1060) */
/* cout << val[ich] << " " << hex << word << " " << ww << " " << (word&(ww)) << dec <<endl; */
/* //else { */
//cout << "-" ; //cout << "-" ;
//} //}
//ib++; ib++;
} }
idr++;
} }
idr++;
if (idr==dr) { if (idr==dr) {
idr=0; idr=0;
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl; // cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
// cout <<dec << iw<<endl; cout <<dec << iw<<endl;
iw++; iw++;
}//end if() }//end if()
//end else() //end else()
wp+=1; wp+=1;
// ii++; ii++;
}//end for }//end for
@ -147,7 +117,7 @@ class deserializer : public slsDetectorData<int> {
int ii=0; int ii=0;
int ich; int ich;
int nb=dbl.size(); int nb=dbl.size();
int bit;
char *dval; char *dval;
idr=0; idr=0;
@ -158,12 +128,7 @@ class deserializer : public slsDetectorData<int> {
ib=0; ib=0;
ich=0; ich=0;
for (ib=0; ib<nb; ib++) { for (const auto &bit : dbl) {
// for (const auto &bit : dbl) {
/* if (ich>1060) */
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
bit=dbl[ib];
//ioff=off; //ioff=off;
idr=0; idr=0;
for (iw=0; iw<(nch*dr/nb)/8; iw++) { for (iw=0; iw<(nch*dr/nb)/8; iw++) {
@ -176,7 +141,7 @@ class deserializer : public slsDetectorData<int> {
} }
} }
ii++; ii++;
// ib++; ib++;
}//end for }//end for

View File

@ -1,125 +0,0 @@
#ifndef IMAGEZMQ16BIT_H
#define IMAGEZMQ16BIT_H
#include "slsDetectorData.h"
class imageZmq16bit : public slsDetectorData<uint16_t> {
private:
// int iframe;
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
*/
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
imageZmq16bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, 2*nnx*nny) {
cout << "* " << nx << " " << ny << endl;
int is=0;
for (int row=0; row<ny; row++){
for(int col=0;col<nx;col++){
dataMap[row][col]=is*2;
is++;
}
}
};
virtual double getValue(char *data, int ix, int iy=0) {
cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl;
uint16_t val=getChannel(data, ix, iy)&0x3fff;
return val;
};
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
virtual char *readNextFrame(ifstream &filebin) {
int ff=-1, np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int &ff) {
int np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
char *data=new char[2*nx*ny];
char *d=readNextFrame(filebin, ff, np, data);
if (d==NULL) {delete [] data; data=NULL;}
return data;
}
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
//char *retval=0;
// int nd;
//int fnum = -1;
np=0;
// int pn;
// if (ff>=0)
// fnum=ff;
if (filebin.is_open()) {
if (filebin.read(data, 2*nx*ny) ){
// iframe++;
//ff=iframe;
return data;
}
}
return NULL;
};
virtual char *findNextFrame(char *data, int &ndata, int dsize){
if (dsize<2*nx*ny) ndata=dsize;
else ndata=2*nx*ny;
return data;
}
// virtual int setFrameNumber(int ff){iframe=ff};
int getPacketNumber(int x, int y) {return 0;};
};
#endif

View File

@ -1,125 +0,0 @@
#ifndef IMAGEZMQ32BIT_H
#define IMAGEZMQ32BIT_H
#include "slsDetectorData.h"
class imageZmq32bit : public slsDetectorData<uint16_t> {
private:
// int iframe;
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
*/
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
imageZmq32bit(int nnx=400, int nny=400): slsDetectorData<uint16_t>(nnx, nny, sizeof(uint32_t)*nnx*nny) {
cout << "* " << nx << " " << ny << endl;
int is=0;
for (int row=0; row<ny; row++){
for(int col=0;col<nx;col++){
dataMap[row][col]=is*sizeof(uint32_t);
is++;
}
}
};
/* virtual double getValue(char *data, int ix, int iy=0) { */
/* //cout << ix << " " << ix << dataMap[iy][ix] << 2*nx*ny << " "<< endl; */
/* uint16_t val=getChannel(data, ix, iy); */
/* return val; */
/* }; */
int getFrameNumber(char *buff){return *((int*)buff);};//*((int*)(buff+5))&0xffffff;};
int getPacketNumber(char *buff){return 0;}//((*(((int*)(buff+4))))&0xff)+1;};
virtual char *readNextFrame(ifstream &filebin) {
int ff=-1, np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int &ff) {
int np=-1;
return readNextFrame(filebin, ff, np);
};
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np) {
char *data=new char[2*nx*ny];
char *d=readNextFrame(filebin, ff, np, data);
if (d==NULL) {delete [] data; data=NULL;}
return data;
}
virtual char *readNextFrame(ifstream &filebin, int& ff, int &np, char *data) {
//char *retval=0;
// int nd;
//int fnum = -1;
np=0;
// int pn;
// if (ff>=0)
// fnum=ff;
if (filebin.is_open()) {
if (filebin.read(data, 2*nx*ny) ){
// iframe++;
//ff=iframe;
return data;
}
}
return NULL;
};
virtual char *findNextFrame(char *data, int &ndata, int dsize){
if (dsize<2*nx*ny) ndata=dsize;
else ndata=2*nx*ny;
return data;
}
// virtual int setFrameNumber(int ff){iframe=ff};
int getPacketNumber(int x, int y) {return 0;};
};
#endif

View File

@ -28,8 +28,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
\param c crosstalk parameter for the output buffer \param c crosstalk parameter for the output buffer
*/ */
// moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) { moench03T1ZmqDataNew(int ns=5000): slsDetectorData<uint16_t>(400, 400, ns*32*2+sizeof(int)), nSamples(ns), offset(sizeof(int)), xtalk(0.00021) {
moench03T1ZmqDataNew(int ns=5000, int oo=0): slsDetectorData<uint16_t>(400, 400, ns*32*2+oo), nSamples(ns), offset(oo), xtalk(0.00021) {
int nadc=32; int nadc=32;
int sc_width=25; int sc_width=25;
@ -138,7 +137,6 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
/* vout+=0.0008*val-6224; */ /* vout+=0.0008*val-6224; */
/* return vout; //(double)getChannel(data, ix, iy); /* return vout; //(double)getChannel(data, ix, iy);
*/ */
// cout << ix << " "<< iy << " " << dataMap[iy][ix] << endl;
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy); return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
}; };

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