mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-16 06:47:14 +02:00
Compare commits
98 Commits
udp
...
2020.03.06
Author | SHA1 | Date | |
---|---|---|---|
908afc790d | |||
d6e174ea11 | |||
f255becffe | |||
0a596c689b | |||
a2e019ff36 | |||
959d62ed66 | |||
1d2a46cdbe | |||
aeb9ddfe62 | |||
4a802bd2e4 | |||
c2639854fa | |||
dec4d00fbf | |||
e3f9ef0b25 | |||
9ca86c2edb | |||
c64b09ee79 | |||
4e2f685b76 | |||
6e4a3353a3 | |||
042e5715e6 | |||
e143204ce1 | |||
5f3af794ce | |||
e7df925d6b | |||
7859cf78e9 | |||
1b996d1703 | |||
2fcb41426a | |||
032475fc14 | |||
5430288ce8 | |||
a61c5e0206 | |||
582a3c6878 | |||
134611c638 | |||
06bd6dfd53 | |||
fca7d51cb4 | |||
85aca0ffad | |||
fac95516cf | |||
8abc32e7f1 | |||
1efacc9475 | |||
b2d88b441a | |||
75e083ae46 | |||
9699e064d3 | |||
c6c3a68520 | |||
5e92c5b67e | |||
0947cefe08 | |||
6bbcf6173d | |||
ecc3b36204 | |||
3e88beb8a5 | |||
cce659d98c | |||
95d56ad545 | |||
84cd4d8436 | |||
d7319968a7 | |||
a769f7515c | |||
11e7737a2f | |||
913df8ecae | |||
c10e04c4eb | |||
2e2e91b219 | |||
10ba16a9dc | |||
8c8032dc69 | |||
90acd51389 | |||
f38ed8706f | |||
300b0c8105 | |||
d9cfc59df6 | |||
80304c2eaf | |||
fe3a7b0faf | |||
e66d42a43d | |||
ec76590f28 | |||
2fcb2bff75 | |||
2310b5e55d | |||
dca2d098a9 | |||
462bc2e70c | |||
2da3d179ee | |||
5e6a3b7e3d | |||
6a0a931e3e | |||
2bec476b4f | |||
f902bb06ad | |||
c03bc4a6b4 | |||
6118567959 | |||
02b367ffe8 | |||
87d48fd943 | |||
21a1b872bf | |||
3a74ca8fc2 | |||
f4b922165f | |||
247d40f5a6 | |||
8953235268 | |||
3b84684415 | |||
d0da5d3fcd | |||
52a89cbcc5 | |||
d8c9748850 | |||
f42e87e37f | |||
53a3656d5e | |||
fc27cfd663 | |||
6b0bf02a85 | |||
f1bce15a57 | |||
3ea9b86bf5 | |||
4cce0aee62 | |||
dfb1b9ad69 | |||
4d6996bd55 | |||
0ac28c0208 | |||
37c3048c2a | |||
d3dc9a7690 | |||
c4559fadb3 | |||
806a2736c1 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ bin/
|
||||
*.out
|
||||
*.toc
|
||||
*.o
|
||||
*.so
|
||||
.*
|
||||
build
|
||||
RELEASE.txt
|
||||
|
29
.travis.yml
29
.travis.yml
@ -4,39 +4,25 @@ language: cpp
|
||||
|
||||
os: linux
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- CONDA_PY=3.6
|
||||
- CONDA_PY=3.7
|
||||
- CONDA_PY=3.8
|
||||
|
||||
|
||||
dist: trusty
|
||||
dist: bionic
|
||||
|
||||
install:
|
||||
- sudo apt-get update
|
||||
- ldd --version
|
||||
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
|
||||
- bash miniconda.sh -b -p $HOME/miniconda
|
||||
- export PATH="$HOME/miniconda/bin:$PATH"
|
||||
- source "$HOME/miniconda/etc/profile.d/conda.sh"
|
||||
- rm -f miniconda.sh
|
||||
- hash -r
|
||||
- conda config --set always_yes yes --set changeps1 no
|
||||
- conda config --add channels conda-forge
|
||||
- conda config --add channels slsdetectorgroup
|
||||
- conda update conda
|
||||
- conda update --all
|
||||
- conda install conda-build=3.17
|
||||
- conda install anaconda-client
|
||||
- conda install conda-verify
|
||||
|
||||
# Useful for debugging any issues with conda
|
||||
- conda update -q conda
|
||||
- conda info -a
|
||||
|
||||
|
||||
# Replace dep1 dep2 ... with your dependencies
|
||||
- conda create -q -n test-environment python=$CONDA_PY
|
||||
- source activate test-environment
|
||||
# Useful for debugging any issues with conda
|
||||
- conda create -q -n testenv conda-build anaconda-client conda-verify
|
||||
- conda activate testenv
|
||||
- conda-build .
|
||||
|
||||
script:
|
||||
@ -45,7 +31,8 @@ script:
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
script: find $HOME/miniconda/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:
|
||||
branch: developer
|
||||
tags: true
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(slsDetectorPackage)
|
||||
set(PROJECT_VERSION 5.0.0)
|
||||
include(CheckIPOSupported)
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
include(cmake/project_version.cmake)
|
||||
@ -44,6 +44,9 @@ option(SLS_USE_PYTHON "Python bindings" OFF)
|
||||
option(SLS_USE_CTBGUI "ctb GUI" OFF)
|
||||
option(SLS_BUILD_DOCS "docs" OFF)
|
||||
option(SLS_BUILD_EXAMPLES "examples" OFF)
|
||||
option(SLS_TUNE_LOCAL "tune to local machine" OFF)
|
||||
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
@ -111,6 +114,11 @@ if(SLS_USE_SANITIZER)
|
||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||
endif()
|
||||
|
||||
if(SLS_TUNE_LOCAL)
|
||||
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
|
||||
endif()
|
||||
|
||||
|
||||
#rapidjson
|
||||
add_library(rapidjson INTERFACE)
|
||||
target_include_directories(rapidjson INTERFACE
|
||||
@ -126,7 +134,7 @@ install(TARGETS slsProjectOptions slsProjectWarnings rapidjson
|
||||
)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
||||
set(CMAKE_INSTALL_RPATH $ORIGIN)
|
||||
# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
|
||||
@ -174,6 +182,7 @@ if (SLS_USE_INTEGRATION_TESTS)
|
||||
endif (SLS_USE_INTEGRATION_TESTS)
|
||||
|
||||
if (SLS_USE_PYTHON)
|
||||
set(PYBIND11_CPP_STANDARD -std=c++11)
|
||||
add_subdirectory(libs/pybind11)
|
||||
add_subdirectory(python)
|
||||
endif(SLS_USE_PYTHON)
|
||||
|
113
README.md
113
README.md
@ -2,90 +2,67 @@
|
||||
Detailed documentation can be found on the [official site.](https://www.psi.ch/detectors/users-support)
|
||||
|
||||
### Binaries
|
||||
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)
|
||||
Binaries for the slsDetectorPackage are available through conda.
|
||||
```
|
||||
#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
|
||||
One can also obtain the source code from this repository and compile while realizing the setup dependencies as required.
|
||||
One can also obtain the source code from this repository and compile.
|
||||
```
|
||||
git clone https://github.com/slsdetectorgroup/slsDetectorPackage.git
|
||||
|
||||
```
|
||||
#### Setup dependencies
|
||||
* Gui Client <br>
|
||||
Requirements: Qt 4.8 and Qwt 6.0
|
||||
```
|
||||
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.
|
||||
#### Dependencies
|
||||
* Lib: c++11 compiler (gcc=>4.8), ZeroMQ 4
|
||||
* Gui: Qt 4.8 and Qwt 6.0
|
||||
* Calibration wizards and ctbGUI: ROOT
|
||||
* Optional: HDF5
|
||||
|
||||
* Advanced user Calibration wizards<br>
|
||||
Requirements: ROOT
|
||||
```
|
||||
export ROOTSYS=/usr/local/root-5.34
|
||||
```
|
||||
|
||||
#### Compilation
|
||||
|
||||
Compiling can be done in two ways.
|
||||
Compiling can be done in two ways. Either with the convenience script
|
||||
cmk.sh or directly with cmake for more control.
|
||||
|
||||
**1. Compile using script cmk.sh**<br>
|
||||
|
||||
After compiling, the libraries and executables will be found in `slsDetectorPackage/build/bin` directory<br>
|
||||
|
||||
Usage: [-c] [-b] [-h] [-d HDF5 directory] [-j]<br>
|
||||
* -[no option]: only make<br>
|
||||
* -c: Clean<br>
|
||||
* -b: Builds/Rebuilds CMake files normal mode<br>
|
||||
* -h: Builds/Rebuilds Cmake files with HDF5 package<br>
|
||||
* -d: HDF5 Custom Directory<br>
|
||||
* -t: Build/Rebuilds only text client<br>
|
||||
* -r: Build/Rebuilds only receiver<br>
|
||||
* -g: Build/Rebuilds only gui<br>
|
||||
* -j: Number of threads to compile through<br>
|
||||
* -e: Debug mode
|
||||
|
||||
Basic Option:
|
||||
./cmk.sh -b
|
||||
|
||||
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>
|
||||
|
||||
Usage: [-c] [-b] [-p] [e] [t] [r] [g] [s] [u] [i] [-h] [-d <HDF5 directory>] [-j] <Number of threads>
|
||||
-[no option]: only make
|
||||
-c: Clean
|
||||
-b: Builds/Rebuilds CMake files normal mode
|
||||
-p: Builds/Rebuilds Python API
|
||||
-h: Builds/Rebuilds Cmake files with HDF5 package
|
||||
-d: HDF5 Custom Directory
|
||||
-t: Build/Rebuilds only text client
|
||||
-r: Build/Rebuilds only receiver
|
||||
-g: Build/Rebuilds only gui
|
||||
-s: Simulator
|
||||
-u: Chip Test Gui
|
||||
-j: Number of threads to compile through
|
||||
-e: Debug mode
|
||||
-i: Builds tests
|
||||
|
||||
eg. Rebuild when you switch to a new build and compile in parallel:
|
||||
./cmk.sh -bj5
|
||||
|
||||
**2. Compile without script**<br>
|
||||
Use cmake to create out-of-source builds, by creating a build folder parallel to source directory.
|
||||
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.
|
||||
```
|
||||
$ cd ..
|
||||
$ mkdir slsDetectorPackage-build
|
||||
$ cd slsDetectorPackage-build
|
||||
$ 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
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ../slsDetectorPackage -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON
|
||||
$ make -j12 #or whatever number of threads wanted
|
||||
```
|
||||
|
4
cmk.sh
4
cmk.sh
@ -187,8 +187,8 @@ fi
|
||||
|
||||
#Debug
|
||||
if [ $DEBUG -eq 1 ]; then
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
|
||||
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
|
||||
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
|
||||
echo "Debug Option enabled"
|
||||
fi
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
mkdir build
|
||||
mkdir install
|
||||
cd build
|
||||
@ -6,7 +7,7 @@ cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=install \
|
||||
-DSLS_USE_TEXTCLIENT=ON \
|
||||
-DSLS_USE_RECEIVER=ON \
|
||||
-DSLS_USE_GUI=OFF \
|
||||
-DSLS_USE_GUI=ON \
|
||||
-DSLS_USE_TESTS=ON \
|
||||
-DSLS_USE_PYTHON=OFF \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
|
@ -1,14 +1,4 @@
|
||||
|
||||
# mkdir $PREFIX/lib
|
||||
# mkdir $PREFIX/include
|
||||
|
||||
|
||||
# #Shared and static libraries
|
||||
# cp build/bin/_sls_detector* $PREFIX/lib/.
|
||||
|
||||
|
||||
# #Binaries
|
||||
# cp -r build/bin/sls_detector $PREFIX/lib/.
|
||||
|
||||
echo "|<-------- starting python build"
|
||||
cd python
|
||||
${PYTHON} setup.py install
|
||||
${PYTHON} setup.py install
|
||||
|
7
conda-recepie/conda_build_config.yaml
Normal file
7
conda-recepie/conda_build_config.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
python:
|
||||
- 3.6
|
||||
- 3.7
|
||||
- 3.8
|
||||
|
||||
numpy:
|
||||
- 1.17
|
9
conda-recepie/copy_ctbgui.sh
Normal file
9
conda-recepie/copy_ctbgui.sh
Normal file
@ -0,0 +1,9 @@
|
||||
mkdir $PREFIX/lib
|
||||
mkdir $PREFIX/bin
|
||||
mkdir $PREFIX/include
|
||||
|
||||
|
||||
|
||||
cp build/bin/ctbGui $PREFIX/bin/.
|
||||
cp build/bin/libctbRootLib.so $PREFIX/lib/.
|
||||
|
@ -1,15 +1,3 @@
|
||||
|
||||
mkdir $PREFIX/lib
|
||||
#Copy the GUI
|
||||
mkdir $PREFIX/bin
|
||||
mkdir $PREFIX/include
|
||||
|
||||
#No libs for gui?
|
||||
|
||||
#Binaries
|
||||
cp build/bin/gui_client $PREFIX/bin/.
|
||||
cp build/bin/slsDetectorGui $PREFIX/bin/.
|
||||
|
||||
|
||||
#Which headers do we need for development??
|
||||
|
||||
# cp include/some_lib.h $PREFIX/include/.
|
@ -1,13 +1,14 @@
|
||||
|
||||
package:
|
||||
name: sls_detector_software
|
||||
version: "developer"
|
||||
version: {{ environ.get('GIT_DESCRIBE_TAG', '') }}
|
||||
|
||||
source:
|
||||
- path: ..
|
||||
|
||||
build:
|
||||
number: 1
|
||||
number: 2
|
||||
binary_relocation: True
|
||||
rpaths:
|
||||
- lib/
|
||||
|
||||
@ -16,10 +17,9 @@ requirements:
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- cmake
|
||||
# - qwt 6.* #require qt5 investigate befor activating gui
|
||||
# - qt=4.8.7=7
|
||||
- zeromq=4.2.5=hfc679d8_5
|
||||
- pyzmq
|
||||
- qwt 6.*
|
||||
- qt 4.8.*
|
||||
- zeromq
|
||||
- xorg-libx11
|
||||
- xorg-libice
|
||||
- xorg-libxext
|
||||
@ -51,70 +51,46 @@ requirements:
|
||||
|
||||
|
||||
outputs:
|
||||
- name: sls_detector_lib
|
||||
- name: slsdetlib
|
||||
script: copy_lib.sh
|
||||
|
||||
- name: sls_detector
|
||||
requirements:
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- zeromq
|
||||
|
||||
- name: slsdet
|
||||
|
||||
script: build_pylib.sh
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- python
|
||||
- {{ compiler('c') }}
|
||||
- {{compiler('cxx')}}
|
||||
- python {{ python }}
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- setuptools
|
||||
- sls_detector_lib
|
||||
- pyzmq
|
||||
- pybind11 2.4
|
||||
|
||||
host:
|
||||
- python
|
||||
- pybind11 2.4
|
||||
- pyzmq
|
||||
- sls_detector_lib
|
||||
|
||||
run:
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
run:
|
||||
- python
|
||||
- numpy
|
||||
- sls_detector_lib=developer
|
||||
- pyzmq
|
||||
- libstdcxx-ng
|
||||
- libgcc-ng
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
|
||||
|
||||
test:
|
||||
imports:
|
||||
- sls_detector
|
||||
- slsdet
|
||||
|
||||
# requirements:
|
||||
# build:
|
||||
# - {{ compiler('c') }}
|
||||
# - {{compiler('cxx')}}
|
||||
|
||||
# - name: sls_detector_gui
|
||||
# version: "refactor"
|
||||
# script: copy_gui.sh
|
||||
# requirements:
|
||||
# build:
|
||||
# - {{ compiler('c') }}
|
||||
# - {{compiler('cxx')}}
|
||||
# - cmake
|
||||
# - qwt 6.*
|
||||
# - qt=4.8.7=7
|
||||
# - zeromq=4.2.5=hfc679d8_5
|
||||
# - pyzmq
|
||||
# - xorg-libx11
|
||||
# - xorg-libice
|
||||
# - xorg-libxext
|
||||
# - xorg-libsm
|
||||
# - xorg-libxau
|
||||
# - xorg-libxrender
|
||||
# - xorg-libxfixes
|
||||
# - {{ cdt('mesa-libgl-devel') }} # [linux]
|
||||
# - {{ cdt('mesa-libegl-devel') }} # [linux]
|
||||
# - {{ cdt('mesa-dri-drivers') }} # [linux]
|
||||
# - {{ cdt('libselinux') }} # [linux]
|
||||
# - {{ cdt('libxdamage') }} # [linux]
|
||||
# - {{ cdt('libxxf86vm') }} # [linux]
|
||||
# run:
|
||||
# - sls_detector_lib=refactor
|
||||
# - qwt 6.*
|
||||
# - qt=4.8.7=7
|
||||
- name: slsdetgui
|
||||
script: copy_gui.sh
|
||||
requirements:
|
||||
run:
|
||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||
- qwt 6.*
|
||||
- qt 4.8.*
|
||||
|
@ -71,6 +71,11 @@ target_link_libraries(ctbRootLib PUBLIC
|
||||
${ROOT_EXE_LINKER_FLAGS}
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
ctbRootLib PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
target_link_libraries(ctbGui PUBLIC
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
@ -80,4 +85,5 @@ target_link_libraries(ctbGui PUBLIC
|
||||
|
||||
set_target_properties(ctbGui PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
|
||||
)
|
@ -29,9 +29,10 @@
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ctbMain.h"
|
||||
#include "moench03CtbData.h"
|
||||
#include "moench03TCtbData.h"
|
||||
#include "moench03T1CtbData.h"
|
||||
//#include "moench03TCtbData.h"
|
||||
//#include "moench03T1CtbData.h"
|
||||
#include "moench03CommonMode.h"
|
||||
#include "moench03T1ZmqDataNew.h"
|
||||
#include "moench02CtbData.h"
|
||||
//#include "jungfrau10ModuleData.h"
|
||||
#include "moenchCommonMode.h"
|
||||
@ -43,6 +44,9 @@
|
||||
#include "moench04CtbZmq10GbData.h"
|
||||
#include "deserializer.h"
|
||||
#include "detectorData.h"
|
||||
#include "imageZmq16bit.h"
|
||||
#include "imageZmq32bit.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -232,7 +236,10 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
cbDetType->AddEntry("MOENCH02", MOENCH02);
|
||||
cbDetType->AddEntry("MOENCH04", MOENCH04);
|
||||
// cbDetType->AddEntry("JUNGFRAU1.0", 2);
|
||||
//cbDetType->AddEntry("MOENCH03 T", iiii++);
|
||||
cbDetType->AddEntry("MOENCH03",MOENCH03);
|
||||
cbDetType->AddEntry("IMAGE32BIT",IMAGE32B);
|
||||
cbDetType->AddEntry("IMAGE16BIT",IMAGE16B);
|
||||
|
||||
//cbDetType->AddEntry("MOENCH03", iiii++);
|
||||
// cbDetType->AddEntry("MYTHEN3 0.1", MYTHEN301);
|
||||
// cbDetType->AddEntry("ADCSAR2", ADCSAR2);
|
||||
@ -271,7 +278,7 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
|
||||
|
||||
|
||||
cout << "off "<< endl;
|
||||
// cout << "off "<< endl;
|
||||
|
||||
|
||||
hframe=new TGHorizontalFrame(this, 800,50);
|
||||
@ -290,8 +297,8 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELLimitMinMax,0,16535);
|
||||
hframe->AddFrame(eSerOff,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eSerOff->MapWindow();;
|
||||
eSerOff->SetNumber(5);
|
||||
eSerOff->MapWindow();
|
||||
eSerOff->SetNumber(0);
|
||||
e= eSerOff->TGNumberEntry::GetNumberEntry();
|
||||
eSerOff->Connect("ValueSet(Long_t)","ctbAcquisition",this,"ChangeSerialOffset(Long_t)");
|
||||
e->Connect("ReturnPressed()","ctbAcquisition",this,"ChangeSerialOffset()");
|
||||
@ -337,6 +344,53 @@ 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);
|
||||
@ -609,8 +663,10 @@ hframe=new TGHorizontalFrame(this, 800,50);
|
||||
cout <<"Registering data callback" << endl;
|
||||
try {
|
||||
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;
|
||||
|
||||
// mgAdcs=new TMultiGraph();
|
||||
@ -832,7 +888,7 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
|
||||
// cout <<"global plot is " << globalPlot << endl;
|
||||
// cout << "*******************************************" <<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;
|
||||
cout <<"------Plot: "<< index << " prog:" << data->progressIndex << " nx:" << data->nx << " ny: " << data->ny << " " << data->fileName << " bytes: " << data->databytes << " dr:"<< data->dynamicRange << " fi: " << data ->fileIndex << endl;
|
||||
if (globalPlot || cbGetPedestal->IsOn()) {
|
||||
//#ifdef TESTADC
|
||||
// cout <<"------"<< index << " " << ip << " " << data->npoints << endl;
|
||||
@ -859,6 +915,11 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
nx=eNumCount->GetIntNumber();
|
||||
dr=eDynRange->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;
|
||||
@ -923,7 +984,8 @@ sample1 (dbit0 + dbit1 +...)if (cmd == "rx_dbitlist") {
|
||||
for (int y=0; y<ny; y++) {
|
||||
ped=0;
|
||||
aval=dataStructure->getValue(data->data,x,y);
|
||||
|
||||
//aval=dataStructure->getChannel(data->data,x,y);
|
||||
cout << x << " " <<y << " "<< aval << endl;
|
||||
if (cbGetPedestal->IsOn()) {
|
||||
if (photonFinder) {
|
||||
photonFinder->addToPedestal(aval,x,y);
|
||||
@ -1094,8 +1156,20 @@ void ctbAcquisition::Draw(){
|
||||
void ctbAcquisition::changePlot(){
|
||||
if (rbPlotOff->IsOn()) {
|
||||
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 {
|
||||
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;
|
||||
dbitPlot=0;
|
||||
for (int ii=0; ii<NADCS; ii++)
|
||||
@ -1200,6 +1274,9 @@ void ctbAcquisition::changeDetector(){
|
||||
eNumCount->SetState(kFALSE);
|
||||
eDynRange->SetState(kFALSE);
|
||||
eSerOff->SetState(kFALSE);
|
||||
ePixX->SetState(kFALSE);
|
||||
ePixY->SetState(kFALSE);
|
||||
|
||||
deserializer=0;
|
||||
if (rb2D->IsOn() ) {//|| rbScan->IsOn()
|
||||
switch (cbDetType->GetSelected()) {
|
||||
@ -1210,7 +1287,6 @@ void ctbAcquisition::changeDetector(){
|
||||
// commonMode=new moench03CommonMode();
|
||||
break;
|
||||
case MOENCH04:
|
||||
|
||||
try {
|
||||
auto retval = myDet->getTenGiga().tsquash("Different values");
|
||||
if (retval) {
|
||||
@ -1223,6 +1299,54 @@ void ctbAcquisition::changeDetector(){
|
||||
cout << "MOENCH 0.4!" << endl;
|
||||
commonMode=new moench03CommonMode();
|
||||
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:
|
||||
// cout << "************** T!!!!!!!!!!" << endl;
|
||||
@ -1286,6 +1410,7 @@ 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
|
||||
dataStructure->getDetectorSize(nx,ny);
|
||||
|
||||
}
|
||||
if (deserializer) {
|
||||
ny=1;
|
||||
@ -1511,13 +1636,13 @@ void ctbAcquisition::update() {
|
||||
|
||||
if (dataStructure) {
|
||||
cout << cbDetType->GetSelected()<< endl;
|
||||
if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
}
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
// cout << "settings deserialiation parameters for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// eSerOff->SetNumber( ms->setSerialOffset(-1));
|
||||
// eDynRange->SetNumber( ms->setDynamicRange(-1));
|
||||
// eNumCount->SetNumber( ms->setNumberOfCounters(-1));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@ -1977,20 +2102,22 @@ void ctbAcquisition::ChangeNumberOfChannels(Long_t a){
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeSerialOffset(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// // cout << cbDetType->GetSelected()<< endl;
|
||||
// // if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// // cout << "settings offsets for MYTHEN" << endl;
|
||||
// // mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// // ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302 ){
|
||||
// cout << "settings offsets for MYTHEN" << endl;
|
||||
// mythen3_01_jctbData* ms=(mythen3_01_jctbData*)dataStructure;
|
||||
// ms->setSerialOffset(eSerOff->GetIntNumber());
|
||||
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
void ctbAcquisition::ChangeDynamicRange(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
@ -2004,6 +2131,7 @@ void ctbAcquisition::ChangeDynamicRange(){
|
||||
};
|
||||
|
||||
void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
changeDetector();
|
||||
// if (dataStructure) {
|
||||
// cout << cbDetType->GetSelected()<< endl;
|
||||
// if (cbDetType->GetSelected()==MYTHEN301 || cbDetType->GetSelected()==MYTHEN302){
|
||||
@ -2017,6 +2145,24 @@ void ctbAcquisition::ChangeNumberOfChannels(){
|
||||
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){
|
||||
|
@ -42,7 +42,7 @@ using namespace std;
|
||||
class ctbAcquisition : public TGGroupFrame {
|
||||
|
||||
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
enum {DESERIALIZER, MOENCH04, MOENCH02, MOENCH03, IMAGE32B, IMAGE16B, ADCSAR2, MYTHEN301, MYTHEN302};
|
||||
|
||||
|
||||
private:
|
||||
@ -57,6 +57,9 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
TGNumberEntry *eNumCount;
|
||||
|
||||
|
||||
TGNumberEntry *ePixX;
|
||||
TGNumberEntry *ePixY;
|
||||
|
||||
TGNumberEntry *eFitADC;
|
||||
TGNumberEntry *eBitPlot;
|
||||
TGNumberEntry *eMinRaw;
|
||||
@ -231,7 +234,8 @@ class ctbAcquisition : public TGGroupFrame {
|
||||
void ChangeNumberOfChannels(Long_t);
|
||||
void ChangeDynamicRange();
|
||||
void ChangeDynamicRange(Long_t);
|
||||
|
||||
void ChangeImagePixels();
|
||||
void ChangeImagePixels(Long_t);
|
||||
|
||||
void canvasClicked();
|
||||
void FitADC();
|
||||
|
@ -108,15 +108,26 @@ 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() {
|
||||
|
||||
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
||||
|
||||
try {
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
|
||||
int sid = id;
|
||||
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")
|
||||
|
||||
getValue();
|
||||
@ -128,7 +139,11 @@ void ctbDac::setOn(Bool_t b) {
|
||||
setValue();
|
||||
} else {
|
||||
try {
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), -100, false);
|
||||
int sid = id;
|
||||
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")
|
||||
}
|
||||
getValue();
|
||||
@ -136,7 +151,11 @@ void ctbDac::setOn(Bool_t b) {
|
||||
|
||||
int ctbDac::getValue() {
|
||||
try {
|
||||
int val = myDet->getDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn()).tsquash("Different values");
|
||||
int sid = id;
|
||||
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;
|
||||
dacsValue->SetText(to_string(val).c_str());
|
||||
if (val >= 0) {
|
||||
|
@ -45,7 +45,7 @@ class ctbDac : public TGHorizontalFrame {
|
||||
|
||||
int setLabel(char *tit, int mv);
|
||||
string getLabel();
|
||||
|
||||
int getMoenchDacId();
|
||||
|
||||
|
||||
ClassDef(ctbDac,0)
|
||||
@ -54,8 +54,6 @@ class ctbDac : public TGHorizontalFrame {
|
||||
class ctbDacs : public TGGroupFrame {
|
||||
private:
|
||||
|
||||
|
||||
|
||||
ctbDac *dacs[NDACS+2];
|
||||
|
||||
sls::Detector* myDet;
|
||||
|
@ -71,14 +71,14 @@ class ctbDefs {
|
||||
std::string exceptionMessage,
|
||||
std::string source) {
|
||||
// because sls_detector_exceptions cannot be included
|
||||
if (exceptionMessage.find("hared memory")) {
|
||||
if (exceptionMessage.find("hared memory") != std::string::npos) {
|
||||
throw;
|
||||
}
|
||||
if (exceptionMessage.find("annot connect")) {
|
||||
if (exceptionMessage.find("annot connect") != std::string::npos) {
|
||||
throw;
|
||||
}
|
||||
cprintf(RED, "Warning (%s): %s [Caught Exception: %s]\n", source.c_str(), message.c_str(), exceptionMessage.c_str());
|
||||
//return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
@ -259,8 +259,10 @@ ctbMain::ctbMain(const TGWindow *p, sls::Detector *det)
|
||||
|
||||
cout << "connect mtab" << endl;
|
||||
|
||||
|
||||
setReadoutMode(pat->getReadoutMode());
|
||||
try{
|
||||
setReadoutMode(pat->getReadoutMode());
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
setADCEnable(adcs->setEnable());
|
||||
setAnalogSamples(pat->getAnalogSamples());
|
||||
setDigitalSamples(pat->getDigitalSamples());
|
||||
|
@ -1035,33 +1035,42 @@ void ctbPattern::readoutModeChanged(int flags) {
|
||||
|
||||
}
|
||||
|
||||
int ctbPattern::getReadoutMode() {
|
||||
try{
|
||||
auto retval = myDet->getReadoutMode().tsquash("Different values");
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::ANALOG_AND_DIGITAL:
|
||||
cout << "analog and digital" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::DIGITAL_ONLY:
|
||||
cout << "digital only" << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::ANALOG_ONLY:
|
||||
cout << "analog only" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kFALSE);
|
||||
break;
|
||||
default:
|
||||
throw("unknown readout flag");
|
||||
}
|
||||
int ctbPattern::getReadoutMode() {
|
||||
int retval=slsDetectorDefs::ANALOG_ONLY;
|
||||
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
try{
|
||||
retval = myDet->getReadoutMode().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::ANALOG_AND_DIGITAL:
|
||||
cout << "analog and digital" << endl;
|
||||
cbAnalog->SetOn(kTRUE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::DIGITAL_ONLY:
|
||||
cout << "digital only" << endl;
|
||||
cbAnalog->SetOn(kFALSE);
|
||||
cbDigital->SetOn(kTRUE);
|
||||
break;
|
||||
case slsDetectorDefs::ANALOG_ONLY:
|
||||
cout << "analog only" << endl;
|
||||
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));
|
||||
return retval;
|
||||
} CATCH_DISPLAY ("Could not get readout flags", "ctbPattern::getReadoutMode")
|
||||
|
||||
return -1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int ctbPattern::getAnalogSamples() {
|
||||
@ -1075,13 +1084,17 @@ int ctbPattern::getAnalogSamples() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ctbPattern::getDigitalSamples() {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
eDigitalSamples->SetNumber((Double_t)retval);
|
||||
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
||||
return eDigitalSamples->GetNumber();
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
int ctbPattern::getDigitalSamples() {
|
||||
int retval=0;
|
||||
if (myDet->getDetectorType().squash() == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
try{
|
||||
auto retval = myDet->getNumberOfDigitalSamples().tsquash("Different values");
|
||||
} CATCH_DISPLAY ("Could not get number of digital samples.", "ctbPattern::getDigitalSamples")
|
||||
}
|
||||
eDigitalSamples->SetNumber((Double_t)retval);
|
||||
Emit("digitalSamplesChanged(const int)", eDigitalSamples->GetNumber());
|
||||
return eDigitalSamples->GetNumber();
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ file writing etc.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from sls_detector import Eiger
|
||||
from slsdet import Eiger
|
||||
|
||||
d = Eiger()
|
||||
threshold = range(0, 2000, 200)
|
||||
|
140
examples/moench01_T1_lab.config → examples/jctb_moench03_T1.config
Executable file → Normal file
140
examples/moench01_T1_lab.config → examples/jctb_moench03_T1.config
Executable file → Normal file
@ -1,4 +1,14 @@
|
||||
hostname bchip085+
|
||||
initialchecks 0
|
||||
#############################################
|
||||
### edit with hostname or IP address of your detector
|
||||
############################################
|
||||
hostname bchip181+
|
||||
runclk 40
|
||||
adcclk 20
|
||||
dbitclk 40
|
||||
|
||||
|
||||
|
||||
|
||||
patword 0000 0000000000000000
|
||||
patword 0001 0000000000000000
|
||||
@ -408,84 +418,84 @@ patnloop1 0
|
||||
patloop2 0400 0400
|
||||
patnloop2 0
|
||||
patwait0 00aa
|
||||
patwaittime0 40000
|
||||
patwaittime0 10000
|
||||
patwait1 0400
|
||||
patwaittime1 0
|
||||
patwait2 0400
|
||||
patwaittime2 0
|
||||
|
||||
|
||||
####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
|
||||
#0:rx_tcpport 1977
|
||||
|
||||
####mx-test-1
|
||||
0:rx_udpip 10.1.1.100
|
||||
0:detectorip 10.1.1.19
|
||||
0:rx_udpport 32410
|
||||
####gui listening to (on receiver pc)
|
||||
zmqip 129.129.202.92
|
||||
zmqport 30001
|
||||
####data streaming out of
|
||||
rx_zmqip 10.1.1.100
|
||||
rx_zmqport 30003
|
||||
0:rx_hostname pcmoench01
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
#0:udp_dstip 10.1.1.102
|
||||
0:udp_dstip 129.129.202.136
|
||||
#############################################
|
||||
### edit with any number in the subnet of your server (first 3 numbers as above)
|
||||
############################################
|
||||
#0:udp_srcip 10.1.1.19
|
||||
0:udp_srcip 129.129.202.13
|
||||
|
||||
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 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#turn on datastream from commandline
|
||||
rx_datastream 1
|
||||
|
||||
r_readfreq 1
|
||||
|
||||
#0:configuremac -1
|
||||
rx_datastream 1
|
||||
|
||||
r_readfreq 1
|
||||
rx_readfreq 1
|
||||
|
||||
|
||||
dac:6 800
|
||||
dac:0 1300
|
||||
dac:4 1428
|
||||
dac:1 1000
|
||||
dac:7 900
|
||||
dac:3 680
|
||||
dac:2 1400
|
||||
dac:5 1200
|
||||
dac 6 800
|
||||
dac 0 1300
|
||||
dac 4 1428
|
||||
dac 1 1000
|
||||
dac 7 900
|
||||
dac 3 680
|
||||
dac 2 1400
|
||||
dac 5 1200
|
||||
adcinvert 4a342593
|
||||
samples 5000
|
||||
adcphase 90
|
||||
adcpipeline 15
|
||||
#0xb5cbda6c
|
||||
asamples 5000
|
||||
dsamples 0
|
||||
adcphase 30 deg
|
||||
adcpipeline 14
|
||||
adcreg 14 40
|
||||
powerchip 1
|
||||
|
||||
|
||||
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
|
||||
vhighvoltage 90
|
||||
period 0.005
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
frames 100
|
||||
period 0.1
|
||||
outdir /scratch/
|
||||
enablefwrite 0
|
||||
|
||||
|
||||
|
61
examples/moench03_T1.config
Normal file
61
examples/moench03_T1.config
Normal file
@ -0,0 +1,61 @@
|
||||
#initialchecks 0
|
||||
#############################################
|
||||
### edit with hostname or IP address of your detector
|
||||
############################################
|
||||
hostname bchip181+
|
||||
|
||||
|
||||
|
||||
#############################################
|
||||
### 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 33410
|
||||
|
||||
#############################################
|
||||
### edit with 10 Gbs IP of your server
|
||||
############################################
|
||||
#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.136
|
||||
#zmqport 40001
|
||||
|
||||
|
||||
#############################################
|
||||
### edit with hostname or 1Gbs IP address of your server
|
||||
############################################
|
||||
rx_hostname mpc2011
|
||||
|
||||
|
||||
tengiga 1
|
||||
rx_datastream 1
|
||||
|
||||
|
||||
|
||||
frames 1
|
||||
period 0.001
|
||||
#############################################
|
||||
### edit with directory you want to write to
|
||||
############################################
|
||||
fpath /mnt/moench_data/scratch/
|
||||
fwrite 0
|
||||
rx_datastream 1
|
||||
|
||||
rx_jsonpara frameMode newpedestal
|
||||
rx_jsonpara detectorMode analog
|
||||
rx_discardpolicy discardpartial
|
||||
|
||||
|
||||
adcpipeline 15
|
||||
|
||||
powerchip 1
|
||||
vhighvoltage 90
|
||||
|
||||
adcreg 14 40
|
Submodule libs/pybind11 updated: 80d452484c...4f72ef846f
@ -176,6 +176,7 @@ One can configure all the detector settings in a parameter file {\tt{setup.det}}
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-parameters setup.det
|
||||
\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{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:
|
||||
@ -609,18 +610,19 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_acquire 0-
|
||||
\end{verbatim}
|
||||
No timeout is expected between the start of the acquisition and the arrival of the first trigger.
|
||||
|
||||
Here are the implemented options so far:
|
||||
\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 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{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{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{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{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. 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}} 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}} 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}} 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.
|
||||
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}}.
|
||||
|
||||
@ -628,13 +630,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.
|
||||
|
||||
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.
|
||||
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}} 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:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [trigger/burst_trigger]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_status trigger
|
||||
\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}.
|
||||
@ -715,7 +717,7 @@ 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:
|
||||
\begin{enumerate}
|
||||
\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{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.
|
||||
\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}. 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} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
@ -988,13 +990,14 @@ 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.
|
||||
|
||||
\subsection{Offline image reconstruction}
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. The code is still available doing \\
|
||||
{\tt{git clone git@git.psi.ch:sls\_detectors\_software/sls\_image\_reconstruction.git slsImageReconstruction}}.
|
||||
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.
|
||||
The offline image reconstruction{\tt{slsImageReconstruction}} is not part of the package anymore. However, it can be retrieved from \\
|
||||
{\tt{git clone https://github.com/slsdetectorgroup/slsImageReconstruction.git slsImageReconstruction}}.\\
|
||||
Checkout the {\tt{v3.1}} branch if in a 3.1.X release, the {\tt{v4.0.0}} branch if in 4.0.X release, or the {\tt{v4.1}} branch if in 4.1.X release of the {\tt{slsDetector}} code. There is a {\tt{developer}} branch that has newer updates but needs to be tested.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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}}:
|
||||
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}}:
|
||||
\begin{verbatim}
|
||||
#define EIGER_MAX_FRAMES_PER_FILE 2000
|
||||
\end{verbatim}
|
||||
@ -1043,11 +1046,12 @@ 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.\\
|
||||
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.
|
||||
\begin{verbatim}
|
||||
#define MYCBF
|
||||
##following line only if you need to process with
|
||||
##BUBBLE (Material Science / uXAS beamlines).
|
||||
##following line only if you need to process with BUBBLE
|
||||
#define MSHeader
|
||||
\end{verbatim}
|
||||
Compile it with:
|
||||
@ -1096,6 +1100,10 @@ To use it any geometry:\\
|
||||
eg.
|
||||
{\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}
|
||||
|
||||
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:
|
||||
@ -1257,7 +1265,7 @@ We have also been requested if we could speed up the threshold scan. At the mome
|
||||
./sls_detector_put enablefwrite 0
|
||||
./sls_detector_put resetframescaught 0
|
||||
./sls_detector_put index 0
|
||||
./sls_detector_put triggers 21
|
||||
./sls_detector_put cycles 21
|
||||
./sls_detector_put receiver start
|
||||
./sls_detector_put status start
|
||||
for i in $(seq 0 20);
|
||||
@ -1515,8 +1523,8 @@ frames number
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
\item \begin{verbatim}
|
||||
sls_detector_get triggers
|
||||
triggers number
|
||||
sls_detector_get cycles
|
||||
cycles number
|
||||
\end{verbatim}
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
|
@ -1,20 +1,22 @@
|
||||
|
||||
pybind11_add_module(_sls_detector
|
||||
# find_package (Python COMPONENTS Interpreter Development)
|
||||
|
||||
pybind11_add_module(_slsdet
|
||||
src/main.cpp
|
||||
src/enums.cpp
|
||||
src/detector.cpp
|
||||
src/network.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(_sls_detector PUBLIC
|
||||
target_link_libraries(_slsdet PUBLIC
|
||||
slsDetectorShared
|
||||
slsReceiverShared
|
||||
slsSupportLib
|
||||
zmq )
|
||||
)
|
||||
|
||||
|
||||
|
||||
set_target_properties(_sls_detector PROPERTIES
|
||||
set_target_properties(_slsdet PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
@ -38,8 +40,8 @@ set( PYTHON_FILES
|
||||
)
|
||||
|
||||
foreach(FILE ${PYTHON_FILES})
|
||||
configure_file( sls_detector/${FILE}
|
||||
${CMAKE_BINARY_DIR}/bin/sls_detector/${FILE} )
|
||||
configure_file( slsdet/${FILE}
|
||||
${CMAKE_BINARY_DIR}/bin/slsdet/${FILE} )
|
||||
|
||||
endforeach(FILE ${PYTHON_FILES})
|
||||
|
||||
|
@ -3,9 +3,9 @@ import sys
|
||||
import numpy as np
|
||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
|
||||
from sls_detector import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from sls_detector import dacIndex, readoutMode
|
||||
from sls_detector.lookup import view, find
|
||||
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
||||
from slsdet import dacIndex, readoutMode
|
||||
from slsdet.lookup import view, find
|
||||
|
||||
d = Detector()
|
||||
# e = Eiger()
|
||||
|
@ -4,10 +4,11 @@ out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.ge
|
||||
cmd = out.stdout.splitlines()
|
||||
cmd.pop(0)
|
||||
|
||||
from sls_detector import Detector, Eiger, Ctb
|
||||
from slsdet import Detector, Eiger, 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',
|
||||
'vsvp', 'vth1', 'vth2', 'vth3', 'vshaper', 'vshaperneg', 'rxb_rb',
|
||||
'rxb_lb', 'vref_prech', 'vref_rstore', 'vref_cds',
|
||||
|
@ -1,11 +1,19 @@
|
||||
"""
|
||||
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
|
||||
from pathlib import Path
|
||||
|
||||
#General python stuff
|
||||
import os
|
||||
import locale
|
||||
import argparse
|
||||
path = Path('../../slsDetectorSoftware/tests/')
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
#Realative path from this dir
|
||||
path = Path('../../slsDetectorSoftware/tests/')
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-s", "--startswith", help="for filter", type = str, default=None)
|
||||
args = parser.parse_args()
|
||||
@ -15,15 +23,12 @@ tested = []
|
||||
for fname in files:
|
||||
with open(path/fname) as f:
|
||||
data = f.read()
|
||||
|
||||
data = parse.remove_comments(data)
|
||||
data = data.splitlines()
|
||||
|
||||
|
||||
for line in data:
|
||||
if 'TEST_CASE' in line or 'SECTION' in line:
|
||||
cmd = line.split("\"")[1]
|
||||
tested.append(cmd)
|
||||
tested.append([cmd, fname])
|
||||
|
||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||
all_cmd = out.stdout.splitlines()
|
||||
@ -33,18 +38,18 @@ all_cmd.pop(0)
|
||||
|
||||
if args.startswith is not None:
|
||||
all_cmd = [cmd for cmd in all_cmd if cmd.startswith(args.startswith)]
|
||||
tested = [cmd for cmd in tested if cmd.startswith(args.startswith)]
|
||||
tested = [cmd for cmd in tested if cmd[0].startswith(args.startswith)]
|
||||
|
||||
tn = [cmd[0] for cmd in tested]
|
||||
|
||||
|
||||
not_tested = [cmd for cmd in all_cmd if cmd not in tested]
|
||||
misnamed = [cmd for cmd in tested if cmd not in all_cmd]
|
||||
tested = [cmd for cmd in tested if cmd in all_cmd]
|
||||
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]
|
||||
tested = [cmd for cmd in tested if cmd[0] in all_cmd]
|
||||
|
||||
|
||||
print("\nThe following commands are tested:")
|
||||
for cmd in tested:
|
||||
print(cmd)
|
||||
print(f'{cmd[0]:>18} : {cmd[1]}')
|
||||
|
||||
print("\nThe following commands are NOT tested:")
|
||||
for cmd in not_tested:
|
||||
|
@ -8,7 +8,7 @@ import sys
|
||||
import setuptools
|
||||
import os
|
||||
|
||||
__version__ = 'refactor'
|
||||
__version__ = os.environ.get('GIT_DESCRIBE_TAG', 'developer')
|
||||
|
||||
|
||||
def get_conda_path():
|
||||
@ -19,31 +19,32 @@ def get_conda_path():
|
||||
return os.environ['CONDA_PREFIX']
|
||||
|
||||
|
||||
class get_pybind_include(object):
|
||||
"""Helper class to determine the pybind11 include path
|
||||
The purpose of this class is to postpone importing pybind11
|
||||
until it is actually installed, so that the ``get_include()``
|
||||
method can be invoked. """
|
||||
# class get_pybind_include(object):
|
||||
# """Helper class to determine the pybind11 include path
|
||||
# The purpose of this class is to postpone importing pybind11
|
||||
# until it is actually installed, so that the ``get_include()``
|
||||
# method can be invoked. """
|
||||
|
||||
def __init__(self, user=False):
|
||||
self.user = user
|
||||
# def __init__(self, user=False):
|
||||
# self.user = user
|
||||
|
||||
def __str__(self):
|
||||
import pybind11
|
||||
return pybind11.get_include(self.user)
|
||||
# def __str__(self):
|
||||
# import pybind11
|
||||
# return pybind11.get_include(self.user)
|
||||
|
||||
|
||||
ext_modules = [
|
||||
Extension(
|
||||
'_sls_detector',
|
||||
'_slsdet',
|
||||
['src/main.cpp',
|
||||
'src/enums.cpp',
|
||||
'src/detector.cpp',
|
||||
'src/network.cpp'],
|
||||
include_dirs=[
|
||||
# Path to pybind11 headers
|
||||
get_pybind_include(),
|
||||
get_pybind_include(user=True),
|
||||
# get_pybind_include(),
|
||||
# get_pybind_include(user=True),
|
||||
os.path.join('../libs/pybind11/include'),
|
||||
os.path.join(get_conda_path(), 'include/slsDetectorPackage'),
|
||||
|
||||
],
|
||||
@ -109,20 +110,28 @@ class BuildExt(build_ext):
|
||||
opts.append('/DVERSION_INFO=\\"%s\\"' % self.distribution.get_version())
|
||||
for ext in self.extensions:
|
||||
ext.extra_compile_args = opts
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
print('**************************************************')
|
||||
print(ct)
|
||||
print(opts)
|
||||
print('**************************************************')
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
|
||||
|
||||
def get_shared_lib():
|
||||
return [f for f in os.listdir('.') if '_slsdet' in f]
|
||||
|
||||
setup(
|
||||
name='sls_detector',
|
||||
name='slsdet',
|
||||
version=__version__,
|
||||
author='Erik Frojdh',
|
||||
author_email='erik.frojdh@psi.ch',
|
||||
url='https://github.com/slsdetectorgroup/sls_detector',
|
||||
url='https://github.com/slsdetectorgroup/slsDetectorPackage',
|
||||
description='Detector API for SLS Detector Group detectors',
|
||||
long_description='',
|
||||
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
|
||||
ext_modules=ext_modules,
|
||||
install_requires=['pybind11>=2.2'],
|
||||
cmdclass={'build_ext': BuildExt},
|
||||
zip_safe=False,
|
||||
)
|
||||
|
@ -1,23 +0,0 @@
|
||||
# from .detector import Detector, DetectorError, free_shared_memory
|
||||
from .eiger import Eiger
|
||||
from .ctb import Ctb
|
||||
from .dacs import DetectorDacs, Dac
|
||||
from .detector import Detector
|
||||
from .jungfrau import Jungfrau
|
||||
from .mythen3 import Mythen3
|
||||
# from .jungfrau_ctb import JungfrauCTB
|
||||
# from _sls_detector import DetectorApi
|
||||
|
||||
import _sls_detector
|
||||
|
||||
defs = _sls_detector.slsDetectorDefs
|
||||
runStatus = _sls_detector.slsDetectorDefs.runStatus
|
||||
speedLevel = _sls_detector.slsDetectorDefs.speedLevel
|
||||
timingMode = _sls_detector.slsDetectorDefs.timingMode
|
||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
||||
detectorType = _sls_detector.slsDetectorDefs.detectorType
|
||||
detectorSettings = _sls_detector.slsDetectorDefs.detectorSettings
|
||||
readoutMode = _sls_detector.slsDetectorDefs.readoutMode
|
||||
|
||||
IpAddr = _sls_detector.IpAddr
|
||||
MacAddr = _sls_detector.MacAddr
|
@ -1,9 +0,0 @@
|
||||
from .detector import Detector
|
||||
|
||||
def view(name):
|
||||
names = find(name)
|
||||
for n in names:
|
||||
print(n)
|
||||
|
||||
def find(name):
|
||||
return [n for n in dir(Detector) if name in n]
|
23
python/slsdet/__init__.py
Executable file
23
python/slsdet/__init__.py
Executable file
@ -0,0 +1,23 @@
|
||||
# from .detector import Detector, DetectorError, free_shared_memory
|
||||
from .eiger import Eiger
|
||||
from .ctb import Ctb
|
||||
from .dacs import DetectorDacs, Dac
|
||||
from .detector import Detector
|
||||
from .jungfrau import Jungfrau
|
||||
from .mythen3 import Mythen3
|
||||
# from .jungfrau_ctb import JungfrauCTB
|
||||
# from _slsdet import DetectorApi
|
||||
|
||||
import _slsdet
|
||||
|
||||
defs = _slsdet.slsDetectorDefs
|
||||
runStatus = _slsdet.slsDetectorDefs.runStatus
|
||||
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
||||
timingMode = _slsdet.slsDetectorDefs.timingMode
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||
|
||||
IpAddr = _slsdet.IpAddr
|
||||
MacAddr = _slsdet.MacAddr
|
@ -1,8 +1,8 @@
|
||||
from .detector import Detector
|
||||
from .utils import element_if_equal
|
||||
from .dacs import DetectorDacs
|
||||
import _sls_detector
|
||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
class CtbDacs(DetectorDacs):
|
@ -1,9 +1,9 @@
|
||||
from .detector_property import DetectorProperty
|
||||
from functools import partial
|
||||
import numpy as np
|
||||
import _sls_detector
|
||||
import _slsdet
|
||||
from .detector import freeze
|
||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
class Dac(DetectorProperty):
|
||||
"""
|
||||
This class represents a dac on the detector. One instance handles all
|
@ -1,5 +1,5 @@
|
||||
from _sls_detector import CppDetectorApi
|
||||
from _sls_detector import slsDetectorDefs
|
||||
from _slsdet import CppDetectorApi
|
||||
from _slsdet import slsDetectorDefs
|
||||
|
||||
runStatus = slsDetectorDefs.runStatus
|
||||
speedLevel = slsDetectorDefs.speedLevel
|
@ -11,8 +11,8 @@ from .detector import Detector
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _sls_detector
|
||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
# from .utils import element_if_equal
|
||||
# from sls_detector.errors import DetectorValueError, DetectorError
|
@ -9,8 +9,8 @@ from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _sls_detector
|
||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
# @freeze
|
9
python/slsdet/lookup.py
Normal file
9
python/slsdet/lookup.py
Normal file
@ -0,0 +1,9 @@
|
||||
from .detector import Detector
|
||||
|
||||
def view(name, det = Detector):
|
||||
names = find(name, det)
|
||||
for n in names:
|
||||
print(n)
|
||||
|
||||
def find(name, det = Detector):
|
||||
return [n for n in dir(det) if name.lower() in n.lower()]
|
@ -9,8 +9,8 @@ from .detector import Detector, freeze
|
||||
|
||||
# from .adcs import Adc, DetectorAdcs
|
||||
from .dacs import DetectorDacs
|
||||
import _sls_detector
|
||||
dacIndex = _sls_detector.slsDetectorDefs.dacIndex
|
||||
import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
# vcassh 1200,
|
@ -5,7 +5,7 @@ but not directly used in controlling the detector
|
||||
|
||||
|
||||
from collections import namedtuple
|
||||
import _sls_detector #C++ lib
|
||||
import _slsdet #C++ lib
|
||||
import functools
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ def list_to_bitmask(values):
|
||||
return mask
|
||||
|
||||
def to_geo(value):
|
||||
if isinstance(value, _sls_detector.xy):
|
||||
if isinstance(value, _slsdet.xy):
|
||||
return Geometry(x = value.x, y = value.y)
|
||||
else:
|
||||
raise ValueError("Can only convert sls_detector.xy")
|
@ -2,7 +2,7 @@ C++ API
|
||||
=====================================================
|
||||
|
||||
|
||||
.. py:currentmodule:: _sls_detector
|
||||
.. py:currentmodule:: _slsdet
|
||||
|
||||
.. autoclass:: DetectorApi
|
||||
:members:
|
||||
|
@ -428,6 +428,13 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setImageTestMode", &Detector::setImageTestMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getNumberOfBursts", &Detector::getNumberOfBursts,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfBursts", &Detector::setNumberOfBursts, py::arg())
|
||||
.def("getBurstPeriod", &Detector::getBurstPeriod,
|
||||
py::arg() = Positions{})
|
||||
.def("setBurstPeriod", &Detector::setBurstPeriod, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getInjectChannel", &Detector::getInjectChannel,
|
||||
py::arg() = Positions{})
|
||||
.def("setInjectChannel", &Detector::setInjectChannel, py::arg(),
|
||||
@ -441,6 +448,14 @@ void init_det(py::module &m) {
|
||||
.def("getBurstMode", &Detector::getBurstMode, py::arg() = Positions{})
|
||||
.def("setBurstMode", &Detector::setBurstMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getCurrentSource", &Detector::getCurrentSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setCurrentSource", &Detector::setCurrentSource, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getTimingSource", &Detector::getTimingSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setTimingSource", &Detector::setTimingSource, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getCounterMask", &Detector::getCounterMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setCounterMask", &Detector::setCounterMask, py::arg(),
|
||||
@ -610,6 +625,8 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("writeAdcRegister", &Detector::writeAdcRegister, py::arg(),
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getInitialChecks", &Detector::getInitialChecks)
|
||||
.def("setInitialChecks", &Detector::setInitialChecks, py::arg())
|
||||
.def("getControlPort", &Detector::getControlPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setControlPort", &Detector::setControlPort, py::arg(),
|
||||
|
@ -284,4 +284,11 @@ void init_enums(py::module &m) {
|
||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::timingSourceType>(Defs, "timingSourceType")
|
||||
.value("TIMING_INTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_INTERNAL)
|
||||
.value("TIMING_EXTERNAL",
|
||||
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
||||
.export_values();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ void init_enums(py::module &);
|
||||
void init_experimental(py::module &);
|
||||
void init_det(py::module &);
|
||||
void init_network(py::module &);
|
||||
PYBIND11_MODULE(_sls_detector, m) {
|
||||
PYBIND11_MODULE(_slsdet, m) {
|
||||
m.doc() = R"pbdoc(
|
||||
C/C++ API
|
||||
-----------------------
|
||||
|
@ -16,12 +16,12 @@ def d():
|
||||
|
||||
|
||||
def test_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.acq')
|
||||
m = mocker.patch('_slsdet.DetectorApi.acq')
|
||||
d.acq()
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_busy_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
|
||||
m.return_value = False
|
||||
assert d.busy == False
|
||||
|
||||
@ -31,103 +31,103 @@ def test_assign_to_detector_type(d):
|
||||
d.detector_type = 'Eiger'
|
||||
|
||||
def test_det_type(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
|
||||
m.return_value = 'Eiger'
|
||||
assert d.detector_type == 'Eiger'
|
||||
|
||||
def test_set_dynamic_range_4(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||
d.dynamic_range = 4
|
||||
m.assert_called_with(4)
|
||||
|
||||
def test_set_dynamic_range_8(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||
d.dynamic_range = 8
|
||||
m.assert_called_with(8)
|
||||
|
||||
|
||||
def test_set_dynamic_range_16(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||
d.dynamic_range = 16
|
||||
m.assert_called_with(16)
|
||||
|
||||
def test_set_dynamic_range_32(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||
d.dynamic_range = 32
|
||||
m.assert_called_with(32)
|
||||
|
||||
def test_set_dynamic_range_raises_exception(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setDynamicRange')
|
||||
mocker.patch('_slsdet.DetectorApi.setDynamicRange')
|
||||
with pytest.raises(ValueError):
|
||||
d.dynamic_range = 17
|
||||
|
||||
def test_get_dynamic_range_32(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDynamicRange')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDynamicRange')
|
||||
m.return_value = 32
|
||||
dr = d.dynamic_range
|
||||
assert dr == 32
|
||||
|
||||
def test_eiger_matrix_reset(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getCounterBit')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getCounterBit')
|
||||
m.return_value = True
|
||||
assert d.eiger_matrix_reset == True
|
||||
|
||||
def test_set_eiger_matrix_reset(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setCounterBit')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setCounterBit')
|
||||
d.eiger_matrix_reset = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
|
||||
def test_get_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
|
||||
m.return_value = 100000000
|
||||
assert d.exposure_time == 0.1
|
||||
|
||||
def test_set_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||
d.exposure_time = 1.5
|
||||
m.assert_called_once_with(1500000000)
|
||||
|
||||
def test_set_exposure_time_less_than_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
||||
mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||
with pytest.raises(ValueError):
|
||||
d.exposure_time = -7
|
||||
|
||||
|
||||
def test_get_file_index(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
|
||||
m.return_value = 8
|
||||
assert d.file_index == 8
|
||||
|
||||
def test_set_file_index(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||
d.file_index = 9
|
||||
m.assert_called_with(9)
|
||||
|
||||
|
||||
def test_set_file_index_raises_on_neg(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
||||
mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||
with pytest.raises(ValueError):
|
||||
d.file_index = -9
|
||||
|
||||
|
||||
def test_get_file_name(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileName')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFileName')
|
||||
d.file_name
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_file_name(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileName')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setFileName')
|
||||
d.file_name = 'hej'
|
||||
m.assert_called_once_with('hej')
|
||||
|
||||
def test_get_file_path(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFilePath')
|
||||
d.file_path
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_file_path_when_path_exists(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||
#To avoid raising an exception because path is not there
|
||||
mock_os = mocker.patch('os.path.exists')
|
||||
mock_os.return_value = True
|
||||
@ -135,25 +135,25 @@ def test_set_file_path_when_path_exists(d, mocker):
|
||||
m.assert_called_once_with('/path/to/something/')
|
||||
|
||||
def test_set_file_path_raises_when_not_exists(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
||||
mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||
mock_os = mocker.patch('os.path.exists')
|
||||
mock_os.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
d.file_path = '/path/to/something/'
|
||||
|
||||
def test_get_file_write(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
|
||||
m.return_value = False
|
||||
assert d.file_write == False
|
||||
|
||||
def test_set_file_write(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
|
||||
d.file_write = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
|
||||
def test_get_firmware_version(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
|
||||
m.return_value = 20
|
||||
assert d.firmware_version == 20
|
||||
|
||||
@ -162,38 +162,38 @@ def test_cannot_set_fw_version(d):
|
||||
d.firmware_version = 20
|
||||
|
||||
def test_get_high_voltage_call_signature(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
d.high_voltage
|
||||
m.assert_called_once_with('vhighvoltage', -1)
|
||||
|
||||
def test_get_high_voltage(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
m.return_value = 80
|
||||
assert d.high_voltage == 80
|
||||
|
||||
#self._api.setDac('vhighvoltage', -1, voltage)
|
||||
def test_set_high_voltage(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
d.high_voltage = 80
|
||||
m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||
|
||||
def test_decode_hostname_two_names(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
m.return_value = 'beb059+beb048+'
|
||||
assert d.hostname == ['beb059', 'beb048']
|
||||
|
||||
def test_decode_hostname_four_names(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
m.return_value = 'beb059+beb048+beb120+beb153+'
|
||||
assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
||||
|
||||
def test_decode_hostname_blank(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
m.return_value = ''
|
||||
assert d.hostname == []
|
||||
|
||||
def test_get_image_size_gives_correct_size(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getImageSize')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getImageSize')
|
||||
m.return_value = (512,1024)
|
||||
im_size = d.image_size
|
||||
assert im_size.rows == 512
|
||||
@ -202,7 +202,7 @@ def test_get_image_size_gives_correct_size(d, mocker):
|
||||
|
||||
|
||||
def test_load_config(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
||||
m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||
#To avoid raising an exception because path is not there
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = True
|
||||
@ -210,14 +210,14 @@ def test_load_config(d, mocker):
|
||||
m.assert_called_once_with('/path/to/my/file.config')
|
||||
|
||||
def test_load_config_raises_when_file_is_not_found(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
||||
mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
d.load_config('/path/to/my/file.config')
|
||||
|
||||
def test_load_parameters(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
||||
m = mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||
#To avoid raising an exception because path is not there
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = True
|
||||
@ -225,7 +225,7 @@ def test_load_parameters(d, mocker):
|
||||
m.assert_called_once_with('/path/to/my/file.par')
|
||||
|
||||
def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
||||
mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||
mock_os = mocker.patch('os.path.isfile')
|
||||
mock_os.return_value = False
|
||||
with pytest.raises(FileNotFoundError):
|
||||
@ -233,14 +233,14 @@ def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
||||
|
||||
#getDetectorGeometry
|
||||
def test_get_module_geometry_gives_correct_size(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||
m.return_value = (13,7)
|
||||
g = d.module_geometry
|
||||
assert g.vertical == 7
|
||||
assert g.horizontal == 13
|
||||
|
||||
def test_get_module_geometry_access(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||
m.return_value = (12,3)
|
||||
assert d.module_geometry[0] == 12
|
||||
assert d.module_geometry[1] == 3
|
||||
@ -248,237 +248,237 @@ def test_get_module_geometry_access(d, mocker):
|
||||
assert d.module_geometry.horizontal == 12
|
||||
|
||||
def test_get_n_frames(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
|
||||
m.return_value = 3
|
||||
assert d.n_frames == 3
|
||||
|
||||
def test_set_n_frames(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
d.n_frames = 9
|
||||
m.assert_called_once_with(9)
|
||||
|
||||
def test_set_n_frames_raises_on_neg(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
with pytest.raises(ValueError):
|
||||
d.n_frames = -1
|
||||
|
||||
def test_set_n_frames_raises_on_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
with pytest.raises(ValueError):
|
||||
d.n_frames = 0
|
||||
|
||||
def test_get_n_modules(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
m.return_value = 12
|
||||
assert d.n_modules == 12
|
||||
|
||||
def test_get_period_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getPeriod')
|
||||
m.return_value = 130000000
|
||||
assert d.period == 0.13
|
||||
|
||||
def test_set_period_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||
d.period = 1.953
|
||||
m.assert_called_once_with(1953000000)
|
||||
|
||||
def test_set_period_time_less_than_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
||||
mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||
with pytest.raises(ValueError):
|
||||
d.period = -7
|
||||
|
||||
def test_pulse_chip_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.pulseChip')
|
||||
m = mocker.patch('_slsdet.DetectorApi.pulseChip')
|
||||
d.pulse_chip(15)
|
||||
m.assert_called_once_with(15)
|
||||
|
||||
def test_pulse_chip_call_minus_one(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.pulseChip')
|
||||
m = mocker.patch('_slsdet.DetectorApi.pulseChip')
|
||||
d.pulse_chip(-1)
|
||||
m.assert_called_once_with(-1)
|
||||
|
||||
def test_pulse_chip_asserts_on_smaller_than_minus_one(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.pulseChip')
|
||||
mocker.patch('_slsdet.DetectorApi.pulseChip')
|
||||
with pytest.raises(ValueError):
|
||||
d.pulse_chip(-3)
|
||||
#--------------------------------------------------------------------subexptime
|
||||
def test_get_sub_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getSubExposureTime')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getSubExposureTime')
|
||||
m.return_value = 2370000
|
||||
assert d.sub_exposure_time == 0.00237
|
||||
|
||||
|
||||
def test_set_sub_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||
d.sub_exposure_time = 0.002
|
||||
m.assert_called_once_with(2000000)
|
||||
|
||||
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
||||
mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||
with pytest.raises(ValueError):
|
||||
d.sub_exposure_time = 0
|
||||
|
||||
#-------------------------------------------------------------Rate correction
|
||||
def test_get_rate_correction(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRateCorrection')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getRateCorrection')
|
||||
m.return_value = [132,129]
|
||||
assert d.rate_correction == [132,129]
|
||||
|
||||
def test_set_rate_correction(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
mock_n.return_value = 3
|
||||
d.rate_correction = [123,90,50]
|
||||
m.assert_called_once_with([123,90,50])
|
||||
|
||||
def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
mock_n.return_value = 4
|
||||
with pytest.raises(ValueError):
|
||||
d.rate_correction = [123,90,50]
|
||||
|
||||
#----------------------------------------------------------------Readout clock
|
||||
def test_get_readout_clock_0(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 0
|
||||
assert d.readout_clock == 'Full Speed'
|
||||
|
||||
def test_get_readout_clock_1(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 1
|
||||
assert d.readout_clock == 'Half Speed'
|
||||
|
||||
def test_get_readout_clock_2(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 2
|
||||
assert d.readout_clock == 'Quarter Speed'
|
||||
|
||||
def test_get_readout_clock_3(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
m.return_value = 3
|
||||
assert d.readout_clock == 'Super Slow Speed'
|
||||
|
||||
def test_set_readout_clock_0(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Full Speed'
|
||||
m.assert_called_once_with(0)
|
||||
|
||||
def test_set_readout_clock_1(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Half Speed'
|
||||
m.assert_called_once_with(1)
|
||||
|
||||
def test_set_readout_clock_2(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Quarter Speed'
|
||||
m.assert_called_once_with(2)
|
||||
|
||||
def test_set_readout_clock_3(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
d.readout_clock = 'Super Slow Speed'
|
||||
m.assert_called_once_with(3)
|
||||
|
||||
#----------------------------------------------------------------rx_datastream
|
||||
def test_get_rx_datastream(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||
m.return_value = False
|
||||
assert d.rx_datastream == False
|
||||
|
||||
def test_set_rx_datastream(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||
d.rx_datastream = True
|
||||
m.assert_called_once_with(True)
|
||||
|
||||
def test_get_rx_zmqip(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
d.rx_zmqip
|
||||
m.assert_called_once_with('rx_zmqip')
|
||||
|
||||
def test_get_rx_zmqport_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
d.rx_zmqport
|
||||
m.assert_called_once_with('rx_zmqport')
|
||||
|
||||
def test_get_rx_zmqport_decode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
m.return_value = '30001+30003+'
|
||||
assert d.rx_zmqport == [30001, 30002, 30003, 30004]
|
||||
|
||||
def test_get_rx_zmqport_empty(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
m.return_value = ''
|
||||
assert d.rx_zmqport == []
|
||||
|
||||
|
||||
#--------------------------------------------------------------------status
|
||||
def test_status_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
|
||||
d.status
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_start_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
|
||||
m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
|
||||
d.start_acq()
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_stop_acq_call(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
|
||||
m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
|
||||
d.stop_acq()
|
||||
m.assert_called_once_with()
|
||||
|
||||
#--------------------------------------------------------------------subexptime
|
||||
def test_get_sub_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getSubExposureTime')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getSubExposureTime')
|
||||
m.return_value = 2370000
|
||||
assert d.sub_exposure_time == 0.00237
|
||||
|
||||
|
||||
def test_set_sub_exposure_time(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||
d.sub_exposure_time = 0.002
|
||||
m.assert_called_once_with(2000000)
|
||||
|
||||
def test_set_sub_exposure_time_raises_on_zero(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setSubExposureTime')
|
||||
mocker.patch('_slsdet.DetectorApi.setSubExposureTime')
|
||||
with pytest.raises(ValueError):
|
||||
d.sub_exposure_time = 0
|
||||
|
||||
#------------------------------------------------------------------timing mode
|
||||
def test_get_timing_mode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
|
||||
d.timing_mode
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_timing_mode(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
|
||||
d.timing_mode = 'auto'
|
||||
m.assert_called_once_with('auto')
|
||||
|
||||
#----------------------------------------------------------------vthreshold
|
||||
def test_get_vthreshold(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
d.vthreshold
|
||||
m.assert_called_once_with('vthreshold', -1)
|
||||
|
||||
def test_set_vthreshold(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
d.vthreshold = 1675
|
||||
m.assert_called_once_with('vthreshold', -1, 1675)
|
||||
|
||||
#----------------------------------------------------------------trimbits
|
||||
def test_get_trimbits(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.getAllTrimbits')
|
||||
m = mocker.patch('_slsdet.DetectorApi.getAllTrimbits')
|
||||
d.trimbits
|
||||
m.assert_called_once_with()
|
||||
|
||||
def test_set_trimbits(d, mocker):
|
||||
m = mocker.patch('_sls_detector.DetectorApi.setAllTrimbits')
|
||||
m = mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
|
||||
d.trimbits = 15
|
||||
m.assert_called_once_with(15)
|
||||
|
||||
def test_set_trimbits_raises_outside_range(d, mocker):
|
||||
mocker.patch('_sls_detector.DetectorApi.setAllTrimbits')
|
||||
mocker.patch('_slsdet.DetectorApi.setAllTrimbits')
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
d.trimbits = 69
|
||||
|
@ -15,7 +15,7 @@ from pytest_mock import mocker
|
||||
import sys
|
||||
sys.path.append('/home/l_frojdh/slsdetectorgrup/sls_detector')
|
||||
|
||||
import _sls_detector
|
||||
import _slsdet
|
||||
from sls_detector.errors import DetectorValueError, DetectorError
|
||||
from sls_detector.utils import all_equal, element_if_equal
|
||||
|
||||
@ -47,7 +47,7 @@ def test_set_counters_single(d, mocker):
|
||||
|
||||
|
||||
# def test_busy_call(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getAcquiringFlag')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getAcquiringFlag')
|
||||
# m.return_value = False
|
||||
# assert d.busy == False
|
||||
|
||||
@ -73,34 +73,34 @@ def test_set_counters_single(d, mocker):
|
||||
# d.detector_type = 'Eiger'
|
||||
|
||||
# def test_det_type(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorType')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDetectorType')
|
||||
# m.return_value = 'Eiger'
|
||||
# assert d.detector_type == 'Eiger'
|
||||
|
||||
|
||||
# def test_get_exposure_time(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getExposureTime')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getExposureTime')
|
||||
# m.return_value = 100000000
|
||||
# assert d.exposure_time == 0.1
|
||||
|
||||
# def test_set_exposure_time(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||
# d.exposure_time = 1.5
|
||||
# m.assert_called_once_with(1500000000)
|
||||
|
||||
# def test_set_exposure_time_less_than_zero(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setExposureTime')
|
||||
# mocker.patch('_slsdet.DetectorApi.setExposureTime')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.exposure_time = -7
|
||||
|
||||
|
||||
# def test_get_file_index(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getFileIndex')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFileIndex')
|
||||
# m.return_value = 8
|
||||
# assert d.file_index == 8
|
||||
|
||||
# def test_set_file_index(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||
# d.file_index = 9
|
||||
# m.assert_called_with(9)
|
||||
|
||||
@ -112,28 +112,28 @@ def test_set_counters_single(d, mocker):
|
||||
# assert d.dynamic_range == -100
|
||||
|
||||
# def test_set_file_index_raises_on_neg(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setFileIndex')
|
||||
# mocker.patch('_slsdet.DetectorApi.setFileIndex')
|
||||
# with pytest.raises(ValueError):
|
||||
# d.file_index = -9
|
||||
|
||||
|
||||
# def test_get_file_name(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getFileName')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFileName')
|
||||
# d.file_name
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_file_name(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setFileName')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFileName')
|
||||
# d.file_name = 'hej'
|
||||
# m.assert_called_once_with('hej')
|
||||
|
||||
# def test_get_file_path(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getFilePath')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFilePath')
|
||||
# d.file_path
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_file_path_when_path_exists(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||
# #To avoid raising an exception because path is not there
|
||||
# mock_os = mocker.patch('os.path.exists')
|
||||
# mock_os.return_value = True
|
||||
@ -141,25 +141,25 @@ def test_set_counters_single(d, mocker):
|
||||
# m.assert_called_once_with('/path/to/something/')
|
||||
|
||||
# def test_set_file_path_raises_when_not_exists(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setFilePath')
|
||||
# mocker.patch('_slsdet.DetectorApi.setFilePath')
|
||||
# mock_os = mocker.patch('os.path.exists')
|
||||
# mock_os.return_value = False
|
||||
# with pytest.raises(FileNotFoundError):
|
||||
# d.file_path = '/path/to/something/'
|
||||
|
||||
# def test_get_file_write(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getFileWrite')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFileWrite')
|
||||
# m.return_value = False
|
||||
# assert d.file_write == False
|
||||
|
||||
# def test_set_file_write(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setFileWrite')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setFileWrite')
|
||||
# d.file_write = True
|
||||
# m.assert_called_once_with(True)
|
||||
|
||||
|
||||
# def test_get_firmware_version(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getFirmwareVersion')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getFirmwareVersion')
|
||||
# m.return_value = 20
|
||||
# assert d.firmware_version == 20
|
||||
|
||||
@ -168,38 +168,38 @@ def test_set_counters_single(d, mocker):
|
||||
# d.firmware_version = 20
|
||||
|
||||
# def test_get_high_voltage_call_signature(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# d.high_voltage
|
||||
# m.assert_called_once_with('vhighvoltage', -1)
|
||||
|
||||
# def test_get_high_voltage(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# m.return_value = 80
|
||||
# assert d.high_voltage == 80
|
||||
|
||||
# #self._api.setDac('vhighvoltage', -1, voltage)
|
||||
# def test_set_high_voltage(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
# d.high_voltage = 80
|
||||
# m.assert_called_once_with('vhighvoltage', -1, 80)
|
||||
|
||||
# def test_decode_hostname_two_names(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
# m.return_value = 'beb059+beb048+'
|
||||
# assert d.hostname == ['beb059', 'beb048']
|
||||
|
||||
# def test_decode_hostname_four_names(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
# m.return_value = 'beb059+beb048+beb120+beb153+'
|
||||
# assert d.hostname == ['beb059', 'beb048', 'beb120', 'beb153']
|
||||
|
||||
# def test_decode_hostname_blank(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getHostname')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getHostname')
|
||||
# m.return_value = ''
|
||||
# assert d.hostname == []
|
||||
|
||||
# def test_get_image_size_gives_correct_size(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getImageSize')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getImageSize')
|
||||
# m.return_value = (512,1024)
|
||||
# im_size = d.image_size
|
||||
# assert im_size.rows == 512
|
||||
@ -208,7 +208,7 @@ def test_set_counters_single(d, mocker):
|
||||
|
||||
|
||||
# def test_load_config(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||
# #To avoid raising an exception because path is not there
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = True
|
||||
@ -216,14 +216,14 @@ def test_set_counters_single(d, mocker):
|
||||
# m.assert_called_once_with('/path/to/my/file.config')
|
||||
|
||||
# def test_load_config_raises_when_file_is_not_found(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.readConfigurationFile')
|
||||
# mocker.patch('_slsdet.DetectorApi.readConfigurationFile')
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = False
|
||||
# with pytest.raises(FileNotFoundError):
|
||||
# d.load_config('/path/to/my/file.config')
|
||||
|
||||
# def test_load_parameters(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||
# #To avoid raising an exception because path is not there
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = True
|
||||
@ -231,7 +231,7 @@ def test_set_counters_single(d, mocker):
|
||||
# m.assert_called_once_with('/path/to/my/file.par')
|
||||
|
||||
# def test_load_parameters_raises_when_file_is_not_found(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.readParametersFile')
|
||||
# mocker.patch('_slsdet.DetectorApi.readParametersFile')
|
||||
# mock_os = mocker.patch('os.path.isfile')
|
||||
# mock_os.return_value = False
|
||||
# with pytest.raises(FileNotFoundError):
|
||||
@ -239,14 +239,14 @@ def test_set_counters_single(d, mocker):
|
||||
|
||||
# #getDetectorGeometry
|
||||
# def test_get_module_geometry_gives_correct_size(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||
# m.return_value = (13,7)
|
||||
# g = d.module_geometry
|
||||
# assert g.vertical == 7
|
||||
# assert g.horizontal == 13
|
||||
|
||||
# def test_get_module_geometry_access(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getDetectorGeometry')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDetectorGeometry')
|
||||
# m.return_value = (12,3)
|
||||
# assert d.module_geometry[0] == 12
|
||||
# assert d.module_geometry[1] == 3
|
||||
@ -259,12 +259,12 @@ def test_set_counters_single(d, mocker):
|
||||
# assert t.vertical == 0
|
||||
|
||||
# def test_get_n_frames(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getNumberOfFrames')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfFrames')
|
||||
# m.return_value = 3
|
||||
# assert d.n_frames == 3
|
||||
|
||||
# def test_set_n_frames(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
# d.n_frames = 9
|
||||
# m.assert_called_once_with(9)
|
||||
|
||||
@ -272,12 +272,12 @@ def test_set_counters_single(d, mocker):
|
||||
# assert d.n_frames == -100
|
||||
|
||||
# def test_set_n_frames_raises_on_neg(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_frames = -1
|
||||
|
||||
# def test_set_n_frames_raises_on_zero(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setNumberOfFrames')
|
||||
# mocker.patch('_slsdet.DetectorApi.setNumberOfFrames')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_frames = 0
|
||||
|
||||
@ -285,12 +285,12 @@ def test_set_counters_single(d, mocker):
|
||||
# assert d.n_cycles == -100
|
||||
|
||||
# def test_set_n_cycles_raises_on_zero(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setCycles')
|
||||
# mocker.patch('_slsdet.DetectorApi.setCycles')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_cycles = 0
|
||||
|
||||
# def test_set_n_cycles(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setCycles')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setCycles')
|
||||
# d.n_cycles = 56
|
||||
# m.assert_called_once_with(56)
|
||||
|
||||
@ -300,12 +300,12 @@ def test_set_counters_single(d, mocker):
|
||||
# assert d.n_measurements == -100
|
||||
|
||||
# def test_set_n_measurements_raises_on_zero(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
|
||||
# mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
|
||||
# with pytest.raises(DetectorValueError):
|
||||
# d.n_measurements = 0
|
||||
|
||||
# def test_set_n_measurements(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setNumberOfMeasurements')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setNumberOfMeasurements')
|
||||
# d.n_measurements = 560
|
||||
# m.assert_called_once_with(560)
|
||||
|
||||
@ -313,33 +313,33 @@ def test_set_counters_single(d, mocker):
|
||||
# assert d.n_modules == 0
|
||||
|
||||
# def test_get_n_modules(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
# m.return_value = 12
|
||||
# assert d.n_modules == 12
|
||||
|
||||
# def test_get_period_time(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getPeriod')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getPeriod')
|
||||
# m.return_value = 130000000
|
||||
# assert d.period == 0.13
|
||||
|
||||
# def test_set_period_time(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||
# d.period = 1.953
|
||||
# m.assert_called_once_with(1953000000)
|
||||
|
||||
# def test_set_period_time_less_than_zero(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setPeriod')
|
||||
# mocker.patch('_slsdet.DetectorApi.setPeriod')
|
||||
# with pytest.raises(ValueError):
|
||||
# d.period = -7
|
||||
|
||||
|
||||
# def test_get_online(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getOnline')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getOnline')
|
||||
# d.online
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_online(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setOnline')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setOnline')
|
||||
# d.online = True
|
||||
# m.assert_called_once_with(True)
|
||||
|
||||
@ -347,116 +347,116 @@ def test_set_counters_single(d, mocker):
|
||||
# assert d.last_client_ip == ''
|
||||
|
||||
# def test_last_cliten_ip_call(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getLastClientIP')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getLastClientIP')
|
||||
# d.last_client_ip
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# #-------------------------------------------------------------Rate correction
|
||||
# def test_get_rate_correction(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getRateCorrection')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getRateCorrection')
|
||||
# m.return_value = [132,129]
|
||||
# assert d.rate_correction == [132,129]
|
||||
|
||||
# def test_set_rate_correction(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
# mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
# mock_n.return_value = 3
|
||||
# d.rate_correction = [123,90,50]
|
||||
# m.assert_called_once_with([123,90,50])
|
||||
|
||||
# def test_set_rate_correction_raises_on_wrong_number_of_values(d, mocker):
|
||||
# mocker.patch('_sls_detector.DetectorApi.setRateCorrection')
|
||||
# mock_n = mocker.patch('_sls_detector.DetectorApi.getNumberOfDetectors')
|
||||
# mocker.patch('_slsdet.DetectorApi.setRateCorrection')
|
||||
# mock_n = mocker.patch('_slsdet.DetectorApi.getNumberOfDetectors')
|
||||
# mock_n.return_value = 4
|
||||
# with pytest.raises(ValueError):
|
||||
# d.rate_correction = [123,90,50]
|
||||
|
||||
# #----------------------------------------------------------------Readout clock
|
||||
# def test_get_readout_clock_0(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 0
|
||||
# assert d.readout_clock == 'Full Speed'
|
||||
|
||||
# def test_get_readout_clock_1(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 1
|
||||
# assert d.readout_clock == 'Half Speed'
|
||||
|
||||
# def test_get_readout_clock_2(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 2
|
||||
# assert d.readout_clock == 'Quarter Speed'
|
||||
|
||||
# def test_get_readout_clock_3(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getReadoutClockSpeed')
|
||||
# m.return_value = 3
|
||||
# assert d.readout_clock == 'Super Slow Speed'
|
||||
|
||||
# def test_set_readout_clock_0(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Full Speed'
|
||||
# m.assert_called_once_with(0)
|
||||
|
||||
# def test_set_readout_clock_1(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Half Speed'
|
||||
# m.assert_called_once_with(1)
|
||||
|
||||
# def test_set_readout_clock_2(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Quarter Speed'
|
||||
# m.assert_called_once_with(2)
|
||||
|
||||
# def test_set_readout_clock_3(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setReadoutClockSpeed')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setReadoutClockSpeed')
|
||||
# d.readout_clock = 'Super Slow Speed'
|
||||
# m.assert_called_once_with(3)
|
||||
|
||||
# #----------------------------------------------------------------rx_datastream
|
||||
# def test_get_rx_datastream(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getRxDataStreamStatus')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||
# m.return_value = False
|
||||
# assert d.rx_datastream == False
|
||||
|
||||
# def test_set_rx_datastream(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setRxDataStreamStatus')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||
# d.rx_datastream = True
|
||||
# m.assert_called_once_with(True)
|
||||
|
||||
# def test_get_rx_zmqip(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# d.rx_zmqip
|
||||
# m.assert_called_once_with('rx_zmqip')
|
||||
|
||||
# def test_get_rx_zmqport_call(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# d.rx_zmqport
|
||||
# m.assert_called_once_with('rx_zmqport')
|
||||
|
||||
# def test_get_rx_zmqport_decode(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# m.return_value = ['30001', '30003']
|
||||
# assert d.rx_zmqport == [30001, 30003]
|
||||
|
||||
# def test_get_rx_zmqport_empty(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getNetworkParameter')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getNetworkParameter')
|
||||
# m.return_value = ''
|
||||
# assert d.rx_zmqport == []
|
||||
|
||||
|
||||
# #--------------------------------------------------------------------status
|
||||
# def test_status_call(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getRunStatus')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getRunStatus')
|
||||
# d.status
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_start_detecor(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.startAcquisition')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.startAcquisition')
|
||||
# d.start_detector()
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_stop_acq_call(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.stopAcquisition')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.stopAcquisition')
|
||||
# d.stop_detector()
|
||||
# m.assert_called_once_with()
|
||||
|
||||
@ -464,23 +464,23 @@ def test_set_counters_single(d, mocker):
|
||||
|
||||
# #------------------------------------------------------------------timing mode
|
||||
# def test_get_timing_mode(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getTimingMode')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getTimingMode')
|
||||
# d.timing_mode
|
||||
# m.assert_called_once_with()
|
||||
|
||||
# def test_set_timing_mode(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setTimingMode')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setTimingMode')
|
||||
# d.timing_mode = 'auto'
|
||||
# m.assert_called_once_with('auto')
|
||||
|
||||
# #----------------------------------------------------------------vthreshold
|
||||
# def test_get_vthreshold(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.getDac')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.getDac')
|
||||
# d.vthreshold
|
||||
# m.assert_called_once_with('vthreshold', -1)
|
||||
|
||||
# def test_set_vthreshold(d, mocker):
|
||||
# m = mocker.patch('_sls_detector.DetectorApi.setDac')
|
||||
# m = mocker.patch('_slsdet.DetectorApi.setDac')
|
||||
# d.vthreshold = 1675
|
||||
# m.assert_called_once_with('vthreshold', -1, 1675)
|
||||
|
||||
|
@ -18,4 +18,19 @@ target_link_libraries(result
|
||||
|
||||
set_target_properties(result PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
)
|
||||
|
||||
add_executable(udp udp.cpp)
|
||||
target_link_libraries(udp
|
||||
slsDetectorShared
|
||||
slsSupportLib
|
||||
pthread
|
||||
rt
|
||||
fmt
|
||||
)
|
||||
|
||||
set_target_properties(udp PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
)
|
||||
|
||||
|
||||
|
65
sample/udp.cpp
Normal file
65
sample/udp.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
#include "UdpRxSocket.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include <chrono>
|
||||
#include <fmt/format.h>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include "network_utils.h"
|
||||
|
||||
// Assume packages arrive in order
|
||||
|
||||
// Assume frame nr starts from 0
|
||||
|
||||
using header_t = slsDetectorDefs::sls_detector_header;
|
||||
|
||||
int main() {
|
||||
fmt::print("Hej!\n");
|
||||
|
||||
|
||||
constexpr ssize_t packet_size = 4144;
|
||||
constexpr ssize_t payload_size = packet_size - sizeof(header_t);
|
||||
int port = 50012;
|
||||
|
||||
char * buffer = new char[packet_size];
|
||||
|
||||
sls::UdpRxSocket s(port, packet_size, "10.1.1.107");
|
||||
int n = 0;
|
||||
while(true){
|
||||
// s.ReceiveDataOnly(buffer);
|
||||
if (s.ReceivePacket())
|
||||
std::cout << n++ << std::endl;
|
||||
}
|
||||
|
||||
// auto header = reinterpret_cast<header_t *>(s.buffer());
|
||||
// char *data = s.buffer() + sizeof(header_t);
|
||||
// fmt::print("buffer start: {}\nheader: {}\ndata: {}\n", fmt::ptr(s.buffer()),
|
||||
// fmt::ptr(header), fmt::ptr(data));
|
||||
|
||||
// int n = 0;
|
||||
|
||||
// fmt::print("Buffer size: {}\n", s.buffer_size());
|
||||
// std::vector<uint16_t> image(n_pixels);
|
||||
// char *image_data = (char *)image.data();
|
||||
// uint64_t frame_nr = 0;
|
||||
// while (true) {
|
||||
|
||||
// if (s.ReceivePacket()) {
|
||||
|
||||
// // fmt::print("frame: {} pkt: {} dst: {}\n", header->frameNumber,
|
||||
// // header->packetNumber, header->packetNumber*payload_size);
|
||||
// if (header->frameNumber != frame_nr) {
|
||||
// // dispatch frame
|
||||
// fmt::print("frame {} done! got: {} pkgs\n", frame_nr, n);
|
||||
// frame_nr = header->frameNumber;
|
||||
// n = 0;
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
// }
|
||||
// ++n;
|
||||
// memcpy(image_data + header->packetNumber * payload_size, data,
|
||||
// payload_size);
|
||||
|
||||
// } else {
|
||||
// std::cout << "timeout\n";
|
||||
// }
|
||||
// }
|
||||
}
|
@ -423,7 +423,7 @@ template <class dataType> class analogDetector {
|
||||
if (g==0) g=-1.;
|
||||
}
|
||||
|
||||
return stat[iy][ix].getPedestalRMS()/g;//divide by gain?
|
||||
return stat[iy][ix].getPedestalRMS();//divide by gain?
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef DESERIALIZER_H
|
||||
#define DESERIALIZER_H
|
||||
#include <vector>
|
||||
#include "slsDetectorData.h"
|
||||
|
||||
class deserializer : public slsDetectorData<int> {
|
||||
|
||||
@ -52,7 +53,13 @@ class deserializer : public slsDetectorData<int> {
|
||||
static int* deserializeAll(char *ptr, std::vector <int> dbl, int dr=24, int nch=64*3, int off=5) {
|
||||
// off=0;
|
||||
//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 ioff=0;
|
||||
int idr=0;
|
||||
@ -66,39 +73,62 @@ class deserializer : public slsDetectorData<int> {
|
||||
val[ib]=0;
|
||||
}
|
||||
wp=(int64_t*)ptr;
|
||||
|
||||
int nw=nch/nb;
|
||||
|
||||
cout << "** Number of bits:\t" << nb << endl;
|
||||
cout << "** Samples:\t" << nw << endl;
|
||||
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
cout << dbl[ib] << " " ;
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
for (iw=0; iw<nch/nb; iw) {
|
||||
for (ib=0; ib<nch; ib++) {
|
||||
val[ib]=0;
|
||||
}
|
||||
|
||||
for (iw=0; iw<nw; iw) {
|
||||
word=*wp;;
|
||||
if (ioff<off) {
|
||||
ioff++;
|
||||
// cout <<"*";
|
||||
} else {
|
||||
//if (idr<16) {
|
||||
ib=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ich=iw+nch/nb*(ib);
|
||||
if (word&(1<<bit) && ich<nch) {
|
||||
//ib=0;
|
||||
// cout << hex << "*************" << word << endl;
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
// for (const auto &bit : dbl) {
|
||||
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 << "+" ;
|
||||
val[ich]|=(1<<idr);
|
||||
} //else {
|
||||
}
|
||||
/* if (ich>1060) */
|
||||
/* cout << val[ich] << " " << hex << word << " " << ww << " " << (word&(ww)) << dec <<endl; */
|
||||
/* //else { */
|
||||
//cout << "-" ;
|
||||
//}
|
||||
ib++;
|
||||
//ib++;
|
||||
}
|
||||
|
||||
idr++;
|
||||
}
|
||||
|
||||
idr++;
|
||||
if (idr==dr) {
|
||||
idr=0;
|
||||
// cout << dec << " " << iw << " " << val[iw] << " " << val[iw+nch/2] << endl;
|
||||
cout <<dec << iw<<endl;
|
||||
// cout <<dec << iw<<endl;
|
||||
iw++;
|
||||
}//end if()
|
||||
|
||||
//end else()
|
||||
wp+=1;
|
||||
ii++;
|
||||
// ii++;
|
||||
}//end for
|
||||
|
||||
|
||||
@ -117,7 +147,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
int ii=0;
|
||||
int ich;
|
||||
int nb=dbl.size();
|
||||
|
||||
int bit;
|
||||
char *dval;
|
||||
|
||||
idr=0;
|
||||
@ -127,8 +157,13 @@ class deserializer : public slsDetectorData<int> {
|
||||
dval=ptr;
|
||||
|
||||
ib=0;
|
||||
ich=0;
|
||||
for (const auto &bit : dbl) {
|
||||
ich=0;
|
||||
for (ib=0; ib<nb; ib++) {
|
||||
// for (const auto &bit : dbl) {
|
||||
|
||||
/* if (ich>1060) */
|
||||
/* cout << iw << " " << idr << " " << ib << " " << bit << " " << ich << " " << val[ich] << " ** " ; */
|
||||
bit=dbl[ib];
|
||||
//ioff=off;
|
||||
idr=0;
|
||||
for (iw=0; iw<(nch*dr/nb)/8; iw++) {
|
||||
@ -141,7 +176,7 @@ class deserializer : public slsDetectorData<int> {
|
||||
}
|
||||
}
|
||||
ii++;
|
||||
ib++;
|
||||
// ib++;
|
||||
}//end for
|
||||
|
||||
|
||||
|
125
slsDetectorCalibration/dataStructures/imageZmq16bit.h
Normal file
125
slsDetectorCalibration/dataStructures/imageZmq16bit.h
Normal file
@ -0,0 +1,125 @@
|
||||
#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
|
125
slsDetectorCalibration/dataStructures/imageZmq32bit.h
Normal file
125
slsDetectorCalibration/dataStructures/imageZmq32bit.h
Normal file
@ -0,0 +1,125 @@
|
||||
#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
|
@ -28,7 +28,8 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
\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 sc_width=25;
|
||||
@ -137,6 +138,7 @@ class moench03T1ZmqDataNew : public slsDetectorData<uint16_t> {
|
||||
/* vout+=0.0008*val-6224; */
|
||||
/* return vout; //(double)getChannel(data, ix, iy);
|
||||
*/
|
||||
// cout << ix << " "<< iy << " " << dataMap[iy][ix] << endl;
|
||||
return ((double)getChannel(data, ix, iy))+xtalk*getGhost(iy,iy);
|
||||
};
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/
|
||||
INCDIR= -I. -I../dataStructures ../tiffIO.cpp -I../ -I../interpolations/ -I../../slsSupportLib/include/ -I../../slsReceiverSoftware/include/ -I../../libs/rapidjson/
|
||||
LDFLAG= -L/usr/lib64/ -lpthread -lm -lstdc++ -lzmq -pthread -lrt -ltiff -O3 -g -std=c++11 -Wall
|
||||
#-L../../bin -lhdf5 -L.
|
||||
|
||||
#DESTDIR?=../bin
|
||||
|
||||
all: moenchZmqProcess
|
||||
all: moenchZmqProcess moenchZmqProcessCtbGui
|
||||
|
||||
|
||||
moenchZmqProcess: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcess moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP
|
||||
|
||||
moenchZmqProcessCtbGui: moenchZmqProcess.cpp clean
|
||||
g++ -o moenchZmqProcessCtbGui moenchZmqProcess.cpp $(LDFLAG) $(INCDIR) $(LIBHDF5) $(LIBRARYCBF) -DNEWZMQ -DINTERP -DCTBGUI
|
||||
|
||||
clean:
|
||||
rm -f moenchZmqProcess
|
||||
|
||||
|
@ -149,6 +149,7 @@ int main(int argc, char *argv[]) {
|
||||
if (argc>=9) {
|
||||
nframes=atoi(argv[8]);
|
||||
}
|
||||
|
||||
int xmin=0, xmax=nx, ymin=0, ymax=ny;
|
||||
if (argc>=13) {
|
||||
xmin=atoi(argv[9]);
|
||||
@ -185,6 +186,7 @@ int main(int argc, char *argv[]) {
|
||||
cout << "pedestal file is " << pedfile << endl;
|
||||
if (thr>0)
|
||||
cout << "threshold is " << thr << endl;
|
||||
cout << "Nframes is " << nframes << endl;
|
||||
|
||||
uint32 nnx, nny;
|
||||
double *gmap;
|
||||
|
@ -74,6 +74,14 @@ int main(int argc, char *argv[]) {
|
||||
// high_resolution_clock::time_point t1;
|
||||
// high_resolution_clock::time_point t2 ;
|
||||
time_t begin,end,finished;
|
||||
int rms=0;
|
||||
|
||||
int nped=1000, nped0=100;
|
||||
|
||||
#ifdef PTC
|
||||
nped=10000;
|
||||
nped0=10000;
|
||||
#endif
|
||||
|
||||
|
||||
if (argc > 4) {
|
||||
@ -111,7 +119,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
//slsDetectorData *det=new moench03T1ZmqDataNew();
|
||||
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew();
|
||||
moench03T1ZmqDataNew *det=new moench03T1ZmqDataNew(5000,sizeof(int));
|
||||
cout << endl << " det" <<endl;
|
||||
int npx, npy;
|
||||
det->getDetectorSize(npx, npy);
|
||||
@ -129,8 +137,15 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
int ncol_cm=CM_ROWS;
|
||||
double xt_ghost=C_GHOST;
|
||||
moench03CommonMode *cm=new moench03CommonMode(ncol_cm);
|
||||
moench03GhostSummation *gs=new moench03GhostSummation(det, xt_ghost);
|
||||
|
||||
|
||||
moench03CommonMode *cm=NULL;
|
||||
moench03GhostSummation *gs=NULL;
|
||||
#ifdef CORR
|
||||
cm=new moench03CommonMode(ncol_cm);
|
||||
gs=new moench03GhostSummation(det, xt_ghost);
|
||||
#endif
|
||||
|
||||
double *gainmap=NULL;
|
||||
float *gm;
|
||||
double *gmap=NULL;
|
||||
@ -158,7 +173,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
//analogDetector<uint16_t> *filter=new analogDetector<uint16_t>(det,1,NULL,1000);
|
||||
#ifndef INTERP
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
singlePhotonDetector *filter=new singlePhotonDetector(det,3, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs);
|
||||
|
||||
multiThreadedCountingDetector *mt=new multiThreadedCountingDetector(filter,nthreads,fifosize);
|
||||
|
||||
@ -169,7 +184,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (etafname) interp->readFlatField(etafname);
|
||||
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
|
||||
interpolatingDetector *filter=new interpolatingDetector(det,interp, nSigma, 1, cm, nped, nped0, -1, -1, gainmap, gs);
|
||||
multiThreadedInterpolatingDetector *mt=new multiThreadedInterpolatingDetector(filter,nthreads,fifosize);
|
||||
#endif
|
||||
|
||||
@ -293,7 +308,8 @@ int main(int argc, char *argv[]) {
|
||||
uint8_t detType = 0;
|
||||
uint8_t version = 0;
|
||||
// int* flippedData = 0;
|
||||
char* additionalJsonHeader = 0;
|
||||
string* additionalJsonHeader = 0;
|
||||
//char* additionalJsonHeader = 0;
|
||||
|
||||
int32_t threshold=0;
|
||||
|
||||
@ -356,6 +372,11 @@ int main(int argc, char *argv[]) {
|
||||
sprintf(ofname,"%s_%ld_ped.tiff",fname,fileindex);
|
||||
mt->writePedestal(ofname);
|
||||
cout << "Writing pedestal to " << ofname << endl;
|
||||
if (rms) {
|
||||
sprintf(ofname,"%s_%ld_var.tiff",fname,fileindex);
|
||||
mt->writePedestalRMS(ofname);
|
||||
cout << "Writing pedestal variance to " << ofname << endl;
|
||||
}
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (fMode==eFlat) {
|
||||
@ -388,7 +409,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
dout[ix]=ped[ix];
|
||||
// if (ix<100*400)
|
||||
// cout << ix << " " << ped[ix] << endl;
|
||||
// cout << ix << " " << ped[ix] << " "<< dout[ix] << endl;
|
||||
}
|
||||
|
||||
}
|
||||
@ -426,9 +447,9 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// }
|
||||
// }
|
||||
dout[ix]=detimage[ix];
|
||||
if (dout[ix]<0) dout[ix]=0;
|
||||
// cout << ix << " " << dout[ix] << endl;
|
||||
dout[ix]=detimage[ix];
|
||||
if (dout[ix]<0) dout[ix]=0;
|
||||
//cout << ix << " " << dout[ix] << endl;
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -448,44 +469,21 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// cout << "Sending image size " << nnx << " " << nny << endl;
|
||||
|
||||
#ifndef DEVELOPER
|
||||
#ifndef MOENCH_BRANCH
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 0,0, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEVELOPER
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
#endif
|
||||
#ifdef MOENCH_BRANCH
|
||||
/*
|
||||
int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0,
|
||||
uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0,
|
||||
uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL,
|
||||
uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0,
|
||||
uint64_t bunchId = 0, uint64_t timestamp = 0,
|
||||
uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0,
|
||||
uint32_t debug = 0, uint16_t roundRNumber = 0,
|
||||
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0,
|
||||
char* additionalJsonHeader = 0) {
|
||||
int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEADER_VERSION , uint32_t dr, uint64_t fileindex, uint32_t 0, uint32_t 0, uint32_t, uint64_t, uint64_t, char*, uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, int*, char*)
|
||||
|
||||
*/
|
||||
//zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version);//, 0,additionalJsonHeader);
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
|
||||
/* old
|
||||
zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex, subFrameIndex, packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, flippedData, additionalJsonHeader);
|
||||
*/
|
||||
/*
|
||||
// #ifndef DEVELOPER
|
||||
// #ifndef MOENCH_BRANCH
|
||||
// zmqsocket2->SendHeaderData (0, false, SLS_DETECTOR_JSON_HEADER_VERSION, dr, fileindex, 1,1, nnx, nny, nnx*nny*dr/8,acqIndex, frameIndex, fname, acqIndex,0 , packetNumber,bunchId, timestamp, modId, xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, additionalJsonHeader);
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
|
||||
new
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,additionalJsonHeader);
|
||||
*/
|
||||
#endif
|
||||
|
||||
|
||||
// #ifdef DEVELOPER
|
||||
// #ifdef CTBGUI
|
||||
// zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 0,0,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
// #endif
|
||||
// #ifndef CTBGUI
|
||||
zmqsocket2->SendHeaderData (0, false,SLS_DETECTOR_JSON_HEADER_VERSION , dr, fileindex, 1,1,nnx,nny,nnx*nny*dr/8,acqIndex, frameIndex, fname,acqIndex,0 , packetNumber,bunchId, timestamp, modId,xCoord, yCoord, zCoord,debug, roundRNumber, detType, version, 0,0, 0,additionalJsonHeader);
|
||||
//#endif
|
||||
|
||||
|
||||
zmqsocket2->SendData((char*)dout,nnx*nny*dr/8);
|
||||
cprintf(GREEN, "Sent Data\n");
|
||||
@ -577,6 +575,7 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD
|
||||
/* Analog detector commands */
|
||||
//isPedestal=0;
|
||||
//isFlat=0;
|
||||
rms=0;
|
||||
fMode=eFrame;
|
||||
frameMode_s="frame";
|
||||
cprintf(MAGENTA, "Frame mode: ");
|
||||
@ -586,11 +585,17 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD
|
||||
if (frameMode_s == "pedestal"){
|
||||
fMode=ePedestal;
|
||||
//isPedestal=1;
|
||||
} else if (frameMode_s == "newPedestal"){
|
||||
} else if (frameMode_s == "newpedestal"){
|
||||
mt->newDataSet(); //resets pedestal
|
||||
// cprintf(MAGENTA, "Resetting pedestal\n");
|
||||
fMode=ePedestal;
|
||||
//isPedestal=1;
|
||||
} else if (frameMode_s == "variance"){
|
||||
mt->newDataSet(); //resets pedestal
|
||||
// cprintf(MAGENTA, "Resetting pedestal\n");
|
||||
fMode=ePedestal;
|
||||
rms=1;
|
||||
//isPedestal=1;
|
||||
}
|
||||
#ifdef INTERP
|
||||
else if (frameMode_s == "flatfield") {
|
||||
@ -611,11 +616,13 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD
|
||||
frameMode_s="frame";
|
||||
}
|
||||
}
|
||||
}
|
||||
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
|
||||
cprintf(MAGENTA, "%s\n" , frameMode_s.c_str());
|
||||
} else
|
||||
cprintf(RED, "%s\n" , frameMode_s.c_str());
|
||||
|
||||
mt->setFrameMode(fMode);
|
||||
|
||||
// threshold=0;
|
||||
threshold=0;
|
||||
cprintf(MAGENTA, "Threshold: ");
|
||||
if (doc.HasMember("threshold")) {
|
||||
if (doc["threshold"].IsInt()) {
|
||||
@ -683,10 +690,11 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
|
||||
} else
|
||||
cprintf(RED, "%s\n" , frameMode_s.c_str());
|
||||
|
||||
mt->setDetectorMode(dMode);
|
||||
cprintf(MAGENTA, "%s\n" , detectorMode_s.c_str());
|
||||
|
||||
// cout << "done " << endl;
|
||||
|
||||
@ -737,7 +745,7 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD
|
||||
|
||||
// cout << "file" << endl;
|
||||
// cout << "data " << endl;
|
||||
if (of==NULL) {
|
||||
if (of==NULL && dMode!=eAnalog && fMode!=ePedestal && threshold<=0) {
|
||||
#ifdef WRITE_QUAD
|
||||
sprintf(ofname,"%s_%ld.clust2",filename.c_str(),fileindex);
|
||||
#endif
|
||||
@ -772,15 +780,13 @@ int ZmqSocket::SendHeaderData(int 0, bool false, uint32_t SLS_DETECTOR_JSON_HEAD
|
||||
mt->pushData(buff);
|
||||
mt->nextThread();
|
||||
mt->popFree(buff);
|
||||
cprintf(GREEN, "Frame\n");
|
||||
} else {
|
||||
cprintf(RED, "Incomplete frame: received only %d packet\n", packetNumber);
|
||||
//length =
|
||||
zmqsocket->ReceiveData(0, dummybuff, size);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
iframe++;
|
||||
|
||||
} // exiting infinite loop
|
||||
|
@ -461,6 +461,50 @@ public:
|
||||
return ped;
|
||||
};
|
||||
|
||||
|
||||
virtual double *getPedestalRMS(){
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
// if (ped) delete [] ped;
|
||||
double *rms=new double[nx*ny];
|
||||
double *p0=new double[nx*ny];
|
||||
|
||||
for (int i=0; i<nThreads; i++) {
|
||||
//inte=(slsInterpolation*)dets[i]->getInterpolation(nb,emi,ema);
|
||||
// cout << i << endl;
|
||||
p0=dets[i]->getPedestalRMS(p0);
|
||||
if (p0) {
|
||||
if (i==0) {
|
||||
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]=p0[ib]*p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
} else {
|
||||
for (int ib=0; ib<nx*ny; ib++) {
|
||||
rms[ib]+=p0[ib]*p0[ib]/((double)nThreads);
|
||||
// cout << p0[ib] << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
delete [] p0;
|
||||
|
||||
/* for (int ib=0; ib<nx*ny; ib++) { */
|
||||
/* if (rms[ib]>0) */
|
||||
/* rms[ib]=sqrt(ped[ib]); */
|
||||
/* else */
|
||||
/* rms[ib]=0; */
|
||||
/* } */
|
||||
|
||||
|
||||
return rms;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual double *setPedestal(double *h=NULL){
|
||||
//int nb=0;
|
||||
@ -498,6 +542,27 @@ public:
|
||||
};
|
||||
|
||||
|
||||
virtual void *writePedestalRMS(const char * imgname){
|
||||
|
||||
int nx, ny;
|
||||
dets[0]->getDetectorSize(nx,ny);
|
||||
|
||||
double *rms=getPedestalRMS();
|
||||
float *gm=new float[nx*ny];
|
||||
if (gm) {
|
||||
for (int ix=0; ix<nx*ny; ix++) {
|
||||
gm[ix]=rms[ix];
|
||||
}
|
||||
WriteToTiff(gm,imgname ,nx, ny);
|
||||
delete [] gm;
|
||||
delete [] rms;
|
||||
} else cout << "Could not allocate float image " << endl;
|
||||
|
||||
return NULL;
|
||||
|
||||
};
|
||||
|
||||
|
||||
virtual void *readPedestal(const char * imgname, int nb=-1, double emin=1, double emax=0){
|
||||
|
||||
int nx, ny;
|
||||
|
@ -1,5 +1,8 @@
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
set(SOURCES
|
||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
||||
@ -89,8 +92,8 @@ target_link_libraries(slsDetectorGui PUBLIC
|
||||
${QT_QTCORE_LIBRARIES}
|
||||
${QT_QTGUI_LIBRARIES}
|
||||
${QWT_LIBRARIES}
|
||||
png
|
||||
z
|
||||
PNG::PNG
|
||||
ZLIB::ZLIB
|
||||
Qt4::QtOpenGL
|
||||
Qt4::QtSvg
|
||||
)
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>350</height>
|
||||
<width>376</width>
|
||||
<height>425</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@ -240,7 +240,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<width>376</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -145,6 +145,10 @@
|
||||
<property name="windowTitle">
|
||||
<string>SLS Detector GUI</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/mountain.png</normaloff>:/icons/images/mountain.png</iconset>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhNone</set>
|
||||
</property>
|
||||
@ -371,101 +375,6 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionOpenSetup">
|
||||
<property name="text">
|
||||
<string>&Load &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveSetup">
|
||||
<property name="text">
|
||||
<string>&Save &Setup</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMeasurementWizard">
|
||||
<property name="text">
|
||||
<string>&Measurement Wizard</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenConfiguration">
|
||||
<property name="text">
|
||||
<string>&Load &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveConfiguration">
|
||||
<property name="text">
|
||||
<string>&Save &Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnergyCalibration">
|
||||
<property name="text">
|
||||
<string>&Energy Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAngularCalibration">
|
||||
<property name="text">
|
||||
<string>&Angular Calibration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Debug</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBeamline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Beamline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExpert">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Expert</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConfiguration">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Configuration</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionVersion">
|
||||
<property name="text">
|
||||
<string>&Version</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadConfiguration">
|
||||
<property name="text">
|
||||
<string>Load Configuration</string>
|
||||
@ -476,6 +385,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Load Trimbits</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadParameters">
|
||||
<property name="text">
|
||||
<string>Load Parameters</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDebug">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -500,12 +414,14 @@ p, li { white-space: pre-wrap; }
|
||||
<string>Dockable Windows</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLoadParameters">
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>Load Parameters</string>
|
||||
<string>&About</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../include/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -432,19 +432,6 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QComboBox" name="comboPeriodUnit">
|
||||
<property name="enabled">
|
||||
@ -666,108 +653,6 @@ Frame period between exposures.
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delay After Trigger:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="spinNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||
<property name="enabled">
|
||||
@ -903,65 +788,6 @@ Exposure Time of a frame.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QComboBox" name="comboDelayUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="comboExpUnit">
|
||||
<property name="enabled">
|
||||
@ -1084,6 +910,577 @@ Frame period between exposures.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblTrigger">
|
||||
<layout class="QGridLayout" name="gridLblTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurst">
|
||||
<layout class="QGridLayout" name="gridLblBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Bursts:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>208</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSpinTrigger">
|
||||
<layout class="QGridLayout" name="gridSpinTrigger">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumTriggers">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageSpinBurst">
|
||||
<layout class="QGridLayout" name="gridSpinBurst">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QSpinBox" name="spinNumBursts">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>2000000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QStackedWidget" name="stackedLblDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>171</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageLblDelay">
|
||||
<layout class="QGridLayout" name="gridLblDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delay After Trigger:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageLblBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridLblBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblBurstPeriod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Burst Period:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QStackedWidget" name="stackedSpinDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>152</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>152</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSpinDelay">
|
||||
<layout class="QGridLayout" name="gridSpinDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinDelay">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageSpinBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridSpinBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QDoubleSpinBox" name="spinBurstPeriod">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="keyboardTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>2000000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="3">
|
||||
<widget class="QStackedWidget" name="stackedComboDelayBurstPeriod">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageComboDelay">
|
||||
<layout class="QGridLayout" name="gridComboDelay">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboDelayUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageComboBurstPeriod">
|
||||
<layout class="QGridLayout" name="gridComboBurstPeriod">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="comboBurstPeriodUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The Delay between Trigger Edge and Start of Exposure ( or Readout).
|
||||
#delay#</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>hr</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>min</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ms</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>us</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ns</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1116,9 +1513,6 @@ Frame period between exposures.
|
||||
<tabstop>comboExpUnit</tabstop>
|
||||
<tabstop>spinPeriod</tabstop>
|
||||
<tabstop>comboPeriodUnit</tabstop>
|
||||
<tabstop>spinNumTriggers</tabstop>
|
||||
<tabstop>spinDelay</tabstop>
|
||||
<tabstop>comboDelayUnit</tabstop>
|
||||
<tabstop>spinNumSamples</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
|
@ -822,7 +822,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="stackedWidget1D">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSuperImpose">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -1360,6 +1360,27 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkGainPlot1D">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Displays minimum, maximum and sum of values for each plot.
|
||||
<nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gain Plot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -2347,7 +2368,6 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<zorder>box1D</zorder>
|
||||
<zorder>boxFrequency</zorder>
|
||||
<zorder>box2D</zorder>
|
||||
<zorder>horizontalSpacer_6</zorder>
|
||||
<zorder>boxPlotAxis</zorder>
|
||||
<zorder>boxSave</zorder>
|
||||
</widget>
|
||||
|
@ -214,6 +214,46 @@
|
||||
<string>Very Low Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G1_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G1_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_HC_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_HC_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_LC_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G2_LC_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G4_HG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>G4_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Undefined</string>
|
||||
|
@ -16,7 +16,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt2DPlot *gp,
|
||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt1DPlot *gp1, SlsQt2DPlot *gp,
|
||||
QString title, QString filePath, QString fileName,
|
||||
int64_t aIndex, bool displayStats, QString min, QString max,
|
||||
QString sum);
|
||||
@ -37,6 +37,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
||||
int id;
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
SlsQt2DPlot *plot2d{nullptr};
|
||||
SlsQt1DPlot *gainplot1d{nullptr};
|
||||
SlsQt2DPlot *gainplot2d{nullptr};
|
||||
QString filePath{"/"};
|
||||
QString fileName{"run"};
|
||||
|
@ -31,6 +31,7 @@ class qDefs : public QWidget {
|
||||
|
||||
static const int Q_FONT_SIZE=9;
|
||||
static const int DATA_GAIN_PLOT_RATIO=5;
|
||||
static const int MIN_HEIGHT_GAIN_PLOT_1D=75;
|
||||
|
||||
static void DisplayExceptions(std::string emsg, std::string src) {
|
||||
try {
|
||||
|
@ -30,8 +30,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent = 0);
|
||||
qDetectorMain(int multiId, std::string fname, bool isDevel);
|
||||
~qDetectorMain();
|
||||
|
||||
private slots:
|
||||
|
@ -12,7 +12,6 @@ class detectorData;
|
||||
#include "Detector.h"
|
||||
|
||||
class QResizeEvent;
|
||||
#include <QFutureWatcher>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
@ -64,11 +63,11 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
|
||||
private slots:
|
||||
void SetSaveFileName(QString val);
|
||||
void AcquireFinished();
|
||||
void AcquireThread();
|
||||
void UpdatePlot();
|
||||
|
||||
|
||||
signals:
|
||||
void StartAcquireSignal();
|
||||
void AcquireFinishedSignal();
|
||||
void AbortSignal();
|
||||
void UpdateSignal();
|
||||
@ -81,7 +80,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
void DetachHists();
|
||||
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer);
|
||||
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
|
||||
std::string AcquireThread();
|
||||
void AcquisitionFinished(double currentProgress, int detectorStatus);
|
||||
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex);
|
||||
void toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL);
|
||||
@ -98,9 +96,10 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
QVector<SlsQtH1D *> hists1d;
|
||||
SlsQt1DPlot *gainplot1d{nullptr};
|
||||
SlsQtH1D * gainhist1d{nullptr};
|
||||
SlsQt2DPlot *plot2d{nullptr};
|
||||
SlsQt2DPlot *gainplot2d{nullptr};
|
||||
QFutureWatcher<std::string> *acqResultWatcher;
|
||||
|
||||
bool is1d{true};
|
||||
bool isRunning{false};
|
||||
@ -124,6 +123,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
int nHists{1};
|
||||
double *datax1d{nullptr};
|
||||
std::vector<double *> datay1d;
|
||||
double *gainDatay1d{nullptr};
|
||||
double *data2d{nullptr};
|
||||
double *gainData{nullptr};
|
||||
|
||||
@ -158,7 +158,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
|
||||
unsigned int nPixelsX{0};
|
||||
unsigned int nPixelsY{0};
|
||||
const static int npixelsx_jctb = 400;
|
||||
int npixelsy_jctb{0};
|
||||
uint32_t pixelMask{0};
|
||||
uint32_t gainMask{0};
|
||||
int gainOffset{0};
|
||||
};
|
||||
|
@ -26,10 +26,12 @@ private slots:
|
||||
void SetNumMeasurements(int val);
|
||||
void SetNumFrames(int val);
|
||||
void SetNumTriggers(int val);
|
||||
void SetNumBursts(int val);
|
||||
void SetNumSamples(int val);
|
||||
void SetExposureTime();
|
||||
void SetAcquisitionPeriod();
|
||||
void SetDelay();
|
||||
void SetBurstPeriod();
|
||||
void SetFileWrite(bool val);
|
||||
void SetFileName();
|
||||
void SetRunIndex(int val);
|
||||
@ -41,17 +43,24 @@ private slots:
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void Initialization();
|
||||
/** default, show trigger and delay,
|
||||
* otherwise for gotthard2 in auto timing mode and burst mode,
|
||||
* show bursts and burst period
|
||||
*/
|
||||
void ShowTriggerDelay();
|
||||
void SetupTimingMode();
|
||||
void EnableWidgetsforTimingMode();
|
||||
|
||||
void GetTimingMode();
|
||||
void GetNumFrames();
|
||||
void GetNumTriggers();
|
||||
void GetNumBursts();
|
||||
void GetNumSamples();
|
||||
void GetExposureTime();
|
||||
void GetAcquisitionPeriod();
|
||||
void CheckAcqPeriodGreaterThanExp();
|
||||
void GetDelay();
|
||||
void GetBurstPeriod();
|
||||
void GetFileWrite();
|
||||
void GetFileName();
|
||||
void GetRunIndex();
|
||||
|
@ -41,6 +41,14 @@ private:
|
||||
FORCESWITCHG1,
|
||||
FORCESWITCHG2,
|
||||
VERLOWGAIN,
|
||||
G1_HIGHGAIN,
|
||||
G1_LOWGAIN,
|
||||
G2_HIGHCAP_HIGHGAIN,
|
||||
G2_HIGHCAP_LOWGAIN,
|
||||
G2_LOWCAP_HIGHGAIN,
|
||||
G2_LOWCAP_LOWGAIN,
|
||||
G4_HIGHGAIN,
|
||||
G4_LOWGAIN,
|
||||
UNDEFINED,
|
||||
UNINITIALIZED,
|
||||
NUMSETTINGS
|
||||
|
@ -77,14 +77,14 @@ class SlsQtH1D:public QwtPlotCurve{
|
||||
int ndata;
|
||||
int n_array;
|
||||
double dx;
|
||||
double *x,*y;
|
||||
double *x{nullptr},*y{nullptr};
|
||||
double ymin,ymax;
|
||||
double firstXgt0,firstYgt0;
|
||||
void Initailize();
|
||||
int SetUpArrays(int n);
|
||||
int CheckIndex(int bx);
|
||||
|
||||
QPen* pen_ptr;
|
||||
QPen* pen_ptr{nullptr};
|
||||
};
|
||||
|
||||
|
||||
@ -132,6 +132,7 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void DisableZoom(bool disable);
|
||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);Update();};
|
||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);Update();};
|
||||
void SetYStep (int step) {ystep = step;};
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
double GetXMinimum(){return hist_list->Hist()->GetXMin();};
|
||||
@ -150,13 +151,14 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void SetLogY(bool yes=1);
|
||||
private:
|
||||
|
||||
SlsQtH1DList* hist_list;
|
||||
SlsQt1DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
SlsQtH1DList* hist_list{nullptr};
|
||||
SlsQt1DZoomer* zoomer{nullptr};
|
||||
QwtPlotPanner* panner{nullptr};
|
||||
|
||||
QwtPlotMarker *hline;
|
||||
QwtPlotMarker *vline;
|
||||
QwtPlotMarker *hline{nullptr};
|
||||
QwtPlotMarker *vline{nullptr};
|
||||
bool disableZoom{false};
|
||||
int ystep{0};
|
||||
|
||||
void SetupZoom();
|
||||
void UnknownStuff();
|
||||
|
@ -26,7 +26,7 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
double x_width,y_width;
|
||||
|
||||
int nx,ny,nb;
|
||||
double *data;
|
||||
double *data{nullptr};
|
||||
double z_min,z_mean,z_max;
|
||||
bool z_mean_has_been_calculated;
|
||||
|
||||
|
@ -20,7 +20,7 @@ class SlsQt2DPlot: public QwtPlot{
|
||||
|
||||
public:
|
||||
SlsQt2DPlot(QWidget * = NULL);
|
||||
|
||||
~SlsQt2DPlot();
|
||||
void SetTitle(QString title);
|
||||
void SetXTitle(QString title);
|
||||
void SetYTitle(QString title);
|
||||
@ -77,17 +77,17 @@ private:
|
||||
QwtLinearColorMap* myColourMap(QVector<double> colourStops);
|
||||
QwtLinearColorMap* myColourMap(int log=0);
|
||||
|
||||
QwtPlotSpectrogram *d_spectrogram;
|
||||
SlsQt2DHist* hist;
|
||||
SlsQt2DZoomer* zoomer;
|
||||
QwtPlotPanner* panner;
|
||||
QwtScaleWidget *rightAxis;
|
||||
QwtPlotSpectrogram *d_spectrogram{nullptr};
|
||||
SlsQt2DHist* hist{nullptr};
|
||||
SlsQt2DZoomer* zoomer{nullptr};
|
||||
QwtPlotPanner* panner{nullptr};
|
||||
QwtScaleWidget *rightAxis{nullptr};
|
||||
|
||||
QwtLinearColorMap* colorMapLinearScale;
|
||||
QwtLinearColorMap* colorMapLogScale;
|
||||
QwtLinearColorMap* colorMapLinearScale{nullptr};
|
||||
QwtLinearColorMap* colorMapLogScale{nullptr};
|
||||
#if QWT_VERSION<0x060000
|
||||
QwtValueList* contourLevelsLinear;
|
||||
QwtValueList* contourLevelsLog;
|
||||
QwtValueList* contourLevelsLinear{nullptr};
|
||||
QwtValueList* contourLevelsLog{nullptr};
|
||||
#else
|
||||
QList<double> contourLevelsLinear;
|
||||
QList<double> contourLevelsLog;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||
#endif
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title) {
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
||||
Initailize();
|
||||
SetData(n, min, max, data);
|
||||
}
|
||||
@ -33,15 +33,18 @@ SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y) : QwtPl
|
||||
|
||||
void SlsQtH1D::Initailize() {
|
||||
ndata = n_array = 0;
|
||||
x = y = 0;
|
||||
x = y = nullptr;
|
||||
pen_ptr = new QPen();
|
||||
SetLineColor();
|
||||
}
|
||||
|
||||
SlsQtH1D::~SlsQtH1D() {
|
||||
delete x;
|
||||
delete y;
|
||||
delete pen_ptr;
|
||||
if (x)
|
||||
delete [] x;
|
||||
if (y)
|
||||
delete [] y;
|
||||
if (pen_ptr)
|
||||
delete pen_ptr;
|
||||
}
|
||||
|
||||
void SlsQtH1D::Attach(SlsQt1DPlot *p) {
|
||||
@ -358,12 +361,16 @@ SlsQt1DPlot::SlsQt1DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
}
|
||||
|
||||
SlsQt1DPlot::~SlsQt1DPlot() {
|
||||
delete hist_list;
|
||||
|
||||
if (hist_list)
|
||||
delete hist_list;
|
||||
if (hline)
|
||||
delete hline;
|
||||
if (vline)
|
||||
delete vline;
|
||||
if (zoomer)
|
||||
delete zoomer;
|
||||
if (panner)
|
||||
delete panner;
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::CalculateNResetZoomBase() {
|
||||
|
@ -52,6 +52,32 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
}
|
||||
|
||||
|
||||
SlsQt2DPlot::~SlsQt2DPlot() {
|
||||
if (d_spectrogram) {
|
||||
d_spectrogram->detach();
|
||||
//delete d_spectrogram;
|
||||
}
|
||||
if (hist) {
|
||||
delete hist;
|
||||
}
|
||||
if (colorMapLinearScale)
|
||||
delete colorMapLinearScale;
|
||||
if (colorMapLogScale)
|
||||
delete colorMapLogScale;
|
||||
|
||||
|
||||
if (zoomer)
|
||||
delete zoomer;
|
||||
if (panner)
|
||||
delete panner;
|
||||
#if QWT_VERSION<0x060000
|
||||
if (contourLevelsLinear)
|
||||
delete contourLevelsLinear;
|
||||
if (contourLevelsLog)
|
||||
delete contourLevelsLog;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetTitle(QString title) {
|
||||
setTitle(title);
|
||||
}
|
||||
@ -94,7 +120,7 @@ void SlsQt2DPlot::SetZFont(const QFont& f) {
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetupColorMap() {
|
||||
|
||||
|
||||
colorMapLinearScale = myColourMap(0);
|
||||
#if QWT_VERSION < 0x060000
|
||||
d_spectrogram->setColorMap(*colorMapLinearScale);
|
||||
|
@ -11,10 +11,10 @@
|
||||
|
||||
int qCloneWidget::NumClones{0};
|
||||
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt2DPlot* gp,
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt1DPlot *gp1, SlsQt2DPlot* gp,
|
||||
QString title, QString fPath, QString fName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max, QString sum):
|
||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
setupUi(this);
|
||||
id = qCloneWidget::NumClones++;
|
||||
SetupWidgetWindow(title);
|
||||
@ -26,6 +26,8 @@ qCloneWidget::~qCloneWidget() {
|
||||
delete plot1d;
|
||||
if (plot2d)
|
||||
delete plot2d;
|
||||
if (gainplot1d)
|
||||
delete gainplot1d;
|
||||
if (gainplot2d)
|
||||
delete gainplot2d;
|
||||
}
|
||||
@ -40,21 +42,35 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
|
||||
// 1d
|
||||
if (plot1d != nullptr) {
|
||||
plotLayout->addWidget(plot1d);
|
||||
if (gainplot1d == nullptr) {
|
||||
plotLayout->addWidget(plot1d);
|
||||
} else {
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
// 2d
|
||||
else {
|
||||
if (gainplot2d == nullptr) {
|
||||
plotLayout->addWidget(plot2d);
|
||||
} else {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
connect(actionSaveClone, SIGNAL(triggered()), this, SLOT(SavePlot()));
|
||||
this->show();
|
||||
if (gainplot1d != nullptr) {
|
||||
gainplot1d->setMinimumHeight(qDefs::MIN_HEIGHT_GAIN_PLOT_1D);
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
// gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
||||
}
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
}
|
||||
|
||||
void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum) {
|
||||
@ -92,6 +108,10 @@ void qCloneWidget::SavePlot() {
|
||||
}
|
||||
|
||||
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
||||
if (gainplot1d != nullptr) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
|
@ -26,27 +26,10 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
QApplication *theApp = new QApplication(argc, argv);
|
||||
theApp->setStyle(new QPlastiqueStyle);
|
||||
theApp->setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
||||
try {
|
||||
qDetectorMain *det = new qDetectorMain(argc, argv, theApp, 0);
|
||||
det->show();
|
||||
theApp->exec();
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
QWidget *parent)
|
||||
: QMainWindow(parent), detType(slsDetectorDefs::GENERIC), isDeveloper(0),
|
||||
heightPlotWindow(0), heightCentralWidget(0) {
|
||||
|
||||
// options
|
||||
std::string fname = "";
|
||||
bool isDeveloper = false;
|
||||
int64_t tempval = 0;
|
||||
int multiId = 0;
|
||||
|
||||
@ -81,7 +64,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
isDeveloper = 1;
|
||||
isDeveloper = true;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
@ -92,7 +75,7 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
tempval = APIGUI;
|
||||
FILE_LOG(logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
||||
<< std::hex << tempval << ")";
|
||||
return;
|
||||
return 0;
|
||||
|
||||
case 'h':
|
||||
default:
|
||||
@ -107,10 +90,29 @@ qDetectorMain::qDetectorMain(int argc, char **argv, QApplication *app,
|
||||
"\t only when more than one multi "
|
||||
"detector object is needed.\n\n";
|
||||
FILE_LOG(logERROR) << help_message;
|
||||
exit(EXIT_FAILURE);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QApplication app(argc, argv);
|
||||
app.setStyle(new QPlastiqueStyle);
|
||||
//app.setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
||||
try {
|
||||
qDetectorMain det(multiId, fname, isDeveloper);
|
||||
det.show();
|
||||
app.exec();
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
std::string(e.what()) + "\nExiting Gui :'( ", "main");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
qDetectorMain::qDetectorMain(int multiId, std::string fname, bool isDevel)
|
||||
: QMainWindow(0), detType(slsDetectorDefs::GENERIC), isDeveloper(isDevel),
|
||||
heightPlotWindow(0), heightCentralWidget(0) {
|
||||
|
||||
setupUi(this);
|
||||
SetUpDetector(fname, multiId);
|
||||
SetUpWidgetWindow();
|
||||
@ -429,8 +431,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
|
||||
void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
if (action == actionAbout) {
|
||||
FILE_LOG(logINFO) << "About Common GUI for Eiger, Gotthard, Jungfrau "
|
||||
"and Moench detectors";
|
||||
FILE_LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench detectors";
|
||||
|
||||
std::string guiVersion = std::to_string(APIGUI);
|
||||
std::string clientVersion = "unknown";
|
||||
@ -447,7 +448,7 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
clientVersion +
|
||||
"<br><br>"
|
||||
"Common GUI to control the SLS Detectors: "
|
||||
"Eiger, Jungfrau, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
|
||||
"Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
|
||||
"It can be operated in parallel with the command "
|
||||
"line interface:<br>"
|
||||
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <QtConcurrentRun>
|
||||
#include <QResizeEvent>
|
||||
|
||||
|
||||
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
@ -32,6 +31,8 @@ qDrawPlot::~qDrawPlot() {
|
||||
delete [] datax1d;
|
||||
for (auto &it : datay1d)
|
||||
delete [] it;
|
||||
if (gainDatay1d)
|
||||
delete [] gainDatay1d;
|
||||
if (data2d)
|
||||
delete [] data2d;
|
||||
if (gainData)
|
||||
@ -39,6 +40,10 @@ qDrawPlot::~qDrawPlot() {
|
||||
|
||||
if (plot1d)
|
||||
delete plot1d;
|
||||
if (gainhist1d)
|
||||
delete gainhist1d;
|
||||
if (gainplot1d)
|
||||
delete gainplot1d;
|
||||
if (plot2d)
|
||||
delete plot2d;
|
||||
if (gainplot2d)
|
||||
@ -54,13 +59,18 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
detType = det->getDetectorType().squash();
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
pixelMask = ((1 << 15) - 1);
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||
pixelMask = ((1 << 14) - 1);
|
||||
gainMask = (3 << 14);
|
||||
gainOffset = 14;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
pixelMask = ((1 << 13) - 1);
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||
pixelMask = ((1 << 12) - 1);
|
||||
gainMask = (3 << 12);
|
||||
gainOffset = 12;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -80,15 +90,12 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
SetupPlots();
|
||||
SetDataCallBack(true);
|
||||
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
|
||||
// future watcher to watch result of AcquireThread only because it uses signals/slots to handle acquire exception
|
||||
acqResultWatcher = new QFutureWatcher<std::string>();
|
||||
|
||||
Initialization();
|
||||
}
|
||||
|
||||
void qDrawPlot::Initialization() {
|
||||
connect(this, SIGNAL(UpdateSignal()), this, SLOT(UpdatePlot()));
|
||||
connect(acqResultWatcher, SIGNAL(finished()), this, SLOT(AcquireFinished()));
|
||||
connect(this, SIGNAL(StartAcquireSignal()), this, SLOT(AcquireThread()));
|
||||
}
|
||||
|
||||
void qDrawPlot::SetupPlots() {
|
||||
@ -99,13 +106,6 @@ void qDrawPlot::SetupPlots() {
|
||||
nPixelsX = res.x;
|
||||
nPixelsY = res.y;
|
||||
switch(detType) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
try{
|
||||
npixelsy_jctb = (det->getNumberOfAnalogSamples().tsquash("Inconsistent values for number of analog samples") * 2)/25;// for moench 03
|
||||
nPixelsX = npixelsx_jctb;
|
||||
nPixelsY = npixelsy_jctb;
|
||||
} CATCH_DISPLAY ("Could not get number of analog samples.", "qDrawPlot::SetupPlots")
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
try{
|
||||
if (det->getQuad().tsquash("Inconsistent values for quad type")) {
|
||||
@ -154,12 +154,40 @@ void qDrawPlot::SetupPlots() {
|
||||
plot1d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetTitle("--");
|
||||
plot1d->SetTitle("");
|
||||
plot1d->SetXTitle(xTitle1d);
|
||||
plot1d->SetYTitle(yTitle1d);
|
||||
h->Attach(plot1d);
|
||||
plot1d->hide();
|
||||
|
||||
if (gainDatay1d)
|
||||
delete[] gainDatay1d;
|
||||
gainDatay1d = new double[nPixelsX];
|
||||
// default display data
|
||||
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
||||
gainDatay1d[px] = 0;
|
||||
}
|
||||
// set gain hist
|
||||
gainhist1d = new SlsQtH1D("", nPixelsX, datax1d, gainDatay1d);
|
||||
gainhist1d->SetLineColor(0);
|
||||
gainhist1d->setStyleLinesorDots(isLines);
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
// setup 1d gain plot
|
||||
gainplot1d = new SlsQt1DPlot(boxPlot);
|
||||
gainplot1d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetTitle("");
|
||||
gainplot1d->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
gainplot1d->setAxisScaleDiv( QwtPlot::yLeft, div);
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Ticks, false);
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Labels, false);
|
||||
gainhist1d->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
gainplot1d->hide();
|
||||
|
||||
// setup 2d data
|
||||
if (data2d)
|
||||
delete [] data2d;
|
||||
@ -197,17 +225,21 @@ void qDrawPlot::SetupPlots() {
|
||||
|
||||
gainplot2d = new SlsQt2DPlot(boxPlot);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
gainplot2d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->setTitle("");
|
||||
gainplot2d->enableAxis(0, false);
|
||||
gainplot2d->enableAxis(1, false);
|
||||
gainplot2d->enableAxis(2, false);
|
||||
gainplot2d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->setTitle("Gain");
|
||||
gainplot2d->SetZTitle("");
|
||||
gainplot2d->enableAxis(QwtPlot::yLeft, false);
|
||||
//gainplot2d->enableAxis(1, false);
|
||||
gainplot2d->enableAxis(QwtPlot::xBottom, false);
|
||||
// set ticks to just 3
|
||||
gainplot2d->setAxisScaleDiv( QwtPlot::yRight, div);
|
||||
gainplot2d->hide();
|
||||
|
||||
// layout of plots
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
|
||||
@ -216,6 +248,10 @@ void qDrawPlot::resizeEvent(QResizeEvent *event) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
if (gainplot1d->isVisible()) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
@ -447,6 +483,7 @@ void qDrawPlot::ClonePlot() {
|
||||
|
||||
SlsQt1DPlot* cloneplot1D = nullptr;
|
||||
SlsQt2DPlot* cloneplot2D = nullptr;
|
||||
SlsQt1DPlot* clonegainplot1D = nullptr;
|
||||
SlsQt2DPlot* clonegainplot2D = nullptr;
|
||||
|
||||
if (is1d) {
|
||||
@ -468,6 +505,24 @@ void qDrawPlot::ClonePlot() {
|
||||
cloneplotHists1D.append(h);
|
||||
h->Attach(cloneplot1D);
|
||||
}
|
||||
if (isGainDataExtracted) {
|
||||
SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, gainDatay1d);
|
||||
h->SetLineColor(0);
|
||||
h->setStyleLinesorDots(isLines);
|
||||
h->setSymbolMarkers(isMarkers);
|
||||
h->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
clonegainplot1D = new SlsQt1DPlot();
|
||||
clonegainplot1D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetTitle("");
|
||||
clonegainplot1D->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
clonegainplot1D->setAxisScaleDiv( QwtPlot::yLeft, div);
|
||||
h->Attach(clonegainplot1D);
|
||||
|
||||
}
|
||||
} else {
|
||||
FILE_LOG(logDEBUG) << "Cloning 2D Image";
|
||||
cloneplot2D = new SlsQt2DPlot();
|
||||
@ -485,19 +540,26 @@ void qDrawPlot::ClonePlot() {
|
||||
|
||||
if (isGainDataExtracted) {
|
||||
clonegainplot2D = new SlsQt2DPlot();
|
||||
clonegainplot2D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot2D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot2D->SetTitle("Gain");
|
||||
clonegainplot2D->SetZTitle("");
|
||||
clonegainplot2D->enableAxis(QwtPlot::yLeft, false);
|
||||
clonegainplot2D->enableAxis(QwtPlot::xBottom, false);
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
clonegainplot2D->setAxisScaleDiv( QwtPlot::yRight, div);
|
||||
|
||||
clonegainplot2D->enableAxis(0, false);
|
||||
clonegainplot2D->enableAxis(1, false);
|
||||
clonegainplot2D->enableAxis(2, false);
|
||||
clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
clonegainplot2D->SetTitle("");
|
||||
}
|
||||
}
|
||||
|
||||
qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot2D,
|
||||
boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
|
||||
new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot1D,
|
||||
clonegainplot2D, boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
|
||||
displayStatistics, lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text());
|
||||
q->show();
|
||||
}
|
||||
|
||||
void qDrawPlot::SavePlot() {
|
||||
@ -547,6 +609,9 @@ void qDrawPlot::DetachHists() {
|
||||
for (QVector<SlsQtH1D *>::iterator h = hists1d.begin(); h != hists1d.end(); ++h) {
|
||||
(*h)->Detach(plot1d);
|
||||
}
|
||||
if (gainhist1d) {
|
||||
gainhist1d->Detach(gainplot1d);
|
||||
}
|
||||
}
|
||||
|
||||
void qDrawPlot::StartAcquisition() {
|
||||
@ -571,16 +636,19 @@ void qDrawPlot::StartAcquisition() {
|
||||
xyRangeChanged = true;
|
||||
}
|
||||
|
||||
// acquisition in another thread
|
||||
QFuture<std::string> future = QtConcurrent::run(this, &qDrawPlot::AcquireThread);
|
||||
acqResultWatcher->setFuture(future);
|
||||
|
||||
emit StartAcquireSignal();
|
||||
FILE_LOG(logDEBUG) << "End of Starting Acquisition in qDrawPlot";
|
||||
}
|
||||
|
||||
void qDrawPlot::AcquireFinished() {
|
||||
FILE_LOG(logDEBUG) << "Acquisition Finished";
|
||||
std::string mess = acqResultWatcher->result();
|
||||
void qDrawPlot::AcquireThread() {
|
||||
FILE_LOG(logDEBUG) << "Acquire Thread";
|
||||
std::string mess;
|
||||
try {
|
||||
det->acquire();
|
||||
} catch (const std::exception &e) {
|
||||
mess = std::string(e.what());
|
||||
}
|
||||
FILE_LOG(logINFO) << "Acquisition Finished";
|
||||
// exception in acquire will not call acquisition finished call back, so handle it
|
||||
if (!mess.empty()) {
|
||||
FILE_LOG(logERROR) << "Acquisition Finished with an exception: " << mess;
|
||||
@ -593,17 +661,7 @@ void qDrawPlot::AcquireFinished() {
|
||||
} CATCH_DISPLAY("Could not stop receiver.", "qDrawPlot::AcquireFinished");
|
||||
emit AbortSignal();
|
||||
}
|
||||
FILE_LOG(logDEBUG) << "End of Acquisition Finished";
|
||||
}
|
||||
|
||||
std::string qDrawPlot::AcquireThread() {
|
||||
FILE_LOG(logDEBUG) << "Acquire Thread";
|
||||
try {
|
||||
det->acquire();
|
||||
} catch (const std::exception &e) {
|
||||
return std::string(e.what());
|
||||
}
|
||||
return std::string("");
|
||||
FILE_LOG(logDEBUG) << "End of Acquisition Finished";
|
||||
}
|
||||
|
||||
void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer) {
|
||||
@ -666,7 +724,8 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
||||
unsigned int nPixels = nPixelsX * (is1d ? 1 : nPixelsY);
|
||||
double* rawData = new double[nPixels];
|
||||
if (hasGainData) {
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange, gainData);
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange,
|
||||
is1d ? gainDatay1d : gainData);
|
||||
isGainDataExtracted = true;
|
||||
} else {
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange);
|
||||
@ -716,6 +775,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
||||
} else {
|
||||
Get2dData(rawData);
|
||||
}
|
||||
delete [] rawData;
|
||||
|
||||
FILE_LOG(logDEBUG) << "End of Get Data";
|
||||
emit UpdateSignal();
|
||||
@ -819,6 +879,20 @@ void qDrawPlot::Update1dPlot() {
|
||||
h->Attach(plot1d);
|
||||
}
|
||||
}
|
||||
if (isGainDataExtracted) {
|
||||
gainhist1d->SetData(nPixelsX, datax1d, gainDatay1d);
|
||||
gainhist1d->SetLineColor(0);
|
||||
gainhist1d->setStyleLinesorDots(isLines);
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
if (!gainplot1d->isVisible()) {
|
||||
gainplot1d->setFixedWidth(plot1d->width() );
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->show();
|
||||
}
|
||||
} else if (gainplot1d->isVisible()) {
|
||||
gainplot1d->hide();
|
||||
}
|
||||
if (xyRangeChanged) {
|
||||
Update1dXYRange();
|
||||
xyRangeChanged = false;
|
||||
@ -832,7 +906,7 @@ void qDrawPlot::Update2dPlot() {
|
||||
plot2d->SetYTitle(yTitle2d);
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||
if (isGainDataExtracted) {
|
||||
if (isGainDataExtracted) {
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
if (!gainplot2d->isVisible()) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
@ -918,14 +992,13 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
||||
|
||||
case 16:
|
||||
if (detType == slsDetectorDefs::JUNGFRAU ||
|
||||
detType == slsDetectorDefs::MOENCH ||
|
||||
detType == slsDetectorDefs::GOTTHARD2) {
|
||||
|
||||
// show gain plot
|
||||
if (gaindest != NULL) {
|
||||
for (ichan = 0; ichan < size; ++ichan) {
|
||||
uint16_t temp = (*((u_int16_t *)source));
|
||||
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
||||
gaindest[ichan] = ((temp & gainMask) >> gainOffset);
|
||||
dest[ichan] = (temp & pixelMask);
|
||||
source += 2;
|
||||
}
|
||||
|
@ -82,14 +82,14 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
lblSpinHV->show();
|
||||
spinHV->show();
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 0: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 1: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 2: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 3: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 4: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 5: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Dac 6: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "i Dac 7: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vbp_colbuf: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vin_cm: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_sda: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vcasc_sfp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vout_cm: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre_cds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "ibias_sfp: ", getSLSIndex(detType, tempid++)));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
@ -343,10 +343,27 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::MOENCH:
|
||||
if (index >= 0 && index < (int)dacWidgets.size()) {
|
||||
return (slsDetectorDefs::dacIndex)index;
|
||||
}
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
switch (index) {
|
||||
case 0:
|
||||
return slsDetectorDefs::VBP_COLBUF;
|
||||
case 1:
|
||||
return slsDetectorDefs::VIPRE;
|
||||
case 2:
|
||||
return slsDetectorDefs::VIN_CM;
|
||||
case 3:
|
||||
return slsDetectorDefs::VB_SDA;
|
||||
case 4:
|
||||
return slsDetectorDefs::VCASC_SFP;
|
||||
case 5:
|
||||
return slsDetectorDefs::VOUT_CM;
|
||||
case 6:
|
||||
return slsDetectorDefs::VIPRE_CDS;
|
||||
case 7:
|
||||
return slsDetectorDefs::IBIAS_SFP;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
switch (index) {
|
||||
|
@ -42,6 +42,10 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
lblDelay->setEnabled(true);
|
||||
spinDelay->setEnabled(true);
|
||||
comboDelayUnit->setEnabled(true);
|
||||
|
||||
// default is triggers and delay (not #bursts and burst period for gotthard2 in auto mode)
|
||||
ShowTriggerDelay();
|
||||
|
||||
// enabling according to det type
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
@ -60,6 +64,13 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
spinStartingFrameNumber->setEnabled(true);
|
||||
startingFnumImplemented = true;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
lblNumBursts->setEnabled(true);
|
||||
spinNumBursts->setEnabled(true);
|
||||
lblBurstPeriod->setEnabled(true);
|
||||
spinBurstPeriod->setEnabled(true);
|
||||
comboBurstPeriodUnit->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -78,6 +89,9 @@ void qTabMeasurement::Initialization() {
|
||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
if (spinNumBursts->isEnabled()) {
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
}
|
||||
if (spinNumSamples->isEnabled()) {
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
}
|
||||
@ -89,6 +103,10 @@ void qTabMeasurement::Initialization() {
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
}
|
||||
if (spinBurstPeriod->isEnabled()) {
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
}
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
@ -101,6 +119,35 @@ void qTabMeasurement::Initialization() {
|
||||
|
||||
}
|
||||
|
||||
void qTabMeasurement::ShowTriggerDelay() {
|
||||
bool showTrigger = true;
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||
try {
|
||||
FILE_LOG(logDEBUG) << "Getting burst mode";
|
||||
auto retval = det->getBurstMode().tsquash("Inconsistent burst mode for all detectors.");
|
||||
// burst mode and auto timing mode
|
||||
if (retval != slsDetectorDefs::BURST_OFF && comboTimingMode->currentIndex() == AUTO) {
|
||||
showTrigger = false;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get burst mode.", "qTabMeasurement::ShowTriggerDelay")
|
||||
}
|
||||
|
||||
if (showTrigger) {
|
||||
stackedLblTriggerBurst->setCurrentWidget(pageLblTrigger);
|
||||
stackedSpinTriggerBurst->setCurrentWidget(pageSpinTrigger);
|
||||
stackedLblDelayBurstPeriod->setCurrentWidget(pageLblDelay);
|
||||
stackedSpinDelayBurstPeriod->setCurrentWidget(pageSpinDelay);
|
||||
stackedComboDelayBurstPeriod->setCurrentWidget(pageComboDelay);
|
||||
} else {
|
||||
stackedLblTriggerBurst->setCurrentWidget(pageLblBurst);
|
||||
stackedSpinTriggerBurst->setCurrentWidget(pageSpinBurst);
|
||||
stackedLblDelayBurstPeriod->setCurrentWidget(pageLblBurstPeriod);
|
||||
stackedSpinDelayBurstPeriod->setCurrentWidget(pageSpinBurstPeriod);
|
||||
stackedComboDelayBurstPeriod->setCurrentWidget(pageComboBurstPeriod);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::SetupTimingMode() {
|
||||
QStandardItemModel* model = qobject_cast<QStandardItemModel *>(comboTimingMode->model());
|
||||
QModelIndex index[NUMTIMINGMODES];
|
||||
@ -139,7 +186,9 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
switch(comboTimingMode->currentIndex()) {
|
||||
case AUTO:
|
||||
// #frames, exptime, period
|
||||
spinNumTriggers->setValue(1);
|
||||
if (det->getDetectorType().squash() != slsDetectorDefs::GOTTHARD2) {
|
||||
spinNumTriggers->setValue(1);
|
||||
}
|
||||
lblNumFrames->setEnabled(true);
|
||||
spinNumFrames->setEnabled(true);
|
||||
lblExpTime->setEnabled(true);
|
||||
@ -148,6 +197,9 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
lblPeriod->setEnabled(true);
|
||||
spinPeriod->setEnabled(true);
|
||||
comboPeriodUnit->setEnabled(true);
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||
ShowTriggerDelay();
|
||||
}
|
||||
break;
|
||||
case TRIGGER:
|
||||
// #triggers, exptime
|
||||
@ -168,6 +220,9 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
lblDelay->setEnabled(true);
|
||||
spinDelay->setEnabled(true);
|
||||
comboDelayUnit->setEnabled(true);
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||
ShowTriggerDelay();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GATED:
|
||||
@ -197,7 +252,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
|
||||
void qTabMeasurement::GetTimingMode() {
|
||||
FILE_LOG(logDEBUG) << "Getting timing mode";
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
try {
|
||||
auto oldMode = comboTimingMode->currentIndex();
|
||||
auto retval = det->getTimingMode().tsquash("Inconsistent timing mode for all detectors.");
|
||||
@ -216,7 +271,7 @@ void qTabMeasurement::GetTimingMode() {
|
||||
throw sls::RuntimeError(std::string("Unknown timing mode: ")+ std::to_string(retval));
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get timing mode.", "qTabMeasurement::GetTimingMode")
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetTimingMode(int val) {
|
||||
@ -266,6 +321,23 @@ void qTabMeasurement::SetNumTriggers(int val) {
|
||||
} CATCH_HANDLE("Could not set number of triggers.", "qTabMeasurement::SetNumTriggers", this, &qTabMeasurement::GetNumTriggers)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumBursts() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of bursts";
|
||||
disconnect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
try {
|
||||
auto retval = det->getNumberOfBursts().tsquash("Inconsistent number of bursts for all detectors.");
|
||||
spinNumBursts->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumBursts")
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumBursts(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of bursts to " << val;
|
||||
try {
|
||||
det->setNumberOfBursts(val);
|
||||
} CATCH_HANDLE("Could not set number of bursts.", "qTabMeasurement::SetNumBursts", this, &qTabMeasurement::GetNumBursts)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumSamples() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of samples";
|
||||
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
@ -385,6 +457,32 @@ void qTabMeasurement::SetDelay() {
|
||||
} CATCH_HANDLE("Could not set delay.", "qTabMeasurement::SetDelay", this, &qTabMeasurement::GetDelay)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetBurstPeriod() {
|
||||
FILE_LOG(logDEBUG) << "Getting Burst Period";
|
||||
disconnect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
disconnect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
try {
|
||||
spinBurstPeriod->setValue(-1);
|
||||
auto retval = det->getBurstPeriod().tsquash("Inconsistent burst period for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinBurstPeriod->setValue(time.first);
|
||||
comboBurstPeriodUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get burst period.", "qTabMeasurement::GetBurstPeriod")
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetBurstPeriod() {
|
||||
auto val = spinBurstPeriod->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboBurstPeriodUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting burst period to " << val << " " << qDefs::getUnitString(unit);
|
||||
try {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setBurstPeriod(timeNS);
|
||||
} CATCH_HANDLE("Could not set burst period.", "qTabMeasurement::SetBurstPeriod", this, &qTabMeasurement::GetBurstPeriod)
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::GetFileWrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Write Enable";
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
@ -577,9 +675,15 @@ void qTabMeasurement::Refresh() {
|
||||
GetExposureTime();
|
||||
GetAcquisitionPeriod();
|
||||
GetNumTriggers();
|
||||
if (spinNumBursts->isEnabled()) {
|
||||
GetNumBursts();
|
||||
}
|
||||
if (delayImplemented) {
|
||||
GetDelay();
|
||||
}
|
||||
if (spinBurstPeriod->isEnabled()) {
|
||||
GetBurstPeriod();
|
||||
}
|
||||
if (sampleImplemented) {
|
||||
GetNumSamples();
|
||||
}
|
||||
|
@ -60,15 +60,21 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
is1d = true;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
is1d = true;
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
chkGainPlot1D->setChecked(true);
|
||||
plot->EnableGainPlot(true);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkGainPlot->setEnabled(true);
|
||||
chkGainPlot->setChecked(true);
|
||||
plot->EnableGainPlot(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -128,6 +134,8 @@ void qTabPlot::Initialization() {
|
||||
//gainplot
|
||||
if (chkGainPlot->isEnabled())
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
if (chkGainPlot1D->isEnabled())
|
||||
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
// gap pixels
|
||||
if (chkGapPixels->isEnabled())
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
@ -576,9 +584,11 @@ void qTabPlot::Refresh() {
|
||||
GetGapPixels();
|
||||
break;
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkGainPlot->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -586,6 +596,7 @@ void qTabPlot::Refresh() {
|
||||
boxPlotType->setEnabled(false);
|
||||
boxFrequency->setEnabled(false);
|
||||
chkGainPlot->setEnabled(false);
|
||||
chkGainPlot1D->setEnabled(false);
|
||||
chkGapPixels->setEnabled(false);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@ void qTabSettings::SetupWidgetWindow() {
|
||||
|
||||
// enabling according to det type
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
lblSettings->setEnabled(false);
|
||||
comboSettings->setEnabled(false);
|
||||
@ -83,11 +82,21 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
item[(int)FORCESWITCHG1]->setEnabled(true);
|
||||
item[(int)FORCESWITCHG2]->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
||||
item[(int)FIXGAIN1]->setEnabled(true);
|
||||
item[(int)FIXGAIN2]->setEnabled(true);
|
||||
break;
|
||||
break;
|
||||
case slsDetectorDefs::MOENCH:
|
||||
item[(int)G1_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G1_LOWGAIN]->setEnabled(true);
|
||||
item[(int)G2_HIGHCAP_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G2_HIGHCAP_LOWGAIN]->setEnabled(true);
|
||||
item[(int)G2_LOWCAP_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G2_LOWCAP_LOWGAIN]->setEnabled(true);
|
||||
item[(int)G4_HIGHGAIN]->setEnabled(true);
|
||||
item[(int)G4_LOWGAIN]->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
|
@ -4,13 +4,14 @@ if [ $# -eq 0 ]; then
|
||||
"gotthard2DetectorServer"
|
||||
"jungfrauDetectorServer"
|
||||
"mythen3DetectorServer"
|
||||
"moenchDetectorServer"
|
||||
)
|
||||
else
|
||||
declare -a det=("${1}")
|
||||
echo "got something"
|
||||
fi
|
||||
|
||||
declare -a deterror=("OK" "OK" "OK" "OK")
|
||||
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
||||
|
||||
for ((i=0;i<${#det[@]};++i))
|
||||
do
|
||||
|
Binary file not shown.
@ -515,7 +515,7 @@ void setupDetector() {
|
||||
// altera pll
|
||||
ALTERA_PLL_SetDefines(PLL_CNTRL_REG, PLL_PARAM_REG, PLL_CNTRL_RCNFG_PRMTR_RST_MSK, PLL_CNTRL_WR_PRMTR_MSK, PLL_CNTRL_PLL_RST_MSK, PLL_CNTRL_ADDR_MSK, PLL_CNTRL_ADDR_OFST);
|
||||
|
||||
bus_w(ADC_PORT_INVERT_REG, 0);// depends on chip
|
||||
setADCInvertRegister(0);// depends on chip
|
||||
|
||||
FILE_LOG(logINFOBLUE, ("Setting Default parameters\n"));
|
||||
cleanFifos(); // FIXME: why twice?
|
||||
|
@ -107,7 +107,6 @@ enum CLKINDEX {RUN_CLK, ADC_CLK, SYNC_CLK, DBIT_CLK, NUM_CLOCKS};
|
||||
#define BIT32_MSK (0xFFFFFFFF)
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
|
||||
#define ADC_PORT_INVERT_VAL (0x453b2593)
|
||||
#define MAXIMUM_ADC_CLK (65)
|
||||
#define PLL_VCO_FREQ_MHZ (800)
|
||||
|
||||
|
Binary file not shown.
@ -23,7 +23,7 @@ target_include_directories(gotthard2DetectorServer_virtual
|
||||
)
|
||||
|
||||
target_compile_definitions(gotthard2DetectorServer_virtual
|
||||
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER DEBUG1
|
||||
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER #DEBUG1
|
||||
)
|
||||
|
||||
target_link_libraries(gotthard2DetectorServer_virtual
|
||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = nios2-buildroot-linux-gnu-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) -DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = gotthard2DetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
@ -104,6 +104,8 @@
|
||||
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||
#define CONTROL_TIMING_SOURCE_EXT_OFST (17)
|
||||
#define CONTROL_TIMING_SOURCE_EXT_MSK (0x00000001 << CONTROL_TIMING_SOURCE_EXT_OFST)
|
||||
#define CONTROL_PWR_CHIP_OFST (31)
|
||||
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||
|
||||
@ -128,6 +130,8 @@
|
||||
#define ASIC_CONFIG_FIX_GAIN_1_VAL ((0x1 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_FIX_GAIN_2_VAL ((0x2 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_RESERVED_VAL ((0x3 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||
#define ASIC_CONFIG_CURRENT_SRC_EN_OFST (7)
|
||||
#define ASIC_CONFIG_CURRENT_SRC_EN_MSK (0x00000001 << ASIC_CONFIG_CURRENT_SRC_EN_OFST)
|
||||
#define ASIC_CONFIG_RST_DAC_OFST (15)
|
||||
#define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST)
|
||||
#define ASIC_CONFIG_DONE_OFST (31)
|
||||
@ -224,7 +228,7 @@
|
||||
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Cylces 64bit Write-register */
|
||||
/* Cylces (also #bursts) 64bit Write-register */
|
||||
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
@ -232,7 +236,7 @@
|
||||
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
/* Period 64bit Write-register */
|
||||
/* Period (also burst period) 64bit Write-register */
|
||||
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||
|
||||
|
Binary file not shown.
@ -39,6 +39,7 @@ int virtual_stop = 0;
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||
uint32_t systemFrequency = 0;
|
||||
int highvoltage = 0;
|
||||
int dacValues[NDAC] = {0};
|
||||
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {0};
|
||||
@ -47,9 +48,9 @@ int injectedChannelsIncrement = 0;
|
||||
int vetoReference[NCHIP][NCHAN];
|
||||
uint8_t adcConfiguration[NCHIP][NADC];
|
||||
int burstMode = BURST_INTERNAL;
|
||||
int64_t exptime_ns = 0;
|
||||
int64_t period_ns = 0;
|
||||
int64_t nframes = 0;
|
||||
int64_t numTriggers = 1;
|
||||
int64_t numBursts = 1;
|
||||
int64_t burstPeriodNs = 0;
|
||||
int detPos[2] = {};
|
||||
|
||||
int isInitCheckDone() {
|
||||
@ -345,6 +346,7 @@ void setupDetector() {
|
||||
clkFrequency[SYSTEM_C1] = DEFAULT_SYSTEM_C1;
|
||||
clkFrequency[SYSTEM_C2] = DEFAULT_SYSTEM_C2;
|
||||
clkFrequency[SYSTEM_C3] = DEFAULT_SYSTEM_C3;
|
||||
systemFrequency = INT_SYSTEM_C0_FREQUENCY;
|
||||
detPos[0] = 0;
|
||||
detPos[1] = 0;
|
||||
|
||||
@ -353,9 +355,9 @@ void setupDetector() {
|
||||
injectedChannelsOffset = 0;
|
||||
injectedChannelsIncrement = 0;
|
||||
burstMode = BURST_INTERNAL;
|
||||
exptime_ns = 0;
|
||||
period_ns = 0;
|
||||
nframes = 0;
|
||||
numTriggers = 1;
|
||||
numBursts = 1;
|
||||
burstPeriodNs = 0;
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
@ -392,6 +394,7 @@ void setupDetector() {
|
||||
// on chip dacs
|
||||
ASIC_Driver_SetDefines(ONCHIP_DAC_DRIVER_FILE_NAME);
|
||||
#endif
|
||||
setTimingSource(DEFAULT_TIMING_SOURCE);
|
||||
|
||||
// Default values
|
||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
@ -439,10 +442,13 @@ void setupDetector() {
|
||||
// Initialization of acquistion parameters
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
setNumBursts(DEFAULT_NUM_BURSTS);
|
||||
setExpTime(DEFAULT_EXPTIME);
|
||||
setPeriod(DEFAULT_PERIOD);
|
||||
setDelayAfterTrigger(DEFAULT_DELAY_AFTER_TRIGGER);
|
||||
setBurstPeriod(DEFAULT_BURST_PERIOD);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setCurrentSource(DEFAULT_CURRENT_SOURCE);
|
||||
}
|
||||
|
||||
int readConfigFile() {
|
||||
@ -452,13 +458,13 @@ int readConfigFile() {
|
||||
}
|
||||
|
||||
// require a sleep before and after the rst dac signal
|
||||
usleep (1 * 1000);
|
||||
usleep (INITIAL_STARTUP_WAIT);
|
||||
|
||||
// inform FPGA that onchip dacs will be configured soon
|
||||
FILE_LOG(logINFO, ("Setting configuration starting bit\n"));
|
||||
bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_RST_DAC_MSK);
|
||||
|
||||
usleep (1 * 1000);
|
||||
usleep (INITIAL_STARTUP_WAIT);
|
||||
|
||||
FILE* fd = fopen(CONFIG_FILE, "r");
|
||||
if(fd == NULL) {
|
||||
@ -731,52 +737,104 @@ int setDynamicRange(int dr){
|
||||
/* parameters - timer */
|
||||
void setNumFrames(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [local]\n", (long long int)val));
|
||||
nframes = val;
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [local]\n", val));
|
||||
// continuous mode
|
||||
if (burstMode == BURST_OFF) {
|
||||
setNumFramesCont(val);
|
||||
setNumFramesBurst(1);
|
||||
} else {
|
||||
setNumFramesBurst(val);
|
||||
setNumFramesCont(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumFrames() {
|
||||
return nframes;
|
||||
if (burstMode == BURST_OFF) {
|
||||
return getNumFramesCont();
|
||||
} else {
|
||||
return getNumFramesBurst();
|
||||
}
|
||||
}
|
||||
|
||||
void setNumTriggers(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", (long long int)val));
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Setting number of triggers %lld\n", val));
|
||||
numTriggers = val;
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
FILE_LOG(logINFO, ("\tBurst and Auto mode: not writing #triggers to register\n"));
|
||||
} else {
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumTriggers() {
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
return numTriggers;
|
||||
}
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
|
||||
void setNumBursts(int64_t val) {
|
||||
if (val > 0) {
|
||||
FILE_LOG(logINFO, ("Setting number of bursts %lld\n", val));
|
||||
numBursts = val;
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("\tNot (Burst and Auto mode): not writing #bursts to register\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getNumBursts() {
|
||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
||||
return get64BitReg(SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
}
|
||||
return numBursts;
|
||||
}
|
||||
|
||||
int setExpTime(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [local]\n", (long long int)val));
|
||||
exptime_ns = val;
|
||||
return OK;
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [local]\n", val));
|
||||
// continuous mode
|
||||
if (burstMode == BURST_OFF) {
|
||||
return setExptimeCont(val);
|
||||
} else {
|
||||
return setExptimeBurst(val);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getExpTime() {
|
||||
return exptime_ns;
|
||||
return getExptimeBoth();
|
||||
}
|
||||
|
||||
int setPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [local]\n", (long long int)val));
|
||||
period_ns = val;
|
||||
return OK;
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [local]\n", val));
|
||||
// continuous mode
|
||||
if (burstMode == BURST_OFF) {
|
||||
setPeriodBurst(0);
|
||||
return setPeriodCont(val);
|
||||
} else {
|
||||
//setPeriodCont(0);
|
||||
return setPeriodBurst(val);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t getPeriod() {
|
||||
return period_ns;
|
||||
if (burstMode == BURST_OFF) {
|
||||
return getPeriodCont();
|
||||
} else {
|
||||
return getPeriodBurst();
|
||||
}
|
||||
}
|
||||
|
||||
void setNumFramesBurst(int64_t val) {
|
||||
@ -790,7 +848,7 @@ int64_t getNumFramesBurst() {
|
||||
}
|
||||
|
||||
void setNumFramesCont(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [Continuous mode]\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting number of frames %lld [Continuous mode]\n", val));
|
||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
@ -799,22 +857,22 @@ int64_t getNumFramesCont() {
|
||||
}
|
||||
|
||||
int setExptimeBurst(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Burst mode]\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Burst mode]\n", val));
|
||||
return setExptimeBoth(val);
|
||||
}
|
||||
|
||||
int setExptimeCont(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Continuous mode]\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting exptime %lld ns [Continuous mode]\n", val));
|
||||
return setExptimeBoth(val);
|
||||
}
|
||||
|
||||
int setExptimeBoth(int64_t val) {
|
||||
val *= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
val *= (1E-9 * systemFrequency);
|
||||
set64BitReg(val, ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getExptimeBoth();
|
||||
val /= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
val /= (1E-9 * systemFrequency);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -822,18 +880,18 @@ int setExptimeBoth(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getExptimeBoth() {
|
||||
return get64BitReg(ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG) / (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
return get64BitReg(ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG) / (1E-9 * systemFrequency);
|
||||
}
|
||||
|
||||
|
||||
int setPeriodBurst(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", (long long int)val));
|
||||
val *= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val));
|
||||
val *= (1E-9 * systemFrequency);
|
||||
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriodBurst();
|
||||
val /= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
val /= (1E-9 * systemFrequency);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -841,17 +899,18 @@ int setPeriodBurst(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getPeriodBurst() {
|
||||
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||
FILE_LOG(logDEBUG, ("Getting period [Burst mode]\n"));
|
||||
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * systemFrequency);
|
||||
}
|
||||
|
||||
int setPeriodCont(int64_t val) {
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", (long long int)val));
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
FILE_LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val));
|
||||
val *= (1E-9 * systemFrequency);
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getPeriodCont();
|
||||
val /= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
val /= (1E-9 * systemFrequency);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -859,21 +918,22 @@ int setPeriodCont(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getPeriodCont() {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
FILE_LOG(logDEBUG, ("Getting period [Continuous mode]\n"));
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * systemFrequency);
|
||||
}
|
||||
|
||||
int setDelayAfterTrigger(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", val));
|
||||
val *= (1E-9 * systemFrequency);
|
||||
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getDelayAfterTrigger();
|
||||
val /= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
val /= (1E-9 * systemFrequency);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -881,7 +941,37 @@ int setDelayAfterTrigger(int64_t val) {
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTrigger() {
|
||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * systemFrequency);
|
||||
}
|
||||
|
||||
int setBurstPeriod(int64_t val) {
|
||||
if (val < 0) {
|
||||
FILE_LOG(logERROR, ("Invalid burst period: %lld ns\n", val));
|
||||
return FAIL;
|
||||
}
|
||||
FILE_LOG(logINFO, ("Setting burst period %lld ns\n", val));
|
||||
burstPeriodNs = val;
|
||||
val *= (1E-9 * systemFrequency);
|
||||
if (burstMode != BURST_OFF) {
|
||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("\t(Continuous mode): not writing burst period to register\n"));
|
||||
}
|
||||
|
||||
// validate for tolerance
|
||||
int64_t retval = getBurstPeriod();
|
||||
val /= (1E-9 * systemFrequency);
|
||||
if (val != retval) {
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int64_t getBurstPeriod() {
|
||||
if (burstMode != BURST_OFF) {
|
||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) / (1E-9 * systemFrequency);
|
||||
}
|
||||
return burstPeriodNs;
|
||||
}
|
||||
|
||||
int64_t getNumFramesLeft() {
|
||||
@ -893,11 +983,11 @@ int64_t getNumTriggersLeft() {
|
||||
}
|
||||
|
||||
int64_t getDelayAfterTriggerLeft() {
|
||||
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * systemFrequency);
|
||||
}
|
||||
|
||||
int64_t getPeriodLeft() {
|
||||
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-9 * systemFrequency);
|
||||
}
|
||||
|
||||
int64_t getFramesFromStart() {
|
||||
@ -1108,6 +1198,10 @@ void setTiming( enum timingMode arg){
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("\tUpdating trigger/burst and delay/burst period registers\n"))
|
||||
setNumTriggers(numTriggers);
|
||||
setNumBursts(numBursts);
|
||||
}
|
||||
|
||||
enum timingMode getTiming() {
|
||||
@ -1470,6 +1564,10 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
||||
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq);
|
||||
clkFrequency[ind] = newfreq;
|
||||
FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind]));
|
||||
// update system frequency
|
||||
if (ind == SYSTEM_C0) {
|
||||
setTimingSource(getTimingSource());
|
||||
}
|
||||
|
||||
// phase is reset by pll (when setting output frequency)
|
||||
if (ind >= READOUT_C0) {
|
||||
@ -1778,10 +1876,24 @@ int setBurstModeinFPGA(enum burstMode value) {
|
||||
int setBurstMode(enum burstMode burst) {
|
||||
FILE_LOG(logINFO, ("Setting burst mode to %s\n", burst == BURST_OFF ? "off" : (burst == BURST_INTERNAL ? "internal" : "external")));
|
||||
|
||||
// remember the number of frames and period (before changing burst mode)
|
||||
int64_t frames = getNumFrames();
|
||||
int64_t period = getPeriod();
|
||||
|
||||
if (setBurstModeinFPGA(burst) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO, ("\tUpdating trigger/burst and burst period registers\n"))
|
||||
setNumTriggers(numTriggers);
|
||||
setNumBursts(numBursts);
|
||||
setBurstPeriod(burstPeriodNs);
|
||||
|
||||
// set number of frames and period again (set registers according to timing mode)
|
||||
FILE_LOG(logINFO, ("\tUpdating #frames and period registers\n"));
|
||||
setNumFrames(frames);
|
||||
setPeriod(period);
|
||||
|
||||
FILE_LOG(logINFO, ("\tSetting %s Mode in Chip\n", burstMode == BURST_OFF ? "Continuous" : "Burst"));
|
||||
int value = burstMode ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
|
||||
|
||||
@ -1829,84 +1941,64 @@ enum burstMode getBurstMode() {
|
||||
int runmode = bus_r (addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
||||
switch (runmode) {
|
||||
case ASIC_CONFIG_RUN_MODE_CONT_VAL:
|
||||
return BURST_OFF;
|
||||
burstMode = BURST_OFF;
|
||||
break;
|
||||
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||
return BURST_INTERNAL;
|
||||
burstMode = BURST_INTERNAL;
|
||||
break;
|
||||
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||
return BURST_EXTERNAL;
|
||||
burstMode = BURST_EXTERNAL;
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
||||
return -1;
|
||||
}
|
||||
return burstMode;
|
||||
}
|
||||
|
||||
void setCurrentSource(int value) {
|
||||
uint32_t addr = ASIC_CONFIG_REG;
|
||||
if (value > 0) {
|
||||
bus_w(addr, (bus_r(addr) | ASIC_CONFIG_CURRENT_SRC_EN_MSK));
|
||||
} else if (value == 0) {
|
||||
bus_w(addr, (bus_r(addr) &~ ASIC_CONFIG_CURRENT_SRC_EN_MSK));
|
||||
}
|
||||
}
|
||||
|
||||
int getCurrentSource() {
|
||||
return ((bus_r(ASIC_CONFIG_REG) & ASIC_CONFIG_CURRENT_SRC_EN_MSK) >> ASIC_CONFIG_CURRENT_SRC_EN_OFST);
|
||||
}
|
||||
|
||||
void setTimingSource(enum timingSourceType value) {
|
||||
uint32_t addr = CONTROL_REG;
|
||||
switch (value) {
|
||||
case TIMING_INTERNAL:
|
||||
FILE_LOG(logINFO, ("Setting timing source to internal\n"));
|
||||
bus_w(addr, (bus_r(addr) &~ CONTROL_TIMING_SOURCE_EXT_MSK));
|
||||
systemFrequency = INT_SYSTEM_C0_FREQUENCY;
|
||||
break;
|
||||
case TIMING_EXTERNAL:
|
||||
FILE_LOG(logINFO, ("Setting timing source to exernal\n"));
|
||||
bus_w(addr, (bus_r(addr) | CONTROL_TIMING_SOURCE_EXT_MSK));
|
||||
systemFrequency = clkFrequency[SYSTEM_C0];
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Unknown timing source %d\n", value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
enum timingSourceType getTimingSource() {
|
||||
if (bus_r(CONTROL_REG) & CONTROL_TIMING_SOURCE_EXT_MSK) {
|
||||
return TIMING_EXTERNAL;
|
||||
}
|
||||
return TIMING_INTERNAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int updateAcquisitionRegisters(char* mess) {
|
||||
// burst mode
|
||||
if (burstMode != BURST_OFF) {
|
||||
// validate #frames in burst mode
|
||||
if (nframes > MAX_FRAMES_IN_BURST_MODE) {
|
||||
sprintf(mess, "Could not start acquisition because number of frames %lld must be <= %d in burst mode.\n", (long long unsigned int)nframes, MAX_FRAMES_IN_BURST_MODE);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
setNumFramesBurst(nframes);
|
||||
// exptime
|
||||
if (setExptimeBurst(exptime_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because exptime could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
// period
|
||||
if (setPeriodBurst(period_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodBurst());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// set continuous values to default (exptime same register)
|
||||
FILE_LOG(logINFO, ("Setting continuous mode registers to defaults\n"));
|
||||
// frames
|
||||
setNumFramesCont(1);
|
||||
// period
|
||||
if (setPeriodCont(0) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set 0 ns, got %lld ns.\n", getPeriodCont());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
// continuous
|
||||
else {
|
||||
// frames
|
||||
setNumFramesCont(nframes);
|
||||
// exptime
|
||||
if (setExptimeCont(exptime_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because exptime could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
// period
|
||||
if (setPeriodCont(period_ns) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodCont());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
// set burst values to default (exptime same register)
|
||||
FILE_LOG(logINFO, ("Setting burst mode registers to defaults\n"));
|
||||
setNumFramesBurst(1);
|
||||
// period
|
||||
if (setPeriodBurst(0) == FAIL) {
|
||||
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set 0 ns, got %lld ns.\n", getPeriodBurst());
|
||||
FILE_LOG(logERROR,(mess));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
// create udp socket
|
||||
|
@ -27,17 +27,23 @@
|
||||
#define TYPE_GOTTHARD2_MODULE_VAL (512)
|
||||
#define TYPE_TOLERANCE (10)
|
||||
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||
#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
|
||||
|
||||
/** Default Parameters */
|
||||
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
|
||||
#define DEFAULT_NUM_FRAMES (1)
|
||||
#define DEFAULT_NUM_CYCLES (1)
|
||||
#define DEFAULT_NUM_BURSTS (1)
|
||||
#define DEFAULT_EXPTIME (0) // 0 ms (220ns in firmware)
|
||||
#define DEFAULT_PERIOD (1 * 1000) // 1 ms
|
||||
#define DEFAULT_PERIOD (0) // 0 ms
|
||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||
#define DEFAULT_BURST_PERIOD (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||
#define DEFAULT_CURRENT_SOURCE (0)
|
||||
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
|
||||
|
||||
#define DEFAULT_READOUT_C0 (144444448) // rdo_clk, 144 MHz
|
||||
#define DEFAULT_READOUT_C1 (144444448) // rdo_x2_clk, 144 MHz
|
||||
#define DEFAULT_SYSTEM_C0 (144444448) // run_clk, 144 MHz
|
||||
@ -47,9 +53,10 @@
|
||||
|
||||
/* Firmware Definitions */
|
||||
#define IP_HEADER_SIZE (20)
|
||||
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz
|
||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // Hz
|
||||
#define SYSTEM_PLL_VCO_FREQ_HZ (722222240) // Hz
|
||||
#define FIXED_PLL_FREQUENCY (20000000) // 20MHz
|
||||
#define INT_SYSTEM_C0_FREQUENCY (144000000) //144 MHz
|
||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // 866 MHz
|
||||
#define SYSTEM_PLL_VCO_FREQ_HZ (722222224) // 722 MHz
|
||||
|
||||
/** Other Definitions */
|
||||
#define BIT16_MASK (0xFFFF)
|
||||
|
Binary file not shown.
@ -28,7 +28,7 @@ target_compile_definitions(jungfrauDetectorServer_virtual
|
||||
)
|
||||
|
||||
target_link_libraries(jungfrauDetectorServer_virtual
|
||||
PUBLIC pthread rt
|
||||
PUBLIC pthread rt slsProjectOptions slsProjectWarnings
|
||||
)
|
||||
|
||||
set_target_properties(jungfrauDetectorServer_virtual PROPERTIES
|
||||
|
@ -219,6 +219,8 @@
|
||||
#define PLL_CNTRL_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_PLL_RST_OFST (3)
|
||||
#define PLL_CNTRL_PLL_RST_MSK (0x00000001 << PLL_CNTRL_PLL_RST_OFST)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_OFST (5)
|
||||
#define PLL_CNTRL_DBIT_WR_PRMTR_MSK (0x00000001 << PLL_CNTRL_DBIT_WR_PRMTR_OFST)
|
||||
#define PLL_CNTRL_ADDR_OFST (16)
|
||||
#define PLL_CNTRL_ADDR_MSK (0x0000003F << PLL_CNTRL_ADDR_OFST)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user