mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 15:27:13 +02:00
Compare commits
215 Commits
2020.08.12
...
2020.09.11
Author | SHA1 | Date | |
---|---|---|---|
3b071cc43f | |||
2805359cd0 | |||
1515b79c97 | |||
2ab4bb1c04 | |||
5214c0f1a4 | |||
60bc3a8fa7 | |||
00f780665f | |||
ab738790e0 | |||
d4cff5b99c | |||
84f49a9b27 | |||
a4926e6ae1 | |||
cf8785ad2e | |||
be8284f5c2 | |||
3fd32b2c9c | |||
d70090967d | |||
88fe306902 | |||
d931416def | |||
6cfaa92b61 | |||
c94dfde17c | |||
b879a377ba | |||
d420451751 | |||
2bc33ad34a | |||
cb23e827bf | |||
a0f915316e | |||
2733bc5320 | |||
3b82e9fcc1 | |||
a95d8f664a | |||
11e7d89da3 | |||
34043c358f | |||
da9c7c354e | |||
4d499e231d | |||
0a7809286b | |||
00abb5e14b | |||
22c2bb0258 | |||
9d1cd09fd4 | |||
80b053eb10 | |||
3cd4f3897b | |||
d011186b9a | |||
669c14d6d5 | |||
ecabc94ade | |||
c58a2d957d | |||
1b214778a5 | |||
d5f6cbc075 | |||
52303daffd | |||
02d4769f6a | |||
a9d1a78662 | |||
3cf2160a2d | |||
4917812bb0 | |||
a0f9c6fe8c | |||
82e978e901 | |||
04bf2aca6d | |||
8bdfe7527f | |||
b33fdf4462 | |||
70386633f6 | |||
6c8443f09e | |||
bf52ec10da | |||
bdac4d133e | |||
e8156d412e | |||
97687f0f6d | |||
bfbfe204f4 | |||
67d57eb5cd | |||
f940c09290 | |||
30293b1d36 | |||
8e09b50c5e | |||
87bad38f80 | |||
67f1f9924a | |||
e1e04ee755 | |||
6e06d4307d | |||
20a959bf61 | |||
8e49a114db | |||
aecde086a0 | |||
311cebcd00 | |||
8496f5715f | |||
f26d8e514b | |||
0b9ff70244 | |||
e82e531fb1 | |||
503f83e8e3 | |||
1a90c58d9e | |||
c467bd677e | |||
f280d033b9 | |||
c9cf845c9a | |||
63bbbfb438 | |||
5540f16116 | |||
a77833b4c7 | |||
9ee67f2cfa | |||
cf3758f155 | |||
b20720686e | |||
1edb1e8816 | |||
30e06c6386 | |||
ea601fe1f7 | |||
f0c576c779 | |||
fb8842e048 | |||
5b182469a1 | |||
a1b88d3a62 | |||
514346c3ba | |||
9218ef5a95 | |||
b124cea67b | |||
497eff6f04 | |||
92635c5bd3 | |||
a00231dab6 | |||
35c7e46d60 | |||
47da2540af | |||
891b8dbd2c | |||
89f0479318 | |||
7048a75808 | |||
a081fbbdaa | |||
22f14cacb0 | |||
6b7dee2631 | |||
6d1856daa2 | |||
7bb9696151 | |||
44335f9cf4 | |||
d62d5ef804 | |||
dbaab61ea2 | |||
180c7b7191 | |||
050f0ff8a0 | |||
658a804cca | |||
73530ddd6f | |||
abe34d573c | |||
05d5652532 | |||
38e0351068 | |||
e192cad1f2 | |||
b8350b070e | |||
3ddeea3c2b | |||
42b5ff3a62 | |||
00978a52c8 | |||
8400c686b5 | |||
adb6171e35 | |||
973b8f7106 | |||
2f81c233f5 | |||
e4274e3f95 | |||
b92f9af025 | |||
7ca1609c58 | |||
4cd81437ab | |||
7e202b6c26 | |||
e0df9fcd99 | |||
30307220e3 | |||
6a74851e0c | |||
ac30717083 | |||
bfed02b41e | |||
b5669dc921 | |||
97ee2d269d | |||
bc5cc3fa29 | |||
abd2808924 | |||
786b14e88b | |||
f19799343e | |||
2e4783f296 | |||
3954913661 | |||
7eafceb0f9 | |||
a1e06ca7a9 | |||
27c1916d63 | |||
64075c0e75 | |||
9505c51404 | |||
6d8168722a | |||
f9261c0f32 | |||
d44388a44e | |||
6a18a214ba | |||
83baf18490 | |||
ddf2085b4b | |||
508ec150f5 | |||
5eda75ebdd | |||
0253933271 | |||
0f80079d16 | |||
fd601128b7 | |||
bc09b8bfb9 | |||
e85326d415 | |||
396685e6a9 | |||
cf6a48d7a9 | |||
4f45110cda | |||
3aa75ce167 | |||
5b364b9ad8 | |||
550ab51f34 | |||
e782fcce62 | |||
a2ec86006d | |||
6399d1bdfb | |||
6cd8bbcb12 | |||
678967bfe1 | |||
ffd694eda1 | |||
ab2f929e83 | |||
4540eddd68 | |||
534c7105f4 | |||
c8a39d1d9e | |||
bd6d212f99 | |||
c4f0052ac9 | |||
5bfbc83a04 | |||
429eb8da53 | |||
f6cde374c4 | |||
1f811dfabd | |||
8ef6f32be6 | |||
a7cc2b38d8 | |||
9b26f5a6c8 | |||
c4fde7f7bc | |||
5f23a664fa | |||
209c97f44c | |||
d631fda2c7 | |||
caff89a040 | |||
42067b3de3 | |||
a287ce46b1 | |||
7212a0d433 | |||
9bae97ec4c | |||
096b0c424d | |||
39c2ab4743 | |||
57e0fd805e | |||
071a1c9f98 | |||
0cb418a89b | |||
4e9c99d65d | |||
dd918fb326 | |||
7ea86dec43 | |||
eeb386fef5 | |||
afabc9a503 | |||
1d8f9a5aed | |||
d4e11e56ea | |||
de69e666a9 | |||
28ffad223d | |||
f0d0e9ab1f | |||
854d8d4ae2 |
@ -63,17 +63,18 @@ find_package(ClangFormat)
|
|||||||
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
|
check_ipo_supported(RESULT SLS_LTO_AVAILABLE)
|
||||||
|
|
||||||
|
|
||||||
# Use ld.gold if it is available and isn't disabled explicitly
|
# # Use ld.gold if it is available and isn't disabled explicitly
|
||||||
option(SLS_USE_LD_GOLD "Use GNU gold linker" ON)
|
# option(SLS_USE_LD_GOLD "Use GNU gold linker" ON)
|
||||||
if (SLS_USE_LD_GOLD)
|
# if (SLS_USE_LD_GOLD)
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
# execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
|
||||||
if ("${LD_VERSION}" MATCHES "GNU gold")
|
# if ("${LD_VERSION}" MATCHES "GNU gold")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
|
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
|
# set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
else ()
|
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
message(WARNING "GNU gold linker isn't available, using the default system linker.")
|
# else ()
|
||||||
endif ()
|
# message(WARNING "GNU gold linker isn't available, using the default system linker.")
|
||||||
endif ()
|
# endif ()
|
||||||
|
# endif ()
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
@ -240,7 +241,7 @@ if(SLS_MASTER_PROJECT)
|
|||||||
# Set install dir CMake packages
|
# Set install dir CMake packages
|
||||||
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
|
set(CMAKE_INSTALL_DIR "share/cmake/${PROJECT_NAME}")
|
||||||
# Set the list of exported targets
|
# Set the list of exported targets
|
||||||
set(PROJECT_LIBRARIES slsSupportLib slsDetectorShared slsReceiverShared)
|
set(PROJECT_LIBRARIES slsSupportShared slsDetectorShared slsReceiverShared)
|
||||||
# Generate and install package config file and version
|
# Generate and install package config file and version
|
||||||
include(cmake/package_config.cmake)
|
include(cmake/package_config.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#Look for an executable called sphinx-build
|
#Look for an executable called sphinx-build
|
||||||
find_program(SPHINX_EXECUTABLE
|
find_program(SPHINX_EXECUTABLE
|
||||||
NAMES sphinx-build
|
NAMES sphinx-build sphinx-build-3.6
|
||||||
DOC "Path to sphinx-build executable")
|
DOC "Path to sphinx-build executable")
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
@ -33,6 +33,7 @@ requirements:
|
|||||||
- {{ cdt('libselinux') }} # [linux]
|
- {{ cdt('libselinux') }} # [linux]
|
||||||
- {{ cdt('libxdamage') }} # [linux]
|
- {{ cdt('libxdamage') }} # [linux]
|
||||||
- {{ cdt('libxxf86vm') }} # [linux]
|
- {{ cdt('libxxf86vm') }} # [linux]
|
||||||
|
- expat
|
||||||
|
|
||||||
host:
|
host:
|
||||||
- libstdcxx-ng
|
- libstdcxx-ng
|
||||||
@ -45,6 +46,7 @@ requirements:
|
|||||||
- xorg-libxau
|
- xorg-libxau
|
||||||
- xorg-libxrender
|
- xorg-libxrender
|
||||||
- xorg-libxfixes
|
- xorg-libxfixes
|
||||||
|
- expat
|
||||||
|
|
||||||
run:
|
run:
|
||||||
- zeromq
|
- zeromq
|
||||||
@ -96,3 +98,4 @@ outputs:
|
|||||||
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
- {{ pin_subpackage('slsdetlib', exact=True) }}
|
||||||
- qwt 6.*
|
- qwt 6.*
|
||||||
- qt 4.8.*
|
- qt 4.8.*
|
||||||
|
- expat
|
||||||
|
@ -59,14 +59,13 @@ set( HEADERS
|
|||||||
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
#set(ROOT_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
# ROOT dictionary generation
|
# ROOT dictionary generation
|
||||||
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
|
include("${ROOT_DIR}/RootMacros.cmake")
|
||||||
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
|
root_generate_dictionary(ctbDict ${HEADERS} LINKDEF ctbLinkDef.h)
|
||||||
add_library(ctbRootLib SHARED ctbDict.cxx)
|
add_library(ctbRootLib SHARED ctbDict.cxx)
|
||||||
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(ctbRootLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
target_link_libraries(ctbRootLib PUBLIC
|
target_link_libraries(ctbRootLib PUBLIC
|
||||||
ROOT::Core
|
ROOT::Core
|
||||||
slsDetectorShared
|
slsDetectorShared
|
||||||
slsSupportLib
|
|
||||||
${ROOT_LIBRARIES}
|
${ROOT_LIBRARIES}
|
||||||
${ROOT_EXE_LINKER_FLAGS}
|
${ROOT_EXE_LINKER_FLAGS}
|
||||||
)
|
)
|
||||||
@ -78,7 +77,6 @@ set_target_properties(
|
|||||||
|
|
||||||
target_link_libraries(ctbGui PUBLIC
|
target_link_libraries(ctbGui PUBLIC
|
||||||
slsDetectorShared
|
slsDetectorShared
|
||||||
slsSupportLib
|
|
||||||
ctbRootLib
|
ctbRootLib
|
||||||
${TIFF_LIBRARIES}
|
${TIFF_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
@ -43,6 +43,7 @@ set(SPHINX_SOURCE_FILES
|
|||||||
src/type_traits.rst
|
src/type_traits.rst
|
||||||
src/ToString.rst
|
src/ToString.rst
|
||||||
src/examples.rst
|
src/examples.rst
|
||||||
|
src/pygettingstarted.rst
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ int main() {
|
|||||||
auto tmp = os.str().erase(0, cmd.size());
|
auto tmp = os.str().erase(0, cmd.size());
|
||||||
auto usage = tmp.substr(0, tmp.find_first_of('\n'));
|
auto usage = tmp.substr(0, tmp.find_first_of('\n'));
|
||||||
tmp.erase(0, usage.size());
|
tmp.erase(0, usage.size());
|
||||||
auto help = replace_all(tmp, "\n\t", "\n\t\t");
|
auto help = replace_all(tmp, "\n\t", "\n\t\t| ");
|
||||||
fs << '\t' << cmd << usage << help << "\n";
|
fs << '\t' << cmd << usage << help << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,6 +32,7 @@ Welcome to slsDetectorPackage's documentation!
|
|||||||
:caption: Python API
|
:caption: Python API
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
pygettingstarted
|
||||||
pydetector
|
pydetector
|
||||||
pyenums
|
pyenums
|
||||||
pyexamples
|
pyexamples
|
||||||
|
@ -7,3 +7,4 @@ Detector
|
|||||||
:members:
|
:members:
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
:inherited-members:
|
@ -4,6 +4,31 @@ Enums
|
|||||||
These enums are defined in slsDetectorDefs in the C++ package and
|
These enums are defined in slsDetectorDefs in the C++ package and
|
||||||
exposed to Python through pybind11.
|
exposed to Python through pybind11.
|
||||||
|
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# Most settings are represented as enums that can be
|
||||||
|
# explicitly imported
|
||||||
|
|
||||||
|
from slsdet import Detector, fileFormat
|
||||||
|
d = Detector()
|
||||||
|
d.fformat = fileFormat.BINARY
|
||||||
|
|
||||||
|
# Altough not recommended for convenience all enums
|
||||||
|
# and some other things can be impored using *
|
||||||
|
|
||||||
|
from slsdet import *
|
||||||
|
d.speed = speedLevel.FULL_SPEED
|
||||||
|
|
||||||
|
# To list the available enums, use dir()
|
||||||
|
|
||||||
|
import slsdet.enums
|
||||||
|
for enum in dir(slsdet.enums):
|
||||||
|
# filter out special memebers
|
||||||
|
if not enum.startswith('_'):
|
||||||
|
print(enum)
|
||||||
|
|
||||||
|
|
||||||
.. py:currentmodule:: slsdet
|
.. py:currentmodule:: slsdet
|
||||||
|
|
||||||
.. autoclass:: runStatus
|
.. autoclass:: runStatus
|
||||||
|
@ -1,7 +1,73 @@
|
|||||||
Examples
|
Examples
|
||||||
================
|
================
|
||||||
|
|
||||||
Some short hints on how to use the detector
|
Some short examples on how to use slsdet. If something is missing don't hesitate to
|
||||||
|
open an issue in our our `github repo
|
||||||
|
<https://github.com/slsdetectorgroup/slsDetectorPackage>`_.
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------
|
||||||
|
Setting exposure time
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
Setting and reading back exposure time can be done either using a Python datetime.timedelta
|
||||||
|
or by setting the time in seconds.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# Set exposure time to 1.2 seconds
|
||||||
|
>>> d.exptime = 1.2
|
||||||
|
|
||||||
|
# Setting exposure time using timedelta
|
||||||
|
import datetime as dt
|
||||||
|
>>> d.exptime = dt.timedelta(seconds = 1.2)
|
||||||
|
|
||||||
|
# With timedelta any arbitrary combination of units can be used
|
||||||
|
>>> t = dt.timedelta(microseconds = 100, seconds = 5.3, minutes = .3)
|
||||||
|
|
||||||
|
# To set exposure time for individual detector one have to resort
|
||||||
|
# to the C++ style API.
|
||||||
|
# Sets exposure time to 1.2 seconds for module 0, 6 and 12
|
||||||
|
>>> d.setExptime(1.2, [0, 6, 12])
|
||||||
|
>>> d.setExptime(dt.timedelta(seconds = 1.2), [0, 6, 12])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------
|
||||||
|
Converting numbers to hex
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
Python support entering numbers in format by using the 0x prefix. However, when reading
|
||||||
|
back you will get a normal integer. This can then be converted to a hex string representation
|
||||||
|
using the built in hex() function.
|
||||||
|
|
||||||
|
.. code-block :: python
|
||||||
|
|
||||||
|
from slsdet import Detector
|
||||||
|
>>> d = Detector()
|
||||||
|
>>> d.patwait0 = 0xaa
|
||||||
|
>>> d.patwait0
|
||||||
|
170
|
||||||
|
|
||||||
|
# Convert to string
|
||||||
|
>>> hex(d.patwait0)
|
||||||
|
'0xaa'
|
||||||
|
|
||||||
|
For multiple values one can use a list comprehension to loop over the values.
|
||||||
|
|
||||||
|
.. code-block :: python
|
||||||
|
|
||||||
|
>>> values = [1,2,3,4,5]
|
||||||
|
>>> [(v) for v in values]
|
||||||
|
['0x1', '0x2', '0x3', '0x4', '0x5']
|
||||||
|
|
||||||
|
# or to a single string by passing the list to .join
|
||||||
|
>>> ', '.join([hex(v) for v in values])
|
||||||
|
'0x1, 0x2, 0x3, 0x4, 0x5'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
Simple threshold scan
|
Simple threshold scan
|
||||||
@ -74,37 +140,39 @@ But lets start looking at the at the manual way:
|
|||||||
::
|
::
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from slsdet import Eiger
|
from slsdet import Detector, runStatus
|
||||||
d = Eiger()
|
|
||||||
|
|
||||||
n = 10
|
|
||||||
t = 1
|
|
||||||
|
|
||||||
d.exposure_time = t
|
n_frames = 10
|
||||||
d.n_frames = n
|
t_exp = 1
|
||||||
d.reset_frames_caught()
|
|
||||||
|
|
||||||
#Start the measurement
|
# Set exposure time and number of frames
|
||||||
|
d = Detector()
|
||||||
|
d.exptime = t_exp
|
||||||
|
d.frames = n_frames
|
||||||
|
|
||||||
|
# Start the measurement
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
d.start_receiver()
|
d.startDetector()
|
||||||
d.start_detector()
|
d.startReceiver()
|
||||||
|
|
||||||
#Wait for the detector to be ready or do other important stuff
|
# Wait for the detector to be ready or do other important stuff
|
||||||
time.sleep(t*n)
|
time.sleep(t_exp * n_frames)
|
||||||
|
|
||||||
#check if the detector is ready otherwise wait a bit longer
|
# check if the detector is ready otherwise wait a bit longer
|
||||||
while d.status != 'idle':
|
while d.status != runStatus.IDLE:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
#Stop the receiver after we got the frames
|
# Stop the receiver after we got the frames
|
||||||
#Detector is already idle so we don't need to stop it
|
# Detector is already idle so we don't need to stop it
|
||||||
d.stop_receiver()
|
d.stopReceiver()
|
||||||
|
|
||||||
|
lost = d.rx_framescaught - n_frames
|
||||||
|
print(
|
||||||
|
f"{n_frames} frames of {t_exp}s took {time.time()-t0:{.3}}s with {lost} frames lost "
|
||||||
|
)
|
||||||
|
|
||||||
lost = d.frames_caught - n
|
|
||||||
print(f'{n} frames of {t}s took {time.time()-t0:{.3}}s with {lost} frames lost ')
|
|
||||||
|
|
||||||
#Reset to not interfere with a potential next measurement
|
|
||||||
d.reset_frames_caught()
|
|
||||||
|
|
||||||
Instead launching d.acq() from a different process is a bit easier since the control of receiver and detector
|
Instead launching d.acq() from a different process is a bit easier since the control of receiver and detector
|
||||||
is handled in the acq call. However, you need to join the process used otherwise a lot of zombie processes would
|
is handled in the acq call. However, you need to join the process used otherwise a lot of zombie processes would
|
||||||
@ -114,30 +182,104 @@ hang around until the main process exits.
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
from slsdet import Eiger
|
from slsdet import Detector, runStatus
|
||||||
|
|
||||||
def acquire():
|
|
||||||
"""
|
|
||||||
Create a new Eiger object that still referes to the same actual detector
|
|
||||||
and same shared memory. Then launch acq.
|
|
||||||
"""
|
|
||||||
detector = Eiger()
|
|
||||||
detector.acq()
|
|
||||||
|
|
||||||
#This is the detector we use throughout the session
|
d = Detector()
|
||||||
d = Eiger()
|
|
||||||
|
|
||||||
#Process to run acquire
|
#Create a separate process to run acquire in
|
||||||
p = Process(target=acquire)
|
p = Process(target=d.acquire)
|
||||||
|
|
||||||
#Start the thread and short sleep to allow the acq to start
|
#Start the thread and short sleep to allow the acq to start
|
||||||
p.start()
|
p.start()
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
#Do some other work
|
#Do some other work
|
||||||
while d.busy is True:
|
while d.status != runStatus.IDLE:
|
||||||
print(d.busy)
|
print("Working")
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
#Join the process
|
#Join the process
|
||||||
p.join()
|
p.join()
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------
|
||||||
|
Setting and getting times
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
import datetime as dt
|
||||||
|
from slsdet import Detector
|
||||||
|
from slsdet.utils import element_if_equal
|
||||||
|
|
||||||
|
d = Detector()
|
||||||
|
|
||||||
|
# The simplest way is to set the exposure time in
|
||||||
|
# seconds by using the exptime property
|
||||||
|
# This sets the exposure time for all modules
|
||||||
|
d.exptime = 0.5
|
||||||
|
|
||||||
|
# exptime also accepts a python datetime.timedelta
|
||||||
|
# which can be used to set the time in almost any unit
|
||||||
|
t = dt.timedelta(milliseconds = 2.3)
|
||||||
|
d.exptime = t
|
||||||
|
|
||||||
|
# or combination of units
|
||||||
|
t = dt.timedelta(minutes = 3, seconds = 1.23)
|
||||||
|
d.exptime = t
|
||||||
|
|
||||||
|
# exptime however always returns the time in seconds
|
||||||
|
>>> d.exptime
|
||||||
|
181.23
|
||||||
|
|
||||||
|
# To get back the exposure time for each module
|
||||||
|
# it's possible to use getExptime, this also returns
|
||||||
|
# the values as datetime.timedelta
|
||||||
|
|
||||||
|
>>> d.getExptime()
|
||||||
|
[datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)]
|
||||||
|
|
||||||
|
# In case the values are the same it's possible to use the
|
||||||
|
# element_if_equal function to reduce the values to a single
|
||||||
|
# value
|
||||||
|
|
||||||
|
>>> t = d.getExptime()
|
||||||
|
>>> element_if_equal(t)
|
||||||
|
datetime.timedelta(seconds=1)
|
||||||
|
|
||||||
|
--------------
|
||||||
|
Reading dacs
|
||||||
|
--------------
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
from slsdet import Detector, Eiger, dacIndex
|
||||||
|
|
||||||
|
#using the specialized class
|
||||||
|
e = Eiger()
|
||||||
|
>>> e.dacs
|
||||||
|
========== DACS =========
|
||||||
|
vsvp : 0 0
|
||||||
|
vtrim : 2480 2480
|
||||||
|
vrpreamp : 3300 3300
|
||||||
|
vrshaper : 1400 1400
|
||||||
|
vsvn : 4000 4000
|
||||||
|
vtgstv : 2556 2556
|
||||||
|
vcmp_ll : 1000 1000
|
||||||
|
vcmp_lr : 1000 1000
|
||||||
|
vcal : 0 0
|
||||||
|
vcmp_rl : 1000 1000
|
||||||
|
rxb_rb : 1100 1100
|
||||||
|
rxb_lb : 1100 1100
|
||||||
|
vcmp_rr : 1000 1000
|
||||||
|
vcp : 1000 1000
|
||||||
|
vcn : 2000 2000
|
||||||
|
vishaper : 1550 1550
|
||||||
|
iodelay : 650 650
|
||||||
|
|
||||||
|
# or using the general class and the list
|
||||||
|
d = Detector()
|
||||||
|
for dac in d.daclist:
|
||||||
|
r = d.getDAC(dac, False)
|
||||||
|
print(f'{dac.name:10s} {r}')
|
||||||
|
228
docs/src/pygettingstarted.rst
Normal file
228
docs/src/pygettingstarted.rst
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
Getting Started
|
||||||
|
==================
|
||||||
|
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
Which Python?
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
We require at lest Python 3.6 and strongly recommended that you don't use the system
|
||||||
|
Python installation. The examples in this documentation uses `conda
|
||||||
|
<https://docs.conda.io/en/latest/miniconda.html>`_ since it provides good support
|
||||||
|
also for non Python packages but there are also other alternatives like, pyenv.
|
||||||
|
|
||||||
|
Using something like conda also allows you to quickly switch beteen different Python
|
||||||
|
environments.
|
||||||
|
|
||||||
|
.. warning ::
|
||||||
|
|
||||||
|
If you use conda avoid also installing packages with pip.
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
PYTHONPATH
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
If you install slsdet using conda everything is set up and you can
|
||||||
|
directly start using the Python bindings. However, if you build
|
||||||
|
from source you need to tell Python where to find slsdet. This
|
||||||
|
is be done by adding your build/bin directory to PYTHONPATH.
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
export PYTHONPATH = /path/to/your/build/bin:$PYTHONPATH
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
Don't forget to compile with the option SLS_USE_PYTHON=ON to enable
|
||||||
|
the Python bindings or if you use the cmk.sh script -p.
|
||||||
|
|
||||||
|
--------------------------------------
|
||||||
|
Which detector class should I use?
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
We provide a generic class called Detector and detector specific
|
||||||
|
versions like, Eiger, Jungfrau etc. The most or all functionality
|
||||||
|
is there in the base class except the convenient access to dacs
|
||||||
|
and temperatures.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
from slsdet import Detector, Eiger
|
||||||
|
|
||||||
|
d = Detector()
|
||||||
|
e = Eiger()
|
||||||
|
|
||||||
|
# Both classes can be used to control an Eiger detector
|
||||||
|
d.exptime = 0.5
|
||||||
|
e.period = 1
|
||||||
|
|
||||||
|
# But Eiger gives a simpler interface to the dacs
|
||||||
|
>>> e.dacs
|
||||||
|
========== DACS =========
|
||||||
|
vsvp : 0
|
||||||
|
vtrim : 2480
|
||||||
|
vrpreamp : 3300
|
||||||
|
vrshaper : 1400
|
||||||
|
vsvn : 4000
|
||||||
|
vtgstv : 2556
|
||||||
|
vcmp_ll : 1000
|
||||||
|
vcmp_lr : 1000
|
||||||
|
vcal : 0
|
||||||
|
vcmp_rl : 1000
|
||||||
|
rxb_rb : 1100
|
||||||
|
rxb_lb : 1100
|
||||||
|
vcmp_rr : 1000
|
||||||
|
vcp : 1000
|
||||||
|
vcn : 2000
|
||||||
|
vishaper : 1550
|
||||||
|
iodelay : 650
|
||||||
|
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
Depending on user feedback we might move some detector specific
|
||||||
|
functionality to the specialized classes.
|
||||||
|
|
||||||
|
|
||||||
|
----------------------------------
|
||||||
|
Hey, there seems to be two APIs?
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
To make the Python API approachable, both if you come from the command line
|
||||||
|
or are using the C++ API, we provide two interfaces to the detector.
|
||||||
|
One is property based and tries to stay as close to the command line syntax
|
||||||
|
as is possible, and the other one directly maps the C++ API found in Detector.h.
|
||||||
|
There is also an underlying design reason for the two APIs since we auto
|
||||||
|
generate the bindings to the C++ code using a mix of pybind11 and clang-tools.
|
||||||
|
The property based API covers most of the functionality but in some cases
|
||||||
|
you have to reach for the C++ like interface.
|
||||||
|
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
d = Detector()
|
||||||
|
|
||||||
|
# C++ like API
|
||||||
|
d.setExptime(0.1)
|
||||||
|
|
||||||
|
# or a bit more pythonic
|
||||||
|
d.exptime = 0.1
|
||||||
|
|
||||||
|
The c++ style API offers more control over access to individual modules
|
||||||
|
in a large detector.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
# Set exposure time for module 1, 5 and 7
|
||||||
|
d.setExptime(0.1, [1,5,7])
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
Finding functions
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
To find out which properties and methods that a Python object have you
|
||||||
|
can use dir()
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
>>> from slsdet import Detector
|
||||||
|
>>> d = Detector()
|
||||||
|
>>> dir(d)
|
||||||
|
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__',
|
||||||
|
'__eq__', '__format__', '__ge__', '__getattribute__', '__gt__',
|
||||||
|
'__hash__', '__init__', '__init_subclass__', '__le__', '__len__',
|
||||||
|
'__lt__', '__module__', '__ne__', '__new__', '__reduce__',
|
||||||
|
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
|
||||||
|
'__str__', '__subclasshook__', '_adc_register', '_frozen',
|
||||||
|
'_register', 'acquire', 'adcclk', 'adcphase', 'adcpipeline',
|
||||||
|
'adcreg', 'asamples', 'auto_comp_disable', 'clearAcquiringFlag',
|
||||||
|
'clearBit', 'clearROI', 'client_version', 'config', 'copyDetectorServer',
|
||||||
|
'counters', 'daclist', 'dacvalues', 'dbitclk', 'dbitphase' ...
|
||||||
|
|
||||||
|
Since the list for Detector is rather long it's an good idea to filter it.
|
||||||
|
The following example gives you properties and methods containing time in
|
||||||
|
their name.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
>>> [item for item in dir(d) if 'time' in item]
|
||||||
|
['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft',
|
||||||
|
'getSubExptime', 'patwaittime0', 'patwaittime1', 'patwaittime2',
|
||||||
|
'setExptime', 'setSubExptime', 'subdeadtime', 'subexptime']
|
||||||
|
|
||||||
|
The above method works on any Python object but for convenience we also
|
||||||
|
included two functions to find names. View prints the names one per line
|
||||||
|
while find returns a list of names.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
from slsdet.lookup import view, find
|
||||||
|
|
||||||
|
>>> view('exptime')
|
||||||
|
exptime
|
||||||
|
getExptime
|
||||||
|
getExptimeForAllGates
|
||||||
|
getExptimeLeft
|
||||||
|
getSubExptime
|
||||||
|
setExptime
|
||||||
|
setSubExptime
|
||||||
|
subexptime
|
||||||
|
|
||||||
|
>>> find('exptime')
|
||||||
|
['exptime', 'getExptime', 'getExptimeForAllGates', 'getExptimeLeft',
|
||||||
|
'getSubExptime', 'setExptime', 'setSubExptime', 'subexptime']
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------
|
||||||
|
Finding out what the function does
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
To access the documentation of a function directly from the Python prompt use help().
|
||||||
|
|
||||||
|
.. code-block :: python
|
||||||
|
|
||||||
|
>>> help(Detector.period)
|
||||||
|
Help on property:
|
||||||
|
|
||||||
|
Period between frames, accepts either a value in seconds or datetime.timedelta
|
||||||
|
|
||||||
|
Note
|
||||||
|
-----
|
||||||
|
:getter: always returns in seconds. To get in datetime.delta, use getPeriod
|
||||||
|
|
||||||
|
Examples
|
||||||
|
-----------
|
||||||
|
>>> d.period = 1.05
|
||||||
|
>>> d.period = datetime.timedelta(minutes = 3, seconds = 1.23)
|
||||||
|
>>> d.period
|
||||||
|
181.23
|
||||||
|
>>> d.getPeriod()
|
||||||
|
[datetime.timedelta(seconds=181, microseconds=230000)]
|
||||||
|
|
||||||
|
|
||||||
|
----------------------
|
||||||
|
Where are the ENUMs?
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
To set some of the detector settings like file format you have
|
||||||
|
to pass in an enum.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
>>> d.setFileFormat(fileFormat.BINARY)
|
||||||
|
|
||||||
|
The enums can be found in slsdet.enums
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
import slsdet
|
||||||
|
>>> [e for e in dir(slsdet.enums) if not e.startswith('_')]
|
||||||
|
['burstMode', 'clockIndex', 'dacIndex', 'detectorModeType',
|
||||||
|
'detectorSettings', 'detectorType', 'dimension', 'externalSignalFlag',
|
||||||
|
'fileFormat', 'frameDiscardPolicy', 'frameModeType', 'masterFlags',
|
||||||
|
'readoutMode', 'runStatus', 'speedLevel', 'timingMode',
|
||||||
|
'timingSourceType']
|
||||||
|
|
||||||
|
# Even though importing using * is not recommended one could
|
||||||
|
# get all the enums like this:
|
||||||
|
>>> from slsdet.enums import *
|
@ -41,11 +41,11 @@ hostname bchip074+bchip075+
|
|||||||
|
|
||||||
|
|
||||||
r_readfreq 1
|
r_readfreq 1
|
||||||
rx_datastream 1
|
rx_zmqstream 1
|
||||||
|
|
||||||
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
|
#replace my_receiver_hostname with the hostname of 1Gb IP of the machine where the receiver runs
|
||||||
rx_hostname my_receiver_hostname
|
rx_hostname my_receiver_hostname
|
||||||
rx_datastream 1
|
rx_zmqstream 1
|
||||||
outdir /tmp/
|
outdir /tmp/
|
||||||
|
|
||||||
|
|
||||||
|
@ -459,8 +459,8 @@ rx_hostname mpc2011
|
|||||||
|
|
||||||
tengiga 1
|
tengiga 1
|
||||||
|
|
||||||
rx_datastream 1
|
rx_zmqstream 1
|
||||||
rx_readfreq 1
|
rx_zmqfreq 1
|
||||||
|
|
||||||
|
|
||||||
dac 6 800
|
dac 6 800
|
||||||
|
@ -35,7 +35,7 @@ zmqport 50001
|
|||||||
|
|
||||||
|
|
||||||
tengiga 1
|
tengiga 1
|
||||||
rx_datastream 1
|
rx_zmqstream 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ period 0.0006
|
|||||||
############################################
|
############################################
|
||||||
fpath /mnt/moench_data/scratch/
|
fpath /mnt/moench_data/scratch/
|
||||||
fwrite 0
|
fwrite 0
|
||||||
rx_datastream 1
|
rx_zmqstream 1
|
||||||
|
|
||||||
rx_jsonpara frameMode frame
|
rx_jsonpara frameMode frame
|
||||||
rx_jsonpara detectorMode counting
|
rx_jsonpara detectorMode counting
|
||||||
|
@ -11,7 +11,7 @@ pybind11_add_module(_slsdet
|
|||||||
target_link_libraries(_slsdet PUBLIC
|
target_link_libraries(_slsdet PUBLIC
|
||||||
slsDetectorShared
|
slsDetectorShared
|
||||||
slsReceiverShared
|
slsReceiverShared
|
||||||
slsSupportLib
|
slsSupportShared
|
||||||
${ZeroMQ_LIBRARIES}
|
${ZeroMQ_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,11 +30,17 @@ set( PYTHON_FILES
|
|||||||
detector_property.py
|
detector_property.py
|
||||||
detector.py
|
detector.py
|
||||||
eiger.py
|
eiger.py
|
||||||
|
enums.py
|
||||||
errors.py
|
errors.py
|
||||||
|
gotthard.py
|
||||||
|
gotthard2.py
|
||||||
|
moench.py
|
||||||
|
proxy.py
|
||||||
ctb.py
|
ctb.py
|
||||||
jungfrau.py
|
jungfrau.py
|
||||||
mythen3.py
|
mythen3.py
|
||||||
registers.py
|
registers.py
|
||||||
|
temperature.py
|
||||||
lookup.py
|
lookup.py
|
||||||
utils.py
|
utils.py
|
||||||
|
|
||||||
|
42
python/examples/exposure_time.py
Normal file
42
python/examples/exposure_time.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
"""
|
||||||
|
Example showing how to set and get exposure times
|
||||||
|
"""
|
||||||
|
|
||||||
|
import datetime as dt
|
||||||
|
from slsdet import Detector
|
||||||
|
from slsdet.utils import element_if_equal
|
||||||
|
|
||||||
|
d = Detector()
|
||||||
|
|
||||||
|
# The simplest way is to set the exposure time in
|
||||||
|
# seconds by using the exptime property
|
||||||
|
# This sets the exposure time for all modules
|
||||||
|
d.exptime = 0.5
|
||||||
|
|
||||||
|
# exptime also accepts a python datetime.timedelta
|
||||||
|
# which can be used to set the time in almost any unit
|
||||||
|
t = dt.timedelta(milliseconds = 2.3)
|
||||||
|
d.exptime = t
|
||||||
|
|
||||||
|
# or combination of units
|
||||||
|
t = dt.timedelta(minutes = 3, seconds = 1.23)
|
||||||
|
d.exptime = t
|
||||||
|
|
||||||
|
#exptime however always returns the time in seconds
|
||||||
|
# >>> d.exptime
|
||||||
|
# 181.23
|
||||||
|
|
||||||
|
# To get back the exposure time for each module
|
||||||
|
# it's possible to use getExptime, this also returns
|
||||||
|
# the values as datetime.timedelta
|
||||||
|
|
||||||
|
# >>> d.getExptime()
|
||||||
|
# [datetime.timedelta(seconds=181, microseconds=230000), datetime.timedelta(seconds=181, microseconds=230000)]
|
||||||
|
|
||||||
|
# In case the values are the same it's possible to use the
|
||||||
|
# element_if_equal function to reduce the values to a single
|
||||||
|
# value
|
||||||
|
|
||||||
|
# >>> t = d.getExptime()
|
||||||
|
# >>> element_if_equal(t)
|
||||||
|
# datetime.timedelta(seconds=1)
|
21
python/examples/non-blocking-acquire-process.py
Normal file
21
python/examples/non-blocking-acquire-process.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import time
|
||||||
|
from multiprocessing import Process
|
||||||
|
from slsdet import Detector, runStatus
|
||||||
|
|
||||||
|
|
||||||
|
d = Detector()
|
||||||
|
|
||||||
|
#Create a separate process to run acquire in
|
||||||
|
p = Process(target=d.acquire)
|
||||||
|
|
||||||
|
#Start the thread and short sleep to allow the acq to start
|
||||||
|
p.start()
|
||||||
|
time.sleep(0.01)
|
||||||
|
|
||||||
|
#Do some other work
|
||||||
|
while d.status != runStatus.IDLE:
|
||||||
|
print("Working")
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
#Join the process
|
||||||
|
p.join()
|
33
python/examples/non-blocking-acquire.py
Normal file
33
python/examples/non-blocking-acquire.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import time
|
||||||
|
from slsdet import Detector, runStatus
|
||||||
|
|
||||||
|
|
||||||
|
n_frames = 10
|
||||||
|
t_exp = 1
|
||||||
|
|
||||||
|
# Set exposure time and number of frames
|
||||||
|
d = Detector()
|
||||||
|
d.exptime = t_exp
|
||||||
|
d.frames = n_frames
|
||||||
|
|
||||||
|
# Start the measurement
|
||||||
|
t0 = time.time()
|
||||||
|
d.startDetector()
|
||||||
|
d.startReceiver()
|
||||||
|
|
||||||
|
# Wait for the detector to be ready or do other important stuff
|
||||||
|
time.sleep(t_exp * n_frames)
|
||||||
|
|
||||||
|
# check if the detector is ready otherwise wait a bit longer
|
||||||
|
while d.status != runStatus.IDLE:
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
# Stop the receiver after we got the frames
|
||||||
|
# Detector is already idle so we don't need to stop it
|
||||||
|
d.stopReceiver()
|
||||||
|
|
||||||
|
lost = d.rx_framescaught - n_frames
|
||||||
|
print(
|
||||||
|
f"{n_frames} frames of {t_exp}s took {time.time()-t0:{.3}}s with {lost} frames lost "
|
||||||
|
)
|
||||||
|
|
32
python/examples/reading_dacs.py
Normal file
32
python/examples/reading_dacs.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
from slsdet import Detector, Eiger, dacIndex
|
||||||
|
|
||||||
|
|
||||||
|
#using the specialized class
|
||||||
|
|
||||||
|
e = Eiger()
|
||||||
|
e.dacs
|
||||||
|
# >>> e.dacs
|
||||||
|
# ========== DACS =========
|
||||||
|
# vsvp : 0 0
|
||||||
|
# vtrim : 2480 2480
|
||||||
|
# vrpreamp : 3300 3300
|
||||||
|
# vrshaper : 1400 1400
|
||||||
|
# vsvn : 4000 4000
|
||||||
|
# vtgstv : 2556 2556
|
||||||
|
# vcmp_ll : 1000 1000
|
||||||
|
# vcmp_lr : 1000 1000
|
||||||
|
# vcal : 0 0
|
||||||
|
# vcmp_rl : 1000 1000
|
||||||
|
# rxb_rb : 1100 1100
|
||||||
|
# rxb_lb : 1100 1100
|
||||||
|
# vcmp_rr : 1000 1000
|
||||||
|
# vcp : 1000 1000
|
||||||
|
# vcn : 2000 2000
|
||||||
|
# vishaper : 1550 1550
|
||||||
|
# iodelay : 650 650
|
||||||
|
|
||||||
|
# or using the general class and the list
|
||||||
|
d = Detector()
|
||||||
|
for dac in d.daclist:
|
||||||
|
r = d.getDAC(dac, False)
|
||||||
|
print(f'{dac.name:10s} {r}')
|
45
python/examples/reading_temperature.py
Normal file
45
python/examples/reading_temperature.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
from slsdet import Detector, Eiger, dacIndex
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Using the general detector class and calling with an index
|
||||||
|
d = Detector()
|
||||||
|
fpga_temp = d.getTemperature(dacIndex.TEMPERATURE_FPGA)
|
||||||
|
print(f'fpga_temp: {fpga_temp}\n')
|
||||||
|
|
||||||
|
#Using the specialized detector class
|
||||||
|
e = Eiger()
|
||||||
|
print("All temperatures for Eiger\n")
|
||||||
|
print(e.temp)
|
||||||
|
# >>> e.temp
|
||||||
|
# temp_fpga : 54°C 60°C
|
||||||
|
# temp_fpgaext : 49°C 52°C
|
||||||
|
# temp_10ge : 47°C 45°C
|
||||||
|
# temp_dcdc : 52°C 53°C
|
||||||
|
# temp_sodl : 51°C 53°C
|
||||||
|
# temp_sodl : 51°C 51°C
|
||||||
|
# temp_fpgafl : 45°C 49°C
|
||||||
|
# temp_fpgafr : 39°C 42°C
|
||||||
|
|
||||||
|
# The temperatures can also be returned in a dictionary
|
||||||
|
t = e.temp.to_dict()
|
||||||
|
print(t)
|
||||||
|
# >>> e.temp.to_dict()
|
||||||
|
# {'fpga': array([55, 60]), 'fpgaext': array([49, 52]),
|
||||||
|
# 't10ge': array([47, 45]), 'dcdc': array([52, 53]),
|
||||||
|
# 'sodl': array([51, 53]), 'sodr': array([51, 51]), '
|
||||||
|
# temp_fpgafl': array([45, 49]),
|
||||||
|
# 'temp_fpgafr': array([39, 42])}
|
||||||
|
|
||||||
|
# or in a numpy array
|
||||||
|
t = e.temp.to_array()
|
||||||
|
print(t)
|
||||||
|
# >>> e.temp.to_array()
|
||||||
|
# array([[55, 60],
|
||||||
|
# [49, 52],
|
||||||
|
# [47, 45],
|
||||||
|
# [52, 53],
|
||||||
|
# [51, 53],
|
||||||
|
# [51, 51],
|
||||||
|
# [45, 49],
|
||||||
|
# [40, 43]])
|
8
python/examples/threshold_scan.py
Normal file
8
python/examples/threshold_scan.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from slsdet import Eiger
|
||||||
|
|
||||||
|
d = Eiger()
|
||||||
|
threshold = range(0, 2000, 200)
|
||||||
|
for th in threshold:
|
||||||
|
print(f'{th=}')
|
||||||
|
d.vthreshold = th
|
||||||
|
d.acquire()
|
20
python/examples/use_enum.py
Normal file
20
python/examples/use_enum.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Most settings are represented as enums that can be
|
||||||
|
# explicitly imported
|
||||||
|
|
||||||
|
from slsdet import Detector, fileFormat
|
||||||
|
d = Detector()
|
||||||
|
d.fformat = fileFormat.BINARY
|
||||||
|
|
||||||
|
# Altough not recommended for convenience all enums
|
||||||
|
# and some other things can be impored using *
|
||||||
|
|
||||||
|
from slsdet import *
|
||||||
|
d.speed = speedLevel.FULL_SPEED
|
||||||
|
|
||||||
|
# To list the available enums, use dir()
|
||||||
|
|
||||||
|
import slsdet.enums
|
||||||
|
for enum in dir(slsdet.enums):
|
||||||
|
# filter out special memebers
|
||||||
|
if not enum.startswith('_'):
|
||||||
|
print(enum)
|
@ -3,13 +3,15 @@ import sys
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||||
|
|
||||||
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb
|
from slsdet import Detector, Mythen3, Eiger, Jungfrau, DetectorDacs, Dac, Ctb, Gotthard2, Moench
|
||||||
from slsdet import dacIndex, readoutMode
|
from slsdet import dacIndex, readoutMode
|
||||||
from slsdet.lookup import view, find
|
from slsdet.lookup import view, find
|
||||||
|
|
||||||
d = Detector()
|
d = Detector()
|
||||||
# e = Eiger()
|
e = Eiger()
|
||||||
c = Ctb()
|
c = Ctb()
|
||||||
|
g = Gotthard2()
|
||||||
# j = Jungfrau()
|
# j = Jungfrau()
|
||||||
# m = Mythen3()
|
# m = Mythen3()
|
||||||
|
m = Moench()
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
import subprocess
|
|
||||||
import locale
|
|
||||||
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
|
||||||
cmd = out.stdout.splitlines()
|
|
||||||
cmd.pop(0)
|
|
||||||
|
|
||||||
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',
|
|
||||||
'vpreamp', 'vref_comp', 'vref_comp_fe vref_ds', 'vref_h_adc',
|
|
||||||
'vref_l_adc', 'iodelay', 'list', 'vref_ds', 'vis', 'vpl',
|
|
||||||
'vref_comp_fe', 'vph', 'vout_cm', 'vcp', 'vcn', 'vcmp_ll', 'vcmp_lr'
|
|
||||||
, 'vcmp_rl', 'vcmp_rr', 'daclist', 'dacvalues', 'vcal', 'vcas']
|
|
||||||
|
|
||||||
missing = []
|
|
||||||
for c in cmd:
|
|
||||||
if c not in pycmd:
|
|
||||||
print(c)
|
|
||||||
missing.append(c)
|
|
||||||
|
|
||||||
print(f'Missing: {len(missing)} commands')
|
|
132
python/scripts/compare_with_commandline.py
Normal file
132
python/scripts/compare_with_commandline.py
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
import subprocess
|
||||||
|
import locale
|
||||||
|
out = subprocess.run(['g', 'list'], stdout = subprocess.PIPE, encoding=locale.getpreferredencoding())
|
||||||
|
cmd = out.stdout.splitlines()
|
||||||
|
cmd.pop(0)
|
||||||
|
|
||||||
|
from slsdet import Detector
|
||||||
|
|
||||||
|
pycmd = dir(Detector)
|
||||||
|
|
||||||
|
|
||||||
|
# dacs are in general not included in the python commands and we expect to
|
||||||
|
# set them from the specialized class or using an enum
|
||||||
|
dacs = [
|
||||||
|
'adcvpp',
|
||||||
|
'iodelay',
|
||||||
|
'list',
|
||||||
|
'rxb_lb',
|
||||||
|
'rxb_rb',
|
||||||
|
'v_chip',
|
||||||
|
'vb_comp',
|
||||||
|
'vb_comp_adc',
|
||||||
|
'vb_comp_fe',
|
||||||
|
'vb_cs',
|
||||||
|
'vb_ds',
|
||||||
|
'vb_opa_1st',
|
||||||
|
'vb_opa_fd',
|
||||||
|
'vb_pixbuf',
|
||||||
|
'vb_sda',
|
||||||
|
'vbp_colbuf',
|
||||||
|
'vcal',
|
||||||
|
'vcal_n',
|
||||||
|
'vcal_p',
|
||||||
|
'vipre_out',
|
||||||
|
'vcas',
|
||||||
|
'vcasc_out',
|
||||||
|
'vcasc_sfp',
|
||||||
|
'vcascn_pb',
|
||||||
|
'vcascp_pb',
|
||||||
|
'vcassh',
|
||||||
|
'vchip_comp_adc',
|
||||||
|
'vchip_comp_fe',
|
||||||
|
'vchip_cs',
|
||||||
|
'vchip_opa_1st',
|
||||||
|
'vchip_opa_fd',
|
||||||
|
'vchip_ref_comp_fe',
|
||||||
|
'vcmp_ll',
|
||||||
|
'vcmp_lr',
|
||||||
|
'vcmp_rl',
|
||||||
|
'vcmp_rr',
|
||||||
|
'vcn',
|
||||||
|
'vcom_adc1',
|
||||||
|
'vcom_adc2',
|
||||||
|
'vcom_cds',
|
||||||
|
'vcp',
|
||||||
|
'vdcsh',
|
||||||
|
'vdd_prot',
|
||||||
|
'vicin',
|
||||||
|
'vin_cm',
|
||||||
|
'vin_com',
|
||||||
|
'vipre',
|
||||||
|
'vipre_cds',
|
||||||
|
'vipre_out',
|
||||||
|
'vishaper',
|
||||||
|
'vout_cm',
|
||||||
|
'vref_cds',
|
||||||
|
'vref_comp',
|
||||||
|
'vref_comp_fe',
|
||||||
|
'vref_ds',
|
||||||
|
'vref_h_adc',
|
||||||
|
'vref_l_adc',
|
||||||
|
'vref_prech',
|
||||||
|
'vref_rstore',
|
||||||
|
'vrpreamp',
|
||||||
|
'vrshaper',
|
||||||
|
'vrshaper_n',
|
||||||
|
'vsvn',
|
||||||
|
'vsvp',
|
||||||
|
'vtgstv',
|
||||||
|
'vth1',
|
||||||
|
'vth2',
|
||||||
|
'vth3',
|
||||||
|
'vtrim'
|
||||||
|
]
|
||||||
|
|
||||||
|
intentionally_missing = [
|
||||||
|
'activate', #use getActive and getRxPadDeactivatedMode syntax is not a good fit for python
|
||||||
|
'temp_10ge', #temperatures already available from enum or specialized class
|
||||||
|
'temp_adc',
|
||||||
|
'temp_dcdc',
|
||||||
|
'temp_fpga',
|
||||||
|
'temp_fpgaext',
|
||||||
|
'temp_fpgafl',
|
||||||
|
'temp_fpgafr',
|
||||||
|
'temp_slowadc',
|
||||||
|
'temp_sodl',
|
||||||
|
'temp_sodr',
|
||||||
|
'trigger', #use sendSoftwareTrigger
|
||||||
|
'update', #use updateServerAndFirmare
|
||||||
|
'udp_validate', #use validateUdpConfiguration
|
||||||
|
'udp_reconfigure', #use reconfigureUdpDestination
|
||||||
|
'pulse', # use pulseChip pulsePixel pulsePixelNmove
|
||||||
|
'pulsechip',
|
||||||
|
'pulsenmove',
|
||||||
|
]
|
||||||
|
|
||||||
|
pycmd += intentionally_missing
|
||||||
|
pycmd += dacs
|
||||||
|
missing = []
|
||||||
|
for c in cmd:
|
||||||
|
if c not in pycmd:
|
||||||
|
print(c)
|
||||||
|
missing.append(c)
|
||||||
|
|
||||||
|
print(f'\nMissing: {len(missing)} commands')
|
||||||
|
print(f'Excluded: {len(dacs)} dacs')
|
||||||
|
print(f'Excluded: {len(intentionally_missing)} other commands')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
not_in_cmd = []
|
||||||
|
for c in pycmd:
|
||||||
|
if c.islower() and not c.startswith('_'):
|
||||||
|
if c not in cmd:
|
||||||
|
not_in_cmd.append(c)
|
||||||
|
print(f'\nCommands in Python and NOT in command line: {len(not_in_cmd)}')
|
||||||
|
for c in not_in_cmd:
|
||||||
|
print(c)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# print(',\n'.join([f'\'{d}\'' for d in sorted(dacs)]))
|
@ -60,6 +60,23 @@ def get_arguments(node):
|
|||||||
args = f", {args}"
|
args = f", {args}"
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def get_arguments_with_default(node):
|
||||||
|
args = []
|
||||||
|
for arg in node.get_arguments():
|
||||||
|
tokens = [t.spelling for t in arg.get_tokens()]
|
||||||
|
print(tokens)
|
||||||
|
if '=' in tokens:
|
||||||
|
if arg.type.spelling == "sls::Positions": #TODO! automate
|
||||||
|
args.append("py::arg() = Positions{}")
|
||||||
|
else:
|
||||||
|
args.append('py::arg()' + ''.join(tokens[tokens.index('='):]))
|
||||||
|
else:
|
||||||
|
args.append('py::arg()')
|
||||||
|
args = ", ".join(args)
|
||||||
|
if args:
|
||||||
|
args = f", {args}"
|
||||||
|
return args
|
||||||
|
|
||||||
|
|
||||||
def get_fdec(node):
|
def get_fdec(node):
|
||||||
args = [a.type.spelling for a in node.get_arguments()]
|
args = [a.type.spelling for a in node.get_arguments()]
|
||||||
@ -86,7 +103,8 @@ def visit(node):
|
|||||||
and child.access_specifier == cindex.AccessSpecifier.PUBLIC
|
and child.access_specifier == cindex.AccessSpecifier.PUBLIC
|
||||||
):
|
):
|
||||||
m.append(child)
|
m.append(child)
|
||||||
args = get_arguments(child)
|
# args = get_arguments(child)
|
||||||
|
args = get_arguments_with_default(child)
|
||||||
fs = get_fdec(child)
|
fs = get_fdec(child)
|
||||||
lines.append(
|
lines.append(
|
||||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||||
|
@ -5,32 +5,15 @@ from .dacs import DetectorDacs, Dac
|
|||||||
from .detector import Detector
|
from .detector import Detector
|
||||||
from .jungfrau import Jungfrau
|
from .jungfrau import Jungfrau
|
||||||
from .mythen3 import Mythen3
|
from .mythen3 import Mythen3
|
||||||
# from .jungfrau_ctb import JungfrauCTB
|
from .gotthard2 import Gotthard2
|
||||||
# from _slsdet import DetectorApi
|
from .gotthard import Gotthard
|
||||||
|
from .moench import Moench
|
||||||
|
|
||||||
import _slsdet
|
import _slsdet
|
||||||
|
|
||||||
defs = _slsdet.slsDetectorDefs
|
defs = _slsdet.slsDetectorDefs
|
||||||
runStatus = _slsdet.slsDetectorDefs.runStatus
|
|
||||||
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
|
||||||
|
|
||||||
|
from .enums import *
|
||||||
detectorType = _slsdet.slsDetectorDefs.detectorType
|
|
||||||
frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
|
|
||||||
fileFormat = _slsdet.slsDetectorDefs.fileFormat
|
|
||||||
dimension = _slsdet.slsDetectorDefs.dimension
|
|
||||||
externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
|
|
||||||
timingMode = _slsdet.slsDetectorDefs.timingMode
|
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
|
||||||
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
|
||||||
clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
|
||||||
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
|
||||||
masterFlags = _slsdet.slsDetectorDefs.masterFlags
|
|
||||||
|
|
||||||
frameModeType = _slsdet.slsDetectorDefs.frameModeType
|
|
||||||
detectorModeType = _slsdet.slsDetectorDefs.detectorModeType
|
|
||||||
burstMode = _slsdet.slsDetectorDefs.burstMode
|
|
||||||
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
|
||||||
|
|
||||||
|
|
||||||
IpAddr = _slsdet.IpAddr
|
IpAddr = _slsdet.IpAddr
|
||||||
|
@ -1,23 +1,33 @@
|
|||||||
from functools import partial
|
from functools import partial
|
||||||
class Adc:
|
class Adc:
|
||||||
def __init__(self, name, detector):
|
def __init__(self, name, enum, detector):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.enum = enum
|
||||||
self._detector = detector
|
self._detector = detector
|
||||||
self.get_nmod = self._detector._api.getNumberOfDetectors
|
self.get_nmod = self._detector.size
|
||||||
# Bind functions to get and set the dac
|
# Bind functions to get and set the dac
|
||||||
self.get = partial(self._detector._api.getAdc, self.name)
|
self.get = partial(self._detector.getAdc, self.enum)
|
||||||
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
"""
|
|
||||||
Get dacs either by slice, key or list
|
|
||||||
"""
|
|
||||||
if key == slice(None, None, None):
|
if key == slice(None, None, None):
|
||||||
return [self.get(i) / 1000 for i in range(self.get_nmod())]
|
return self.get()
|
||||||
elif isinstance(key, Iterable):
|
elif isinstance(key, Iterable):
|
||||||
return [self.get(k) / 1000 for k in key]
|
return self.get(list(key))
|
||||||
else:
|
else:
|
||||||
return self.get(key) / 1000
|
return self.get([key])[0] #No list for single value
|
||||||
|
|
||||||
|
|
||||||
|
# def __getitem__(self, key):
|
||||||
|
# """
|
||||||
|
# Get dacs either by slice, key or list
|
||||||
|
# """
|
||||||
|
# if key == slice(None, None, None):
|
||||||
|
# return [self.get(i) / 1000 for i in range(self.get_nmod())]
|
||||||
|
# elif isinstance(key, Iterable):
|
||||||
|
# return [self.get(k) / 1000 for k in key]
|
||||||
|
# else:
|
||||||
|
# return self.get(key) / 1000
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""String representation for a single adc in all modules"""
|
"""String representation for a single adc in all modules"""
|
||||||
|
@ -32,10 +32,9 @@ class Dac(DetectorProperty):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""String representation for a single dac in all modules"""
|
"""String representation for a single dac in all modules"""
|
||||||
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
dacstr = ''.join([f'{item:5d}' for item in self.get()])
|
||||||
return f'{self.__name__:10s}:{dacstr}'
|
return f'{self.__name__:15s}:{dacstr}'
|
||||||
|
|
||||||
|
|
||||||
# a = Dac('vrf', dacIndex.VRF, 0, 4000, 2500, d )
|
|
||||||
# @freeze
|
|
||||||
class DetectorDacs:
|
class DetectorDacs:
|
||||||
_dacs = []
|
_dacs = []
|
||||||
_dacnames = [_d[0] for _d in _dacs]
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
@ -93,6 +92,9 @@ class DetectorDacs:
|
|||||||
dac_array[i,:] = _d[:]
|
dac_array[i,:] = _d[:]
|
||||||
return dac_array
|
return dac_array
|
||||||
|
|
||||||
|
def to_array(self):
|
||||||
|
return self.get_asarray()
|
||||||
|
|
||||||
def set_from_array(self, dac_array):
|
def set_from_array(self, dac_array):
|
||||||
"""
|
"""
|
||||||
Set the dacs from an numpy array with dac values. [ndacs, nmodules]
|
Set the dacs from an numpy array with dac values. [ndacs, nmodules]
|
||||||
@ -101,6 +103,9 @@ class DetectorDacs:
|
|||||||
for i, _d in enumerate(self):
|
for i, _d in enumerate(self):
|
||||||
_d[:] = dac_array[i]
|
_d[:] = dac_array[i]
|
||||||
|
|
||||||
|
def from_array(self, dac_array):
|
||||||
|
self.set_from_array(dac_array)
|
||||||
|
|
||||||
def set_default(self):
|
def set_default(self):
|
||||||
"""
|
"""
|
||||||
Set all dacs to their default values
|
Set all dacs to their default values
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,22 +6,17 @@ Created on Wed Dec 6 11:51:18 2017
|
|||||||
@author: l_frojdh
|
@author: l_frojdh
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from .detector import Detector
|
from .detector import Detector
|
||||||
|
from .temperature import Temperature, DetectorTemperature
|
||||||
# from .adcs import Adc, DetectorAdcs
|
|
||||||
from .dacs import DetectorDacs
|
from .dacs import DetectorDacs
|
||||||
import _slsdet
|
import _slsdet
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
# from .utils import element_if_equal
|
|
||||||
# from sls_detector.errors import DetectorValueError, DetectorError
|
|
||||||
|
|
||||||
class EigerVcmp:
|
class EigerVcmp:
|
||||||
"""
|
"""
|
||||||
Convenience class to be able to loop over vcmp for Eiger
|
Convenience class to be able to loop over vcmp for Eiger
|
||||||
|
|
||||||
|
|
||||||
.. todo::
|
.. todo::
|
||||||
|
|
||||||
Support single assignment and perhaps unify with Dac class
|
Support single assignment and perhaps unify with Dac class
|
||||||
@ -79,58 +74,6 @@ class EigerDacs(DetectorDacs):
|
|||||||
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
|
('iodelay', dacIndex.IO_DELAY,0, 4000, 660)]
|
||||||
_dacnames = [_d[0] for _d in _dacs]
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
# # noinspection PyProtectedMember
|
|
||||||
# class DetectorDelays:
|
|
||||||
# _delaynames = ['frame', 'left', 'right']
|
|
||||||
|
|
||||||
# def __init__(self, detector):
|
|
||||||
# # We need to at least initially know which detector we are connected to
|
|
||||||
# self._detector = detector
|
|
||||||
|
|
||||||
# setattr(self, '_frame', DetectorProperty(detector._api.getDelayFrame,
|
|
||||||
# detector._api.setDelayFrame,
|
|
||||||
# detector._api.getNumberOfDetectors,
|
|
||||||
# 'frame'))
|
|
||||||
|
|
||||||
# setattr(self, '_left', DetectorProperty(detector._api.getDelayLeft,
|
|
||||||
# detector._api.setDelayLeft,
|
|
||||||
# detector._api.getNumberOfDetectors,
|
|
||||||
# 'left'))
|
|
||||||
|
|
||||||
# setattr(self, '_right', DetectorProperty(detector._api.getDelayRight,
|
|
||||||
# detector._api.setDelayRight,
|
|
||||||
# detector._api.getNumberOfDetectors,
|
|
||||||
# 'right'))
|
|
||||||
# # Index to support iteration
|
|
||||||
# self._current = 0
|
|
||||||
|
|
||||||
# def __getattr__(self, name):
|
|
||||||
# return self.__getattribute__('_' + name)
|
|
||||||
|
|
||||||
# def __setattr__(self, name, value):
|
|
||||||
# if name in self._delaynames:
|
|
||||||
# return self.__getattribute__('_' + name).__setitem__(slice(None, None, None), value)
|
|
||||||
# else:
|
|
||||||
# super().__setattr__(name, value)
|
|
||||||
|
|
||||||
# def __next__(self):
|
|
||||||
# if self._current >= len(self._delaynames):
|
|
||||||
# self._current = 0
|
|
||||||
# raise StopIteration
|
|
||||||
# else:
|
|
||||||
# self._current += 1
|
|
||||||
# return self.__getattr__(self._delaynames[self._current-1])
|
|
||||||
|
|
||||||
# def __iter__(self):
|
|
||||||
# return self
|
|
||||||
|
|
||||||
# def __repr__(self):
|
|
||||||
# hn = self._detector.hostname
|
|
||||||
# r_str = ['Transmission delay [ns]\n'
|
|
||||||
# '{:11s}{:>8s}{:>8s}{:>8s}'.format('', 'left', 'right', 'frame')]
|
|
||||||
# for i in range(self._detector.n_modules):
|
|
||||||
# r_str.append('{:2d}:{:8s}{:>8d}{:>8d}{:>8d}'.format(i, hn[i], self.left[i], self.right[i], self.frame[i]))
|
|
||||||
# return '\n'.join(r_str)
|
|
||||||
|
|
||||||
from .detector import freeze
|
from .detector import freeze
|
||||||
|
|
||||||
@ -152,76 +95,18 @@ class Eiger(Detector):
|
|||||||
self._dacs = EigerDacs(self)
|
self._dacs = EigerDacs(self)
|
||||||
self._vcmp = EigerVcmp(self)
|
self._vcmp = EigerVcmp(self)
|
||||||
|
|
||||||
# self._active = DetectorProperty(self.getActive,
|
# Eiger specific adcs
|
||||||
# self.setActive,
|
self._temp = DetectorTemperature()
|
||||||
# self.size,
|
self._temp.fpga = Temperature('temp_fpga', dacIndex.TEMPERATURE_FPGA, self)
|
||||||
# 'active')
|
self._temp.fpgaext = Temperature('temp_fpgaext', dacIndex.TEMPERATURE_FPGAEXT, self)
|
||||||
|
self._temp.t10ge = Temperature('temp_10ge', dacIndex.TEMPERATURE_10GE, self)
|
||||||
|
self._temp.dcdc = Temperature('temp_dcdc', dacIndex.TEMPERATURE_DCDC, self)
|
||||||
|
self._temp.sodl = Temperature('temp_sodl', dacIndex.TEMPERATURE_SODL, self)
|
||||||
|
self._temp.sodr = Temperature('temp_sodl', dacIndex.TEMPERATURE_SODR, self)
|
||||||
|
self._temp.temp_fpgafl = Temperature('temp_fpgafl', dacIndex.TEMPERATURE_FPGA2, self)
|
||||||
|
self._temp.temp_fpgafr = Temperature('temp_fpgafr', dacIndex.TEMPERATURE_FPGA3, self)
|
||||||
|
|
||||||
# self._trimbit_limits = namedtuple('trimbit_limits', ['min', 'max'])(0, 63)
|
|
||||||
# self._delay = DetectorDelays(self)
|
|
||||||
|
|
||||||
# # Eiger specific adcs
|
|
||||||
# self._temp = DetectorAdcs()
|
|
||||||
# self._temp.fpga = Adc('temp_fpga', self)
|
|
||||||
# self._temp.fpgaext = Adc('temp_fpgaext', self)
|
|
||||||
# self._temp.t10ge = Adc('temp_10ge', self)
|
|
||||||
# self._temp.dcdc = Adc('temp_dcdc', self)
|
|
||||||
# self._temp.sodl = Adc('temp_sodl', self)
|
|
||||||
# self._temp.sodr = Adc('temp_sodr', self)
|
|
||||||
# self._temp.fpgafl = Adc('temp_fpgafl', self)
|
|
||||||
# self._temp.fpgafr = Adc('temp_fpgafr', self)
|
|
||||||
|
|
||||||
# @property
|
|
||||||
# def active(self):
|
|
||||||
# """
|
|
||||||
# Is the detector active? Can be used to enable or disable a detector
|
|
||||||
# module
|
|
||||||
|
|
||||||
# Examples
|
|
||||||
# ----------
|
|
||||||
|
|
||||||
# ::
|
|
||||||
|
|
||||||
# d.active
|
|
||||||
# >> active: [True, True]
|
|
||||||
|
|
||||||
# d.active[1] = False
|
|
||||||
# >> active: [True, False]
|
|
||||||
# """
|
|
||||||
# return self._active
|
|
||||||
|
|
||||||
# @active.setter
|
|
||||||
# def active(self, value):
|
|
||||||
# self._active[:] = value
|
|
||||||
|
|
||||||
# @property
|
|
||||||
# def measured_period(self):
|
|
||||||
# return self._api.getMeasuredPeriod()
|
|
||||||
|
|
||||||
# @property
|
|
||||||
# def measured_subperiod(self):
|
|
||||||
# return self._api.getMeasuredSubPeriod()
|
|
||||||
|
|
||||||
# @property
|
|
||||||
# def add_gappixels(self):
|
|
||||||
# """Enable or disable the (virual) pixels between ASICs
|
|
||||||
|
|
||||||
# Examples
|
|
||||||
# ----------
|
|
||||||
|
|
||||||
# ::
|
|
||||||
|
|
||||||
# d.add_gappixels = True
|
|
||||||
|
|
||||||
# d.add_gappixels
|
|
||||||
# >> True
|
|
||||||
|
|
||||||
# """
|
|
||||||
# return self._api.getGapPixels()
|
|
||||||
|
|
||||||
# @add_gappixels.setter
|
|
||||||
# def add_gappixels(self, value):
|
|
||||||
# self._api.setGapPixels(value)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dacs(self):
|
def dacs(self):
|
||||||
@ -284,68 +169,6 @@ class Eiger(Detector):
|
|||||||
"""
|
"""
|
||||||
return self._dacs
|
return self._dacs
|
||||||
|
|
||||||
# @property
|
|
||||||
# def tx_delay(self):
|
|
||||||
# """
|
|
||||||
# Transmission delay of the modules to allow running the detector
|
|
||||||
# in a network not supporting the full speed of the detector.
|
|
||||||
|
|
||||||
|
|
||||||
# ::
|
|
||||||
|
|
||||||
# d.tx_delay
|
|
||||||
# >>
|
|
||||||
# Transmission delay [ns]
|
|
||||||
# left right frame
|
|
||||||
# 0:beb048 0 15000 0
|
|
||||||
# 1:beb049 100 190000 100
|
|
||||||
|
|
||||||
# d.tx_delay.left = [2000,5000]
|
|
||||||
# """
|
|
||||||
# return self._delay
|
|
||||||
|
|
||||||
# def pulse_all_pixels(self, n):
|
|
||||||
# """
|
|
||||||
# Pulse each pixel of the chip **n** times using the analog test pulses.
|
|
||||||
# The pulse height is set using d.dacs.vcall with 4000 being 0 and 0 being
|
|
||||||
# the highest pulse.
|
|
||||||
|
|
||||||
# ::
|
|
||||||
|
|
||||||
# #Pulse all pixels ten times
|
|
||||||
# d.pulse_all_pixels(10)
|
|
||||||
|
|
||||||
# #Avoid resetting before acq
|
|
||||||
# d.eiger_matrix_reset = False
|
|
||||||
|
|
||||||
# d.acq() #take frame
|
|
||||||
|
|
||||||
# #Restore normal behaviour
|
|
||||||
# d.eiger_matrix_reset = True
|
|
||||||
|
|
||||||
|
|
||||||
# """
|
|
||||||
# self._api.pulseAllPixels(n)
|
|
||||||
|
|
||||||
|
|
||||||
# def pulse_diagonal(self, n):
|
|
||||||
# """
|
|
||||||
# Pulse pixels in super colums in a diagonal fashion. Used for calibration
|
|
||||||
# of vcall. Saves time compared to pulsing all pixels.
|
|
||||||
# """
|
|
||||||
# self._api.pulseDiagonal(n)
|
|
||||||
|
|
||||||
|
|
||||||
# def pulse_chip(self, n):
|
|
||||||
# """
|
|
||||||
# Advance the counter by toggling enable. Gives 2*n+2 int the counter
|
|
||||||
|
|
||||||
# """
|
|
||||||
# n = int(n)
|
|
||||||
# if n >= -1:
|
|
||||||
# self._api.pulseChip(n)
|
|
||||||
# else:
|
|
||||||
# raise ValueError('n must be equal or larger than -1')
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def vcmp(self):
|
def vcmp(self):
|
||||||
@ -437,40 +260,33 @@ class Eiger(Detector):
|
|||||||
# else:
|
# else:
|
||||||
# self._api.setReceiverStreamingPort(port, -1)
|
# self._api.setReceiverStreamingPort(port, -1)
|
||||||
|
|
||||||
# @property
|
@property
|
||||||
# def temp(self):
|
def temp(self):
|
||||||
# """
|
"""
|
||||||
# An instance of DetectorAdcs used to read the temperature
|
An instance of DetectorAdcs used to read the temperature
|
||||||
# of different components
|
of different components
|
||||||
|
|
||||||
# Examples
|
Examples
|
||||||
# -----------
|
-----------
|
||||||
|
|
||||||
# ::
|
::
|
||||||
|
|
||||||
# detector.temp
|
detector.temp
|
||||||
# >>
|
>>
|
||||||
# temp_fpga : 36.90°C, 45.60°C
|
temp_fpga : 36.90°C, 45.60°C
|
||||||
# temp_fpgaext : 31.50°C, 32.50°C
|
temp_fpgaext : 31.50°C, 32.50°C
|
||||||
# temp_10ge : 0.00°C, 0.00°C
|
temp_10ge : 0.00°C, 0.00°C
|
||||||
# temp_dcdc : 36.00°C, 36.00°C
|
temp_dcdc : 36.00°C, 36.00°C
|
||||||
# temp_sodl : 33.00°C, 34.50°C
|
temp_sodl : 33.00°C, 34.50°C
|
||||||
# temp_sodr : 33.50°C, 34.00°C
|
temp_sodr : 33.50°C, 34.00°C
|
||||||
# temp_fpgafl : 33.81°C, 30.93°C
|
temp_fpgafl : 33.81°C, 30.93°C
|
||||||
# temp_fpgafr : 27.88°C, 29.15°C
|
temp_fpgafr : 27.88°C, 29.15°C
|
||||||
|
|
||||||
# a = detector.temp.fpga[:]
|
a = detector.temp.fpga[:]
|
||||||
# a
|
a
|
||||||
# >> [36.568, 45.542]
|
>> [36.568, 45.542]
|
||||||
|
|
||||||
|
|
||||||
# """
|
"""
|
||||||
# return self._temp
|
return self._temp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# def set_delays(self, delta):
|
|
||||||
# self.tx_delay.left = [delta*(i*2) for i in range(self.n_modules)]
|
|
||||||
# self.tx_delay.right = [delta*(i*2+1) for i in range(self.n_modules)]
|
|
||||||
|
|
||||||
|
|
||||||
|
17
python/slsdet/enums.py
Normal file
17
python/slsdet/enums.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
import _slsdet
|
||||||
|
runStatus = _slsdet.slsDetectorDefs.runStatus
|
||||||
|
speedLevel = _slsdet.slsDetectorDefs.speedLevel
|
||||||
|
detectorType = _slsdet.slsDetectorDefs.detectorType
|
||||||
|
frameDiscardPolicy = _slsdet.slsDetectorDefs.frameDiscardPolicy
|
||||||
|
fileFormat = _slsdet.slsDetectorDefs.fileFormat
|
||||||
|
dimension = _slsdet.slsDetectorDefs.dimension
|
||||||
|
externalSignalFlag = _slsdet.slsDetectorDefs.externalSignalFlag
|
||||||
|
timingMode = _slsdet.slsDetectorDefs.timingMode
|
||||||
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
|
detectorSettings = _slsdet.slsDetectorDefs.detectorSettings
|
||||||
|
clockIndex = _slsdet.slsDetectorDefs.clockIndex
|
||||||
|
readoutMode = _slsdet.slsDetectorDefs.readoutMode
|
||||||
|
masterFlags = _slsdet.slsDetectorDefs.masterFlags
|
||||||
|
burstMode = _slsdet.slsDetectorDefs.burstMode
|
||||||
|
timingSourceType = _slsdet.slsDetectorDefs.timingSourceType
|
51
python/slsdet/gotthard.py
Normal file
51
python/slsdet/gotthard.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
This file contains the specialization for the Moench detector
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from .detector import Detector, freeze
|
||||||
|
from .dacs import DetectorDacs
|
||||||
|
import _slsdet
|
||||||
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
|
# @freeze
|
||||||
|
|
||||||
|
# vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp, ib_test_c
|
||||||
|
class GotthardDacs(DetectorDacs):
|
||||||
|
_dacs = [('vref_ds', dacIndex.VREF_DS, 0, 4000, 660),
|
||||||
|
('vcascn_pb', dacIndex.VCASCN_PB, 0, 4000, 650),
|
||||||
|
('vcascp_pb,', dacIndex.VCASCP_PB, 0, 4000, 1480),
|
||||||
|
('vout_cm', dacIndex.VOUT_CM, 0, 4000, 1520),
|
||||||
|
('vcasc_out', dacIndex.VCASC_OUT, 0, 4000, 1320),
|
||||||
|
('vin_cm', dacIndex.VIN_CM, 0, 4000, 1350),
|
||||||
|
('vref_comp', dacIndex.VREF_COMP, 0, 4000, 350),
|
||||||
|
('ib_test_c', dacIndex.IB_TESTC, 0, 4000, 2001),
|
||||||
|
]
|
||||||
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
|
#vthreshold??
|
||||||
|
|
||||||
|
|
||||||
|
@freeze
|
||||||
|
class Gotthard(Detector):
|
||||||
|
"""
|
||||||
|
Subclassing Detector to set up correct dacs and detector specific
|
||||||
|
functions.
|
||||||
|
"""
|
||||||
|
_detector_dynamic_range = [16]
|
||||||
|
|
||||||
|
|
||||||
|
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||||
|
"""available settings for Eiger, note almost always standard"""
|
||||||
|
|
||||||
|
def __init__(self, id=0):
|
||||||
|
super().__init__(id)
|
||||||
|
self._frozen = False
|
||||||
|
self._dacs = GotthardDacs(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dacs(self):
|
||||||
|
return self._dacs
|
61
python/slsdet/gotthard2.py
Normal file
61
python/slsdet/gotthard2.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
This file contains the specialization for the Jungfrau detector
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from .detector import Detector, freeze
|
||||||
|
|
||||||
|
# from .adcs import Adc, DetectorAdcs
|
||||||
|
from .dacs import DetectorDacs
|
||||||
|
import _slsdet
|
||||||
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
|
|
||||||
|
# @freeze
|
||||||
|
class Gotthard2Dacs(DetectorDacs):
|
||||||
|
"""
|
||||||
|
Gotthard2 specific DACs
|
||||||
|
"""
|
||||||
|
_dacs = [('vref_h_adc', dacIndex.VREF_H_ADC, 0, 4000, 2116),
|
||||||
|
('vb_comp_fe', dacIndex.VB_COMP_FE, 0, 4000, 0),
|
||||||
|
('vb_comp_adc', dacIndex.VB_COMP_ADC, 0, 4000, 0),
|
||||||
|
('vcom_cds', dacIndex.VCOM_CDS, 0, 4000, 705),
|
||||||
|
('vref_rstore', dacIndex.VREF_RSTORE, 0, 4000, 205),
|
||||||
|
('vb_opa_1st', dacIndex.VB_OPA_1ST, 0, 4000, 0),
|
||||||
|
('vref_comp_fe', dacIndex.VREF_COMP_FE, 0, 4000, 0),
|
||||||
|
('vcom_adc1', dacIndex.VCOM_ADC1, 0, 4000, 705),
|
||||||
|
('vref_prech', dacIndex.VREF_PRECH, 0, 4000, 900),
|
||||||
|
('vref_l_adc', dacIndex.VREF_L_ADC, 0, 4000, 700),
|
||||||
|
('vref_cds', dacIndex.VREF_CDS, 0, 4000, 600),
|
||||||
|
('vb_cs', dacIndex.VB_CS, 0, 4000, 2799),
|
||||||
|
('vb_opa_fd', dacIndex.VB_OPA_FD, 0, 4000, 0),
|
||||||
|
('vcom_adc2', dacIndex.VCOM_ADC2, 0, 4000, 704),
|
||||||
|
]
|
||||||
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@freeze
|
||||||
|
class Gotthard2(Detector):
|
||||||
|
"""
|
||||||
|
Subclassing Detector to set up correct dacs and detector specific
|
||||||
|
functions.
|
||||||
|
"""
|
||||||
|
_detector_dynamic_range = [16]
|
||||||
|
|
||||||
|
|
||||||
|
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||||
|
"""available settings for Eiger, note almost always standard"""
|
||||||
|
|
||||||
|
def __init__(self, id=0):
|
||||||
|
super().__init__(id)
|
||||||
|
self._frozen = False
|
||||||
|
self._dacs = Gotthard2Dacs(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dacs(self):
|
||||||
|
return self._dacs
|
52
python/slsdet/moench.py
Normal file
52
python/slsdet/moench.py
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
This file contains the specialization for the Moench detector
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from .detector import Detector, freeze
|
||||||
|
from .dacs import DetectorDacs
|
||||||
|
import _slsdet
|
||||||
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
|
from .detector_property import DetectorProperty
|
||||||
|
|
||||||
|
# @freeze
|
||||||
|
class MoenchDacs(DetectorDacs):
|
||||||
|
"""
|
||||||
|
Jungfrau specific DACs
|
||||||
|
"""
|
||||||
|
_dacs = [('vbp_colbuf', dacIndex.VBP_COLBUF, 0, 4000, 1300),
|
||||||
|
('vipre', dacIndex.VIPRE, 0, 4000, 1000),
|
||||||
|
('vin_cm,', dacIndex.VIN_CM, 0, 4000, 1400),
|
||||||
|
('vb_sda', dacIndex.VB_SDA, 0, 4000, 680),
|
||||||
|
('vcasc_sfp', dacIndex.VCASC_SFP, 0, 4000, 1428),
|
||||||
|
('vout_cm', dacIndex.VOUT_CM, 0, 4000, 1200),
|
||||||
|
('vipre_cds', dacIndex.VIPRE_CDS, 0, 4000, 800),
|
||||||
|
('ibias_sfp', dacIndex.IBIAS_SFP, 0, 4000, 900),
|
||||||
|
]
|
||||||
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
|
#vthreshold??
|
||||||
|
|
||||||
|
|
||||||
|
@freeze
|
||||||
|
class Moench(Detector):
|
||||||
|
"""
|
||||||
|
Subclassing Detector to set up correct dacs and detector specific
|
||||||
|
functions.
|
||||||
|
"""
|
||||||
|
_detector_dynamic_range = [16]
|
||||||
|
|
||||||
|
|
||||||
|
_settings = ['standard', 'highgain', 'lowgain', 'veryhighgain', 'verylowgain']
|
||||||
|
"""available settings for Eiger, note almost always standard"""
|
||||||
|
|
||||||
|
def __init__(self, id=0):
|
||||||
|
super().__init__(id)
|
||||||
|
self._frozen = False
|
||||||
|
self._dacs = MoenchDacs(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dacs(self):
|
||||||
|
return self._dacs
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
This file contains the specialization for the Jungfrau detector
|
This file contains the specialization for the Mythen3 detector
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
@ -19,22 +19,22 @@ class Mythen3Dacs(DetectorDacs):
|
|||||||
"""
|
"""
|
||||||
Jungfrau specific DACs
|
Jungfrau specific DACs
|
||||||
"""
|
"""
|
||||||
_dacs = [('vcassh', dacIndex.VCASSH, 0, 4000, 1220),
|
_dacs = [('vcassh', dacIndex.VCASSH, 0, 4000, 1220),
|
||||||
('vth2', dacIndex.VTH2, 0, 4000, 2800),
|
('vth2', dacIndex.VTH2, 0, 4000, 2800),
|
||||||
('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280),
|
('vrshaper', dacIndex.VRSHAPER, 0, 4000, 1280),
|
||||||
('vrshaper_n', dacIndex.VRSHAPER_N, 0, 4000, 2800),
|
('vrshaper_n', dacIndex.VRSHAPER_N, 0, 4000, 2800),
|
||||||
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
|
('vipre_out', dacIndex.VIPRE_OUT, 0, 4000, 1220),
|
||||||
('vth3', dacIndex.VTH3, 0, 4000, 2800),
|
('vth3', dacIndex.VTH3, 0, 4000, 2800),
|
||||||
('vth1', dacIndex.VTH1, 0, 4000, 2800),
|
('vth1', dacIndex.VTH1, 0, 4000, 2800),
|
||||||
('vicin', dacIndex.VICIN, 0, 4000, 1708),
|
('vicin', dacIndex.VICIN, 0, 4000, 1708),
|
||||||
('vcas', dacIndex.VCAS, 0, 4000, 1800),
|
('vcas', dacIndex.VCAS, 0, 4000, 1800),
|
||||||
('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100),
|
('vrpreamp', dacIndex.VRPREAMP, 0, 4000, 1100),
|
||||||
('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100),
|
('vcal_n', dacIndex.VCAL_N, 0, 4000, 1100),
|
||||||
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
|
('vipre', dacIndex.VIPRE, 0, 4000, 2624),
|
||||||
('vishaper', dacIndex.VISHAPER, 0, 4000, 1708),
|
('vishaper', dacIndex.VISHAPER, 0, 4000, 1708),
|
||||||
('vcal_p', dacIndex.VCAL_P, 0, 4000, 1712),
|
('vcal_p', dacIndex.VCAL_P, 0, 4000, 1712),
|
||||||
('vtrim', dacIndex.VTRIM, 0, 4000, 2800),
|
('vtrim', dacIndex.VTRIM, 0, 4000, 2800),
|
||||||
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
|
('vdcsh', dacIndex.VDCSH, 0, 4000, 800),
|
||||||
]
|
]
|
||||||
_dacnames = [_d[0] for _d in _dacs]
|
_dacnames = [_d[0] for _d in _dacs]
|
||||||
|
|
||||||
|
85
python/slsdet/proxy.py
Normal file
85
python/slsdet/proxy.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
from .utils import element_if_equal
|
||||||
|
from .enums import dacIndex
|
||||||
|
|
||||||
|
|
||||||
|
def set_proxy_using_dict(func, key, value):
|
||||||
|
if isinstance(value, dict) and all(isinstance(k, int) for k in value.keys()):
|
||||||
|
for dkey, dvalue in value.items():
|
||||||
|
func(key, dvalue, [dkey])
|
||||||
|
else:
|
||||||
|
func(key, value)
|
||||||
|
|
||||||
|
class JsonProxy:
|
||||||
|
"""
|
||||||
|
Proxy class to allow for intuitive setting and getting of rx_jsonpara
|
||||||
|
This class is returned by Detectr.rx_jsonpara
|
||||||
|
"""
|
||||||
|
def __init__(self, det):
|
||||||
|
self.det = det
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
return element_if_equal(self.det.getAdditionalJsonParameter(key))
|
||||||
|
|
||||||
|
def __setitem__(self, key, value):
|
||||||
|
self.det.setAdditionalJsonParameter(key, str(value))
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
r = element_if_equal(self.det.getAdditionalJsonHeader())
|
||||||
|
if isinstance(r, list):
|
||||||
|
rstr = ''
|
||||||
|
for i, list_item in enumerate(r):
|
||||||
|
list_item = dict(list_item)
|
||||||
|
rstr += ''.join([f'{i}:{key}: {value}\n' for key, value in list_item.items()])
|
||||||
|
|
||||||
|
return rstr.strip('\n')
|
||||||
|
else:
|
||||||
|
r = dict(r)
|
||||||
|
return '\n'.join([f'{key}: {value}' for key, value in r.items()])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class SlowAdcProxy:
|
||||||
|
"""
|
||||||
|
Proxy class to allow for more intuitive reading the slow ADCs
|
||||||
|
"""
|
||||||
|
def __init__(self, det):
|
||||||
|
self.det = det
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
dac_index = dacIndex(int(dacIndex.SLOW_ADC0)+key)
|
||||||
|
return element_if_equal(self.det.getSlowADC(dac_index))
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
rstr = ''
|
||||||
|
for i in range(7):
|
||||||
|
r = element_if_equal(self.__getitem__(i))
|
||||||
|
if isinstance(r, list):
|
||||||
|
rstr += ' '.join(f'{item} mV' for item in r)
|
||||||
|
else:
|
||||||
|
rstr += f'{i}: {r} mV\n'
|
||||||
|
|
||||||
|
return rstr.strip('\n')
|
||||||
|
|
||||||
|
class ClkDivProxy:
|
||||||
|
"""
|
||||||
|
Proxy class to allow for more intuitive reading clockdivider
|
||||||
|
"""
|
||||||
|
def __init__(self, det):
|
||||||
|
self.det = det
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
return element_if_equal(self.det.getClockDivider(key))
|
||||||
|
|
||||||
|
def __setitem__(self, key, value):
|
||||||
|
set_proxy_using_dict(self.det.setClockDivider, key, value)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
rstr = ''
|
||||||
|
for i in range(6):
|
||||||
|
r = element_if_equal(self.__getitem__(i))
|
||||||
|
if isinstance(r, list):
|
||||||
|
rstr += ' '.join(f'{item}' for item in r)
|
||||||
|
else:
|
||||||
|
rstr += f'{i}: {r}\n'
|
||||||
|
|
||||||
|
return rstr.strip('\n')
|
50
python/slsdet/temperature.py
Normal file
50
python/slsdet/temperature.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
from functools import partial
|
||||||
|
from collections.abc import Iterable
|
||||||
|
import numpy as np
|
||||||
|
class Temperature:
|
||||||
|
degree_sign = u"\N{DEGREE SIGN}"
|
||||||
|
|
||||||
|
def __init__(self, name, enum, detector):
|
||||||
|
self.name = name
|
||||||
|
self.enum = enum
|
||||||
|
self._detector = detector
|
||||||
|
self.get_nmod = self._detector.size
|
||||||
|
# Bind functions to get and set the dac
|
||||||
|
self.get = partial(self._detector.getTemperature, self.enum)
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
if key == slice(None, None, None):
|
||||||
|
return self.get()
|
||||||
|
elif isinstance(key, Iterable):
|
||||||
|
return self.get(list(key))
|
||||||
|
else:
|
||||||
|
return self.get([key])[0] # No list for single value
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
"""String representation for a single temperature in all modules"""
|
||||||
|
|
||||||
|
tempstr = ''.join([f'{item:5d}{self.degree_sign}C' for item in self.get()])
|
||||||
|
return f'{self.name:15s}:{tempstr}'
|
||||||
|
|
||||||
|
class DetectorTemperature:
|
||||||
|
"""
|
||||||
|
Interface to temperatures on the readout board
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
for attr, value in self.__dict__.items():
|
||||||
|
yield value
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
"""String representation of all temps all mods"""
|
||||||
|
r_str = '\n'.join([repr(temp) for temp in self])
|
||||||
|
return r_str
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
"""Get temperatures as a dictionary with numpy arrays"""
|
||||||
|
return {attr:np.array(value.get()) for attr, value in self.__dict__.items()}
|
||||||
|
|
||||||
|
def to_array(self):
|
||||||
|
"""Get all temperatures as a numpy array"""
|
||||||
|
t = self.to_dict()
|
||||||
|
return np.vstack([value for key, value in t.items()])
|
@ -8,6 +8,8 @@ from collections import namedtuple
|
|||||||
import _slsdet #C++ lib
|
import _slsdet #C++ lib
|
||||||
import functools
|
import functools
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
import pathlib
|
||||||
|
import os
|
||||||
|
|
||||||
Geometry = namedtuple('Geometry', ['x', 'y'])
|
Geometry = namedtuple('Geometry', ['x', 'y'])
|
||||||
|
|
||||||
@ -77,6 +79,7 @@ def element(func):
|
|||||||
return element_if_equal(func(self, *args, **kwargs))
|
return element_if_equal(func(self, *args, **kwargs))
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
def eiger_register_to_time(register):
|
def eiger_register_to_time(register):
|
||||||
"""
|
"""
|
||||||
Decode register value and return time in s. Values are stored in
|
Decode register value and return time in s. Values are stored in
|
||||||
@ -93,3 +96,34 @@ def make_timedelta(t):
|
|||||||
return t
|
return t
|
||||||
else:
|
else:
|
||||||
return dt.timedelta(seconds=t)
|
return dt.timedelta(seconds=t)
|
||||||
|
|
||||||
|
def make_string_path(path):
|
||||||
|
"""
|
||||||
|
Accepts either a pathlib.Path or a string, expands ~ to user and convert
|
||||||
|
Path to str
|
||||||
|
"""
|
||||||
|
if isinstance(path, pathlib.Path):
|
||||||
|
return path.expanduser().as_posix()
|
||||||
|
elif isinstance(path, str):
|
||||||
|
return os.path.expanduser(path)
|
||||||
|
else:
|
||||||
|
raise ValueError("Cannot convert argument to posix path")
|
||||||
|
|
||||||
|
|
||||||
|
def set_using_dict(func, args):
|
||||||
|
if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
|
||||||
|
for key, value in args.items():
|
||||||
|
func(value, [key])
|
||||||
|
else:
|
||||||
|
func(args)
|
||||||
|
|
||||||
|
def set_time_using_dict(func, args):
|
||||||
|
if isinstance(args, dict) and all(isinstance(k, int) for k in args.keys()):
|
||||||
|
for key, value in args.items():
|
||||||
|
if isinstance(value, int):
|
||||||
|
value = float(value)
|
||||||
|
func(value, [key])
|
||||||
|
else:
|
||||||
|
if isinstance(args, int):
|
||||||
|
args = float(args)
|
||||||
|
func(args)
|
@ -36,6 +36,10 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const std::string &)) &
|
(void (Detector::*)(const std::string &)) &
|
||||||
Detector::loadParameters,
|
Detector::loadParameters,
|
||||||
py::arg())
|
py::arg())
|
||||||
|
.def("loadParameters",
|
||||||
|
(void (Detector::*)(const std::vector<std::string> &)) &
|
||||||
|
Detector::loadParameters,
|
||||||
|
py::arg())
|
||||||
.def("getHostname",
|
.def("getHostname",
|
||||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getHostname,
|
Detector::getHostname,
|
||||||
@ -180,6 +184,14 @@ void init_det(py::module &m) {
|
|||||||
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getDelayAfterTriggerLeft,
|
Detector::getDelayAfterTriggerLeft,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getDynamicRange",
|
||||||
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getDynamicRange,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setDynamicRange",
|
||||||
|
(void (Detector::*)(int)) & Detector::setDynamicRange, py::arg())
|
||||||
|
.def("getDynamicRangeList", (std::vector<int>(Detector::*)() const) &
|
||||||
|
Detector::getDynamicRangeList)
|
||||||
.def("getTimingMode",
|
.def("getTimingMode",
|
||||||
(Result<defs::timingMode>(Detector::*)(sls::Positions) const) &
|
(Result<defs::timingMode>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getTimingMode,
|
Detector::getTimingMode,
|
||||||
@ -188,6 +200,9 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(defs::timingMode, sls::Positions)) &
|
(void (Detector::*)(defs::timingMode, sls::Positions)) &
|
||||||
Detector::setTimingMode,
|
Detector::setTimingMode,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getTimingModeList",
|
||||||
|
(std::vector<defs::timingMode>(Detector::*)() const) &
|
||||||
|
Detector::getTimingModeList)
|
||||||
.def("getSpeed",
|
.def("getSpeed",
|
||||||
(Result<defs::speedLevel>(Detector::*)(sls::Positions) const) &
|
(Result<defs::speedLevel>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getSpeed,
|
Detector::getSpeed,
|
||||||
@ -294,6 +309,9 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const int, sls::Positions)) &
|
(void (Detector::*)(const int, sls::Positions)) &
|
||||||
Detector::setImageTestMode,
|
Detector::setImageTestMode,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getTemperatureList",
|
||||||
|
(std::vector<defs::dacIndex>(Detector::*)() const) &
|
||||||
|
Detector::getTemperatureList)
|
||||||
.def("getTemperature",
|
.def("getTemperature",
|
||||||
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
||||||
Detector::getTemperature,
|
Detector::getTemperature,
|
||||||
@ -304,11 +322,11 @@ void init_det(py::module &m) {
|
|||||||
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
||||||
const) &
|
const) &
|
||||||
Detector::getDAC,
|
Detector::getDAC,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = false, py::arg() = Positions{})
|
||||||
.def("setDAC",
|
.def("setDAC",
|
||||||
(void (Detector::*)(defs::dacIndex, int, bool, sls::Positions)) &
|
(void (Detector::*)(defs::dacIndex, int, bool, sls::Positions)) &
|
||||||
Detector::setDAC,
|
Detector::setDAC,
|
||||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{})
|
||||||
.def("getOnChipDAC",
|
.def("getOnChipDAC",
|
||||||
(Result<int>(Detector::*)(defs::dacIndex, int, sls::Positions)
|
(Result<int>(Detector::*)(defs::dacIndex, int, sls::Positions)
|
||||||
const) &
|
const) &
|
||||||
@ -328,6 +346,14 @@ void init_det(py::module &m) {
|
|||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::setExternalSignalFlags,
|
Detector::setExternalSignalFlags,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getParallelMode",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getParallelMode,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setParallelMode",
|
||||||
|
(void (Detector::*)(bool, sls::Positions)) &
|
||||||
|
Detector::setParallelMode,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("acquire", (void (Detector::*)()) & Detector::acquire)
|
.def("acquire", (void (Detector::*)()) & Detector::acquire)
|
||||||
.def("clearAcquiringFlag",
|
.def("clearAcquiringFlag",
|
||||||
(void (Detector::*)()) & Detector::clearAcquiringFlag)
|
(void (Detector::*)()) & Detector::clearAcquiringFlag)
|
||||||
@ -364,6 +390,18 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(sls::Positions)) &
|
(void (Detector::*)(sls::Positions)) &
|
||||||
Detector::sendSoftwareTrigger,
|
Detector::sendSoftwareTrigger,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
.def("getScan",
|
||||||
|
(Result<defs::scanParameters>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getScan,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setScan",
|
||||||
|
(void (Detector::*)(const defs::scanParameters)) &
|
||||||
|
Detector::setScan,
|
||||||
|
py::arg())
|
||||||
|
.def("getScanErrorMessage",
|
||||||
|
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getScanErrorMessage,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getNumberofUDPInterfaces",
|
.def("getNumberofUDPInterfaces",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getNumberofUDPInterfaces,
|
Detector::getNumberofUDPInterfaces,
|
||||||
@ -450,14 +488,22 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setDestinationUDPPort",
|
.def("setDestinationUDPPort",
|
||||||
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort,
|
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort,
|
||||||
py::arg(), py::arg())
|
py::arg(), py::arg() = -1)
|
||||||
.def("getDestinationUDPPort2",
|
.def("getDestinationUDPPort2",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getDestinationUDPPort2,
|
Detector::getDestinationUDPPort2,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setDestinationUDPPort2",
|
.def("setDestinationUDPPort2",
|
||||||
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2,
|
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2,
|
||||||
py::arg(), py::arg())
|
py::arg(), py::arg() = -1)
|
||||||
|
.def("reconfigureUDPDestination",
|
||||||
|
(void (Detector::*)(sls::Positions)) &
|
||||||
|
Detector::reconfigureUDPDestination,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("validateUDPConfiguration",
|
||||||
|
(void (Detector::*)(sls::Positions)) &
|
||||||
|
Detector::validateUDPConfiguration,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("printRxConfiguration",
|
.def("printRxConfiguration",
|
||||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::printRxConfiguration,
|
Detector::printRxConfiguration,
|
||||||
@ -522,7 +568,7 @@ void init_det(py::module &m) {
|
|||||||
Detector::getRxPort,
|
Detector::getRxPort,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setRxPort", (void (Detector::*)(int, int)) & Detector::setRxPort,
|
.def("setRxPort", (void (Detector::*)(int, int)) & Detector::setRxPort,
|
||||||
py::arg(), py::arg())
|
py::arg(), py::arg() = -1)
|
||||||
.def("getRxFifoDepth",
|
.def("getRxFifoDepth",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getRxFifoDepth,
|
Detector::getRxFifoDepth,
|
||||||
@ -670,13 +716,21 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(int, sls::Positions)) &
|
(void (Detector::*)(int, sls::Positions)) &
|
||||||
Detector::setRxZmqTimer,
|
Detector::setRxZmqTimer,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getRxZmqStartingFrame",
|
||||||
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getRxZmqStartingFrame,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setRxZmqStartingFrame",
|
||||||
|
(void (Detector::*)(int, sls::Positions)) &
|
||||||
|
Detector::setRxZmqStartingFrame,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getRxZmqPort",
|
.def("getRxZmqPort",
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getRxZmqPort,
|
Detector::getRxZmqPort,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setRxZmqPort",
|
.def("setRxZmqPort",
|
||||||
(void (Detector::*)(int, int)) & Detector::setRxZmqPort, py::arg(),
|
(void (Detector::*)(int, int)) & Detector::setRxZmqPort, py::arg(),
|
||||||
py::arg())
|
py::arg() = -1)
|
||||||
.def("getRxZmqIP",
|
.def("getRxZmqIP",
|
||||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getRxZmqIP,
|
Detector::getRxZmqIP,
|
||||||
@ -691,7 +745,7 @@ void init_det(py::module &m) {
|
|||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setClientZmqPort",
|
.def("setClientZmqPort",
|
||||||
(void (Detector::*)(int, int)) & Detector::setClientZmqPort,
|
(void (Detector::*)(int, int)) & Detector::setClientZmqPort,
|
||||||
py::arg(), py::arg())
|
py::arg(), py::arg() = -1)
|
||||||
.def("getClientZmqIp",
|
.def("getClientZmqIp",
|
||||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getClientZmqIp,
|
Detector::getClientZmqIp,
|
||||||
@ -700,12 +754,6 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const sls::IpAddr, sls::Positions)) &
|
(void (Detector::*)(const sls::IpAddr, sls::Positions)) &
|
||||||
Detector::setClientZmqIp,
|
Detector::setClientZmqIp,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getDynamicRange",
|
|
||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getDynamicRange,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setDynamicRange",
|
|
||||||
(void (Detector::*)(int)) & Detector::setDynamicRange, py::arg())
|
|
||||||
.def("getSubExptime",
|
.def("getSubExptime",
|
||||||
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getSubExptime,
|
Detector::getSubExptime,
|
||||||
@ -730,7 +778,8 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(int, defs::detectorSettings, bool,
|
(void (Detector::*)(int, defs::detectorSettings, bool,
|
||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::setThresholdEnergy,
|
Detector::setThresholdEnergy,
|
||||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = defs::STANDARD, py::arg() = true,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getSettingsPath",
|
.def("getSettingsPath",
|
||||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getSettingsPath,
|
Detector::getSettingsPath,
|
||||||
@ -739,14 +788,6 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
Detector::setSettingsPath,
|
Detector::setSettingsPath,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getParallelMode",
|
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getParallelMode,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setParallelMode",
|
|
||||||
(void (Detector::*)(bool, sls::Positions)) &
|
|
||||||
Detector::setParallelMode,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getOverFlowMode",
|
.def("getOverFlowMode",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getOverFlowMode,
|
Detector::getOverFlowMode,
|
||||||
@ -939,11 +980,11 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const int, const int, sls::Positions)) &
|
(void (Detector::*)(const int, const int, sls::Positions)) &
|
||||||
Detector::setInjectChannel,
|
Detector::setInjectChannel,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def(
|
.def("getVetoPhoton",
|
||||||
"getVetoPhoton",
|
(void (Detector::*)(const int, const std::string &,
|
||||||
(Result<std::vector<int>>(Detector::*)(const int, sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::getVetoPhoton,
|
Detector::getVetoPhoton,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("setVetoPhoton",
|
.def("setVetoPhoton",
|
||||||
(void (Detector::*)(const int, const int, const int,
|
(void (Detector::*)(const int, const int, const int,
|
||||||
const std::string &, sls::Positions)) &
|
const std::string &, sls::Positions)) &
|
||||||
@ -954,6 +995,11 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const int, const int, sls::Positions)) &
|
(void (Detector::*)(const int, const int, sls::Positions)) &
|
||||||
Detector::setVetoReference,
|
Detector::setVetoReference,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("setVetoFile",
|
||||||
|
(void (Detector::*)(const int, const std::string &,
|
||||||
|
sls::Positions)) &
|
||||||
|
Detector::setVetoFile,
|
||||||
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("getBurstMode",
|
.def("getBurstMode",
|
||||||
(Result<defs::burstMode>(Detector::*)(sls::Positions)) &
|
(Result<defs::burstMode>(Detector::*)(sls::Positions)) &
|
||||||
Detector::getBurstMode,
|
Detector::getBurstMode,
|
||||||
@ -962,6 +1008,20 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(defs::burstMode, sls::Positions)) &
|
(void (Detector::*)(defs::burstMode, sls::Positions)) &
|
||||||
Detector::setBurstMode,
|
Detector::setBurstMode,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getCDSGain",
|
||||||
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getCDSGain,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setCDSGain",
|
||||||
|
(void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getFilter",
|
||||||
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
|
Detector::getFilter,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setFilter",
|
||||||
|
(void (Detector::*)(int, sls::Positions)) & Detector::setFilter,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getCurrentSource",
|
.def("getCurrentSource",
|
||||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getCurrentSource,
|
Detector::getCurrentSource,
|
||||||
@ -987,6 +1047,24 @@ void init_det(py::module &m) {
|
|||||||
(void (Detector::*)(const bool, sls::Positions)) &
|
(void (Detector::*)(const bool, sls::Positions)) &
|
||||||
Detector::setVeto,
|
Detector::setVeto,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getADCConfiguration",
|
||||||
|
(Result<int>(Detector::*)(const int, const int, sls::Positions)
|
||||||
|
const) &
|
||||||
|
Detector::getADCConfiguration,
|
||||||
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("setADCConfiguration",
|
||||||
|
(void (Detector::*)(const int, const int, const int,
|
||||||
|
sls::Positions)) &
|
||||||
|
Detector::setADCConfiguration,
|
||||||
|
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getBadChannels",
|
||||||
|
(void (Detector::*)(const std::string &, sls::Positions) const) &
|
||||||
|
Detector::getBadChannels,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("setBadChannels",
|
||||||
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
|
Detector::setBadChannels,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getCounterMask",
|
.def("getCounterMask",
|
||||||
(Result<uint32_t>(Detector::*)(sls::Positions) const) &
|
(Result<uint32_t>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getCounterMask,
|
Detector::getCounterMask,
|
||||||
@ -1267,31 +1345,6 @@ void init_det(py::module &m) {
|
|||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::setAdditionalJsonParameter,
|
Detector::setAdditionalJsonParameter,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("getDetectorMinMaxEnergyThreshold",
|
|
||||||
(Result<int>(Detector::*)(const bool, sls::Positions) const) &
|
|
||||||
Detector::getDetectorMinMaxEnergyThreshold,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("setDetectorMinMaxEnergyThreshold",
|
|
||||||
(void (Detector::*)(const bool, const int, sls::Positions)) &
|
|
||||||
Detector::setDetectorMinMaxEnergyThreshold,
|
|
||||||
py::arg(), py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getFrameMode",
|
|
||||||
(Result<defs::frameModeType>(Detector::*)(sls::Positions) const) &
|
|
||||||
Detector::getFrameMode,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setFrameMode",
|
|
||||||
(void (Detector::*)(defs::frameModeType, sls::Positions)) &
|
|
||||||
Detector::setFrameMode,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("getDetectorMode",
|
|
||||||
(Result<defs::detectorModeType>(Detector::*)(sls::Positions)
|
|
||||||
const) &
|
|
||||||
Detector::getDetectorMode,
|
|
||||||
py::arg() = Positions{})
|
|
||||||
.def("setDetectorMode",
|
|
||||||
(void (Detector::*)(defs::detectorModeType, sls::Positions)) &
|
|
||||||
Detector::setDetectorMode,
|
|
||||||
py::arg(), py::arg() = Positions{})
|
|
||||||
.def("programFPGA",
|
.def("programFPGA",
|
||||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||||
Detector::programFPGA,
|
Detector::programFPGA,
|
||||||
|
@ -259,24 +259,13 @@ void init_enums(py::module &m) {
|
|||||||
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
|
.value("IS_SLAVE", slsDetectorDefs::masterFlags::IS_SLAVE)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::frameModeType>(Defs, "frameModeType")
|
|
||||||
.value("PEDESTAL", slsDetectorDefs::frameModeType::PEDESTAL)
|
|
||||||
.value("NEW_PEDESTAL", slsDetectorDefs::frameModeType::NEW_PEDESTAL)
|
|
||||||
.value("FLATFIELD", slsDetectorDefs::frameModeType::FLATFIELD)
|
|
||||||
.value("NEW_FLATFIELD", slsDetectorDefs::frameModeType::NEW_FLATFIELD)
|
|
||||||
.export_values();
|
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::detectorModeType>(Defs, "detectorModeType")
|
|
||||||
.value("COUNTING", slsDetectorDefs::detectorModeType::COUNTING)
|
|
||||||
.value("INTERPOLATING",
|
|
||||||
slsDetectorDefs::detectorModeType::INTERPOLATING)
|
|
||||||
.value("ANALOG", slsDetectorDefs::detectorModeType::ANALOG)
|
|
||||||
.export_values();
|
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
py::enum_<slsDetectorDefs::burstMode>(Defs, "burstMode")
|
||||||
.value("BURST_OFF", slsDetectorDefs::burstMode::BURST_OFF)
|
|
||||||
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
.value("BURST_INTERNAL", slsDetectorDefs::burstMode::BURST_INTERNAL)
|
||||||
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
.value("BURST_EXTERNAL", slsDetectorDefs::burstMode::BURST_EXTERNAL)
|
||||||
|
.value("CONTINUOUS_INTERNAL",
|
||||||
|
slsDetectorDefs::burstMode::CONTINUOUS_INTERNAL)
|
||||||
|
.value("CONTINUOUS_EXTERNAL",
|
||||||
|
slsDetectorDefs::burstMode::CONTINUOUS_EXTERNAL)
|
||||||
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
|
.value("NUM_BURST_MODES", slsDetectorDefs::burstMode::NUM_BURST_MODES)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
|
@ -379,15 +379,15 @@ def test_set_readout_clock_3(d, mocker):
|
|||||||
d.readout_clock = 'Super Slow Speed'
|
d.readout_clock = 'Super Slow Speed'
|
||||||
m.assert_called_once_with(3)
|
m.assert_called_once_with(3)
|
||||||
|
|
||||||
#----------------------------------------------------------------rx_datastream
|
#----------------------------------------------------------------rx_zmqstream
|
||||||
def test_get_rx_datastream(d, mocker):
|
def test_get_rx_zmqstream(d, mocker):
|
||||||
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||||
m.return_value = False
|
m.return_value = False
|
||||||
assert d.rx_datastream == False
|
assert d.rx_zmqstream == False
|
||||||
|
|
||||||
def test_set_rx_datastream(d, mocker):
|
def test_set_rx_zmqstream(d, mocker):
|
||||||
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||||
d.rx_datastream = True
|
d.rx_zmqstream = True
|
||||||
m.assert_called_once_with(True)
|
m.assert_called_once_with(True)
|
||||||
|
|
||||||
def test_get_rx_zmqip(d, mocker):
|
def test_get_rx_zmqip(d, mocker):
|
@ -412,15 +412,15 @@ def test_set_counters_single(d, mocker):
|
|||||||
# d.readout_clock = 'Super Slow Speed'
|
# d.readout_clock = 'Super Slow Speed'
|
||||||
# m.assert_called_once_with(3)
|
# m.assert_called_once_with(3)
|
||||||
|
|
||||||
# #----------------------------------------------------------------rx_datastream
|
# #----------------------------------------------------------------rx_zmqstream
|
||||||
# def test_get_rx_datastream(d, mocker):
|
# def test_get_rx_zmqstream(d, mocker):
|
||||||
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
# m = mocker.patch('_slsdet.DetectorApi.getRxDataStreamStatus')
|
||||||
# m.return_value = False
|
# m.return_value = False
|
||||||
# assert d.rx_datastream == False
|
# assert d.rx_zmqstream == False
|
||||||
|
|
||||||
# def test_set_rx_datastream(d, mocker):
|
# def test_set_rx_zmqstream(d, mocker):
|
||||||
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
# m = mocker.patch('_slsdet.DetectorApi.setRxDataStreamStatus')
|
||||||
# d.rx_datastream = True
|
# d.rx_zmqstream = True
|
||||||
# m.assert_called_once_with(True)
|
# m.assert_called_once_with(True)
|
||||||
|
|
||||||
# def test_get_rx_zmqip(d, mocker):
|
# def test_get_rx_zmqip(d, mocker):
|
@ -7,6 +7,7 @@ Testing functions from utils.py
|
|||||||
import pytest
|
import pytest
|
||||||
from slsdet.utils import *
|
from slsdet.utils import *
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
import pathlib
|
||||||
|
|
||||||
def test_iterable():
|
def test_iterable():
|
||||||
assert is_iterable(5) == False
|
assert is_iterable(5) == False
|
||||||
@ -94,3 +95,22 @@ def test_make_timedelta_from_timedelta():
|
|||||||
r = make_timedelta(t)
|
r = make_timedelta(t)
|
||||||
assert 60 == r.total_seconds()
|
assert 60 == r.total_seconds()
|
||||||
assert r == dt.timedelta(minutes=1)
|
assert r == dt.timedelta(minutes=1)
|
||||||
|
|
||||||
|
|
||||||
|
def test_make_string_path_from_Path():
|
||||||
|
pathstr = "/some/temp/path"
|
||||||
|
p = pathlib.Path(pathstr)
|
||||||
|
r = make_string_path(p)
|
||||||
|
assert isinstance(r, str)
|
||||||
|
assert r == p.as_posix()
|
||||||
|
assert r == pathstr
|
||||||
|
|
||||||
|
def test_make_string_path_expand_user():
|
||||||
|
pathstr = "~/tmp/virtual.config"
|
||||||
|
home = pathlib.Path.home()
|
||||||
|
expanded_str = pathstr.replace('~', home.as_posix())
|
||||||
|
p = pathlib.Path(pathstr)
|
||||||
|
rp = make_string_path(p)
|
||||||
|
rs = make_string_path(pathstr)
|
||||||
|
assert rp == expanded_str
|
||||||
|
assert rs == expanded_str
|
@ -1,6 +1,6 @@
|
|||||||
add_executable(using_logger using_logger.cpp)
|
add_executable(using_logger using_logger.cpp)
|
||||||
target_link_libraries(using_logger
|
target_link_libraries(using_logger
|
||||||
slsSupportLib
|
slsSupportShared
|
||||||
pthread
|
pthread
|
||||||
rt
|
rt
|
||||||
)
|
)
|
||||||
@ -22,7 +22,7 @@ set_target_properties(using_logger PROPERTIES
|
|||||||
# add_executable(udp udp.cpp)
|
# add_executable(udp udp.cpp)
|
||||||
# target_link_libraries(udp
|
# target_link_libraries(udp
|
||||||
# slsDetectorShared
|
# slsDetectorShared
|
||||||
# slsSupportLib
|
# slsSupportShared
|
||||||
# pthread
|
# pthread
|
||||||
# rt
|
# rt
|
||||||
# fmt
|
# fmt
|
||||||
|
@ -23,7 +23,7 @@ foreach(exe ${MOENCH_EXECUTABLES})
|
|||||||
|
|
||||||
target_link_libraries(${exe}
|
target_link_libraries(${exe}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
slsSupportLib
|
slsSupportShared
|
||||||
${ZeroMQ_LIBRARIES}
|
${ZeroMQ_LIBRARIES}
|
||||||
pthread
|
pthread
|
||||||
tiff
|
tiff
|
||||||
|
@ -241,7 +241,7 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
if (zmqsocket->Connect()) {
|
if (zmqsocket->Connect()) {
|
||||||
cprintf(RED, "Error: Could not connect to socket %s\n",
|
cprintf(RED, "Error: Could not connect to socket %s\n",
|
||||||
zmqsocket->GetZmqServerAddress());
|
(zmqsocket->GetZmqServerAddress()).c_str());
|
||||||
delete zmqsocket;
|
delete zmqsocket;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} else
|
} else
|
||||||
@ -281,12 +281,12 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
if (zmqsocket2->Connect()) {
|
if (zmqsocket2->Connect()) {
|
||||||
cprintf(RED, "BBB Error: Could not connect to socket %s\n",
|
cprintf(RED, "BBB Error: Could not connect to socket %s\n",
|
||||||
zmqsocket2->GetZmqServerAddress());
|
zmqsocket2->GetZmqServerAddress().c_str());
|
||||||
// delete zmqsocket2;
|
// delete zmqsocket2;
|
||||||
send = false;
|
send = false;
|
||||||
// return EXIT_FAILURE;
|
// return EXIT_FAILURE;
|
||||||
} else
|
} else
|
||||||
printf("Zmq Client at %s\n", zmqsocket2->GetZmqServerAddress());
|
printf("Zmq Client at %s\n", zmqsocket2->GetZmqServerAddress().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,6 +388,7 @@ int main(int argc, char *argv[]) {
|
|||||||
while (mt->isBusy()) {;}//wait until all data are processed from the queues
|
while (mt->isBusy()) {;}//wait until all data are processed from the queues
|
||||||
|
|
||||||
if (of) {
|
if (of) {
|
||||||
|
mt->setFilePointer(NULL);
|
||||||
fclose(of);
|
fclose(of);
|
||||||
of=NULL;
|
of=NULL;
|
||||||
}
|
}
|
||||||
|
@ -602,12 +602,14 @@ int *getClusters(char *data, int *ph=NULL) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void writeClusters(FILE *f, single_photon_hit *cl, int nph, int fn=0){
|
static void writeClusters(FILE *f, single_photon_hit *cl, int nph, int fn=0){
|
||||||
if (nph>0) {
|
if (f) {
|
||||||
|
if (nph>0) {
|
||||||
#ifndef OLDFORMAT
|
#ifndef OLDFORMAT
|
||||||
if (fwrite((void*)&fn, 1, sizeof(int), f))
|
if (fwrite((void*)&fn, 1, sizeof(int), f))
|
||||||
if (fwrite((void*)&nph, 1, sizeof(int), f))
|
if (fwrite((void*)&nph, 1, sizeof(int), f))
|
||||||
#endif
|
#endif
|
||||||
for (int i=0; i<nph; i++) (cl+i)->write(f);
|
for (int i=0; i<nph; i++) (cl+i)->write(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,6 +88,7 @@ target_include_directories(slsDetectorGui PUBLIC
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(slsDetectorGui PUBLIC
|
target_link_libraries(slsDetectorGui PUBLIC
|
||||||
|
slsProjectOptions
|
||||||
slsProjectWarnings
|
slsProjectWarnings
|
||||||
slsDetectorShared
|
slsDetectorShared
|
||||||
${QT_QTCORE_LIBRARIES}
|
${QT_QTCORE_LIBRARIES}
|
||||||
@ -97,6 +98,7 @@ target_link_libraries(slsDetectorGui PUBLIC
|
|||||||
ZLIB::ZLIB
|
ZLIB::ZLIB
|
||||||
Qt4::QtOpenGL
|
Qt4::QtOpenGL
|
||||||
Qt4::QtSvg
|
Qt4::QtSvg
|
||||||
|
expat
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties(slsDetectorGui PROPERTIES
|
set_target_properties(slsDetectorGui PROPERTIES
|
||||||
@ -104,10 +106,10 @@ set_target_properties(slsDetectorGui PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS slsDetectorGui
|
install(TARGETS slsDetectorGui
|
||||||
# EXPORT "${TARGETS_EXPORT_NAME}"
|
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -52,6 +52,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>-1.000000000000000</double>
|
<double>-1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
|
@ -98,6 +98,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -413,249 +413,6 @@ Directory where one saves the data.
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QGroupBox" name="boxCorrection_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>Options</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QRadioButton" name="radioDefaultDeadtime">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Default Dead Time</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="chkTenGiga">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><nobr>
|
|
||||||
Compression using Root. Available only for Gotthard in Expert Mode.
|
|
||||||
</nobr><br><nobr>
|
|
||||||
#r_compression#
|
|
||||||
</nobr></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>10GbE</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="4">
|
|
||||||
<widget class="QSpinBox" name="spinCustomDeadTime">
|
|
||||||
<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="suffix">
|
|
||||||
<string>ns</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>-1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>200000000</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="chkRate">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Rate:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>10</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QRadioButton" name="radioCustomDeadtime">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Custom Dead Time:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="5">
|
|
||||||
<spacer name="horizontalSpacer_7">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>10</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="6">
|
|
||||||
<widget class="QWidget" name="widgetEiger" native="true">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridEiger">
|
|
||||||
<item row="0" column="1">
|
|
||||||
<spacer name="horizontalSpacer_4">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>10</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QComboBox" name="comboEigerClkDivider">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Full Speed</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Half Speed</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Quarter Speed</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="4">
|
|
||||||
<spacer name="horizontalSpacer_6">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Expanding</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>10</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="lblEigerFlags">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>105</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Flags:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="lblClkDivider">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>105</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Clock Divider:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QComboBox" name="comboEigerParallelFlag">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>25</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Parallel</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Non Parallel</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -672,6 +429,232 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QGroupBox" name="boxCorrection_2">
|
||||||
|
<property name="title">
|
||||||
|
<string>Options</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lblClkDivider">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>105</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Clock Divider:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboClkDivider">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Full Speed</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Half Speed</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Quarter Speed</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkParallel">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Parallel Readout</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QCheckBox" name="chkTenGiga">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><nobr>
|
||||||
|
Compression using Root. Available only for Gotthard in Expert Mode.
|
||||||
|
</nobr><br><nobr>
|
||||||
|
#r_compression#
|
||||||
|
</nobr></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>10GbE</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkRate">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Rate:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioDefaultDeadtime">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Default Dead Time</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioCustomDeadtime">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Custom Dead Time:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinCustomDeadTime">
|
||||||
|
<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="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string>ns</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>200000000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_7">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
@ -680,12 +663,6 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
|||||||
<tabstop>btnOutputBrowse</tabstop>
|
<tabstop>btnOutputBrowse</tabstop>
|
||||||
<tabstop>comboFileFormat</tabstop>
|
<tabstop>comboFileFormat</tabstop>
|
||||||
<tabstop>chkOverwriteEnable</tabstop>
|
<tabstop>chkOverwriteEnable</tabstop>
|
||||||
<tabstop>chkTenGiga</tabstop>
|
|
||||||
<tabstop>chkRate</tabstop>
|
|
||||||
<tabstop>radioDefaultDeadtime</tabstop>
|
|
||||||
<tabstop>radioCustomDeadtime</tabstop>
|
|
||||||
<tabstop>spinCustomDeadTime</tabstop>
|
|
||||||
<tabstop>comboEigerClkDivider</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../include/icons.qrc"/>
|
<include location="../include/icons.qrc"/>
|
||||||
|
@ -180,6 +180,9 @@
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
<string><html><head/><body><p>High Voltage. Range: 60 - 200V. Swich off high voltage by setting to 0.</p><p>-1 corresponds to different values from detectors.</p><p>#highvoltage#</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>-1</number>
|
<number>-1</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -432,7 +432,7 @@
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>4</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="5" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
|
<widget class="QStackedWidget" name="stackedLblTriggerBurst">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -503,7 +503,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="3">
|
<item row="5" column="3">
|
||||||
<widget class="QComboBox" name="comboPeriodUnit">
|
<widget class="QComboBox" name="comboPeriodUnit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -572,7 +572,7 @@ Frame period between exposures.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" colspan="2">
|
<item row="2" column="2" colspan="2">
|
||||||
<widget class="QSpinBox" name="spinNumMeasurements">
|
<widget class="QSpinBox" name="spinNumMeasurements">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -616,7 +616,7 @@ Frame period between exposures.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@ -674,7 +674,7 @@ Frame period between exposures.
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="4" column="2">
|
||||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -718,7 +718,7 @@ Exposure Time of a frame.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="lblPeriod">
|
<widget class="QLabel" name="lblPeriod">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -735,7 +735,7 @@ Frame period between exposures.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="lblNumFrames">
|
<widget class="QLabel" name="lblNumFrames">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -745,7 +745,7 @@ Frame period between exposures.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="lblExpTime">
|
<widget class="QLabel" name="lblExpTime">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -762,7 +762,7 @@ Exposure Time of a frame.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" colspan="2">
|
<item row="3" column="2" colspan="2">
|
||||||
<widget class="QSpinBox" name="spinNumFrames">
|
<widget class="QSpinBox" name="spinNumFrames">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -809,7 +809,7 @@ Exposure Time of a frame.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="3">
|
<item row="4" column="3">
|
||||||
<widget class="QComboBox" name="comboExpUnit">
|
<widget class="QComboBox" name="comboExpUnit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -871,7 +871,7 @@ Exposure Time of a frame.
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="5" column="2">
|
||||||
<widget class="QDoubleSpinBox" name="spinPeriod">
|
<widget class="QDoubleSpinBox" name="spinPeriod">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -931,7 +931,7 @@ Frame period between exposures.
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="2">
|
<item row="6" column="2">
|
||||||
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
|
<widget class="QStackedWidget" name="stackedSpinTriggerBurst">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -1070,7 +1070,7 @@ Frame period between exposures.
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="7" column="0">
|
||||||
<widget class="QStackedWidget" name="stackedLblDelayBurstPeriod">
|
<widget class="QStackedWidget" name="stackedLblDelayBurstPeriod">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -1141,7 +1141,7 @@ Frame period between exposures.
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2">
|
<item row="7" column="2">
|
||||||
<widget class="QStackedWidget" name="stackedSpinDelayBurstPeriod">
|
<widget class="QStackedWidget" name="stackedSpinDelayBurstPeriod">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -1268,7 +1268,7 @@ Frame period between exposures.
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="3">
|
<item row="7" column="3">
|
||||||
<widget class="QStackedWidget" name="stackedComboDelayBurstPeriod">
|
<widget class="QStackedWidget" name="stackedComboDelayBurstPeriod">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -1431,7 +1431,7 @@ Frame period between exposures.
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QStackedWidget" name="stackedLblSamplesGates">
|
<widget class="QStackedWidget" name="stackedLblSamplesGates">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -1502,7 +1502,7 @@ Frame period between exposures.
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="2">
|
<item row="8" column="2">
|
||||||
<widget class="QStackedWidget" name="stackedSpinSamplesGates">
|
<widget class="QStackedWidget" name="stackedSpinSamplesGates">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -1639,6 +1639,53 @@ Frame period between exposures.
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lblBurstMode">
|
||||||
|
<property name="text">
|
||||||
|
<string>Burst Mode:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="2">
|
||||||
|
<widget class="QComboBox" name="comboBurstMode">
|
||||||
|
<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>Timing Mode of the detector.
|
||||||
|
#timing#</string>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Burst Internal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Burst External</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Continuous Internal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Continuous External</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -2169,7 +2169,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QStackedWidget" name="stackedTimeInterval">
|
<widget class="QStackedWidget" name="stackedTimeInterval">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pageTimeGap">
|
<widget class="QWidget" name="pageTimeGap">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||||
@ -2181,6 +2181,9 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="decimals">
|
<property name="decimals">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
@ -2249,6 +2252,9 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="keyboardTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -19,7 +19,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
~qDrawPlot();
|
~qDrawPlot();
|
||||||
bool GetIsRunning();
|
bool GetIsRunning();
|
||||||
void SetRunning(bool enable);
|
void SetRunning(bool enable);
|
||||||
int GetProgress();
|
double GetProgress();
|
||||||
int64_t GetCurrentFrameIndex();
|
int64_t GetCurrentFrameIndex();
|
||||||
void Select1dPlot(bool enable);
|
void Select1dPlot(bool enable);
|
||||||
void SetPlotTitlePrefix(QString title);
|
void SetPlotTitlePrefix(QString title);
|
||||||
@ -152,7 +152,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
bool disableZoom{false};
|
bool disableZoom{false};
|
||||||
int numDiscardBits{0};
|
int numDiscardBits{0};
|
||||||
|
|
||||||
int progress{0};
|
double progress{0};
|
||||||
int64_t currentFrame{0};
|
int64_t currentFrame{0};
|
||||||
mutable std::mutex mPlots;
|
mutable std::mutex mPlots;
|
||||||
int64_t currentAcqIndex{0};
|
int64_t currentAcqIndex{0};
|
||||||
|
@ -18,17 +18,24 @@ class qTabAdvanced : public QWidget, private Ui::TabAdvancedObject {
|
|||||||
void SetDetector();
|
void SetDetector();
|
||||||
void SetControlPort(int port);
|
void SetControlPort(int port);
|
||||||
void SetStopPort(int port);
|
void SetStopPort(int port);
|
||||||
void SetDetectorUDPIP();
|
void SetDetectorUDPIP(bool force = false);
|
||||||
void SetDetectorUDPMAC();
|
void ForceSetDetectorUDPIP();
|
||||||
|
void SetDetectorUDPMAC(bool force = false);
|
||||||
|
void ForceSetDetectorUDPMAC();
|
||||||
void SetCltZMQPort(int port);
|
void SetCltZMQPort(int port);
|
||||||
void SetCltZMQIP();
|
void SetCltZMQIP(bool force = false);
|
||||||
void SetRxrHostname();
|
void ForceSetCltZMQIP();
|
||||||
|
void SetRxrHostname(bool force = false);
|
||||||
|
void ForceSetRxrHostname();
|
||||||
void SetRxrTCPPort(int port);
|
void SetRxrTCPPort(int port);
|
||||||
void SetRxrUDPPort(int port);
|
void SetRxrUDPPort(int port);
|
||||||
void SetRxrUDPIP();
|
void SetRxrUDPIP(bool force = false);
|
||||||
void SetRxrUDPMAC();
|
void ForceSetRxrUDPIP();
|
||||||
|
void SetRxrUDPMAC(bool force = false);
|
||||||
|
void ForceSetRxrUDPMAC();
|
||||||
void SetRxrZMQPort(int port);
|
void SetRxrZMQPort(int port);
|
||||||
void SetRxrZMQIP();
|
void SetRxrZMQIP(bool force = false);
|
||||||
|
void ForceSetRxrZMQIP();
|
||||||
void GetROI();
|
void GetROI();
|
||||||
void ClearROI();
|
void ClearROI();
|
||||||
void SetROI();
|
void SetROI();
|
||||||
|
@ -13,14 +13,15 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
|||||||
private slots:
|
private slots:
|
||||||
void GetOutputDir();
|
void GetOutputDir();
|
||||||
void BrowseOutputDir();
|
void BrowseOutputDir();
|
||||||
void SetOutputDir();
|
void SetOutputDir(bool force = false);
|
||||||
|
void ForceSetOutputDir();
|
||||||
void SetFileFormat(int format);
|
void SetFileFormat(int format);
|
||||||
void SetOverwriteEnable(bool enable);
|
void SetOverwriteEnable(bool enable);
|
||||||
void SetTenGigaEnable(bool enable);
|
void SetTenGigaEnable(bool enable);
|
||||||
void EnableRateCorrection();
|
void EnableRateCorrection();
|
||||||
void SetRateCorrection();
|
void SetRateCorrection();
|
||||||
void SetSpeed(int speed);
|
void SetSpeed(int speed);
|
||||||
void SetFlags();
|
void SetParallel(bool enable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
@ -34,11 +35,9 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
|||||||
void GetTenGigaEnable();
|
void GetTenGigaEnable();
|
||||||
void GetRateCorrection();
|
void GetRateCorrection();
|
||||||
void GetSpeed();
|
void GetSpeed();
|
||||||
void GetFlags();
|
void GetParallel();
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
// Button group for radiobuttons for rate
|
// Button group for radiobuttons for rate
|
||||||
QButtonGroup *btnGroupRate;
|
QButtonGroup *btnGroupRate;
|
||||||
// enum for the Eiger Parallel flag
|
|
||||||
enum { PARALLEL, NONPARALLEL };
|
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetTimingMode(int val);
|
void SetTimingMode(int val);
|
||||||
|
void SetBurstMode(int val);
|
||||||
void SetNumMeasurements(int val);
|
void SetNumMeasurements(int val);
|
||||||
void SetNumFrames(int val);
|
void SetNumFrames(int val);
|
||||||
void SetNumTriggers(int val);
|
void SetNumTriggers(int val);
|
||||||
@ -31,7 +32,8 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
|||||||
void SetDelay();
|
void SetDelay();
|
||||||
void SetBurstPeriod();
|
void SetBurstPeriod();
|
||||||
void SetFileWrite(bool val);
|
void SetFileWrite(bool val);
|
||||||
void SetFileName();
|
void SetFileName(bool force = false);
|
||||||
|
void ForceSetFileName();
|
||||||
void SetRunIndex(int val);
|
void SetRunIndex(int val);
|
||||||
void SetStartingFrameNumber(int val);
|
void SetStartingFrameNumber(int val);
|
||||||
void UpdateProgress();
|
void UpdateProgress();
|
||||||
@ -51,6 +53,7 @@ class qTabMeasurement : public QWidget, private Ui::TabMeasurementObject {
|
|||||||
void EnableWidgetsforTimingMode();
|
void EnableWidgetsforTimingMode();
|
||||||
|
|
||||||
void GetTimingMode();
|
void GetTimingMode();
|
||||||
|
void GetBurstMode();
|
||||||
void GetNumFrames();
|
void GetNumFrames();
|
||||||
void GetNumTriggers();
|
void GetNumTriggers();
|
||||||
void GetNumBursts();
|
void GetNumBursts();
|
||||||
|
@ -24,6 +24,12 @@ class qTabPlot : public QWidget, private Ui::TabPlotObject {
|
|||||||
void SetBinary();
|
void SetBinary();
|
||||||
void SetGapPixels(bool enable);
|
void SetGapPixels(bool enable);
|
||||||
void SetTitles();
|
void SetTitles();
|
||||||
|
void isXMinModified();
|
||||||
|
void isXMaxModified();
|
||||||
|
void isYMinModified();
|
||||||
|
void isYMaxModified();
|
||||||
|
void isZMinModified();
|
||||||
|
void isZMaxModified();
|
||||||
void SetXRange();
|
void SetXRange();
|
||||||
void SetYRange();
|
void SetYRange();
|
||||||
void CheckAspectRatio();
|
void CheckAspectRatio();
|
||||||
|
@ -26,7 +26,7 @@ void qDacWidget::SetupWidgetWindow(std::string name) {
|
|||||||
|
|
||||||
void qDacWidget::Initialization() {
|
void qDacWidget::Initialization() {
|
||||||
if (isDac) {
|
if (isDac) {
|
||||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
connect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ void qDacWidget::SetDetectorIndex(int id) {
|
|||||||
void qDacWidget::GetDac() {
|
void qDacWidget::GetDac() {
|
||||||
LOG(logDEBUG) << "Getting Dac " << index;
|
LOG(logDEBUG) << "Getting Dac " << index;
|
||||||
|
|
||||||
disconnect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
disconnect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac()));
|
||||||
try {
|
try {
|
||||||
// dac units
|
// dac units
|
||||||
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
|
auto retval = det->getDAC(index, 0, {detectorIndex}).squash(-1);
|
||||||
@ -52,7 +52,7 @@ void qDacWidget::GetDac() {
|
|||||||
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
||||||
"qDacWidget::GetDac")
|
"qDacWidget::GetDac")
|
||||||
|
|
||||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
connect(spinDac, SIGNAL(valueChanged(double)), this, SLOT(SetDac()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDacWidget::SetDac() {
|
void qDacWidget::SetDac() {
|
||||||
|
@ -222,12 +222,12 @@ void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
|
|||||||
actionLoadTrimbits->setEnabled(false);
|
actionLoadTrimbits->setEnabled(false);
|
||||||
switch (detType) {
|
switch (detType) {
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
|
case slsDetectorDefs::MYTHEN3:
|
||||||
actionLoadTrimbits->setEnabled(true);
|
actionLoadTrimbits->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
case slsDetectorDefs::MYTHEN3:
|
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -334,7 +334,8 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
|
|
||||||
tabs->setTabEnabled(ADVANCED, enable);
|
tabs->setTabEnabled(ADVANCED, enable);
|
||||||
actionLoadTrimbits->setVisible(enable &&
|
actionLoadTrimbits->setVisible(enable &&
|
||||||
detType == slsDetectorDefs::EIGER);
|
(detType == slsDetectorDefs::EIGER ||
|
||||||
|
detType == slsDetectorDefs::MYTHEN3));
|
||||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,11 +401,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
|||||||
this, tr("Load Detector Trimbits"), fName,
|
this, tr("Load Detector Trimbits"), fName,
|
||||||
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
tr("Trimbit files (*.trim noise.sn*);;All Files(*)"));
|
||||||
fileDialog->setFileMode(QFileDialog::AnyFile);
|
fileDialog->setFileMode(QFileDialog::AnyFile);
|
||||||
if (fileDialog->exec() == QDialog::Accepted)
|
if (fileDialog->exec() == QDialog::Accepted) {
|
||||||
fName = fileDialog->selectedFiles()[0];
|
fName = fileDialog->selectedFiles()[0];
|
||||||
|
|
||||||
// Gets called when cancelled as well
|
|
||||||
if (!fName.isEmpty()) {
|
|
||||||
det->loadTrimbits(std::string(fName.toAscii().constData()));
|
det->loadTrimbits(std::string(fName.toAscii().constData()));
|
||||||
qDefs::Message(qDefs::INFORMATION,
|
qDefs::Message(qDefs::INFORMATION,
|
||||||
"The Trimbits have been loaded successfully.",
|
"The Trimbits have been loaded successfully.",
|
||||||
|
@ -248,7 +248,7 @@ bool qDrawPlot::GetIsRunning() { return isRunning; }
|
|||||||
|
|
||||||
void qDrawPlot::SetRunning(bool enable) { isRunning = enable; }
|
void qDrawPlot::SetRunning(bool enable) { isRunning = enable; }
|
||||||
|
|
||||||
int qDrawPlot::GetProgress() { return progress; }
|
double qDrawPlot::GetProgress() { return progress; }
|
||||||
|
|
||||||
int64_t qDrawPlot::GetCurrentFrameIndex() { return currentFrame; }
|
int64_t qDrawPlot::GetCurrentFrameIndex() { return currentFrame; }
|
||||||
|
|
||||||
@ -717,7 +717,7 @@ void qDrawPlot::AcquisitionFinished(double currentProgress,
|
|||||||
LOG(logERROR) << "Acquisition finished [Status: ERROR]";
|
LOG(logERROR) << "Acquisition finished [Status: ERROR]";
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO) << "Acquisition finished [ Status:" << status
|
LOG(logINFO) << "Acquisition finished [ Status:" << status
|
||||||
<< ", Progress: " << currentProgress << " ]";
|
<< ", Progress: " << currentProgress << "% ]";
|
||||||
}
|
}
|
||||||
emit AcquireFinishedSignal();
|
emit AcquireFinishedSignal();
|
||||||
}
|
}
|
||||||
@ -741,10 +741,10 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
|
|||||||
<< " \t complete image: " << data->completeImage << std::endl
|
<< " \t complete image: " << data->completeImage << std::endl
|
||||||
<< " ]";
|
<< " ]";
|
||||||
|
|
||||||
progress = (int)data->progressIndex;
|
progress = data->progressIndex;
|
||||||
currentAcqIndex = data->fileIndex;
|
currentAcqIndex = data->fileIndex;
|
||||||
currentFrame = frameIndex;
|
currentFrame = frameIndex;
|
||||||
LOG(logDEBUG) << "[ Progress:" << progress << ", Frame:" << currentFrame
|
LOG(logDEBUG) << "[ Progress:" << progress << "%, Frame:" << currentFrame
|
||||||
<< " ]";
|
<< " ]";
|
||||||
|
|
||||||
// 1d check if npixelX has changed (m3 for different counters enabled)
|
// 1d check if npixelX has changed (m3 for different counters enabled)
|
||||||
|
@ -29,6 +29,7 @@ void qTabAdvanced::SetupWidgetWindow() {
|
|||||||
tab_roi->setEnabled(true);
|
tab_roi->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
|
tab_trimming->setEnabled(true);
|
||||||
lblDiscardBits->setEnabled(true);
|
lblDiscardBits->setEnabled(true);
|
||||||
spinDiscardBits->setEnabled(true);
|
spinDiscardBits->setEnabled(true);
|
||||||
lblGateIndex->setEnabled(true);
|
lblGateIndex->setEnabled(true);
|
||||||
@ -65,8 +66,7 @@ void qTabAdvanced::Initialization() {
|
|||||||
|
|
||||||
// trimming
|
// trimming
|
||||||
if (tab_trimming->isEnabled()) {
|
if (tab_trimming->isEnabled()) {
|
||||||
// editingFinished to not set trimbits for every character input
|
connect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this,
|
||||||
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
|
||||||
SLOT(SetAllTrimbits()));
|
SLOT(SetAllTrimbits()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,23 +79,36 @@ void qTabAdvanced::Initialization() {
|
|||||||
SLOT(SetStopPort(int)));
|
SLOT(SetStopPort(int)));
|
||||||
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
|
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetDetectorUDPIP()));
|
SLOT(SetDetectorUDPIP()));
|
||||||
|
connect(dispDetectorUDPIP, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetDetectorUDPIP()));
|
||||||
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
|
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetDetectorUDPMAC()));
|
SLOT(SetDetectorUDPMAC()));
|
||||||
|
connect(dispDetectorUDPMAC, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetDetectorUDPMAC()));
|
||||||
connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
|
connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetCltZMQPort(int)));
|
SLOT(SetCltZMQPort(int)));
|
||||||
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
|
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
|
||||||
|
connect(dispZMQIP, SIGNAL(returnPressed()), this, SLOT(ForceSetCltZMQIP()));
|
||||||
connect(dispRxrHostname, SIGNAL(editingFinished()), this,
|
connect(dispRxrHostname, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetRxrHostname()));
|
SLOT(SetRxrHostname()));
|
||||||
|
connect(dispRxrHostname, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetRxrHostname()));
|
||||||
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
|
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRxrTCPPort(int)));
|
SLOT(SetRxrTCPPort(int)));
|
||||||
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
|
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRxrUDPPort(int)));
|
SLOT(SetRxrUDPPort(int)));
|
||||||
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
|
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
|
||||||
|
connect(dispRxrUDPIP, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetRxrUDPIP()));
|
||||||
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
|
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetRxrUDPMAC()));
|
SLOT(SetRxrUDPMAC()));
|
||||||
|
connect(dispRxrUDPMAC, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetRxrUDPMAC()));
|
||||||
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRxrZMQPort(int)));
|
SLOT(SetRxrZMQPort(int)));
|
||||||
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
||||||
|
connect(dispRxrZMQIP, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetRxrZMQIP()));
|
||||||
|
|
||||||
// roi
|
// roi
|
||||||
if (tab_roi->isEnabled()) {
|
if (tab_roi->isEnabled()) {
|
||||||
@ -421,28 +434,42 @@ void qTabAdvanced::SetStopPort(int port) {
|
|||||||
&qTabAdvanced::GetStopPort)
|
&qTabAdvanced::GetStopPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetDetectorUDPIP() {
|
void qTabAdvanced::SetDetectorUDPIP(bool force) {
|
||||||
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
// return forces modification (inconsistency from command line)
|
||||||
LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
if (dispDetectorUDPIP->isModified() || force) {
|
||||||
try {
|
dispDetectorUDPIP->setModified(false);
|
||||||
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
std::string s = dispDetectorUDPIP->text().toAscii().constData();
|
||||||
|
LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||||
|
try {
|
||||||
|
det->setSourceUDPIP(sls::IpAddr{s},
|
||||||
|
{comboDetector->currentIndex()});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set Detector UDP IP.",
|
||||||
|
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||||
|
&qTabAdvanced::GetDetectorUDPIP)
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Detector UDP IP.",
|
|
||||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
|
||||||
&qTabAdvanced::GetDetectorUDPIP)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetDetectorUDPMAC() {
|
void qTabAdvanced::ForceSetDetectorUDPIP() { SetDetectorUDPIP(true); };
|
||||||
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
|
||||||
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
void qTabAdvanced::SetDetectorUDPMAC(bool force) {
|
||||||
try {
|
// return forces modification (inconsistency from command line)
|
||||||
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
if (dispDetectorUDPMAC->isModified() || force) {
|
||||||
|
dispDetectorUDPMAC->setModified(false);
|
||||||
|
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
|
||||||
|
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||||
|
try {
|
||||||
|
det->setSourceUDPMAC(sls::MacAddr{s},
|
||||||
|
{comboDetector->currentIndex()});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
||||||
|
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||||
|
&qTabAdvanced::GetDetectorUDPMAC)
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
|
||||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
|
||||||
&qTabAdvanced::GetDetectorUDPMAC)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabAdvanced::ForceSetDetectorUDPMAC() { SetDetectorUDPMAC(true); }
|
||||||
|
|
||||||
void qTabAdvanced::SetCltZMQPort(int port) {
|
void qTabAdvanced::SetCltZMQPort(int port) {
|
||||||
LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
||||||
try {
|
try {
|
||||||
@ -453,29 +480,44 @@ void qTabAdvanced::SetCltZMQPort(int port) {
|
|||||||
&qTabAdvanced::GetCltZMQPort)
|
&qTabAdvanced::GetCltZMQPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetCltZMQIP() {
|
void qTabAdvanced::SetCltZMQIP(bool force) {
|
||||||
std::string s = dispZMQIP->text().toAscii().constData();
|
// return forces modification (inconsistency from command line)
|
||||||
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
if (dispZMQIP->isModified() || force) {
|
||||||
try {
|
dispZMQIP->setModified(false);
|
||||||
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
std::string s = dispZMQIP->text().toAscii().constData();
|
||||||
|
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||||
|
try {
|
||||||
|
det->setClientZmqIp(sls::IpAddr{s},
|
||||||
|
{comboDetector->currentIndex()});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set Client ZMQ IP.",
|
||||||
|
"qTabAdvanced::SetCltZMQIP", this,
|
||||||
|
&qTabAdvanced::GetCltZMQIP)
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetCltZMQIP",
|
|
||||||
this, &qTabAdvanced::GetCltZMQIP)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrHostname() {
|
void qTabAdvanced::ForceSetCltZMQIP() { SetCltZMQIP(true); }
|
||||||
std::string s = dispZMQIP->text().toAscii().constData();
|
|
||||||
LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
|
||||||
try {
|
|
||||||
det->setRxHostname(s, {comboDetector->currentIndex()});
|
|
||||||
}
|
|
||||||
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetRxrHostname",
|
|
||||||
this, &qTabAdvanced::GetRxrHostname)
|
|
||||||
|
|
||||||
// update all network widgets (receiver mainly)
|
void qTabAdvanced::SetRxrHostname(bool force) {
|
||||||
SetDetector();
|
// return forces modification (inconsistency from command line)
|
||||||
|
if (dispRxrHostname->isModified() || force) {
|
||||||
|
dispRxrHostname->setModified(false);
|
||||||
|
std::string s = dispRxrHostname->text().toAscii().constData();
|
||||||
|
LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
||||||
|
try {
|
||||||
|
det->setRxHostname(s, {comboDetector->currentIndex()});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set Client ZMQ IP.",
|
||||||
|
"qTabAdvanced::SetRxrHostname", this,
|
||||||
|
&qTabAdvanced::GetRxrHostname)
|
||||||
|
|
||||||
|
// update all network widgets (receiver mainly)
|
||||||
|
SetDetector();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabAdvanced::ForceSetRxrHostname() { SetRxrHostname(true); }
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrTCPPort(int port) {
|
void qTabAdvanced::SetRxrTCPPort(int port) {
|
||||||
LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
||||||
try {
|
try {
|
||||||
@ -496,29 +538,42 @@ void qTabAdvanced::SetRxrUDPPort(int port) {
|
|||||||
&qTabAdvanced::GetRxrUDPPort)
|
&qTabAdvanced::GetRxrUDPPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrUDPIP() {
|
void qTabAdvanced::SetRxrUDPIP(bool force) {
|
||||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
// return forces modification (inconsistency from command line)
|
||||||
LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
if (dispRxrUDPIP->isModified() || force) {
|
||||||
try {
|
dispRxrUDPIP->setModified(false);
|
||||||
det->setDestinationUDPIP(sls::IpAddr{s},
|
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||||
{comboDetector->currentIndex()});
|
LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||||
|
try {
|
||||||
|
det->setDestinationUDPIP(sls::IpAddr{s},
|
||||||
|
{comboDetector->currentIndex()});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set Receiver UDP IP.",
|
||||||
|
"qTabAdvanced::SetRxrUDPIP", this,
|
||||||
|
&qTabAdvanced::GetRxrUDPIP)
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver UDP IP.", "qTabAdvanced::SetRxrUDPIP",
|
|
||||||
this, &qTabAdvanced::GetRxrUDPIP)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrUDPMAC() {
|
void qTabAdvanced::ForceSetRxrUDPIP() { SetRxrUDPIP(true); }
|
||||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
|
||||||
LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
void qTabAdvanced::SetRxrUDPMAC(bool force) {
|
||||||
try {
|
// return forces modification (inconsistency from command line)
|
||||||
det->setDestinationUDPMAC(sls::MacAddr{s},
|
if (dispRxrUDPMAC->isModified() || force) {
|
||||||
{comboDetector->currentIndex()});
|
dispRxrUDPMAC->setModified(false);
|
||||||
|
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||||
|
LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||||
|
try {
|
||||||
|
det->setDestinationUDPMAC(sls::MacAddr{s},
|
||||||
|
{comboDetector->currentIndex()});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
||||||
|
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||||
|
&qTabAdvanced::GetRxrUDPMAC)
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
|
||||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
|
||||||
&qTabAdvanced::GetRxrUDPMAC)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabAdvanced::ForceSetRxrUDPMAC() { SetRxrUDPMAC(true); }
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrZMQPort(int port) {
|
void qTabAdvanced::SetRxrZMQPort(int port) {
|
||||||
LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
||||||
try {
|
try {
|
||||||
@ -529,16 +584,23 @@ void qTabAdvanced::SetRxrZMQPort(int port) {
|
|||||||
&qTabAdvanced::GetRxrZMQPort)
|
&qTabAdvanced::GetRxrZMQPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabAdvanced::SetRxrZMQIP() {
|
void qTabAdvanced::SetRxrZMQIP(bool force) {
|
||||||
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
// return forces modification (inconsistency from command line)
|
||||||
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
if (dispRxrZMQIP->isModified() || force) {
|
||||||
try {
|
dispRxrZMQIP->setModified(false);
|
||||||
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
std::string s = dispRxrZMQIP->text().toAscii().constData();
|
||||||
|
LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||||
|
try {
|
||||||
|
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set Receiver ZMQ IP.",
|
||||||
|
"qTabAdvanced::SetRxrZMQIP", this,
|
||||||
|
&qTabAdvanced::GetRxrZMQIP)
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set Receiver ZMQ IP.", "qTabAdvanced::SetRxrZMQIP",
|
|
||||||
this, &qTabAdvanced::GetRxrZMQIP)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabAdvanced::ForceSetRxrZMQIP() { SetRxrZMQIP(true); }
|
||||||
|
|
||||||
void qTabAdvanced::GetROI() {
|
void qTabAdvanced::GetROI() {
|
||||||
LOG(logDEBUG) << "Getting ROI";
|
LOG(logDEBUG) << "Getting ROI";
|
||||||
try {
|
try {
|
||||||
@ -575,7 +637,7 @@ void qTabAdvanced::SetROI() {
|
|||||||
|
|
||||||
void qTabAdvanced::GetAllTrimbits() {
|
void qTabAdvanced::GetAllTrimbits() {
|
||||||
LOG(logDEBUG) << "Getting all trimbits value";
|
LOG(logDEBUG) << "Getting all trimbits value";
|
||||||
disconnect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
disconnect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetAllTrimbits()));
|
SLOT(SetAllTrimbits()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -584,7 +646,7 @@ void qTabAdvanced::GetAllTrimbits() {
|
|||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
||||||
|
|
||||||
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
connect(spinSetAllTrimbits, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetAllTrimbits()));
|
SLOT(SetAllTrimbits()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,12 +32,20 @@ void qTabDataOutput::SetupWidgetWindow() {
|
|||||||
radioDefaultDeadtime->setEnabled(true);
|
radioDefaultDeadtime->setEnabled(true);
|
||||||
radioCustomDeadtime->setEnabled(true);
|
radioCustomDeadtime->setEnabled(true);
|
||||||
// flags and speed
|
// flags and speed
|
||||||
widgetEiger->setVisible(true);
|
lblClkDivider->setEnabled(true);
|
||||||
widgetEiger->setEnabled(true);
|
comboClkDivider->setEnabled(true);
|
||||||
|
chkParallel->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
chkTenGiga->setEnabled(true);
|
chkTenGiga->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
case slsDetectorDefs::MYTHEN3:
|
||||||
|
chkParallel->setEnabled(true);
|
||||||
|
break;
|
||||||
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
|
lblClkDivider->setEnabled(true);
|
||||||
|
comboClkDivider->setEnabled(true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -54,6 +62,8 @@ void qTabDataOutput::Initialization() {
|
|||||||
SLOT(GetOutputDir()));
|
SLOT(GetOutputDir()));
|
||||||
connect(dispOutputDir, SIGNAL(editingFinished()), this,
|
connect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||||
SLOT(SetOutputDir()));
|
SLOT(SetOutputDir()));
|
||||||
|
connect(dispOutputDir, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetOutputDir()));
|
||||||
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
|
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
|
||||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetFileFormat(int)));
|
SLOT(SetFileFormat(int)));
|
||||||
@ -69,15 +79,18 @@ void qTabDataOutput::Initialization() {
|
|||||||
SLOT(EnableRateCorrection()));
|
SLOT(EnableRateCorrection()));
|
||||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||||
SLOT(SetRateCorrection()));
|
SLOT(SetRateCorrection()));
|
||||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
connect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRateCorrection()));
|
SLOT(SetRateCorrection()));
|
||||||
}
|
}
|
||||||
// flags, speed
|
// parallel
|
||||||
if (widgetEiger->isEnabled()) {
|
if (chkParallel->isEnabled()) {
|
||||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
connect(chkParallel, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetParallel(bool)));
|
||||||
|
}
|
||||||
|
// speed
|
||||||
|
if (comboClkDivider->isEnabled()) {
|
||||||
|
connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSpeed(int)));
|
SLOT(SetSpeed(int)));
|
||||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
|
||||||
SLOT(SetFlags()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,35 +182,41 @@ void qTabDataOutput::BrowseOutputDir() {
|
|||||||
dispOutputDir->setText(directory);
|
dispOutputDir->setText(directory);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetOutputDir() {
|
void qTabDataOutput::SetOutputDir(bool force) {
|
||||||
QString path = dispOutputDir->text();
|
// return forces modification (inconsistency from command line)
|
||||||
LOG(logDEBUG) << "Setting output directory to "
|
if (dispOutputDir->isModified() || force) {
|
||||||
<< path.toAscii().constData();
|
dispOutputDir->setModified(false);
|
||||||
|
QString path = dispOutputDir->text();
|
||||||
|
LOG(logDEBUG) << "Setting output directory to "
|
||||||
|
<< path.toAscii().constData();
|
||||||
|
|
||||||
// empty
|
// empty
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
qDefs::Message(qDefs::WARNING,
|
qDefs::Message(qDefs::WARNING,
|
||||||
"Invalid Output Path. Must not be empty.",
|
"Invalid Output Path. Must not be empty.",
|
||||||
"qTabDataOutput::SetOutputDir");
|
"qTabDataOutput::SetOutputDir");
|
||||||
LOG(logWARNING) << "Invalid Output Path. Must not be empty.";
|
LOG(logWARNING) << "Invalid Output Path. Must not be empty.";
|
||||||
GetOutputDir();
|
GetOutputDir();
|
||||||
} else {
|
} else {
|
||||||
// chop off trailing '/'
|
// chop off trailing '/'
|
||||||
if (path.endsWith('/')) {
|
if (path.endsWith('/')) {
|
||||||
while (path.endsWith('/')) {
|
while (path.endsWith('/')) {
|
||||||
path.chop(1);
|
path.chop(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
std::string spath = std::string(path.toAscii().constData());
|
||||||
|
try {
|
||||||
|
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set output file path.",
|
||||||
|
"qTabDataOutput::SetOutputDir", this,
|
||||||
|
&qTabDataOutput::GetOutputDir)
|
||||||
}
|
}
|
||||||
std::string spath = std::string(path.toAscii().constData());
|
|
||||||
try {
|
|
||||||
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
|
||||||
}
|
|
||||||
CATCH_HANDLE("Could not set output file path.",
|
|
||||||
"qTabDataOutput::SetOutputDir", this,
|
|
||||||
&qTabDataOutput::GetOutputDir)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabDataOutput::ForceSetOutputDir() { SetOutputDir(true); };
|
||||||
|
|
||||||
void qTabDataOutput::GetFileFormat() {
|
void qTabDataOutput::GetFileFormat() {
|
||||||
LOG(logDEBUG) << "Getting File Format";
|
LOG(logDEBUG) << "Getting File Format";
|
||||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -288,7 +307,7 @@ void qTabDataOutput::GetRateCorrection() {
|
|||||||
SLOT(EnableRateCorrection()));
|
SLOT(EnableRateCorrection()));
|
||||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||||
SLOT(SetRateCorrection()));
|
SLOT(SetRateCorrection()));
|
||||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
disconnect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRateCorrection()));
|
SLOT(SetRateCorrection()));
|
||||||
try {
|
try {
|
||||||
spinCustomDeadTime->setValue(-1);
|
spinCustomDeadTime->setValue(-1);
|
||||||
@ -305,7 +324,7 @@ void qTabDataOutput::GetRateCorrection() {
|
|||||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||||
SLOT(SetRateCorrection()));
|
SLOT(SetRateCorrection()));
|
||||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
connect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetRateCorrection()));
|
SLOT(SetRateCorrection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,22 +370,21 @@ void qTabDataOutput::SetRateCorrection() {
|
|||||||
|
|
||||||
void qTabDataOutput::GetSpeed() {
|
void qTabDataOutput::GetSpeed() {
|
||||||
LOG(logDEBUG) << "Getting Speed";
|
LOG(logDEBUG) << "Getting Speed";
|
||||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSpeed(int)));
|
SLOT(SetSpeed(int)));
|
||||||
try {
|
try {
|
||||||
auto retval =
|
auto retval =
|
||||||
det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
||||||
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval));
|
comboClkDivider->setCurrentIndex(static_cast<int>(retval));
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed")
|
CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSpeed(int)));
|
SLOT(SetSpeed(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetSpeed(int speed) {
|
void qTabDataOutput::SetSpeed(int speed) {
|
||||||
LOG(logINFO) << "Setting Speed to "
|
LOG(logINFO) << "Setting Speed to "
|
||||||
<< comboEigerClkDivider->currentText().toAscii().data();
|
<< comboClkDivider->currentText().toAscii().data();
|
||||||
;
|
|
||||||
try {
|
try {
|
||||||
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
||||||
}
|
}
|
||||||
@ -374,34 +392,28 @@ void qTabDataOutput::SetSpeed(int speed) {
|
|||||||
&qTabDataOutput::GetSpeed)
|
&qTabDataOutput::GetSpeed)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetFlags() {
|
void qTabDataOutput::GetParallel() {
|
||||||
LOG(logDEBUG) << "Getting readout flags";
|
LOG(logDEBUG) << "Getting parallel readout";
|
||||||
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(chkParallel, SIGNAL(toggled(bool)), this,
|
||||||
SLOT(SetFlags()));
|
SLOT(SetParallel(bool)));
|
||||||
try {
|
try {
|
||||||
auto retval = det->getParallelMode().tsquash(
|
auto retval = det->getParallelMode().tsquash(
|
||||||
"Parallel Flag is inconsistent for all detectors.");
|
"Parallel Flag is inconsistent for all detectors.");
|
||||||
// parallel or non parallel
|
chkParallel->setChecked(retval);
|
||||||
if (retval)
|
|
||||||
comboEigerParallelFlag->setCurrentIndex(PARALLEL);
|
|
||||||
else
|
|
||||||
comboEigerParallelFlag->setCurrentIndex(NONPARALLEL);
|
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get flags.", "qTabDataOutput::GetFlags")
|
CATCH_DISPLAY("Could not get parallel readout.",
|
||||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
"qTabDataOutput::GetParallel")
|
||||||
SLOT(SetFlags()));
|
connect(chkParallel, SIGNAL(toggled(bool)), this, SLOT(SetParallel(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::SetFlags() {
|
void qTabDataOutput::SetParallel(bool enable) {
|
||||||
auto mode =
|
LOG(logINFO) << "Setting PArallel readout to " << enable;
|
||||||
comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
|
||||||
try {
|
try {
|
||||||
LOG(logINFO) << "Setting Readout Flags to "
|
det->setParallelMode(enable);
|
||||||
<< comboEigerParallelFlag->currentText().toAscii().data();
|
|
||||||
det->setParallelMode(mode);
|
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set readout flags.", "qTabDataOutput::SetFlags",
|
CATCH_HANDLE("Could not set parallel readout.",
|
||||||
this, &qTabDataOutput::GetFlags)
|
"qTabDataOutput::SetParallel", this,
|
||||||
|
&qTabDataOutput::GetParallel)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::Refresh() {
|
void qTabDataOutput::Refresh() {
|
||||||
@ -419,9 +431,11 @@ void qTabDataOutput::Refresh() {
|
|||||||
if (chkTenGiga->isEnabled()) {
|
if (chkTenGiga->isEnabled()) {
|
||||||
GetTenGigaEnable();
|
GetTenGigaEnable();
|
||||||
}
|
}
|
||||||
if (widgetEiger->isEnabled()) {
|
if (chkParallel->isEnabled()) {
|
||||||
|
GetParallel();
|
||||||
|
}
|
||||||
|
if (comboClkDivider->isEnabled()) {
|
||||||
GetSpeed();
|
GetSpeed();
|
||||||
GetFlags();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(logDEBUG) << "**Updated DataOutput Tab";
|
LOG(logDEBUG) << "**Updated DataOutput Tab";
|
||||||
|
@ -290,7 +290,7 @@ void qTabDeveloper::Initialization() {
|
|||||||
SLOT(Refresh()));
|
SLOT(Refresh()));
|
||||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetHighVoltage()));
|
SLOT(SetHighVoltage()));
|
||||||
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDeveloper::PopulateDetectors() {
|
void qTabDeveloper::PopulateDetectors() {
|
||||||
@ -312,7 +312,7 @@ void qTabDeveloper::GetHighVoltage() {
|
|||||||
if (!comboHV->isVisible() && !spinHV->isVisible())
|
if (!comboHV->isVisible() && !spinHV->isVisible())
|
||||||
return;
|
return;
|
||||||
LOG(logDEBUG) << "Getting High Voltage";
|
LOG(logDEBUG) << "Getting High Voltage";
|
||||||
disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
disconnect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetHighVoltage()));
|
SLOT(SetHighVoltage()));
|
||||||
try {
|
try {
|
||||||
@ -359,7 +359,7 @@ void qTabDeveloper::GetHighVoltage() {
|
|||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get high voltage.",
|
CATCH_DISPLAY("Could not get high voltage.",
|
||||||
"qTabDeveloper::GetHighVoltage")
|
"qTabDeveloper::GetHighVoltage")
|
||||||
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
|
||||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetHighVoltage()));
|
SLOT(SetHighVoltage()));
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,8 @@ void qTabMeasurement::SetupWidgetWindow() {
|
|||||||
ShowGates();
|
ShowGates();
|
||||||
|
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
|
lblBurstMode->hide();
|
||||||
|
comboBurstMode->hide();
|
||||||
switch (det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
lblNumSamples->setEnabled(true);
|
lblNumSamples->setEnabled(true);
|
||||||
@ -64,6 +66,8 @@ void qTabMeasurement::SetupWidgetWindow() {
|
|||||||
startingFnumImplemented = true;
|
startingFnumImplemented = true;
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
case slsDetectorDefs::GOTTHARD2:
|
||||||
|
lblBurstMode->show();
|
||||||
|
comboBurstMode->show();
|
||||||
lblNumBursts->setEnabled(true);
|
lblNumBursts->setEnabled(true);
|
||||||
spinNumBursts->setEnabled(true);
|
spinNumBursts->setEnabled(true);
|
||||||
lblBurstPeriod->setEnabled(true);
|
lblBurstPeriod->setEnabled(true);
|
||||||
@ -89,6 +93,10 @@ void qTabMeasurement::SetupWidgetWindow() {
|
|||||||
void qTabMeasurement::Initialization() {
|
void qTabMeasurement::Initialization() {
|
||||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetTimingMode(int)));
|
SLOT(SetTimingMode(int)));
|
||||||
|
if (comboBurstMode->isVisible()) {
|
||||||
|
connect(comboBurstMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetBurstMode(int)));
|
||||||
|
}
|
||||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this,
|
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetNumMeasurements(int)));
|
SLOT(SetNumMeasurements(int)));
|
||||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this,
|
connect(spinNumFrames, SIGNAL(valueChanged(int)), this,
|
||||||
@ -129,6 +137,8 @@ void qTabMeasurement::Initialization() {
|
|||||||
}
|
}
|
||||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||||
|
connect(dispFileName, SIGNAL(returnPressed()), this,
|
||||||
|
SLOT(ForceSetFileName()));
|
||||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||||
if (startingFnumImplemented) {
|
if (startingFnumImplemented) {
|
||||||
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this,
|
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this,
|
||||||
@ -142,18 +152,15 @@ void qTabMeasurement::Initialization() {
|
|||||||
void qTabMeasurement::ShowTriggerDelay() {
|
void qTabMeasurement::ShowTriggerDelay() {
|
||||||
bool showTrigger = true;
|
bool showTrigger = true;
|
||||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||||
try {
|
// burst and auto
|
||||||
LOG(logDEBUG) << "Getting burst mode";
|
if ((comboBurstMode->currentIndex() ==
|
||||||
auto retval = det->getBurstMode().tsquash(
|
slsDetectorDefs::BURST_INTERNAL ||
|
||||||
"Inconsistent burst mode for all detectors.");
|
comboBurstMode->currentIndex() ==
|
||||||
// burst mode and auto timing mode
|
slsDetectorDefs::BURST_EXTERNAL) &&
|
||||||
if (retval != slsDetectorDefs::BURST_OFF &&
|
(comboTimingMode->currentIndex() == AUTO)) {
|
||||||
comboTimingMode->currentIndex() == AUTO) {
|
// show burst, burstperiod, not trigger or delay
|
||||||
showTrigger = false;
|
showTrigger = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get burst mode.",
|
|
||||||
"qTabMeasurement::ShowTriggerDelay")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showTrigger) {
|
if (showTrigger) {
|
||||||
@ -246,7 +253,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
|||||||
spinPeriod->setEnabled(true);
|
spinPeriod->setEnabled(true);
|
||||||
comboPeriodUnit->setEnabled(true);
|
comboPeriodUnit->setEnabled(true);
|
||||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||||
ShowTriggerDelay();
|
GetBurstMode(); // also decides to show trigger or burst mode
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRIGGER:
|
case TRIGGER:
|
||||||
@ -270,7 +277,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
|||||||
spinDelay->setEnabled(true);
|
spinDelay->setEnabled(true);
|
||||||
comboDelayUnit->setEnabled(true);
|
comboDelayUnit->setEnabled(true);
|
||||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||||
ShowTriggerDelay();
|
GetBurstMode(); // also decides to show trigger or burst mode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -357,6 +364,42 @@ void qTabMeasurement::SetTimingMode(int val) {
|
|||||||
this, &qTabMeasurement::GetTimingMode)
|
this, &qTabMeasurement::GetTimingMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabMeasurement::GetBurstMode() {
|
||||||
|
LOG(logDEBUG) << "Getting burst mode";
|
||||||
|
disconnect(comboBurstMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetBurstMode(int)));
|
||||||
|
try {
|
||||||
|
auto retval = det->getBurstMode().tsquash(
|
||||||
|
"Inconsistent burst mode for all detectors.");
|
||||||
|
switch (retval) {
|
||||||
|
case slsDetectorDefs::BURST_INTERNAL:
|
||||||
|
case slsDetectorDefs::BURST_EXTERNAL:
|
||||||
|
case slsDetectorDefs::CONTINUOUS_INTERNAL:
|
||||||
|
case slsDetectorDefs::CONTINUOUS_EXTERNAL:
|
||||||
|
comboBurstMode->setCurrentIndex((int)retval);
|
||||||
|
ShowTriggerDelay();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw sls::RuntimeError(std::string("Unknown burst mode: ") +
|
||||||
|
std::to_string(retval));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get burst mode.", "qTabMeasurement::GetBurstMode")
|
||||||
|
connect(comboBurstMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetBurstMode(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabMeasurement::SetBurstMode(int val) {
|
||||||
|
LOG(logINFO) << "Setting burst mode:"
|
||||||
|
<< comboBurstMode->currentText().toAscii().data();
|
||||||
|
try {
|
||||||
|
det->setBurstMode(static_cast<slsDetectorDefs::burstMode>(val));
|
||||||
|
ShowTriggerDelay();
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set burst mode.", "qTabMeasurement::SetBurstMode",
|
||||||
|
this, &qTabMeasurement::GetBurstMode)
|
||||||
|
}
|
||||||
|
|
||||||
void qTabMeasurement::SetNumMeasurements(int val) {
|
void qTabMeasurement::SetNumMeasurements(int val) {
|
||||||
LOG(logINFO) << "Setting Number of Measurements to " << val;
|
LOG(logINFO) << "Setting Number of Measurements to " << val;
|
||||||
numMeasurements = val;
|
numMeasurements = val;
|
||||||
@ -723,19 +766,26 @@ void qTabMeasurement::GetFileName() {
|
|||||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::SetFileName() {
|
void qTabMeasurement::SetFileName(bool force) {
|
||||||
std::string val = std::string(dispFileName->text().toAscii().constData());
|
// return forces modification (inconsistency from command line)
|
||||||
LOG(logINFO) << "Setting File Name Prefix:" << val;
|
if (dispFileName->isModified() || force) {
|
||||||
try {
|
dispFileName->setModified(false);
|
||||||
det->setFileNamePrefix(val);
|
std::string val =
|
||||||
}
|
std::string(dispFileName->text().toAscii().constData());
|
||||||
CATCH_HANDLE("Could not set file name prefix.",
|
LOG(logINFO) << "Setting File Name Prefix:" << val;
|
||||||
"qTabMeasurement::SetFileName", this,
|
try {
|
||||||
&qTabMeasurement::GetFileName)
|
det->setFileNamePrefix(val);
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set file name prefix.",
|
||||||
|
"qTabMeasurement::SetFileName", this,
|
||||||
|
&qTabMeasurement::GetFileName)
|
||||||
|
|
||||||
emit FileNameChangedSignal(dispFileName->text());
|
emit FileNameChangedSignal(dispFileName->text());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabMeasurement::ForceSetFileName() { SetFileName(true); }
|
||||||
|
|
||||||
void qTabMeasurement::GetRunIndex() {
|
void qTabMeasurement::GetRunIndex() {
|
||||||
LOG(logDEBUG) << "Getting Acquisition File index";
|
LOG(logDEBUG) << "Getting Acquisition File index";
|
||||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this,
|
disconnect(spinIndex, SIGNAL(valueChanged(int)), this,
|
||||||
@ -904,6 +954,9 @@ void qTabMeasurement::Refresh() {
|
|||||||
|
|
||||||
if (!plot->GetIsRunning()) {
|
if (!plot->GetIsRunning()) {
|
||||||
GetTimingMode();
|
GetTimingMode();
|
||||||
|
if (comboBurstMode->isVisible()) {
|
||||||
|
GetBurstMode();
|
||||||
|
}
|
||||||
GetNumFrames();
|
GetNumFrames();
|
||||||
GetExposureTime();
|
GetExposureTime();
|
||||||
GetAcquisitionPeriod();
|
GetAcquisitionPeriod();
|
||||||
|
@ -87,9 +87,9 @@ void qTabPlot::Initialization() {
|
|||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
connect(spinTimeGap, SIGNAL(editingFinished()), this,
|
connect(spinTimeGap, SIGNAL(valueChanged(double)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this,
|
connect(spinNthFrame, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
|
|
||||||
// navigation buttons for options
|
// navigation buttons for options
|
||||||
@ -174,17 +174,17 @@ void qTabPlot::Initialization() {
|
|||||||
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||||
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
||||||
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
||||||
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified()));
|
||||||
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified()));
|
||||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified()));
|
||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified()));
|
||||||
connect(chkAspectRatio, SIGNAL(toggled(bool)), this,
|
connect(chkAspectRatio, SIGNAL(toggled(bool)), this,
|
||||||
SLOT(CheckAspectRatio()));
|
SLOT(CheckAspectRatio()));
|
||||||
|
|
||||||
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||||
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(isZMinModified()));
|
||||||
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
|
connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(isZMaxModified()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabPlot::Select1DPlot(bool enable) {
|
void qTabPlot::Select1DPlot(bool enable) {
|
||||||
@ -389,6 +389,48 @@ void qTabPlot::SetTitles() {
|
|||||||
SLOT(SetTitles()));
|
SLOT(SetTitles()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabPlot::isXMinModified() {
|
||||||
|
if (dispXMin->isModified()) {
|
||||||
|
dispXMin->setModified(false);
|
||||||
|
SetXRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabPlot::isXMaxModified() {
|
||||||
|
if (dispXMax->isModified()) {
|
||||||
|
dispXMax->setModified(false);
|
||||||
|
SetXRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabPlot::isYMinModified() {
|
||||||
|
if (dispYMin->isModified()) {
|
||||||
|
dispYMin->setModified(false);
|
||||||
|
SetYRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabPlot::isYMaxModified() {
|
||||||
|
if (dispYMax->isModified()) {
|
||||||
|
dispYMax->setModified(false);
|
||||||
|
SetYRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabPlot::isZMinModified() {
|
||||||
|
if (dispZMin->isModified()) {
|
||||||
|
dispZMin->setModified(false);
|
||||||
|
SetZRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabPlot::isZMaxModified() {
|
||||||
|
if (dispZMax->isModified()) {
|
||||||
|
dispZMax->setModified(false);
|
||||||
|
SetZRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void qTabPlot::SetXRange() {
|
void qTabPlot::SetXRange() {
|
||||||
LOG(logDEBUG) << "Enable X axis range";
|
LOG(logDEBUG) << "Enable X axis range";
|
||||||
|
|
||||||
@ -452,10 +494,14 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
disconnect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||||
disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
disconnect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
||||||
disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
disconnect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
||||||
disconnect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
disconnect(dispXMin, SIGNAL(editingFinished()), this,
|
||||||
disconnect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
SLOT(isXMinModified()));
|
||||||
disconnect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
disconnect(dispXMax, SIGNAL(editingFinished()), this,
|
||||||
disconnect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
SLOT(isXMaxModified()));
|
||||||
|
disconnect(dispYMin, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(isYMinModified()));
|
||||||
|
disconnect(dispYMax, SIGNAL(editingFinished()), this,
|
||||||
|
SLOT(isYMaxModified()));
|
||||||
|
|
||||||
// check all, fill all
|
// check all, fill all
|
||||||
chkXMin->setChecked(true);
|
chkXMin->setChecked(true);
|
||||||
@ -550,10 +596,10 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||||
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
connect(chkYMin, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
||||||
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
connect(chkYMax, SIGNAL(toggled(bool)), this, SLOT(SetYRange()));
|
||||||
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(isXMinModified()));
|
||||||
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(isXMaxModified()));
|
||||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(isYMinModified()));
|
||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(isYMaxModified()));
|
||||||
|
|
||||||
bool isRange[4]{true, true, true, true};
|
bool isRange[4]{true, true, true, true};
|
||||||
plot->SetXYRangeChanged(true, ranges, isRange);
|
plot->SetXYRangeChanged(true, ranges, isRange);
|
||||||
@ -583,9 +629,9 @@ void qTabPlot::GetStreamingFrequency() {
|
|||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this,
|
disconnect(spinTimeGap, SIGNAL(valueChanged(double)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this,
|
disconnect(spinNthFrame, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
try {
|
try {
|
||||||
int freq = det->getRxZmqFrequency().tsquash(
|
int freq = det->getRxZmqFrequency().tsquash(
|
||||||
@ -621,9 +667,9 @@ void qTabPlot::GetStreamingFrequency() {
|
|||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
connect(spinTimeGap, SIGNAL(editingFinished()), this,
|
connect(spinTimeGap, SIGNAL(valueChanged(double)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this,
|
connect(spinNthFrame, SIGNAL(valueChanged(int)), this,
|
||||||
SLOT(SetStreamingFrequency()));
|
SLOT(SetStreamingFrequency()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int updateFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
@ -105,8 +106,9 @@ void basictests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// does check only if flag is 0 (by default), set by command line
|
// does check only if flag is 0 (by default), set by command line
|
||||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
if ((!debugflag) && (!updateFlag) &&
|
||||||
(testBus() == FAIL))) {
|
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||||
|
(testBus() == FAIL))) {
|
||||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||||
"Dangerous to continue.\n");
|
"Dangerous to continue.\n");
|
||||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
@ -145,7 +147,7 @@ void basictests() {
|
|||||||
(long long int)client_sw_apiversion));
|
(long long int)client_sw_apiversion));
|
||||||
|
|
||||||
// return if flag is not zero, debug mode
|
// return if flag is not zero, debug mode
|
||||||
if (debugflag) {
|
if (debugflag || updateFlag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,7 +419,7 @@ uint32_t getDetectorIP() {
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer() {
|
void initControlServer() {
|
||||||
if (initError == OK) {
|
if (!updateFlag && initError == OK) {
|
||||||
setupDetector();
|
setupDetector();
|
||||||
}
|
}
|
||||||
initCheckDone = 1;
|
initCheckDone = 1;
|
||||||
@ -2347,7 +2349,7 @@ int stopStateMachine() {
|
|||||||
sharedMemory_setStop(1);
|
sharedMemory_setStop(1);
|
||||||
// read till status is idle
|
// read till status is idle
|
||||||
while (sharedMemory_getStatus() == RUNNING)
|
while (sharedMemory_getStatus() == RUNNING)
|
||||||
;
|
usleep(500);
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
LOG(logINFO, ("Stopped State Machine\n"));
|
LOG(logINFO, ("Stopped State Machine\n"));
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -39,6 +39,10 @@ uint64_t Beb_deactivatedStartFrameNumber = 0;
|
|||||||
int Beb_quadEnable = 0;
|
int Beb_quadEnable = 0;
|
||||||
int Beb_positions[2] = {0, 0};
|
int Beb_positions[2] = {0, 0};
|
||||||
int Beb_readNLines = MAX_ROWS_PER_READOUT;
|
int Beb_readNLines = MAX_ROWS_PER_READOUT;
|
||||||
|
int Beb_deactivated_transmission_flowcontrol_10g = 0;
|
||||||
|
int Beb_deactivated_transmission_delay_frame = 0;
|
||||||
|
int Beb_deactivated_transmission_delay_left = 0;
|
||||||
|
int Beb_deactivated_transmission_delay_right = 0;
|
||||||
|
|
||||||
void BebInfo_BebInfo(struct BebInfo *bebInfo, unsigned int beb_num) {
|
void BebInfo_BebInfo(struct BebInfo *bebInfo, unsigned int beb_num) {
|
||||||
bebInfo->beb_number = beb_num;
|
bebInfo->beb_number = beb_num;
|
||||||
@ -180,6 +184,11 @@ void Beb_GetModuleConfiguration(int *master, int *top, int *normal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
int Beb_IsTransmitting(int *retval, int tengiga, int waitForDelay) {
|
||||||
|
if (!Beb_activated) {
|
||||||
|
// not transmitting
|
||||||
|
*retval = 0;
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
// mapping new memory
|
// mapping new memory
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int addr_l_txndelaycounter = 0, addr_l_framedelaycounter = 0;
|
int addr_l_txndelaycounter = 0, addr_l_framedelaycounter = 0;
|
||||||
@ -482,6 +491,9 @@ int Beb_Set32bitOverflow(int val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Beb_GetTenGigaFlowControl() {
|
int Beb_GetTenGigaFlowControl() {
|
||||||
|
if (!Beb_activated)
|
||||||
|
return Beb_deactivated_transmission_flowcontrol_10g;
|
||||||
|
|
||||||
u_int32_t offset = FLOW_REG_OFFSET;
|
u_int32_t offset = FLOW_REG_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
@ -501,6 +513,11 @@ int Beb_GetTenGigaFlowControl() {
|
|||||||
|
|
||||||
int Beb_SetTenGigaFlowControl(int value) {
|
int Beb_SetTenGigaFlowControl(int value) {
|
||||||
LOG(logINFO, ("Setting ten giga flow control to %d\n", value));
|
LOG(logINFO, ("Setting ten giga flow control to %d\n", value));
|
||||||
|
if (!Beb_activated) {
|
||||||
|
Beb_deactivated_transmission_flowcontrol_10g = value;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
value = value == 0 ? 0 : 1;
|
value = value == 0 ? 0 : 1;
|
||||||
u_int32_t offset = FLOW_REG_OFFSET;
|
u_int32_t offset = FLOW_REG_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
@ -521,12 +538,17 @@ int Beb_SetTenGigaFlowControl(int value) {
|
|||||||
retval | ((value << FLOW_REG_TXM_FLOW_CNTRL_10G_OFST) &
|
retval | ((value << FLOW_REG_TXM_FLOW_CNTRL_10G_OFST) &
|
||||||
FLOW_REG_TXM_FLOW_CNTRL_10G_MSK));
|
FLOW_REG_TXM_FLOW_CNTRL_10G_MSK));
|
||||||
|
|
||||||
|
Beb_deactivated_transmission_flowcontrol_10g = value;
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Beb_GetTransmissionDelayFrame() {
|
int Beb_GetTransmissionDelayFrame() {
|
||||||
|
if (!Beb_activated) {
|
||||||
|
return Beb_deactivated_transmission_delay_frame;
|
||||||
|
}
|
||||||
|
|
||||||
u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
|
u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
@ -547,6 +569,10 @@ int Beb_SetTransmissionDelayFrame(int value) {
|
|||||||
LOG(logERROR, ("Invalid transmission delay frame value %d\n", value));
|
LOG(logERROR, ("Invalid transmission delay frame value %d\n", value));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!Beb_activated) {
|
||||||
|
Beb_deactivated_transmission_delay_frame = value;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
|
u_int32_t offset = TXM_DELAY_FRAME_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
@ -556,12 +582,16 @@ int Beb_SetTransmissionDelayFrame(int value) {
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
Beb_Write32(csp0base, offset, value);
|
Beb_Write32(csp0base, offset, value);
|
||||||
|
Beb_deactivated_transmission_delay_frame = value;
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Beb_GetTransmissionDelayLeft() {
|
int Beb_GetTransmissionDelayLeft() {
|
||||||
|
if (!Beb_activated) {
|
||||||
|
return Beb_deactivated_transmission_delay_left;
|
||||||
|
}
|
||||||
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
@ -582,6 +612,10 @@ int Beb_SetTransmissionDelayLeft(int value) {
|
|||||||
LOG(logERROR, ("Invalid transmission delay left value %d\n", value));
|
LOG(logERROR, ("Invalid transmission delay left value %d\n", value));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!Beb_activated) {
|
||||||
|
Beb_deactivated_transmission_delay_left = value;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
@ -591,12 +625,17 @@ int Beb_SetTransmissionDelayLeft(int value) {
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
Beb_Write32(csp0base, offset, value);
|
Beb_Write32(csp0base, offset, value);
|
||||||
|
Beb_deactivated_transmission_delay_left = value;
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Beb_GetTransmissionDelayRight() {
|
int Beb_GetTransmissionDelayRight() {
|
||||||
|
if (!Beb_activated) {
|
||||||
|
return Beb_deactivated_transmission_delay_right;
|
||||||
|
}
|
||||||
|
|
||||||
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
|
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
@ -617,6 +656,10 @@ int Beb_SetTransmissionDelayRight(int value) {
|
|||||||
LOG(logERROR, ("Invalid transmission delay right value %d\n", value));
|
LOG(logERROR, ("Invalid transmission delay right value %d\n", value));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (!Beb_activated) {
|
||||||
|
Beb_deactivated_transmission_delay_right = value;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
|
u_int32_t offset = TXM_DELAY_RIGHT_OFFSET;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
||||||
@ -626,57 +669,12 @@ int Beb_SetTransmissionDelayRight(int value) {
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
Beb_Write32(csp0base, offset, value);
|
Beb_Write32(csp0base, offset, value);
|
||||||
|
Beb_deactivated_transmission_delay_right = value;
|
||||||
Beb_close(fd, csp0base);
|
Beb_close(fd, csp0base);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val) {
|
|
||||||
|
|
||||||
if (!Beb_activated)
|
|
||||||
return val;
|
|
||||||
|
|
||||||
// mapping new memory
|
|
||||||
u_int32_t *csp0base = 0;
|
|
||||||
u_int32_t valueread = 0;
|
|
||||||
u_int32_t offset = TXM_DELAY_LEFT_OFFSET;
|
|
||||||
char modename[100] = "";
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case TXN_LEFT:
|
|
||||||
offset = TXM_DELAY_LEFT_OFFSET;
|
|
||||||
strcpy(modename, "Transmission Delay Left");
|
|
||||||
break;
|
|
||||||
case TXN_RIGHT:
|
|
||||||
offset = TXM_DELAY_RIGHT_OFFSET;
|
|
||||||
strcpy(modename, "Transmission Delay Right");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LOG(logERROR, ("Unrecognized mode in network parameter: %d\n", mode));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// open file pointer
|
|
||||||
int fd = Beb_open(&csp0base, XPAR_PLB_GPIO_SYS_BASEADDR);
|
|
||||||
if (fd < 0) {
|
|
||||||
LOG(logERROR,
|
|
||||||
("Could not read register to set network parameter. FAIL\n"));
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
if (val > -1) {
|
|
||||||
valueread = Beb_Read32(csp0base, offset);
|
|
||||||
Beb_Write32(csp0base, offset, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
valueread = Beb_Read32(csp0base, offset);
|
|
||||||
}
|
|
||||||
// close file pointer
|
|
||||||
if (fd > 0)
|
|
||||||
Beb_close(fd, csp0base);
|
|
||||||
|
|
||||||
return valueread;
|
|
||||||
}
|
|
||||||
|
|
||||||
u_int32_t Beb_GetFirmwareRevision() {
|
u_int32_t Beb_GetFirmwareRevision() {
|
||||||
// mapping new memory
|
// mapping new memory
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
|
@ -986,11 +986,16 @@ int Feb_Control_StartAcquisition() {
|
|||||||
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
||||||
|
|
||||||
int Feb_Control_SoftwareTrigger() {
|
int Feb_Control_SoftwareTrigger() {
|
||||||
unsigned int orig_value = 0;
|
|
||||||
Feb_Interface_ReadRegister(Feb_Control_AddressToAll(), DAQ_REG_CHIP_CMDS,
|
|
||||||
&orig_value);
|
|
||||||
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
|
|
||||||
if (Feb_Control_activated) {
|
if (Feb_Control_activated) {
|
||||||
|
unsigned int orig_value = 0;
|
||||||
|
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||||
|
DAQ_REG_CHIP_CMDS, &orig_value)) {
|
||||||
|
LOG(logERROR, ("Could not read DAQ_REG_CHIP_CMDS to send software "
|
||||||
|
"trigger\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
unsigned int cmd = orig_value | DAQ_REG_CHIP_CMDS_INT_TRIGGER;
|
||||||
|
|
||||||
// set trigger bit
|
// set trigger bit
|
||||||
LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd));
|
LOG(logDEBUG1, ("Setting Trigger, Register:0x%x\n", cmd));
|
||||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||||
@ -1862,9 +1867,16 @@ int Feb_Control_PrintCorrectedValues() {
|
|||||||
// So if software says now 40.00 you neeed to convert to mdegrees 40000(call it
|
// So if software says now 40.00 you neeed to convert to mdegrees 40000(call it
|
||||||
// A1) and then A1/65536/0.00198421639-273.15
|
// A1) and then A1/65536/0.00198421639-273.15
|
||||||
int Feb_Control_GetLeftFPGATemp() {
|
int Feb_Control_GetLeftFPGATemp() {
|
||||||
|
if (!Feb_Control_activated) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
unsigned int temperature = 0;
|
unsigned int temperature = 0;
|
||||||
Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, FEB_REG_STATUS,
|
||||||
&temperature);
|
&temperature)) {
|
||||||
|
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get left feb "
|
||||||
|
"temperature\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
temperature = temperature >> 16;
|
temperature = temperature >> 16;
|
||||||
temperature =
|
temperature =
|
||||||
@ -1875,9 +1887,16 @@ int Feb_Control_GetLeftFPGATemp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_GetRightFPGATemp() {
|
int Feb_Control_GetRightFPGATemp() {
|
||||||
|
if (!Feb_Control_activated) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
unsigned int temperature = 0;
|
unsigned int temperature = 0;
|
||||||
Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS,
|
if (!Feb_Interface_ReadRegister(Feb_Control_rightAddress, FEB_REG_STATUS,
|
||||||
&temperature);
|
&temperature)) {
|
||||||
|
LOG(logERROR, ("Trouble reading FEB_REG_STATUS reg to get right feb "
|
||||||
|
"temperature\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
temperature = temperature >> 16;
|
temperature = temperature >> 16;
|
||||||
temperature =
|
temperature =
|
||||||
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
|
((((float)(temperature) / 65536.0f) / 0.00198421639f) - 273.15f) *
|
||||||
@ -1887,15 +1906,29 @@ int Feb_Control_GetRightFPGATemp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t Feb_Control_GetMeasuredPeriod() {
|
int64_t Feb_Control_GetMeasuredPeriod() {
|
||||||
|
if (!Feb_Control_activated) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
unsigned int value = 0;
|
unsigned int value = 0;
|
||||||
Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_PERIOD_REG,
|
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_PERIOD_REG,
|
||||||
&value);
|
&value)) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Trouble reading MEAS_PERIOD_REG reg to get measured period\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return (int64_t)value * 10;
|
return (int64_t)value * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Feb_Control_GetSubMeasuredPeriod() {
|
int64_t Feb_Control_GetSubMeasuredPeriod() {
|
||||||
|
if (!Feb_Control_activated) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
unsigned int value = 0;
|
unsigned int value = 0;
|
||||||
Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_SUBPERIOD_REG,
|
if (!Feb_Interface_ReadRegister(Feb_Control_leftAddress, MEAS_SUBPERIOD_REG,
|
||||||
&value);
|
&value)) {
|
||||||
|
LOG(logERROR, ("Trouble reading MEAS_SUBPERIOD_REG reg to get measured "
|
||||||
|
"sub period\n"));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return (int64_t)value * 10;
|
return (int64_t)value * 10;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int updateFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
@ -140,7 +141,7 @@ void basictests() {
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
// return if debugflag is not zero, debug mode
|
// return if debugflag is not zero, debug mode
|
||||||
if (debugflag) {
|
if (debugflag || updateFlag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +320,7 @@ u_int32_t getDetectorIP() {
|
|||||||
|
|
||||||
void initControlServer() {
|
void initControlServer() {
|
||||||
LOG(logINFOBLUE, ("Configuring Control server\n"));
|
LOG(logINFOBLUE, ("Configuring Control server\n"));
|
||||||
if (initError == OK) {
|
if (!updateFlag && initError == OK) {
|
||||||
readDetectorNumber();
|
readDetectorNumber();
|
||||||
getModuleConfiguration();
|
getModuleConfiguration();
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
@ -2217,7 +2218,7 @@ int stopStateMachine() {
|
|||||||
sharedMemory_setStop(1);
|
sharedMemory_setStop(1);
|
||||||
// read till status is idle
|
// read till status is idle
|
||||||
while (sharedMemory_getStatus() == RUNNING)
|
while (sharedMemory_getStatus() == RUNNING)
|
||||||
;
|
usleep(500);
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
LOG(logINFO, ("Stopped State Machine\n"));
|
LOG(logINFO, ("Stopped State Machine\n"));
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#define REQUIRED_FIRMWARE_VERSION (26)
|
#define REQUIRED_FIRMWARE_VERSION (27)
|
||||||
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
|
#define IDFILECOMMAND "more /home/root/executables/detid.txt"
|
||||||
#define CONFIG_FILE ("config_eiger.txt")
|
#define CONFIG_FILE ("config_eiger.txt")
|
||||||
#define WAIT_STOP_SERVER_START (1 * 1000 * 1000)
|
#define WAIT_STOP_SERVER_START (1 * 1000 * 1000)
|
||||||
|
@ -121,9 +121,10 @@
|
|||||||
|
|
||||||
#define ASIC_CONFIG_RUN_MODE_OFST (0)
|
#define ASIC_CONFIG_RUN_MODE_OFST (0)
|
||||||
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
|
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
|
||||||
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x0 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
#define ASIC_CONFIG_RUN_MODE_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
#define ASIC_CONFIG_RUN_MODE_INT_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
#define ASIC_CONFIG_GAIN_OFST (4)
|
#define ASIC_CONFIG_GAIN_OFST (4)
|
||||||
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
|
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
|
||||||
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
Binary file not shown.
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int updateFlag;
|
||||||
extern int checkModuleFlag;
|
extern int checkModuleFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
@ -92,8 +93,9 @@ void basictests() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// does check only if flag is 0 (by default), set by command line
|
// does check only if flag is 0 (by default), set by command line
|
||||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
if ((!debugflag) && (!updateFlag) &&
|
||||||
(testBus() == FAIL))) {
|
((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
|
||||||
|
(testFpga() == FAIL) || (testBus() == FAIL))) {
|
||||||
sprintf(initErrorMessage,
|
sprintf(initErrorMessage,
|
||||||
"Could not pass basic tests of FPGA and bus. Dangerous to "
|
"Could not pass basic tests of FPGA and bus. Dangerous to "
|
||||||
"continue. (Firmware version:0x%llx) \n",
|
"continue. (Firmware version:0x%llx) \n",
|
||||||
@ -131,7 +133,7 @@ void basictests() {
|
|||||||
(long long int)client_sw_apiversion));
|
(long long int)client_sw_apiversion));
|
||||||
|
|
||||||
// return if flag is not zero, debug mode
|
// return if flag is not zero, debug mode
|
||||||
if (debugflag) {
|
if (debugflag || updateFlag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,6 +177,13 @@ void basictests() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int checkKernelVersion() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return OK;
|
||||||
|
#endif
|
||||||
|
return Nios_checkKernelVersion(KERNEL_DATE_VRSN);
|
||||||
|
}
|
||||||
|
|
||||||
int checkType() {
|
int checkType() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
@ -326,7 +335,7 @@ u_int32_t getDetectorIP() {
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer() {
|
void initControlServer() {
|
||||||
if (initError == OK) {
|
if (!updateFlag && initError == OK) {
|
||||||
setupDetector();
|
setupDetector();
|
||||||
}
|
}
|
||||||
initCheckDone = 1;
|
initCheckDone = 1;
|
||||||
@ -809,11 +818,15 @@ int setDynamicRange(int dr) { return DYNAMIC_RANGE; }
|
|||||||
/* parameters - timer */
|
/* parameters - timer */
|
||||||
void setNumFrames(int64_t val) {
|
void setNumFrames(int64_t val) {
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL ||
|
||||||
|
burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Setting number of frames %lld [Continuous mode]\n", val));
|
("Setting number of frames %lld [Continuous mode]\n", val));
|
||||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Setting number of frames %d [Burst mode]\n", (int)val));
|
("Setting number of frames %d [Burst mode]\n", (int)val));
|
||||||
bus_w(ASIC_INT_FRAMES_REG,
|
bus_w(ASIC_INT_FRAMES_REG,
|
||||||
@ -826,9 +839,12 @@ void setNumFrames(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumFrames() {
|
int64_t getNumFrames() {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
return ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
return ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
||||||
ASIC_INT_FRAMES_OFST);
|
ASIC_INT_FRAMES_OFST);
|
||||||
}
|
}
|
||||||
@ -856,9 +872,13 @@ int64_t getNumTriggers() {
|
|||||||
void setNumBursts(int64_t val) {
|
void setNumBursts(int64_t val) {
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
LOG(logINFO, ("Setting number of bursts %lld\n", val));
|
LOG(logINFO, ("Setting number of bursts %lld\n", val));
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst-trigger or continuous
|
||||||
|
else {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("\tNot (Burst and Auto mode): not writing to register\n"));
|
("\tNot (Burst and Auto mode): not writing to register\n"));
|
||||||
numBurstsReg = val;
|
numBurstsReg = val;
|
||||||
@ -867,9 +887,12 @@ void setNumBursts(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumBursts() {
|
int64_t getNumBursts() {
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
}
|
}
|
||||||
|
// burst-trigger or continuous
|
||||||
return numBurstsReg;
|
return numBurstsReg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,12 +924,16 @@ int setPeriod(int64_t val) {
|
|||||||
LOG(logERROR, ("Invalid period: %lld ns\n", val));
|
LOG(logERROR, ("Invalid period: %lld ns\n", val));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
val *= (1E-9 * systemFrequency);
|
// continuous
|
||||||
if (burstMode == BURST_OFF) {
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val));
|
LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", val));
|
||||||
|
val *= (1E-9 * systemFrequency);
|
||||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", val));
|
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);
|
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
|
||||||
}
|
}
|
||||||
// validate for tolerance
|
// validate for tolerance
|
||||||
@ -919,10 +946,13 @@ int setPeriod(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getPeriod() {
|
int64_t getPeriod() {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
||||||
(1E-9 * systemFrequency);
|
(1E-9 * systemFrequency);
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG) /
|
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG) /
|
||||||
(1E-9 * systemFrequency);
|
(1E-9 * systemFrequency);
|
||||||
}
|
}
|
||||||
@ -965,9 +995,13 @@ int setBurstPeriod(int64_t val) {
|
|||||||
}
|
}
|
||||||
LOG(logINFO, ("Setting burst period %lld ns\n", val));
|
LOG(logINFO, ("Setting burst period %lld ns\n", val));
|
||||||
val *= (1E-9 * systemFrequency);
|
val *= (1E-9 * systemFrequency);
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
} else {
|
}
|
||||||
|
// burst-trigger, continuous
|
||||||
|
else {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("\tNot (Burst and Auto mode): not writing to register\n"));
|
("\tNot (Burst and Auto mode): not writing to register\n"));
|
||||||
burstPeriodReg = val;
|
burstPeriodReg = val;
|
||||||
@ -983,10 +1017,13 @@ int setBurstPeriod(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int64_t getBurstPeriod() {
|
int64_t getBurstPeriod() {
|
||||||
if (burstMode != BURST_OFF && getTiming() == AUTO_TIMING) {
|
// burst and auto
|
||||||
|
if ((burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) &&
|
||||||
|
getTiming() == AUTO_TIMING) {
|
||||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG) /
|
||||||
(1E-9 * systemFrequency);
|
(1E-9 * systemFrequency);
|
||||||
}
|
}
|
||||||
|
// burst-trigger, continuous
|
||||||
return burstPeriodReg / (1E-9 * systemFrequency);
|
return burstPeriodReg / (1E-9 * systemFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,7 +1247,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||||
}
|
}
|
||||||
// auto and burst
|
// auto and burst
|
||||||
else if (burstMode != BURST_OFF) {
|
else if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
numBurstsReg = get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
numBurstsReg = get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
burstPeriodReg = get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
burstPeriodReg = get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
}
|
}
|
||||||
@ -1237,7 +1274,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
LOG(logINFO, ("\tTriggers reg: %lld, Delay reg: %lldns\n",
|
LOG(logINFO, ("\tTriggers reg: %lld, Delay reg: %lldns\n",
|
||||||
getNumTriggers(), getDelayAfterTrigger()));
|
getNumTriggers(), getDelayAfterTrigger()));
|
||||||
// burst
|
// burst
|
||||||
if (burstMode != BURST_OFF) {
|
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
LOG(logINFO, ("\tFrame reg: 1, Period reg: 0\n"))
|
LOG(logINFO, ("\tFrame reg: 1, Period reg: 0\n"))
|
||||||
set64BitReg(1, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(1, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
set64BitReg(0, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(0, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
@ -1249,7 +1286,7 @@ void setTiming(enum timingMode arg) {
|
|||||||
set64BitReg(1, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
set64BitReg(1, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||||
set64BitReg(0, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
set64BitReg(0, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||||
// burst
|
// burst
|
||||||
if (burstMode != BURST_OFF) {
|
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
set64BitReg(numBurstsReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(numBurstsReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
set64BitReg(burstPeriodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(burstPeriodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
LOG(logINFO, ("\tFrames reg (bursts): %lld, Period reg(burst "
|
LOG(logINFO, ("\tFrames reg (bursts): %lld, Period reg(burst "
|
||||||
@ -2052,15 +2089,18 @@ int setBurstModeinFPGA(enum burstMode value) {
|
|||||||
uint32_t addr = ASIC_CONFIG_REG;
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
uint32_t runmode = 0;
|
uint32_t runmode = 0;
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case BURST_OFF:
|
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_CONT_VAL;
|
|
||||||
break;
|
|
||||||
case BURST_INTERNAL:
|
case BURST_INTERNAL:
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
|
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
|
||||||
break;
|
break;
|
||||||
case BURST_EXTERNAL:
|
case BURST_EXTERNAL:
|
||||||
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
|
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
|
||||||
break;
|
break;
|
||||||
|
case CONTINUOUS_INTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_INT_CONT_VAL;
|
||||||
|
break;
|
||||||
|
case CONTINUOUS_EXTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("Unknown burst mode %d\n", value));
|
LOG(logERROR, ("Unknown burst mode %d\n", value));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -2074,16 +2114,20 @@ int setBurstModeinFPGA(enum burstMode value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int setBurstMode(enum burstMode burst) {
|
int setBurstMode(enum burstMode burst) {
|
||||||
LOG(logINFO, ("Setting burst mode to %s\n",
|
LOG(logINFO,
|
||||||
burst == BURST_OFF
|
("Setting burst mode to %s\n",
|
||||||
? "off"
|
(burst == BURST_INTERNAL
|
||||||
: (burst == BURST_INTERNAL ? "internal" : "external")));
|
? "burst_internal"
|
||||||
|
: (burst == BURST_EXTERNAL ? "burst external"
|
||||||
|
: (burst == CONTINUOUS_INTERNAL
|
||||||
|
? "continuous internal"
|
||||||
|
: "continuous external")))));
|
||||||
|
|
||||||
// update
|
// update
|
||||||
int64_t framesReg = 0;
|
int64_t framesReg = 0;
|
||||||
int64_t periodReg = 0;
|
int64_t periodReg = 0;
|
||||||
// burst
|
// burst
|
||||||
if (burstMode != BURST_OFF) {
|
if (burstMode == BURST_INTERNAL || burstMode == BURST_EXTERNAL) {
|
||||||
framesReg = ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
framesReg = ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >>
|
||||||
ASIC_INT_FRAMES_OFST);
|
ASIC_INT_FRAMES_OFST);
|
||||||
periodReg =
|
periodReg =
|
||||||
@ -2107,7 +2151,7 @@ int setBurstMode(enum burstMode burst) {
|
|||||||
|
|
||||||
LOG(logINFO, ("\tUpdating registers\n"));
|
LOG(logINFO, ("\tUpdating registers\n"));
|
||||||
// continuous
|
// continuous
|
||||||
if (burstMode == BURST_OFF) {
|
if (burstMode == CONTINUOUS_INTERNAL || burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
set64BitReg(framesReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
set64BitReg(framesReg, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
set64BitReg(periodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
set64BitReg(periodReg, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
LOG(logINFO, ("\tFrames reg: %lld, Period reg: %lldns\n",
|
LOG(logINFO, ("\tFrames reg: %lld, Period reg: %lldns\n",
|
||||||
@ -2157,14 +2201,17 @@ int configureASICGlobalSettings() {
|
|||||||
int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
|
int value = ((filter << ASIC_FILTER_OFST) & ASIC_FILTER_MSK) |
|
||||||
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
|
((cdsGain << ASIC_CDS_GAIN_OFST) & ASIC_CDS_GAIN_MSK);
|
||||||
switch (burstMode) {
|
switch (burstMode) {
|
||||||
case BURST_OFF:
|
|
||||||
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
|
||||||
break;
|
|
||||||
case BURST_INTERNAL:
|
case BURST_INTERNAL:
|
||||||
break;
|
break;
|
||||||
case BURST_EXTERNAL:
|
case BURST_EXTERNAL:
|
||||||
value |= ASIC_EXT_TIMING_MSK;
|
value |= ASIC_EXT_TIMING_MSK;
|
||||||
break;
|
break;
|
||||||
|
case CONTINUOUS_INTERNAL:
|
||||||
|
value |= ASIC_CONT_MODE_MSK;
|
||||||
|
break;
|
||||||
|
case CONTINUOUS_EXTERNAL:
|
||||||
|
value |= (ASIC_CONT_MODE_MSK | ASIC_EXT_TIMING_MSK);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
LOG(logINFO, ("\tSending Global Chip settings:0x%x (filter:%d, "
|
||||||
"cdsgain:%d)\n",
|
"cdsgain:%d)\n",
|
||||||
@ -2213,15 +2260,18 @@ enum burstMode getBurstMode() {
|
|||||||
uint32_t addr = ASIC_CONFIG_REG;
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
int runmode = bus_r(addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
int runmode = bus_r(addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
||||||
switch (runmode) {
|
switch (runmode) {
|
||||||
case ASIC_CONFIG_RUN_MODE_CONT_VAL:
|
|
||||||
burstMode = BURST_OFF;
|
|
||||||
break;
|
|
||||||
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||||
burstMode = BURST_INTERNAL;
|
burstMode = BURST_INTERNAL;
|
||||||
break;
|
break;
|
||||||
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||||
burstMode = BURST_EXTERNAL;
|
burstMode = BURST_EXTERNAL;
|
||||||
break;
|
break;
|
||||||
|
case ASIC_CONFIG_RUN_MODE_INT_CONT_VAL:
|
||||||
|
burstMode = CONTINUOUS_INTERNAL;
|
||||||
|
break;
|
||||||
|
case ASIC_CONFIG_RUN_MODE_EXT_CONT_VAL:
|
||||||
|
burstMode = CONTINUOUS_EXTERNAL;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
LOG(logERROR, ("Unknown run mode read from FPGA %d\n", runmode));
|
||||||
return -1;
|
return -1;
|
||||||
@ -2430,9 +2480,13 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
int numRepeats = getNumTriggers();
|
int numRepeats = getNumTriggers();
|
||||||
if (getTiming() == AUTO_TIMING) {
|
if (getTiming() == AUTO_TIMING) {
|
||||||
if (burstMode == BURST_OFF) {
|
// continuous
|
||||||
|
if (burstMode == CONTINUOUS_INTERNAL ||
|
||||||
|
burstMode == CONTINUOUS_EXTERNAL) {
|
||||||
numRepeats = 1;
|
numRepeats = 1;
|
||||||
} else {
|
}
|
||||||
|
// burst
|
||||||
|
else {
|
||||||
numRepeats = getNumBursts();
|
numRepeats = getNumBursts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2510,8 +2564,8 @@ void *start_timer(void *arg) {
|
|||||||
sendUDPPacket(1, packetData2, vetopacketsize);
|
sendUDPPacket(1, packetData2, vetopacketsize);
|
||||||
}
|
}
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Sent frame: %d (bursts: %d) [%lld]\n", frameNr, repeatNr,
|
("Sent frame: %d (bursts/ triggers: %d) [%lld]\n", frameNr,
|
||||||
(long long unsigned int)virtual_currentFrameNumber));
|
repeatNr, (long long unsigned int)virtual_currentFrameNumber));
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
@ -2556,7 +2610,7 @@ int stopStateMachine() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
sharedMemory_setStop(1);
|
sharedMemory_setStop(1);
|
||||||
while (sharedMemory_getStatus() == RUNNING)
|
while (sharedMemory_getStatus() == RUNNING)
|
||||||
;
|
usleep(500);
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
LOG(logINFO, ("Stopped State Machine\n"));
|
LOG(logINFO, ("Stopped State Machine\n"));
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#define REQRD_FRMWRE_VRSN (0x200707)
|
#define REQRD_FRMWRE_VRSN (0x200707)
|
||||||
|
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
|
||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
@ -46,8 +47,8 @@
|
|||||||
#define DEFAULT_CURRENT_SOURCE (0)
|
#define DEFAULT_CURRENT_SOURCE (0)
|
||||||
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
|
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
|
||||||
|
|
||||||
#define DEFAULT_READOUT_C0 (8) //(108333336) // rdo_clk, 108 MHz
|
#define DEFAULT_READOUT_C0 (6) //(144444448) // rdo_clk, 144 MHz
|
||||||
#define DEFAULT_READOUT_C1 (8) //(108333336) // rdo_x2_clk, 108 MHz
|
#define DEFAULT_READOUT_C1 (6) //(144444448) // rdo_x2_clk, 144 MHz
|
||||||
#define DEFAULT_SYSTEM_C0 (5) //(144444448) // run_clk, 144 MHz
|
#define DEFAULT_SYSTEM_C0 (5) //(144444448) // run_clk, 144 MHz
|
||||||
#define DEFAULT_SYSTEM_C1 (10) //(72222224) // chip_clk, 72 MHz
|
#define DEFAULT_SYSTEM_C1 (10) //(72222224) // chip_clk, 72 MHz
|
||||||
#define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz
|
#define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz
|
||||||
|
Binary file not shown.
@ -18,6 +18,9 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Global variable from slsDetectorServer_funcs
|
||||||
|
extern int debugflag;
|
||||||
|
extern int updateFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
@ -91,7 +94,8 @@ void basictests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// does check only if flag is 0 (by default), set by command line
|
// does check only if flag is 0 (by default), set by command line
|
||||||
if (((checkType() == FAIL) || (testFpga() == FAIL) ||
|
if ((!debugflag) && (!updateFlag) &&
|
||||||
|
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||||
(testBus() == FAIL))) {
|
(testBus() == FAIL))) {
|
||||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||||
"Dangerous to continue.\n");
|
"Dangerous to continue.\n");
|
||||||
@ -125,7 +129,9 @@ void basictests() {
|
|||||||
(long long int)fwversion, (long long int)swversion,
|
(long long int)fwversion, (long long int)swversion,
|
||||||
(long long int)client_sw_apiversion));
|
(long long int)client_sw_apiversion));
|
||||||
|
|
||||||
LOG(logINFO, ("Basic Tests - success\n"));
|
if (!debugflag || updateFlag) {
|
||||||
|
LOG(logINFO, ("Basic Tests - success\n"));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +349,7 @@ u_int32_t getBoardRevision() {
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer() {
|
void initControlServer() {
|
||||||
if (initError == OK) {
|
if (!updateFlag && initError == OK) {
|
||||||
setupDetector();
|
setupDetector();
|
||||||
}
|
}
|
||||||
initCheckDone = 1;
|
initCheckDone = 1;
|
||||||
@ -1630,7 +1636,7 @@ int stopStateMachine() {
|
|||||||
sharedMemory_setStop(1);
|
sharedMemory_setStop(1);
|
||||||
// read till status is idle
|
// read till status is idle
|
||||||
while (sharedMemory_getStatus() == RUNNING)
|
while (sharedMemory_getStatus() == RUNNING)
|
||||||
;
|
usleep(500);
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
LOG(logINFO, ("Stopped State Machine\n"));
|
LOG(logINFO, ("Stopped State Machine\n"));
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int updateFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
@ -77,8 +78,9 @@ void basictests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// does check only if flag is 0 (by default), set by command line
|
// does check only if flag is 0 (by default), set by command line
|
||||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
if ((!debugflag) && (!updateFlag) &&
|
||||||
(testBus() == FAIL))) {
|
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||||
|
(testBus() == FAIL))) {
|
||||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||||
"Dangerous to continue.\n");
|
"Dangerous to continue.\n");
|
||||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
@ -119,7 +121,7 @@ void basictests() {
|
|||||||
(long long int)client_sw_apiversion));
|
(long long int)client_sw_apiversion));
|
||||||
|
|
||||||
// return if flag is not zero, debug mode
|
// return if flag is not zero, debug mode
|
||||||
if (debugflag) {
|
if (debugflag || updateFlag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +349,7 @@ u_int32_t getDetectorIP() {
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer() {
|
void initControlServer() {
|
||||||
if (initError == OK) {
|
if (!updateFlag && initError == OK) {
|
||||||
setupDetector();
|
setupDetector();
|
||||||
}
|
}
|
||||||
initCheckDone = 1;
|
initCheckDone = 1;
|
||||||
@ -1818,7 +1820,7 @@ int stopStateMachine() {
|
|||||||
sharedMemory_setStop(1);
|
sharedMemory_setStop(1);
|
||||||
// read till status is idle
|
// read till status is idle
|
||||||
while (sharedMemory_getStatus() == RUNNING)
|
while (sharedMemory_getStatus() == RUNNING)
|
||||||
;
|
usleep(500);
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
LOG(logINFO, ("Stopped State Machine\n"));
|
LOG(logINFO, ("Stopped State Machine\n"));
|
||||||
return OK;
|
return OK;
|
||||||
|
Binary file not shown.
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int updateFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
@ -101,8 +102,9 @@ void basictests() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// does check only if flag is 0 (by default), set by command line
|
// does check only if flag is 0 (by default), set by command line
|
||||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
if ((!debugflag) && (!updateFlag) &&
|
||||||
(testBus() == FAIL))) {
|
((checkType() == FAIL) || (testFpga() == FAIL) ||
|
||||||
|
(testBus() == FAIL))) {
|
||||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||||
"Dangerous to continue.\n");
|
"Dangerous to continue.\n");
|
||||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
@ -141,7 +143,7 @@ void basictests() {
|
|||||||
(long long int)client_sw_apiversion));
|
(long long int)client_sw_apiversion));
|
||||||
|
|
||||||
// return if flag is not zero, debug mode
|
// return if flag is not zero, debug mode
|
||||||
if (debugflag) {
|
if (debugflag || updateFlag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +415,7 @@ uint32_t getDetectorIP() {
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer() {
|
void initControlServer() {
|
||||||
if (initError == OK) {
|
if (!updateFlag && initError == OK) {
|
||||||
setupDetector();
|
setupDetector();
|
||||||
}
|
}
|
||||||
initCheckDone = 1;
|
initCheckDone = 1;
|
||||||
@ -1980,7 +1982,7 @@ int stopStateMachine() {
|
|||||||
sharedMemory_setStop(1);
|
sharedMemory_setStop(1);
|
||||||
// read till status is idle
|
// read till status is idle
|
||||||
while (sharedMemory_getStatus() == RUNNING)
|
while (sharedMemory_getStatus() == RUNNING)
|
||||||
;
|
usleep(500);
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
LOG(logINFO, ("Stopped State Machine\n"));
|
LOG(logINFO, ("Stopped State Machine\n"));
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -49,6 +49,10 @@
|
|||||||
#define BASE_ASIC_RDO (0x00500) // 0x1806_0500 - 0x1806_050F
|
#define BASE_ASIC_RDO (0x00500) // 0x1806_0500 - 0x1806_050F
|
||||||
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/asic_rdo/asic_rdo.vhd
|
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/asic_rdo/asic_rdo.vhd
|
||||||
|
|
||||||
|
/** Dead time Free Controller */
|
||||||
|
#define BASE_DEADTIME_FREE_CTRL (0x00580) // 0x1806_0580 - 0x1806_0587
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/mythen_III_mcb/blob/master/code/hdl/DeadTimeFreeController/DeadTimeFreeCtrl.vhd
|
||||||
|
|
||||||
/* UDP datagram generator */
|
/* UDP datagram generator */
|
||||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||||
|
|
||||||
@ -125,6 +129,10 @@
|
|||||||
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
#define CONTROL_STP_ACQSTN_MSK (0x00000001 << CONTROL_STP_ACQSTN_OFST)
|
||||||
#define CONTROL_STRT_PATTERN_OFST (2)
|
#define CONTROL_STRT_PATTERN_OFST (2)
|
||||||
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
|
#define CONTROL_STRT_PATTERN_MSK (0x00000001 << CONTROL_STRT_PATTERN_OFST)
|
||||||
|
#define CONTROL_STRT_READOUT_OFST (3) // not connected in software yet
|
||||||
|
#define CONTROL_STRT_READOUT_MSK (0x00000001 << CONTROL_STRT_READOUT_OFST)
|
||||||
|
#define CONTROL_STRT_SW_TRIGGER_OFST (4)
|
||||||
|
#define CONTROL_STRT_SW_TRIGGER_MSK (0x00000001 << CONTROL_STRT_SW_TRIGGER_OFST)
|
||||||
#define CONTROL_CRE_RST_OFST (10)
|
#define CONTROL_CRE_RST_OFST (10)
|
||||||
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
|
#define CONTROL_CRE_RST_MSK (0x00000001 << CONTROL_CRE_RST_OFST)
|
||||||
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
|
#define CONTROL_PRPHRL_RST_OFST (11) // Only GBE10?
|
||||||
@ -140,6 +148,13 @@
|
|||||||
|
|
||||||
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
|
||||||
|
/* Formatting for data core -----------------------------------------------*/
|
||||||
|
#define FMT_CONFIG_REG (0x00 * REG_OFFSET + BASE_FMT)
|
||||||
|
|
||||||
|
#define FMT_CONFIG_TXN_DELAY_OFST (0)
|
||||||
|
#define FMT_CONFIG_TXN_DELAY_MSK (0x00FFFFFF << FMT_CONFIG_TXN_DELAY_OFST)
|
||||||
|
|
||||||
|
|
||||||
/* Packetizer -------------------------------------------------------------*/
|
/* Packetizer -------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Packetizer Config Register */
|
/* Packetizer Config Register */
|
||||||
@ -460,4 +475,15 @@
|
|||||||
#define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0)
|
#define ASICRDO_CNFG_RESSTRG_LNGTH_OFST (0)
|
||||||
#define ASICRDO_CNFG_RESSTRG_LNGTH_MSK (0x000000FF << ASICRDO_CNFG_RESSTRG_LNGTH_OFST)
|
#define ASICRDO_CNFG_RESSTRG_LNGTH_MSK (0x000000FF << ASICRDO_CNFG_RESSTRG_LNGTH_OFST)
|
||||||
|
|
||||||
|
|
||||||
|
/** Dead time Free Controller
|
||||||
|
* --------------------------------------------------*/
|
||||||
|
|
||||||
|
#define DEADTIME_CONFIG_REG (0x00 * REG_OFFSET + BASE_DEADTIME_FREE_CTRL)
|
||||||
|
|
||||||
|
#define DEADTIME_FREE_MODE_ENBL_OFST (0)
|
||||||
|
#define DEADTIME_FREE_MODE_ENBL_MSK (0x00000001 << DEADTIME_FREE_MODE_ENBL_OFST)
|
||||||
|
#define DEADTIME_EARLY_EXP_FIN_ERR_OFST (4)
|
||||||
|
#define DEADTIME_EARLY_EXP_FIN_ERR_MSK (0x00000001 << DEADTIME_EARLY_EXP_FIN_ERR_OFST)
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
Binary file not shown.
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int updateFlag;
|
||||||
extern int checkModuleFlag;
|
extern int checkModuleFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
extern const enum detectorType myDetectorType;
|
extern const enum detectorType myDetectorType;
|
||||||
@ -80,8 +81,9 @@ void basictests() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// does check only if flag is 0 (by default), set by command line
|
// does check only if flag is 0 (by default), set by command line
|
||||||
if ((!debugflag) && ((checkType() == FAIL) || (testFpga() == FAIL) ||
|
if ((!debugflag) && (!updateFlag) &&
|
||||||
(testBus() == FAIL))) {
|
((checkKernelVersion() == FAIL) || (checkType() == FAIL) ||
|
||||||
|
(testFpga() == FAIL) || (testBus() == FAIL))) {
|
||||||
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
strcpy(initErrorMessage, "Could not pass basic tests of FPGA and bus. "
|
||||||
"Dangerous to continue.\n");
|
"Dangerous to continue.\n");
|
||||||
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
@ -117,7 +119,7 @@ void basictests() {
|
|||||||
(long long int)client_sw_apiversion));
|
(long long int)client_sw_apiversion));
|
||||||
|
|
||||||
// return if flag is not zero, debug mode
|
// return if flag is not zero, debug mode
|
||||||
if (debugflag) {
|
if (debugflag || updateFlag) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +163,13 @@ void basictests() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int checkKernelVersion() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return OK;
|
||||||
|
#endif
|
||||||
|
return Nios_checkKernelVersion(KERNEL_DATE_VRSN);
|
||||||
|
}
|
||||||
|
|
||||||
int checkType() {
|
int checkType() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
@ -249,15 +258,15 @@ u_int16_t getHardwareVersionNumber() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return bus_r(MCB_SERIAL_NO_REG);
|
return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >>
|
||||||
|
MCB_SERIAL_NO_VRSN_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t getDetectorNumber() {
|
u_int32_t getDetectorNumber() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return ((bus_r(MCB_SERIAL_NO_REG) & MCB_SERIAL_NO_VRSN_MSK) >>
|
return bus_r(MCB_SERIAL_NO_REG);
|
||||||
MCB_SERIAL_NO_VRSN_OFST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int64_t getDetectorMAC() {
|
u_int64_t getDetectorMAC() {
|
||||||
@ -313,7 +322,7 @@ u_int32_t getDetectorIP() {
|
|||||||
/* initialization */
|
/* initialization */
|
||||||
|
|
||||||
void initControlServer() {
|
void initControlServer() {
|
||||||
if (initError == OK) {
|
if (!updateFlag && initError == OK) {
|
||||||
setupDetector();
|
setupDetector();
|
||||||
}
|
}
|
||||||
initCheckDone = 1;
|
initCheckDone = 1;
|
||||||
@ -378,6 +387,7 @@ void setupDetector() {
|
|||||||
clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0;
|
clkDivider[SYSTEM_C0] = DEFAULT_SYSTEM_C0;
|
||||||
clkDivider[SYSTEM_C1] = DEFAULT_SYSTEM_C1;
|
clkDivider[SYSTEM_C1] = DEFAULT_SYSTEM_C1;
|
||||||
clkDivider[SYSTEM_C2] = DEFAULT_SYSTEM_C2;
|
clkDivider[SYSTEM_C2] = DEFAULT_SYSTEM_C2;
|
||||||
|
clkDivider[SYSTEM_C3] = DEFAULT_SYSTEM_C3;
|
||||||
|
|
||||||
highvoltage = 0;
|
highvoltage = 0;
|
||||||
trimmingPrint = logINFO;
|
trimmingPrint = logINFO;
|
||||||
@ -572,240 +582,28 @@ int setDynamicRange(int dr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parameters - module, speed, readout */
|
/* set parameters - readout */
|
||||||
|
|
||||||
int setModule(sls_detector_module myMod, char *mess) {
|
int setParallelMode(int mode) {
|
||||||
|
if (mode < 0)
|
||||||
LOG(logINFO, ("Setting module\n"));
|
|
||||||
|
|
||||||
/* future implementation
|
|
||||||
// settings (not yet implemented)
|
|
||||||
setSettings((enum detectorSettings)myMod.reg);
|
|
||||||
if (myMod.reg >= 0) {
|
|
||||||
detectorModules->reg = myMod.reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// threshold
|
|
||||||
if (myMod.eV >= 0)
|
|
||||||
setThresholdEnergy(myMod.eV);
|
|
||||||
else {
|
|
||||||
// (loading a random trim file) (dont return fail)
|
|
||||||
setSettings(UNDEFINED);
|
|
||||||
LOG(logERROR,
|
|
||||||
("Settings has been changed to undefined (random trim
|
|
||||||
file)\n"));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// dacs
|
|
||||||
for (int i = 0; i < NDAC; ++i) {
|
|
||||||
// ignore dacs with -1
|
|
||||||
if (myMod.dacs[i] != -1) {
|
|
||||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
|
||||||
if (myMod.dacs[i] != detectorDacs[i]) {
|
|
||||||
sprintf(mess, "Could not set module. Could not set dac %d\n",
|
|
||||||
i);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
// setSettings(UNDEFINED);
|
|
||||||
// LOG(logERROR, ("Settings has been changed to undefined\n"));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// trimbits
|
|
||||||
if (myMod.nchan == 0) {
|
|
||||||
LOG(logINFO, ("Setting module without trimbits\n"));
|
|
||||||
} else {
|
|
||||||
// set trimbits
|
|
||||||
if (setTrimbits(myMod.chanregs) == FAIL) {
|
|
||||||
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
// setSettings(UNDEFINED);
|
|
||||||
// LOG(logERROR, ("Settings has been changed to undefined (random "
|
|
||||||
// "trim file)\n"));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int setBit(int ibit, int patword) { return patword |= (1 << ibit); }
|
|
||||||
|
|
||||||
int clearBit(int ibit, int patword) { return patword &= ~(1 << ibit); }
|
|
||||||
|
|
||||||
int setTrimbits(int *trimbits) {
|
|
||||||
LOG(logINFOBLUE, ("Setting trimbits\n"));
|
|
||||||
|
|
||||||
// validate
|
|
||||||
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
|
|
||||||
if (trimbits[ichan] < 0 || trimbits[ichan] > 63) {
|
|
||||||
LOG(logERROR, ("Trimbit value (%d) for channel %d is invalid\n",
|
|
||||||
trimbits[ichan], ichan));
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOG(logINFO, ("Trimbits validated\n"));
|
|
||||||
trimmingPrint = logDEBUG5;
|
|
||||||
|
|
||||||
uint64_t patword = 0;
|
|
||||||
int iaddr = 0;
|
|
||||||
for (int ichip = 0; ichip < NCHIP; ichip++) {
|
|
||||||
LOG(logDEBUG1, (" Chip %d\n", ichip));
|
|
||||||
iaddr = 0;
|
|
||||||
patword = 0;
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
|
|
||||||
// chip select
|
|
||||||
patword = setBit(SIGNAL_TBLoad_1 + ichip, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
|
|
||||||
// reset trimbits
|
|
||||||
patword = setBit(SIGNAL_resStorage, patword);
|
|
||||||
patword = setBit(SIGNAL_resCounter, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
patword = clearBit(SIGNAL_resStorage, patword);
|
|
||||||
patword = clearBit(SIGNAL_resCounter, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
|
|
||||||
// select first channel
|
|
||||||
patword = setBit(SIGNAL_CHSserialIN, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
// 1 clk pulse
|
|
||||||
patword = setBit(SIGNAL_CHSclk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
patword = clearBit(SIGNAL_CHSclk, patword);
|
|
||||||
// clear 1st channel
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
patword = clearBit(SIGNAL_CHSserialIN, patword);
|
|
||||||
// 2 clk pulses
|
|
||||||
for (int i = 0; i < 2; i++) {
|
|
||||||
patword = setBit(SIGNAL_CHSclk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
patword = clearBit(SIGNAL_CHSclk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for each channel (all chips)
|
|
||||||
for (int ich = 0; ich < NCHAN_1_COUNTER; ich++) {
|
|
||||||
LOG(logDEBUG1, (" Chip %d, Channel %d\n", ichip, ich));
|
|
||||||
int val = trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
|
|
||||||
NCOUNTERS * ich] +
|
|
||||||
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
|
|
||||||
NCOUNTERS * ich + 1] *
|
|
||||||
64 +
|
|
||||||
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
|
|
||||||
NCOUNTERS * ich + 2] *
|
|
||||||
64 * 64;
|
|
||||||
|
|
||||||
// push 6 0 bits
|
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
patword = clearBit(SIGNAL_serialIN, patword);
|
|
||||||
patword = clearBit(SIGNAL_clk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
patword = setBit(SIGNAL_clk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
}
|
|
||||||
|
|
||||||
// deserialize
|
|
||||||
for (int i = 0; i < 18; i++) {
|
|
||||||
if (val & (1 << i)) {
|
|
||||||
patword = setBit(SIGNAL_serialIN, patword);
|
|
||||||
} else {
|
|
||||||
patword = clearBit(SIGNAL_serialIN, patword);
|
|
||||||
}
|
|
||||||
patword = clearBit(SIGNAL_clk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
|
|
||||||
patword = setBit(SIGNAL_clk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
}
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
|
|
||||||
// move to next channel
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
patword = setBit(SIGNAL_CHSclk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
patword = clearBit(SIGNAL_CHSclk, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// chip unselect
|
|
||||||
patword = clearBit(SIGNAL_TBLoad_1 + ichip, patword);
|
|
||||||
writePatternWord(iaddr++, patword);
|
|
||||||
|
|
||||||
// last iaddr check
|
|
||||||
if (iaddr >= MAX_PATTERN_LENGTH) {
|
|
||||||
LOG(logERROR, ("Addr 0x%x is past max_address_length 0x%x!\n",
|
|
||||||
iaddr, MAX_PATTERN_LENGTH));
|
|
||||||
trimmingPrint = logINFO;
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set pattern wait address
|
|
||||||
for (int i = 0; i <= 2; i++)
|
|
||||||
setPatternWaitAddress(i, MAX_PATTERN_LENGTH - 1);
|
|
||||||
|
|
||||||
// pattern loop
|
|
||||||
for (int i = 0; i <= 2; i++) {
|
|
||||||
int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
|
||||||
setPatternLoop(i, &stop, &stop, &nloop);
|
|
||||||
}
|
|
||||||
|
|
||||||
// pattern limits
|
|
||||||
{
|
|
||||||
int start = 0, nloop = 0;
|
|
||||||
setPatternLoop(-1, &start, &iaddr, &nloop);
|
|
||||||
}
|
|
||||||
// send pattern to the chips
|
|
||||||
startPattern();
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy trimbits locally
|
|
||||||
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
|
|
||||||
detectorChans[ichan] = trimbits[ichan];
|
|
||||||
}
|
|
||||||
trimmingPrint = logINFO;
|
|
||||||
LOG(logINFO, ("All trimbits have been loaded\n"));
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int setAllTrimbits(int val) {
|
|
||||||
int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan));
|
|
||||||
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
|
|
||||||
trimbits[ichan] = val;
|
|
||||||
}
|
|
||||||
if (setTrimbits(trimbits) == FAIL) {
|
|
||||||
LOG(logERROR, ("Could not set all trimbits to %d\n", val));
|
|
||||||
free(trimbits);
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
LOG(logINFO, ("Setting %s mode\n", (mode ? "Parallel" : "Non Parallel")));
|
||||||
|
uint32_t addr = DEADTIME_CONFIG_REG;
|
||||||
|
if (mode) {
|
||||||
|
bus_w(addr, bus_r(addr) | DEADTIME_FREE_MODE_ENBL_MSK);
|
||||||
|
} else {
|
||||||
|
bus_w(addr, bus_r(addr) & ~DEADTIME_FREE_MODE_ENBL_MSK);
|
||||||
}
|
}
|
||||||
// setSettings(UNDEFINED);
|
|
||||||
// LOG(logERROR, ("Settings has been changed to undefined (random "
|
|
||||||
// "trim file)\n"));
|
|
||||||
LOG(logINFO, ("All trimbits have been set to %d\n", val));
|
|
||||||
free(trimbits);
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getAllTrimbits() {
|
int getParallelMode() {
|
||||||
int value = detectorChans[0];
|
return ((bus_r(DEADTIME_CONFIG_REG) & DEADTIME_FREE_MODE_ENBL_MSK) >>
|
||||||
if (detectorModules) {
|
DEADTIME_FREE_MODE_ENBL_OFST);
|
||||||
for (int ichan = 0; ichan < ((detectorModules)->nchan); ichan++) {
|
|
||||||
if (detectorChans[ichan] != value) {
|
|
||||||
value = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
LOG(logINFO, ("Value of all Trimbits: %d\n", value));
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* parameters - timer */
|
||||||
|
|
||||||
void setNumFrames(int64_t val) {
|
void setNumFrames(int64_t val) {
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
||||||
@ -1147,6 +945,240 @@ int64_t getMeasurementTime() {
|
|||||||
(1E-9 * FIXED_PLL_FREQUENCY);
|
(1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* parameters - module, speed, readout */
|
||||||
|
|
||||||
|
int setModule(sls_detector_module myMod, char *mess) {
|
||||||
|
|
||||||
|
LOG(logINFO, ("Setting module\n"));
|
||||||
|
|
||||||
|
/* future implementation
|
||||||
|
// settings (not yet implemented)
|
||||||
|
setSettings((enum detectorSettings)myMod.reg);
|
||||||
|
if (myMod.reg >= 0) {
|
||||||
|
detectorModules->reg = myMod.reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// threshold
|
||||||
|
if (myMod.eV >= 0)
|
||||||
|
setThresholdEnergy(myMod.eV);
|
||||||
|
else {
|
||||||
|
// (loading a random trim file) (dont return fail)
|
||||||
|
setSettings(UNDEFINED);
|
||||||
|
LOG(logERROR,
|
||||||
|
("Settings has been changed to undefined (random trim
|
||||||
|
file)\n"));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// dacs
|
||||||
|
for (int i = 0; i < NDAC; ++i) {
|
||||||
|
// ignore dacs with -1
|
||||||
|
if (myMod.dacs[i] != -1) {
|
||||||
|
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||||
|
if (myMod.dacs[i] != detectorDacs[i]) {
|
||||||
|
sprintf(mess, "Could not set module. Could not set dac %d\n",
|
||||||
|
i);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
// setSettings(UNDEFINED);
|
||||||
|
// LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// trimbits
|
||||||
|
if (myMod.nchan == 0) {
|
||||||
|
LOG(logINFO, ("Setting module without trimbits\n"));
|
||||||
|
} else {
|
||||||
|
// set trimbits
|
||||||
|
if (setTrimbits(myMod.chanregs) == FAIL) {
|
||||||
|
sprintf(mess, "Could not set module. Could not set trimbits\n");
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
// setSettings(UNDEFINED);
|
||||||
|
// LOG(logERROR, ("Settings has been changed to undefined (random "
|
||||||
|
// "trim file)\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setBit(int ibit, int patword) { return patword |= (1 << ibit); }
|
||||||
|
|
||||||
|
int clearBit(int ibit, int patword) { return patword &= ~(1 << ibit); }
|
||||||
|
|
||||||
|
int setTrimbits(int *trimbits) {
|
||||||
|
LOG(logINFOBLUE, ("Setting trimbits\n"));
|
||||||
|
|
||||||
|
// validate
|
||||||
|
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
|
||||||
|
if (trimbits[ichan] < 0 || trimbits[ichan] > 63) {
|
||||||
|
LOG(logERROR, ("Trimbit value (%d) for channel %d is invalid\n",
|
||||||
|
trimbits[ichan], ichan));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Trimbits validated\n"));
|
||||||
|
trimmingPrint = logDEBUG5;
|
||||||
|
|
||||||
|
uint64_t patword = 0;
|
||||||
|
int iaddr = 0;
|
||||||
|
for (int ichip = 0; ichip < NCHIP; ichip++) {
|
||||||
|
LOG(logDEBUG1, (" Chip %d\n", ichip));
|
||||||
|
iaddr = 0;
|
||||||
|
patword = 0;
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
|
||||||
|
// chip select
|
||||||
|
patword = setBit(SIGNAL_TBLoad_1 + ichip, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
|
||||||
|
// reset trimbits
|
||||||
|
patword = setBit(SIGNAL_resStorage, patword);
|
||||||
|
patword = setBit(SIGNAL_resCounter, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
patword = clearBit(SIGNAL_resStorage, patword);
|
||||||
|
patword = clearBit(SIGNAL_resCounter, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
|
||||||
|
// select first channel
|
||||||
|
patword = setBit(SIGNAL_CHSserialIN, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
// 1 clk pulse
|
||||||
|
patword = setBit(SIGNAL_CHSclk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
patword = clearBit(SIGNAL_CHSclk, patword);
|
||||||
|
// clear 1st channel
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
patword = clearBit(SIGNAL_CHSserialIN, patword);
|
||||||
|
// 2 clk pulses
|
||||||
|
for (int i = 0; i < 2; i++) {
|
||||||
|
patword = setBit(SIGNAL_CHSclk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
patword = clearBit(SIGNAL_CHSclk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for each channel (all chips)
|
||||||
|
for (int ich = 0; ich < NCHAN_1_COUNTER; ich++) {
|
||||||
|
LOG(logDEBUG1, (" Chip %d, Channel %d\n", ichip, ich));
|
||||||
|
int val = trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
|
||||||
|
NCOUNTERS * ich] +
|
||||||
|
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
|
||||||
|
NCOUNTERS * ich + 1] *
|
||||||
|
64 +
|
||||||
|
trimbits[ichip * NCHAN_1_COUNTER * NCOUNTERS +
|
||||||
|
NCOUNTERS * ich + 2] *
|
||||||
|
64 * 64;
|
||||||
|
|
||||||
|
// push 6 0 bits
|
||||||
|
for (int i = 0; i < 6; i++) {
|
||||||
|
patword = clearBit(SIGNAL_serialIN, patword);
|
||||||
|
patword = clearBit(SIGNAL_clk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
patword = setBit(SIGNAL_clk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
}
|
||||||
|
|
||||||
|
// deserialize
|
||||||
|
for (int i = 0; i < 18; i++) {
|
||||||
|
if (val & (1 << i)) {
|
||||||
|
patword = setBit(SIGNAL_serialIN, patword);
|
||||||
|
} else {
|
||||||
|
patword = clearBit(SIGNAL_serialIN, patword);
|
||||||
|
}
|
||||||
|
patword = clearBit(SIGNAL_clk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
|
||||||
|
patword = setBit(SIGNAL_clk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
}
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
|
||||||
|
// move to next channel
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
patword = setBit(SIGNAL_CHSclk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
patword = clearBit(SIGNAL_CHSclk, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// chip unselect
|
||||||
|
patword = clearBit(SIGNAL_TBLoad_1 + ichip, patword);
|
||||||
|
writePatternWord(iaddr++, patword);
|
||||||
|
|
||||||
|
// last iaddr check
|
||||||
|
if (iaddr >= MAX_PATTERN_LENGTH) {
|
||||||
|
LOG(logERROR, ("Addr 0x%x is past max_address_length 0x%x!\n",
|
||||||
|
iaddr, MAX_PATTERN_LENGTH));
|
||||||
|
trimmingPrint = logINFO;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set pattern wait address
|
||||||
|
for (int i = 0; i <= 2; i++)
|
||||||
|
setPatternWaitAddress(i, MAX_PATTERN_LENGTH - 1);
|
||||||
|
|
||||||
|
// pattern loop
|
||||||
|
for (int i = 0; i <= 2; i++) {
|
||||||
|
int stop = MAX_PATTERN_LENGTH - 1, nloop = 0;
|
||||||
|
setPatternLoop(i, &stop, &stop, &nloop);
|
||||||
|
}
|
||||||
|
|
||||||
|
// pattern limits
|
||||||
|
{
|
||||||
|
int start = 0, nloop = 0;
|
||||||
|
setPatternLoop(-1, &start, &iaddr, &nloop);
|
||||||
|
}
|
||||||
|
// send pattern to the chips
|
||||||
|
startPattern();
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy trimbits locally
|
||||||
|
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
|
||||||
|
detectorChans[ichan] = trimbits[ichan];
|
||||||
|
}
|
||||||
|
trimmingPrint = logINFO;
|
||||||
|
LOG(logINFO, ("All trimbits have been loaded\n"));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setAllTrimbits(int val) {
|
||||||
|
int *trimbits = malloc(sizeof(int) * ((detectorModules)->nchan));
|
||||||
|
for (int ichan = 0; ichan < ((detectorModules)->nchan); ++ichan) {
|
||||||
|
trimbits[ichan] = val;
|
||||||
|
}
|
||||||
|
if (setTrimbits(trimbits) == FAIL) {
|
||||||
|
LOG(logERROR, ("Could not set all trimbits to %d\n", val));
|
||||||
|
free(trimbits);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
// setSettings(UNDEFINED);
|
||||||
|
// LOG(logERROR, ("Settings has been changed to undefined (random "
|
||||||
|
// "trim file)\n"));
|
||||||
|
LOG(logINFO, ("All trimbits have been set to %d\n", val));
|
||||||
|
free(trimbits);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getAllTrimbits() {
|
||||||
|
int value = detectorChans[0];
|
||||||
|
if (detectorModules) {
|
||||||
|
for (int ichan = 0; ichan < ((detectorModules)->nchan); ichan++) {
|
||||||
|
if (detectorChans[ichan] != value) {
|
||||||
|
value = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Value of all Trimbits: %d\n", value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
/* parameters - dac, hv */
|
/* parameters - dac, hv */
|
||||||
void setDAC(enum DACINDEX ind, int val, int mV) {
|
void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
@ -2044,6 +2076,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
clkPhase[SYSTEM_C0] = 0;
|
clkPhase[SYSTEM_C0] = 0;
|
||||||
clkPhase[SYSTEM_C1] = 0;
|
clkPhase[SYSTEM_C1] = 0;
|
||||||
clkPhase[SYSTEM_C2] = 0;
|
clkPhase[SYSTEM_C2] = 0;
|
||||||
|
clkPhase[SYSTEM_C3] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the phase in degrees (reset by pll)
|
// set the phase in degrees (reset by pll)
|
||||||
@ -2067,6 +2100,28 @@ int getClockDivider(enum CLKINDEX ind) {
|
|||||||
return clkDivider[ind];
|
return clkDivider[ind];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getTransmissionDelayFrame() {
|
||||||
|
return ((bus_r(FMT_CONFIG_REG) & FMT_CONFIG_TXN_DELAY_MSK) >>
|
||||||
|
FMT_CONFIG_TXN_DELAY_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setTransmissionDelayFrame(int value) {
|
||||||
|
if (value < 0 || value > MAX_TIMESLOT_VAL) {
|
||||||
|
LOG(logERROR, ("Transmission delay %d should be in range: 0 - %d\n",
|
||||||
|
value, MAX_TIMESLOT_VAL));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
LOG(logINFO, ("Setting transmission delay: %d\n", value));
|
||||||
|
uint32_t addr = FMT_CONFIG_REG;
|
||||||
|
bus_w(addr, bus_r(addr) & ~FMT_CONFIG_TXN_DELAY_MSK);
|
||||||
|
bus_w(addr, (bus_r(addr) | ((value << FMT_CONFIG_TXN_DELAY_OFST) &
|
||||||
|
FMT_CONFIG_TXN_DELAY_MSK)));
|
||||||
|
LOG(logDEBUG1, ("Transmission delay read %d\n",
|
||||||
|
((bus_r(addr) & FMT_CONFIG_TXN_DELAY_MSK) >>
|
||||||
|
FMT_CONFIG_TXN_DELAY_OFST)));
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
|
|
||||||
int startStateMachine() {
|
int startStateMachine() {
|
||||||
@ -2239,7 +2294,7 @@ int stopStateMachine() {
|
|||||||
sharedMemory_setStop(1);
|
sharedMemory_setStop(1);
|
||||||
// read till status is idle
|
// read till status is idle
|
||||||
while (sharedMemory_getStatus() == RUNNING)
|
while (sharedMemory_getStatus() == RUNNING)
|
||||||
;
|
usleep(500);
|
||||||
sharedMemory_setStop(0);
|
sharedMemory_setStop(0);
|
||||||
LOG(logINFO, ("Stopped State Machine\n"));
|
LOG(logINFO, ("Stopped State Machine\n"));
|
||||||
}
|
}
|
||||||
@ -2251,6 +2306,12 @@ int stopStateMachine() {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int softwareTrigger() {
|
||||||
|
LOG(logINFO, ("Sending Software Trigger\n"));
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_SW_TRIGGER_MSK);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
enum runStatus getRunStatus() {
|
enum runStatus getRunStatus() {
|
||||||
LOG(logDEBUG1, ("Getting status\n"));
|
LOG(logDEBUG1, ("Getting status\n"));
|
||||||
// scan error or running
|
// scan error or running
|
||||||
@ -2294,8 +2355,17 @@ enum runStatus getRunStatus() {
|
|||||||
|
|
||||||
// not running
|
// not running
|
||||||
else {
|
else {
|
||||||
|
// error from too short exptime in parallel mode
|
||||||
|
uint32_t deadtimeReg = bus_r(DEADTIME_CONFIG_REG);
|
||||||
|
if ((deadtimeReg & DEADTIME_EARLY_EXP_FIN_ERR_MSK) >>
|
||||||
|
DEADTIME_EARLY_EXP_FIN_ERR_OFST) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Status: ERROR in Dead Time Reg (too short exptime) %08x\n",
|
||||||
|
deadtimeReg));
|
||||||
|
s = ERROR;
|
||||||
|
}
|
||||||
// stopped or error
|
// stopped or error
|
||||||
if (retval & FLOW_STATUS_FIFO_FULL_MSK) {
|
else if (retval & FLOW_STATUS_FIFO_FULL_MSK) {
|
||||||
LOG(logINFOBLUE, ("Status: STOPPED\n")); // FIFO FULL??
|
LOG(logINFOBLUE, ("Status: STOPPED\n")); // FIFO FULL??
|
||||||
s = STOPPED;
|
s = STOPPED;
|
||||||
} else if (retval & FLOW_STATUS_CSM_BUSY_MSK) {
|
} else if (retval & FLOW_STATUS_CSM_BUSY_MSK) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#define REQRD_FRMWRE_VRSN 0x190000
|
#define REQRD_FRMWRE_VRSN 0x190000
|
||||||
|
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
|
||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
@ -24,30 +25,34 @@
|
|||||||
#define MAX_EXT_SIGNALS (8)
|
#define MAX_EXT_SIGNALS (8)
|
||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
#define DEFAULT_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
#define DEFAULT_PATTERN_FILE ("DefaultPattern_mythen3.txt")
|
||||||
#define DEFAULT_INTERNAL_GATES (1)
|
#define DEFAULT_INTERNAL_GATES (1)
|
||||||
#define DEFAULT_EXTERNAL_GATES (1)
|
#define DEFAULT_EXTERNAL_GATES (1)
|
||||||
#define DEFAULT_DYNAMIC_RANGE (32)
|
#define DEFAULT_DYNAMIC_RANGE (32)
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
#define DEFAULT_NUM_FRAMES (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
|
||||||
#define DEFAULT_GATE_DELAY (0)
|
#define DEFAULT_GATE_DELAY (0)
|
||||||
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
|
||||||
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||||
#define DEFAULT_READOUT_C0 (10) //(125000000) // rdo_clk, 125 MHz
|
#define DEFAULT_READOUT_C0 (10) //(100000000) // rdo_clk, 100 MHz
|
||||||
#define DEFAULT_READOUT_C1 (10) //(125000000) // rdo_x2_clk, 125 MHz
|
#define DEFAULT_READOUT_C1 (10) //(100000000) // smp sample clk (x2), 100 MHz
|
||||||
#define DEFAULT_SYSTEM_C0 (4) //(250000000) // run_clk, 250 MHz
|
#define DEFAULT_SYSTEM_C0 (20) // (50000000) // run_clk, 50 MHz
|
||||||
#define DEFAULT_SYSTEM_C1 (8) //(125000000) // chip_clk, 125 MHz
|
#define DEFAULT_SYSTEM_C1 (10) //(100000000) // sync_clk, 100 MHz
|
||||||
#define DEFAULT_SYSTEM_C2 (8) //(125000000) // sync_clk, 125 MHz
|
#define DEFAULT_SYSTEM_C2 (10) //(100000000) // str_clk, 100 MHz
|
||||||
|
#define DEFAULT_SYSTEM_C3 (5) //(200000000) // smp_clk, 200 MHz
|
||||||
|
// (DEFAULT_SYSTEM_C3 only for timing receiver) should not be changed
|
||||||
|
|
||||||
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
|
#define DEFAULT_ASIC_LATCHING_NUM_PULSES (10)
|
||||||
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
|
#define DEFAULT_MSTR_OTPT_P1_NUM_PULSES (20)
|
||||||
|
|
||||||
/* Firmware Definitions */
|
/* Firmware Definitions */
|
||||||
|
#define MAX_TIMESLOT_VAL (0xFFFFFF)
|
||||||
#define IP_HEADER_SIZE (20)
|
#define IP_HEADER_SIZE (20)
|
||||||
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz
|
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz
|
||||||
#define READOUT_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
#define READOUT_PLL_VCO_FREQ_HZ (1000000000) // 1GHz
|
||||||
#define SYSTEM_PLL_VCO_FREQ_HZ (1000000000) // 1GHz
|
#define SYSTEM_PLL_VCO_FREQ_HZ (1000000000) // 1GHz
|
||||||
#define MAX_NUM_DESERIALIZERS (40)
|
#define MAX_NUM_DESERIALIZERS (40)
|
||||||
|
|
||||||
@ -104,10 +109,12 @@ enum CLKINDEX {
|
|||||||
SYSTEM_C0,
|
SYSTEM_C0,
|
||||||
SYSTEM_C1,
|
SYSTEM_C1,
|
||||||
SYSTEM_C2,
|
SYSTEM_C2,
|
||||||
|
SYSTEM_C3,
|
||||||
NUM_CLOCKS
|
NUM_CLOCKS
|
||||||
};
|
};
|
||||||
#define CLK_NAMES \
|
#define CLK_NAMES \
|
||||||
"READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2"
|
"READOUT_C0", "READOUT_C1", "SYSTEM_C0", "SYSTEM_C1", "SYSTEM_C2", \
|
||||||
|
"SYSTEM_C3"
|
||||||
enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
|
enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
|
||||||
|
|
||||||
/* Struct Definitions */
|
/* Struct Definitions */
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a value from a range to a different range (eg voltage to dac or vice
|
* Convert a value from a range to a different range (eg voltage to dac or vice
|
||||||
@ -17,3 +18,5 @@ int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
|||||||
int outputMax, int inputValue, int *outputValue);
|
int outputMax, int inputValue, int *outputValue);
|
||||||
|
|
||||||
int getAbsPath(char *buf, size_t bufSize, char *fname);
|
int getAbsPath(char *buf, size_t bufSize, char *fname);
|
||||||
|
|
||||||
|
int GetTimeFromString(char *buf, time_t *result);
|
@ -87,3 +87,7 @@ int mapCSP0(void);
|
|||||||
* Get Nios base address
|
* Get Nios base address
|
||||||
*/
|
*/
|
||||||
u_int32_t *Nios_getBaseAddress();
|
u_int32_t *Nios_getBaseAddress();
|
||||||
|
|
||||||
|
/** check kernel version against expected version string (complain if too old)
|
||||||
|
* @returns OK or FAIL */
|
||||||
|
int Nios_checkKernelVersion(char *expectedVersion);
|
@ -56,6 +56,9 @@ typedef struct udpStruct_s {
|
|||||||
int isInitCheckDone();
|
int isInitCheckDone();
|
||||||
int getInitResult(char **mess);
|
int getInitResult(char **mess);
|
||||||
void basictests();
|
void basictests();
|
||||||
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
int checkKernelVersion();
|
||||||
|
#endif
|
||||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \
|
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || \
|
||||||
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
int checkType();
|
int checkType();
|
||||||
@ -179,9 +182,11 @@ int setExternalSampling(int val);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parameters - readout
|
// parameters - readout
|
||||||
#ifdef EIGERD
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
int setParallelMode(int mode);
|
int setParallelMode(int mode);
|
||||||
int getParallelMode();
|
int getParallelMode();
|
||||||
|
#endif
|
||||||
|
#ifdef EIGERD
|
||||||
int setOverFlowMode(int mode);
|
int setOverFlowMode(int mode);
|
||||||
int getOverFlowMode();
|
int getOverFlowMode();
|
||||||
#endif
|
#endif
|
||||||
@ -277,9 +282,9 @@ int64_t getMeasurementTime();
|
|||||||
int setModule(sls_detector_module myMod, char *mess);
|
int setModule(sls_detector_module myMod, char *mess);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
#ifdef MYTHEN3D
|
||||||
int setTrimbits(int *trimbits);
|
|
||||||
int setBit(int ibit, int patword);
|
int setBit(int ibit, int patword);
|
||||||
int clearBit(int ibit, int patword);
|
int clearBit(int ibit, int patword);
|
||||||
|
int setTrimbits(int *trimbits);
|
||||||
int setAllTrimbits(int val);
|
int setAllTrimbits(int val);
|
||||||
int getAllTrimbits();
|
int getAllTrimbits();
|
||||||
#endif
|
#endif
|
||||||
@ -531,6 +536,8 @@ int *getBadChannels(int *nch);
|
|||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||||
int getTenGigaFlowControl();
|
int getTenGigaFlowControl();
|
||||||
int setTenGigaFlowControl(int value);
|
int setTenGigaFlowControl(int value);
|
||||||
|
#endif
|
||||||
|
#if defined(JUNGFRAUD) || defined(EIGERD) || defined(MYTHEN3D)
|
||||||
int getTransmissionDelayFrame();
|
int getTransmissionDelayFrame();
|
||||||
int setTransmissionDelayFrame(int value);
|
int setTransmissionDelayFrame(int value);
|
||||||
#endif
|
#endif
|
||||||
@ -550,7 +557,7 @@ int startStateMachine();
|
|||||||
void *start_timer(void *arg);
|
void *start_timer(void *arg);
|
||||||
#endif
|
#endif
|
||||||
int stopStateMachine();
|
int stopStateMachine();
|
||||||
#ifdef EIGERD
|
#if defined(EIGERD) || defined(MYTHEN3D)
|
||||||
int softwareTrigger();
|
int softwareTrigger();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#define _GNU_SOURCE // needed for strptime to be at the top
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
@ -60,3 +61,12 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
|||||||
LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf));
|
LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetTimeFromString(char *buf, time_t *result) {
|
||||||
|
struct tm t;
|
||||||
|
if (NULL == strptime(buf, "%a %b %d %H:%M:%S %Z %Y", &t)) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
*result = mktime(&t);
|
||||||
|
return OK;
|
||||||
|
}
|
@ -2,10 +2,13 @@
|
|||||||
#include "RegisterDefs.h"
|
#include "RegisterDefs.h"
|
||||||
#include "ansi.h"
|
#include "ansi.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
|
#include "common.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#include <fcntl.h> // open
|
#include <fcntl.h> // open
|
||||||
#include <sys/mman.h> // mmap
|
#include <string.h>
|
||||||
|
#include <sys/mman.h> // mmap
|
||||||
|
#include <sys/utsname.h> // uname
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
@ -127,3 +130,49 @@ int mapCSP0(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t *Nios_getBaseAddress() { return csp0base; }
|
u_int32_t *Nios_getBaseAddress() { return csp0base; }
|
||||||
|
|
||||||
|
int Nios_checkKernelVersion(char *expectedVersion) {
|
||||||
|
// extract kernel date string
|
||||||
|
struct utsname buf;
|
||||||
|
if (uname(&buf) == -1) {
|
||||||
|
LOG(logERROR, ("Could not get kernel version\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove first word (#version number)
|
||||||
|
const char *ptr = strchr(buf.version, ' ');
|
||||||
|
if (ptr == NULL) {
|
||||||
|
LOG(logERROR, ("Could not parse kernel version\n"));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
char output[256];
|
||||||
|
memset(output, 0, 256);
|
||||||
|
strcpy(output, buf.version + (ptr - buf.version + 1));
|
||||||
|
|
||||||
|
// convert kernel date string into time
|
||||||
|
time_t kernelDate;
|
||||||
|
if (GetTimeFromString(output, &kernelDate) == FAIL) {
|
||||||
|
LOG(logERROR, ("Could not parse retrieved kernel date, %s\n", output));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert expected date into time
|
||||||
|
time_t expDate;
|
||||||
|
if (GetTimeFromString(expectedVersion, &expDate) == FAIL) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("Could not parse expected kernel date, %s\n", expectedVersion));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// compare if kernel time is older than expected time
|
||||||
|
if (kernelDate < expDate) {
|
||||||
|
LOG(logERROR, ("Kernel Version Incompatible (too old)! Expected: [%s], "
|
||||||
|
"Got [%s]\n",
|
||||||
|
expectedVersion, output));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(logINFOBLUE, ("Kernel Version Compatible: %s [min.: %s]\n", output,
|
||||||
|
expectedVersion));
|
||||||
|
return OK;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user