Compare commits

..

163 Commits

Author SHA1 Message Date
699fb2ed66 fixed conda build 2025-03-27 16:05:32 +01:00
53b84b17a6 Merge pull request #1162 from slsdetectorgroup/910/fix_tests_real_g2
Some checks failed
CMake / Configure and build using cmake (push) Failing after 10s
910: fixed tests for real gotthard2. change in reg address to test
2025-03-19 17:16:19 +01:00
16d404c21b fixed tests for real gotthard2. change in reg address to test 2025-03-19 17:11:05 +01:00
34ce96ffa0 Merge pull request #1157 from slsdetectorgroup/910/jf_timing_decoder_only_hw2.0
Some checks failed
CMake / Configure and build using cmake (push) Failing after 12s
jf: get timing info decoder only for hw 2.0
2025-03-18 12:31:45 +01:00
d5fa26ef9a even get is not supported for timing info decoder for jungfrau hw v1.0. only hw v2.0 is uspported 2025-03-18 12:29:25 +01:00
77f20b4e97 updated jungfrau binary 2025-03-18 11:04:55 +01:00
a295208c12 Merge pull request #1125 from slsdetectorgroup/910/release_notes
release notes
2025-03-12 09:29:48 +01:00
36a6087e1d Update RELEASE.txt
Updated frame sync notes
2025-03-12 08:10:49 +01:00
fb406a7c6c experimental tag on frame syncrhonizer release notes 2025-03-11 15:41:21 +01:00
6e4380db43 updated 910 lib versioning dates 2025-03-11 15:25:40 +01:00
903652bb72 added back the binaries that were missing 2025-03-11 11:04:43 +01:00
1609706093 minor changes in topic 2025-03-11 10:43:39 +01:00
14d2d171bb Merged main to 9.1.0.rc, keeping 9.1.0.rc changes 2025-03-11 10:34:17 +01:00
dd8452b365 jf firmware dates updated in release notes 2025-03-11 09:40:12 +01:00
15a9fb86da Merge pull request #1140 from slsdetectorgroup/910/jf_firmware_dates
910/jf firmware dates
2025-03-11 09:36:02 +01:00
222d2b3fad updated jf binary for fwv 1.6 and 2.6 2025-03-11 09:31:05 +01:00
a57531312f jungfrau firmware dates for fw v 1.6 and fw2.6 2025-03-11 09:29:01 +01:00
85a03a1d72 removed CMakeFiles folder. mistakenly added to repo (#1136) 2025-03-10 14:26:22 +01:00
fc197ed002 changed line 66 in docs/conf.py.in to app.add_css_file(filename) (#1130)
Co-authored-by: AliceMazzoleni99 <l_mazzol_a@pc17378.psi.ch>
2025-03-06 14:41:46 +01:00
a5d242876b m3:default period set to 0, updated serverBin folder as well (#1126) 2025-03-04 16:06:46 +01:00
76ce5de89e added release notes for m3 default period 2025-03-04 15:43:45 +01:00
dbb0dbcbcd release notes 2025-03-04 15:28:09 +01:00
87d40d418e reverted servers of eiger, gotthard, gotthard2, moench and mythen3 as nothing has really changed there other than formatting 2025-03-03 15:30:35 +01:00
c82712b587 prior release notes 2025-03-03 11:40:29 +01:00
9dd1509714 formatting 2025-03-03 11:02:38 +01:00
c8290598db 910: multi ids ignored silently in config file (#1114)
* warn that the multi id is ignored in config file? or throw?

* throw and not just warn with printouts as that could be silent as well

* throw for any multi id command in the file.
2025-02-27 10:41:31 +01:00
ff6a2655a2 when creating the python bindings for Detector class, it should ignore the assignment operators (#1106) 2025-02-26 12:20:35 +01:00
7b2e6ae4ab 910: udpated help on multi module and multi command help (#1116)
* udpated help on multi module and multi command help

* fixed issues with empty lines and other syntax with docuemntation

* fixed some warningsin documentation

* some changes to documentation about command line usage

* minor
2025-02-26 11:13:59 +01:00
706f3a103c jf: removed check to allow chipv1.0 also to set comp disable time (#1117) 2025-02-24 09:38:57 +01:00
5de98b3db0 file from Anna: could be reduce print out in zmq processing when using energy threshold (#1112) 2025-02-21 12:49:18 +01:00
7494e41862 910/frame synchronizer (#1086)
* wip: draft of frame synchronizer, semaphores not done yet

* signal handler not affecting semaphore inside lambda function

* finally works with sem

* install targets cmake error fix

* reducing the number of data call backs. incoming from developer

* WIP: of synchronisation (#969)

* WIP of synchronisation

* working so far if everything goes right

* added all information into json headers

* valid json

* allow frame synchronizer to have access to static libzmq when compiling on conda (libzeromq-devel not installed by default

* upto date with multirecieverapp for invalid arguments and help

* formatting

* remove warnings

* changes to print

* removed prints

* no need for print frames to be called

* minor

* commnet

* adding json header in start callback, imagesize in data callback and formatted

* fixed sanitizer issues. 1 left for ctrl+C
- zmq_msg_t should be deleted, not freed. Same with the char arrays and semaphores.

* fixed sanitizer issues and made it more readable

* moving clearing old frames to new startacq just in case it has to process soem frames before the callback

* created a callback mutex to register the callbacks when using threads for different Receiver objects instead of child processes, remove the clean up of the frames (deleting from a signal is thread unsafe) from the siginterrupt handler, reading or  setting terminate should also be inside the mutex, pass receiver object index so that only the first one   cleans up the shared structure

---------

Co-authored-by: Felix Engelmann <felix-github@nlogn.org>
2025-02-18 11:19:00 +01:00
7607fdc9a7 910 jf : bunch id decoder and auto comp disable (#1096)
* jf wip: bunch id decoder only in pcb v2.0 check and comments

* auto comp disable the same way for both chip versions. compdisabletime also available for 1.1 now

* formatting

* fixed tests

* updated jf binary
2025-02-18 11:16:11 +01:00
1bfffb842d added documentation of order in hostname command in quick start guide, udp header format for row and column values and in command line hostname (#1098) 2025-02-18 11:12:20 +01:00
7c48ae9a49 dont usleep if no transmission delay (#1100) 2025-02-18 11:10:26 +01:00
bf82aeee8d 910/restream stop delay (#1093)
* wait a bit for post processor to process the dummy

* refactoring

* minor
2025-02-11 11:02:32 +01:00
84e83bf551 restream stop if stop called, temp solution (#1092)
* restream stop if stop called, temp solution until new command for it

* chekckrestream is ambiguous when only checking receiver

* moved restreaming in background to receiver stop instead of detector stop (was in stop before due to gui stop button access), increase to 2s time to restream in client acquire

* minor

* moved stop to module class

* fix from before
2025-02-11 09:17:25 +01:00
60ce31bb17 removed .str().c_str() (#1089) 2025-02-11 09:15:18 +01:00
2947b65e02 versioning and formatting 2025-02-04 14:25:21 +01:00
e92578f89d formatting 2025-01-31 12:27:35 +01:00
0e45ae189d allowing pyctbgui to work for xilinx ctb (#1079)
* allowing pyctbgui to work for xilinx ctb

* slowadc and adc enable (only 10g) allowed for xilinx ctb
2025-01-31 12:24:05 +01:00
e6e260d8ca remove cross-compiler option in the case of compiling the detector server on the detector module CPU (#1078)
Co-authored-by: Martin Mueller <martin.mueller@psi.ch>
2025-01-30 09:44:36 +01:00
fcc9b6ad54 added sls_detector_acquire_zmq binary in conda (#1074) 2025-01-14 15:43:11 +01:00
0771461c01 CLI: added empty dbit list option 'none' (#1069)
* cli: added 'none' to the rx_dbitlist command to be able to set the dbit list to an empty list
2025-01-13 16:46:01 +01:00
ed6686d4a7 Dev/workflow build fix png and tiff (#1071)
* installing png on github workflow actions for the build fail on github due to latest ubuntu

* installing tiff on github workflow
2025-01-13 16:07:34 +01:00
ec3d3e38a6 minor to test 2025-01-13 14:44:28 +01:00
e47d3d4d15 documentation for moenchzmq conda 2024-12-05 10:50:52 +01:00
f9dbffcb6e documentation: added moenchzmq conda info in installation page (#1066) 2024-12-05 10:39:43 +01:00
e83527adee ctb: make patternX path autocomplete (#1065) 2024-11-29 15:02:29 +01:00
dee86c63eb back to getting version for conda from tag (#1060) 2024-11-26 14:35:38 +01:00
ce41e8aa34 adding pmodules variant for 9.0.0_rh8 2024-11-26 11:41:16 +01:00
7e2c8a37dc Dev/900/docs (#1057)
* minimum python is 3.8, so >=

* removed ctb frame documentation. should be in internal wiki

* minor doc change
2024-11-26 10:48:58 +01:00
aeb59364c5 dev: pybind 2.13.6 and python 3.8 (#1055)
* changed pybind 2.13.0 to 2.13.6, kept conda at min 2.13.0

* changed min python version from 3.6 to 3.8
2024-11-25 15:01:18 +01:00
1f16f84fed dev cmake_source_dir (#1052)
* when package used as subdirectory (cmake-subfolder-example) it fails when python is used because the cmake_source_dir is now the one above package.

* changed cmake_current_list_dir to cmake_current_source_dir

* removing the unnecessary VERSION file installed in the root directory (from PR #1020)
2024-11-25 14:55:22 +01:00
0123169e35 dev/ bumped pybind11 version and added setuptools on host (#1049)
* bumped pybind11 version and added setuptools on host

* updated pybind11 tarball to 2.13 and in cmakefile to get 2.13 frpm github, also updated documentation about pybind 2.13

* updated client versioing, doc

* updating readme

---------

Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
2024-11-22 14:32:39 +01:00
ffd7cd1070 fix cmake (cannot find VERSION file) when using package as subfolder as cmake_source_dir is not same anymore, add troubleshooting doc for m3 regarding loose control board for waiting status in auto timing mode, fix m3 tests to test register write (previously was read only) (#1048) 2024-11-21 16:44:09 +01:00
c6c7632ef7 updated m3 fw version (#1045) 2024-11-21 12:18:59 +01:00
b79759bcff formatting 2024-11-21 11:09:38 +01:00
d9e8e1c1c2 dev: version from file to cmake and python (#1025)
- renamed conda-recipe folder
- added a check to see if build and install folder exists in build.sh (conda recipe)
- created VERSION file that has '0.0.0'for developer but can be updated using update_version.py that takes in a version. The script checks for semantic versioning and updates VERSION file
- VERSION file also copied along with py files to slsdet in python cmakelist and build_pylib.sh (for conda), also copied in root folder for installations (for no coding purpose)
- init.py and setup.py reads this file to get the version (a bit differently to find the VERSION file)
- VERSION file read into cmake to get the version and also added to compile definition. So RELEASE removed from versionAPI.h (using SLS_DET_VERSION compile definiton instead) and also removed updateRelease script.
- conda getting project version from environment variable SLS_DET_VERSION that is set in build_pylib.sh prior.
- added 3.13 python to conda build
- anything related to ctb removed from release notes as users will always use developer
- sets 0.0.0 to VERSION file by running update_version.py without an argument
2024-11-21 10:46:20 +01:00
c57e835a41 dev: fixed invalid arguments to slsmultireceiver (#1040)
* wasnt showing error message for invalid arguments to slsmultireceiver

* allow 0 arguments to act like an slsReceiver with start tcp port 1954 and just 1 receiver
2024-11-21 10:40:03 +01:00
b3d9af29fc Dev/jungfrau temp control default enable (#1042)
* jungfrau: enabling temp control by default at server startup
2024-11-21 10:28:41 +01:00
4829429abd dev: legal gain values in jungfrau simulator (#1044)
* legal gain values in jungfrau simulator

* typo
2024-11-20 16:59:28 +01:00
f1ffc6057a fixed cli documentation (#1038) 2024-11-20 11:14:50 +01:00
8f51215cb3 fixed typo in python for vb_pixbuf Jungfrau dac (#1031) 2024-11-18 09:54:05 +01:00
7b21ce34d6 Dev/document json ctb file format (#1029)
* docs receiver formats rewrite

* added documentation for all the receiver files, updated release notes, udpated help in commands help for timing, fixed by throwing exception for aa dividy by 0 error caused by not freeing memory (detsize) when switching between 1d and 2d detectors, removed unnecessary 'recevier up' printout, fixed dbit list 64 bit mask error in master json file (was not 64 bit before), fixed bug in reading gotthard1 data (needs to be tested)

* generating commands help and formatting, also fix help for trimen command line

* added ctb frame format documentation, added some links to some commands, added documentation about adding expat-devel in installation for rhel8 gui, fixed some indentation issues that screwed up command line help documentation

* added ctb frame format documentation

* updated documentation about zeromq-devel for <8.0.0 versions
2024-11-18 09:52:24 +01:00
e1497f9cb9 Dev/server malloc check (#1023)
* usleep in communication to actually relay the err message of memory allocation to the client (weird but test for now), function in server to handle memory allcoation issues (updates mess, ret and sendsit to the client and returns prior from function implementatin, setting fnum in client for the speicific functions that send to detector each argument separtely, they need to remember the fnum else they throw with the incorrect fnum
* server: every malloc must check if it succeeded, rearranging so that the free is clear as well (only in funcs so far)
* fixed malloc checks in other places other than funcs.c
2024-11-18 09:46:21 +01:00
5088e5a205 Dev/detach pthreads not joining (#1019)
* detach the pthreads that are not joining else memory leak

* removed the clean up comment, also refactored the pthread join/detach for ctb 1g
2024-11-07 11:24:46 +01:00
06266f3905 gui: hide 'complete image' and just show 'missing packets' when there are missing packets in that image form the receiver (#1014) 2024-10-28 09:39:40 +01:00
5f805f8789 Dev/jf firmware rollback (#1011)
* jf: rolling back firmware required to v1.5 and 2.5, updated release notes, fixed a bug when updating server (when server name same as link name:throws with no message, pedestal mode check changed for the time being for loops to be 0xFF size

* compensating for jf fw bug for pedestalmode where loops should be 16 bit, but is 8 bit in fw. to be fixed in next version

* formatting

* formatting, merge fix

* fixed python test simulator to kill previous servers

* rmeoved merge binary
2024-10-24 15:53:49 +02:00
60868ae74e Dev/rm volatile (#1007)
* Removing volatile and replacing with atomic to ensure atomicity

* compiling header include issue
2024-10-23 12:39:03 +02:00
37e65634d4 Dev/g2 fix configure chip startup (#1009)
* g2: chip reconfigure variable not set when powering on at startup because readconfig is the one configuring the chip the first time to default chip settings

* cleaning up code
2024-10-22 17:19:28 +02:00
6fcdba56a4 Dev/document autocomplete (#1004)
* fixed the gendoc to reflect the new parser, updated documentation to include info about autocomplete in the command line part, error in createing docs

* fixed list deprecated, fixed command help (to show properly on a html, fixed other help warnings

* minor indents

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2024-10-21 16:39:50 +02:00
0b9fd0664e setting detsize after hostname should throw also for single module for consistency (#1000)
Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2024-10-21 16:33:13 +02:00
6add9aad5d Dev/proper free (#1005)
* first draft of fixing the free function available within the class

* removed class member function freeSharedmemory for both Detector and Module; made the free function freeSharedmemory accessible to python interface; setHostname if there is already a module in shm will recreate the Detector object while freeing shm completely and keeping detsize and intitialchecks (previous commit), sethostname called from DetectorClass in virtual command to have one point of entry (previous commit), testing Module class frees shared memory using free function

* Detector class: added copy and move constructor and assignmentoperators due to explicit destructor (DetectorImpl fwd declared), DetectorImpl class: included ZmqSocket to remove destructor (should not be virtual in any case), Module class: removed explciit destructor to allow compiler generated constructor and operators

* formatting

* minor fix for readme autocomplete

* updated client version date
2024-10-21 16:25:07 +02:00
76ab0228ac formatting and moench fw release update 2024-10-16 11:30:04 +02:00
a1e69bba37 updating release notes (superficial), package release version (superficial), client and receiver version (too old) 2024-10-16 11:18:03 +02:00
270ee48148 formatting 2024-10-11 15:44:59 +02:00
c679135138 Dev/g2 fix next frame number (#996)
* binaries in
2024-10-07 17:09:00 +02:00
0f88617477 first draft at fixing nextframenumber properly with firmware (#995)
* fixing nextframenumber properly with firmware

* updated firmware to have getnextframenumber and fixed setnextframenumber to reset also the header fifo when stopping

* fix tests for gotthard2
2024-10-04 16:53:14 +02:00
04eed990c7 fix the command help in the command help generator for Gotthard2 about nextframenumber (#994) 2024-10-03 11:50:42 +02:00
d2bfb91a16 formatting 2024-10-02 16:45:10 +02:00
5e024153bc Dev/g2 stop frame number (#980)
* get/set next frame number in G2 (firmware only has set, no get)
* firmware has issues: each stop keeps 2 frame header in fifo and the resetting frame number happens after that
* removed the option to set burstmode to burst external or continuwous internal
* needs to be revisited before 9.0.0
2024-10-02 15:26:06 +02:00
e59de85a33 formatting 2024-10-01 14:44:59 +02:00
fd010b9aa5 removed 'Caller/CALLER' from test names as there is only one command line now (#993) 2024-10-01 12:25:05 +02:00
45957391a6 minor. removed warning print at startup for empty eth udp to listen to (#992) 2024-10-01 12:05:00 +02:00
f2f3817a7f updated jungfrau timing info decoder mask (#991) 2024-10-01 11:29:48 +02:00
f43bb8eea4 jf: timing info decoder (#987)
* timing_info_decoder command with options swissfel (default) and shine. added to python, command line generation, autocomplete, tostring, tests.
2024-10-01 11:17:35 +02:00
8a7ed30676 Dev/m3 readout speed (#985)
* added readoutspeed command to m3 (fullspeed - 10, half speed - 20, quarter speed - 40), removed reaodut pll, moved up system pll clock indices, leaving pll index in common altera code, default speed is half speed, allow only system_c0 to be set, the others can be obtained, same for clkphase, maxclkphaseshift, clkfreq. added to readoutspeedlist commands, updated help and updated tests

* updated readoutspeedlist command
2024-09-30 17:22:24 +02:00
5b832cb6aa Jf: Electron collection mode (#983)
* electron collection mode for jungfrau. also removing the config chip when using register command
* collectionMode: HOLE/ELECTRON (enum)
2024-09-30 17:15:22 +02:00
7fa5b5d70a fixing python version. allowing versions to execute even if no detector connected or in shared memory (#990) 2024-09-30 17:10:20 +02:00
6348ccd05b change gain mode help from dynamicgain to dynamic (#988) 2024-09-30 17:04:15 +02:00
8144397b2c sleep implemented for command line, mainly for config files for firmware developers (#982) 2024-09-30 16:57:53 +02:00
2dc0963c56 Dev/reg bit change no validate (#970)
- do not validate write reg, setbit and clearbit by default anymore
- --validate will force validation on the bitmask or entire reg
- remove return value for write reg (across server to client, but thankfully not in the Detector class)
- extend validation into writereg, setbit and clearbit for Eiger (always special)
-  need to check python (TODO)
- missed the rx_zmqip implementations in detector.h and python bindings
2024-09-30 16:54:12 +02:00
a44ba4dc35 Dev/rx callbacks (#966)
* changed rxr callback signatures to all include structs
* removed datamodify call back as size can be changed in the original data call back now
* bringing some parameters (set functions) to dataProcessor class for its callback (namely udpport, quad, fliprows, totalframes, jsonheader), resulting in also removing totalframes from 2 other function signatures

* updated MultiReceiverApp to reflect the new callback signatures
2024-09-30 16:30:13 +02:00
007330caa7 format 2024-09-26 15:39:49 +02:00
492b4815a6 rx_zmqip has been removed. Remove it also for pyctbgui (#979) 2024-09-26 10:43:16 +02:00
33b8e0817e missed the rx_zmqip implementations in detector.h and python bindings (#975) 2024-09-18 13:41:58 +02:00
ab7425a9d3 8.0.2 psi modules 2024-09-17 12:20:36 +02:00
d8f925520e dont build doc for Tobi Schluter from libzmq, which uses iso-8859-1 and the umlaut cause compilation to fail on some machines (#973) 2024-09-16 17:26:31 +02:00
9f079b17a2 Dev/xilinx mat update (#959)
* put back code to obtain adc and dac device indexafter loading device tree and then create folder iio_device_links and create symbolic links there according to device indices found. ln -sf operation not permitted, so folder has to be deleted and created everytime. Also refactored definitions to have all the xilinx name or detector specific stuff out of programbyArm.c

* uncommented waittransceiverreset at startup (should work now) and return of powering off chip at startup (error for transceiver alignment reset)

* updated registerdefs from firmware

* minor prints and updating names from registerdefs

* waittransceiverreset has been fixed in firmware and removing warnign for that, transceiver alignment check for powering off chip is not done in fw (giving a warning and returning ok for now)

* fixing ipchecksum (not done), removed startperiphery, allowing readout command to be allowed for xilinx when acquiring
2024-09-10 16:19:03 +02:00
5b61ff24bb Dev/pyctbgui merge (#960)
* added empty c extension

* added rotation to the decoding

* added color map, options and findex

* minor

* move checks to before acquisition

* added pixel map based decoder

* cleanup

* no thread creation for single thread processing

* added rotation and test to compare

* allow high and low water mark for zmq (also buffer size) for fast readouts

* removed roatation during decoding

* added Transpose to image and invert Y False to invert it

* retains the zoomed state after the first image of gui, catch and display exception if no detector connected

* moved start frame to dockable widget, removed extra frame number label, moved current measurement also to dockable widget, hide frame plot entirely when showing patternviewer

* first image dependin on which plot

* remember settings of main window size and position, dockewidget if docked, its size and posisiotn as well, then update it next time the gui is opened

* change in comment

* using c decoder for moench 04 and matterhorn

* catch exception from invalid image from decoder

* clean up

* update row and col when choosing image type, neeeded to show values

* fix for previous PR

* disable resetting colormap values
keep the range selected for every new acquisition

* fix typos + tested on virtual matterhorn

* minor print

* refactored Slow ADCs Tab

* refactored DAC tab

* refactored power supplies

* refactored signals tab

* refactored transceiver tab

* fix typo

* fix typo2

* remove commented code

* delete commented code

* delete commented code

* delete commented signals code

* remove commented code for transceiver tab

* refactor adc tab

* refactor Pattern Tab

* Refactor transceivers tab (PR#5) (#118)

* refactored transceiver tab

* remove commented code for transceiver tab

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>

* refactor adc tab (PR#6) (#119)


* refactor adc tab

* refactored Plot and Acquisition Tabs

* fix the regression issue

* restructure project files

* applying singleton and renaming tabs to services

* working install using pip

* applies singleton to tab classes and remove CI erros

* added pyzmq and pillow

* remove the singleton implementation and keep changes

* fix merge errors in mainWindow

* moved misplaced init file

* rename service to tab

* reorganize imports

* iterate over tabs

* reorder tabs

* add slowadc to the list

* saving changes (buggy)
power supply ui not showing in the gui

* split power supply tab

* fixed tests

* add hardcoded values to defines file

* fix error

* separate power supply

* fix errors for powerSuppliesTab

* split dacs

* split slow adcs

* split signals tab

* added tests for bit_utils

* add slowAdc class to defines

* split transceiver ui file

* split adc.ui

* split pattern ui file

* split plot and acquisition ui file

* added basic test for parsing bit names

* removed redundant code in read_alias_file

* fix dacs ui position

* testing for correct exception

* cmd and args at split

* group radio buttons

* fix comments from PR#1

* show legend

* added python version and dev requirements to setup.py

* fix dac issue

* moved _decoder into pkg

* added inplace build

* removed clear

* fixed dependencies

* make tests run without slsdet

* updated name of action

* define colcount

* fixed loading of alias file

* add yapf and ruff

* apply formatting

* fix E and F rules

* add more ruff rules

* change variable name

* squashing gh debugging commits and add pre-commit

* update label values to mv units

* add hook for yapf

* reconfigure yapf precommit hook

* add format and check_format to makefile

* change gh actions

* update readme

* added check_format

* WIP

* added linting in github action

* updated readme]

* add more control for color choice

* remove useless file

* fix un-updated line after refactoring Defines
BIT0_31_MASK is not found in Defines.signals

* visually improve the interface

* fix last commit

* add only selected plots for legend

* add hide legend button

* change hide legend to show legend
checkbox show legend is checked by default

* add support for saving in numpy

* solve conversations

* fix acq index offset

* fix browse button in pattern error

* fix other browse button errors

* finish tests and add usage.md

* remove buffer

* add file,numpy-like interface and tests

* remove useless .npy files

* subscriptible npz files

* remove useless files

* remove repetetive tests

* save changes

* add mode r+, add with support,remove logging

* remove offset of acqIndex between raw and numpy saving

* fix only saving last frame

* save signals of multiple devices

* add comments and move condition for clearer code

* fix bug when vieweing pattern file

* iterate over enabled and plotted plots

* add padestal substraction to transceiver and analog data

* init pedestal frames to detector.frames

* restore old exception

* add pedestal substraction for digital signals

* remove frames spinbox from plotTab

* remove comments and use str instead of Path

* avoid saving all frames

* correct exception and log error's trace

* add gui tests

* add waveform test

* add pedestal test

* refactor by using fixtures

* add tests for moench analog and pattern

* add pytest-qt to dependencies

* add save and load gui parameters

* remove nohup file

* fix old bug IndexError

* save plot type

* a

* handle canceling load, loading matterhorn pedestal for moench

* remove comparing .png files for pattern test

* save plot type

* red error on status bar when shape mismatch for loaded pedestal

* fix makefile and docstrings

* fix PRs conversation

* move code into different function

* fix wrong function names for power supply

* removed old ctbgui

* removed unnecessary files

---------

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
Co-authored-by: Braham Bechir <braham_b@pc11979.psi.ch>
Co-authored-by: Bechir <bechir.braham@psi.ch>
Co-authored-by: Bechir <bechir.brahem420@gmail.com>
2024-09-10 16:00:04 +02:00
c6477e0ed6 fixed stop server not starting up with setup variables (#949)
* m3: fixed stop server not starting up with setup variables

* all servers except eiger fixed for virtual stop server to start up with setupDetector function called

* virtual tests work

* eiger: versions print neednt be in stop server

* jungfrau: stop server (not virtual) also needs to read config file

* ensuring master is setup for virtual and real servers
2024-09-10 15:24:51 +02:00
38d7fb0c38 fixed a warning about narrowing conversion from size_t to int (#963) 2024-09-10 15:23:15 +02:00
e848293916 Dev/zmq stream all ipv6 adn remove rx_zmqip (#958)
* enable ipv6 in zmq socket

* removed rx_zmqip API and field in gui, changed client updaterxrzip to updateclientzmqip to have the rx_hostname ip if 0. 

* updated command line for rx_zmqip to give a warning. 

* Replaced 'depreciated' to 'deprecated' everywhere

* switching from * to 0.0.0.0 works for rebinding zmq sockets

* fixed help in command line for rx_zmqip * to 0.0.0.0 and removed cmd in python

* remove publisher zmq socket ip also for moench post processing

* fixed tests

* publisher zmq ip macros to be reused
2024-09-10 15:19:08 +02:00
15e8c0d9f1 Moench mess from developer (#953)
* new moench data structure for offline processing
2024-09-05 15:32:20 +02:00
588d11dedf added keepalive zmq socket option (after 60s of idle time, 10 probes every sec. Mainly because an issue at Max IV (#956) 2024-09-03 17:37:00 +02:00
782c8abd9a rx: moved creating fpath (if it doesnt exist) from setting file path to at the start of acquisition when creating file. This is done here so that it does not fail if fwrite is disabled anyway. Also fixed it in documentation. Changed in documentation that the default for fwrite is disabled (#957) 2024-09-03 17:32:01 +02:00
1d4a5d6d29 dev: jungfrau HW 1.0: adc output clock phase to 120 (#952)
* jungfrau: change adc output clock phase from 180 to 120 for v1.0 boards for reliable readout of adc #2

* versioning

* formatting
2024-08-22 15:45:41 +02:00
9c57571a41 formatting 2024-08-20 16:28:09 +02:00
b4533ac11f Dev/xilinx ctb test (#942)
* voltage regulators only looks at dac and not at ctrl_reg

* xilinx: change dac max to 2048, setting dac ist not inverse conversion from dac to voltage anymore, but setting power is inverse, also there is max and min to power, a different min for vio and this is checked at funcs interface, not printign or converting to mv in dac for power regulators (as its conversion max and min are different)

* Use links for dacs/adc and adapt power rglt thresholds

* Remove wait for transceiver reset

* adc and dac device not used anymore and hence removed

* udp restucturing: arm has to be multiple of 16 and no byteswap in udp_gen, option to compile locally in arm architecture, memsize of the second udp memory has to be limited

---------

Co-authored-by: Martin Brückner <martin.brueckner@psi.ch>
2024-08-20 14:33:18 +02:00
991a4115d4 updated documentation from martin (#948) 2024-08-19 16:50:24 +02:00
ff107faae6 bug fixes related to file saving (#931) (#946)
* fix the file path resetting issue of GUI in the case where different modules have different fpath setting.

* fix stack-buffer-overflow issue when using HDF5 HDF5DataFile::parameterDataTypes have 64bit type (i.e. STD_U64LE), the size of fill_value should be at least 8 bytes.

* change the type of fill_value to uint64_t

Co-authored-by: Z.H. Li <zhenghenge@gmail.com>
2024-08-19 13:45:25 +02:00
d57643434d dev: client: status for blocking acquire stop with slave temporarily in waiting (#944)
* acq finish call back gets status squashed with default error but before that need to wait for gotthard slaves to catch up from waiting to stopped
2024-08-15 17:09:36 +02:00
de33aff077 developer: moench empty data callback (#936)
* moench (feature to wait for post processing to be done in new sls_detector_acquire_zmq executable)

READOUT_ACTION_ZMQ added to action enums
sls_detector_acquire_zmq added to executables
empty data call back so that client listens to last dummy zmq packet from moench post processor
processor: remove NEWZMQ ifdefs and remove connect for zmq publisher socket

* fix to compile

* cmds generated and parsed
2024-08-13 11:27:06 +02:00
c13049f144 G2: reconfigure chip (#927)
* changed common.c readADCFromFile to make it more general and move temperature calculation for Eiger out of this function and inside whereever it is called.
* g2 and m2: gethighvoltage was just a variable set in server, it is now moved to a get inside DAC5671 implementation (but not reading a measured value, instead what is set from a file), high voltage variable used inside DAC5671 for virtual servers
* g2: switching off hv (ifrom non zero to zero value) will wait for 10s; powering on chip reconfigures chip; powering off chip unconfigures chip; powering off chip also includes check if hv = 0, if not throw exception; chip configuration checked before acquring; at start up: hv switched off and chip powered on, so does not wait 10s to switch off hv;
* included test to check powering off chip when hv is on should throw an exception
* g2:  check if chip configured before acquiring

* nios: read hv value set from file and virtual still goes into DAC5671 for conversions to and fro dac to V, change common readadc to readparameter to generalize, make sethighvoltage into a get and set to catch errors in get as well, g2: if not at startup, remmeber hv value before setting it and after check if value was being switched off (from a non zero value) and wait 10s if it was (10s wait only for switching off from non zero and not at startup)
2024-08-02 12:46:39 +02:00
ce7f01bdc4 Dev: m3 clkdiv0 20 (#924)
* m3: clk 0 changed from 10 to 20 (100MHz to 50MHz)

* g2: startup clk div back to 10 as in firmware but setting in software startup to 20

* m3: minor print error if clk divider > max
2024-07-25 17:18:45 +02:00
bf523c0c5e fix to rapidjson for build with gcc 14 (#929) 2024-07-25 17:15:14 +02:00
1efd106c6a developer: blocking acquire stop with slave temporarily in waiting (#926)
* client: stopping a blocking acquire of multi modules checks status to catch slaves that might still be in waiting. Problem is (gotthard2 25um at least) slave is in waiting only temporarily before going go idle/stopped. So a 50ms sleep is necessary ot not throw an unnecessary error

* client: when stopping blocking acquire, wait up to 1s in 50ms increments for slave to stop waiting temporarily
2024-07-16 15:43:31 +02:00
08dc8e3cbb client bug fix: m3 multi module bad channel file throws bad allocation when modules skipped, needed to add vectors in 2d vector of bad channel list (#920)
Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2024-07-16 11:59:17 +02:00
96f7a1ecfb moench server: changed default values of adcphase for full speed from 300 to 150 and dac vipre_cds from 800 to 1280 (#922) 2024-07-15 12:31:53 +02:00
64d489f1e6 formatting 2024-02-07 13:25:11 +01:00
56abf82d92 updated binaries 2024-02-07 13:23:58 +01:00
3d21bb64c4 Dev/xilinx acq (#901)
* period and exptime(patternwaittime level 0)

* added new regsieterdefs and updated api version and fixedpattern reg

* autogenerate commands

* formatting

* minor

* wip resetflow, readout mode, transceiver mask, transceiver enable

* acquisition, but streaming done bit and busy (exposing + read chip to fifo) not known yet from fw

* programming fpga and device tree done

* most configuration done, need to connect configuretransceiver to client

* stuck at resetting transciever timed out

* minor

* fixed virtual, added chip busyto fifo, streaming busy, set/getnext framenumber

* configuretransceiver from client, added help in client

* make formatt and command generation

* tests for xilinx ctb works

* command generation

* dacs added and tested, power not done

* power added

* added temp_fpga

* binaries in

* ctrlreg is 0 to enable chip=fixed, high dac val = min val= fixed, power regulators in weird order=fixed, device tree could be loaded with dacs before adcs=fixed

* start works

* virtual server sends

* receiver works

* tests

* python function and enum generation, commands generatorn and autocomplete, formatting, tests

* tests fail at start(transceiver not aligned)

* tests passed

* all binaries compiled

* eiger binary in

* added --nomodule cehck for xilinx
2024-02-07 13:23:08 +01:00
f6b0ba9703 Protect from getenv("HOME") returning nullptr (#907) (#908)
* Protect from getenv("HOME") returning nullptr (e.g., in case running in systemd)

* Write proper warning in Module.cpp

Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2024-02-07 10:27:03 +01:00
d17bc5da62 moench: changed max shifts of adc clk from 240 to 200 (#900) 2024-01-30 09:58:53 +01:00
a884db0e2c m3 fix to get kernel version properly on nios without an incorrect error msg (#898) 2024-01-26 10:41:24 +01:00
5e9fd43d49 updated pmod 8.0.1 for rh7 and rh8 2024-01-16 17:05:07 +01:00
8bce89d5dc pmod for 7.0.3 and 8.0.0 from previous releases 2024-01-16 16:11:59 +01:00
aa40128965 Moench v8 (#892)
* new rct structure for moench03

* new moench data structure for offline processing

* meonch raw data and zmq process files updated to 7.0.3 version

* implemented config file for Zmq file

* raw data and zmq work with config file, but only with one file/interface

* zmq config change

* added config examples for zmq and rawdata
2024-01-12 14:01:06 +01:00
a03780718e Fixed path when building as submodule 2024-01-12 09:17:14 +01:00
bd1a125154 moench default speed set to after init readout configuration (half speed) (#886) 2024-01-11 18:07:34 +01:00
ffe7728966 formatting 2024-01-11 18:04:19 +01:00
b69e053bb4 updated commands generation 2024-01-11 18:03:34 +01:00
daec0dc389 minor 2024-01-11 18:02:30 +01:00
c8bb70f876 Dev/xilinx defaults and pattern (#888)
* implemented testbus, testfpga, set/get #frames, triggers, allowed that and for connection to client, also allowed, getnumchannels, configuremac, getrunstatus, setdetectorposition with dummy values

* connected kernelversion, hardwareversion, versions, framesl, triggersl, dr, timingmode, pattern (except patioctrl) thats there for altera ctb

* replaced set/get64Bit to set/getU64bit in all loadpattern.c for (ctb and m3 also)
2024-01-11 18:01:08 +01:00
9a08ecc5a5 Xilinx client tests (#887)
* implemented testbus, testfpga, set/get #frames, triggers, allowed that and for connection to client, also allowed, getnumchannels, configuremac, getrunstatus, setdetectorposition with dummy values

* allowing tests for xilinx

* binaries in
2024-01-10 16:23:52 +01:00
9738cb7d74 Xilinx ctb (#884)
* updated registers, arm64

* compiler set to aarch64 for xilinx server

* updated RegisterDefs.h

* merge into generate branch and resolving conflicts and adding the xilinx changes to callerspecial and commands.yaml

* compiles and can print firmware version (using a different csp0 address)

* fixing other servers (gotthard, jungfrau, moench, mythen3) that it returns in case of mapping failure, xilinxctb: added that it checks type, prints proper fw version, checks kernel date, added armprocessor define to use in common places, added specifiers to supress overflow and truncation warnings

* added detector ip and mac adddress to the printout

* fixed tests and recompiled servers
2024-01-04 17:10:16 +01:00
4f4125a3b2 Generate commands/fix detp detg command rename (#882)
* replacing detp with sls_Detector_put and detg with sls_detector_get

* sls_detector_not implemented, but extended message to ask user to use sls_detector_get or sls_detector_put

* autocompletion also for sls_detector or det
2023-12-13 17:01:10 +01:00
51412f40cf Generate commands/fix det command rename (#881)
* made a link to bash autocompletion script in main folder, and replaced all references to 'det' command with 'sls_detector'
2023-12-13 15:38:10 +01:00
ce7270e8a2 commands code generation (#871)
* commands code generation  (#803)

* commands code generation for only frames command

* fix cmake file and add Caller files

* working exptime, fully extended commands file and its variants

* start adding template commands

* add INT_CMD_VEC_ID template

* add list command, generate multiple bins, format code

* reach 208 commands using the cpp macros

* add tests for command parser

* start adding tests for commands parser

* fix typo to use commands.yaml

* add more tests for command_parser

* add all template functions (up to 218 commands)

* finish template functions and add more CmdProxy.cpp functions (250+)

* 257 commands

* 300 commands the rest are very special commands

* add special commands without generation

* separate special functions from generated c++ file

* implementing one command for put and get (buggy)

* add infer action in a separate file

* generate header for special commands from yaml

* allow only 0 or 1 for bool inputs

* group all commands in gen_commands.py

* add help to gen_commands.py

* add autocomplete bash script

* autocompletion: add support for module levels and help

* remove debugging line

* add autocompletion, help to commands, change int [0,1] to bool

* copy tests for Caller.cpp. Tests pass

* update with the new developer branch changes

* fix errors after merging (there is problems with tests)

* fixed port/stopport in yaml (intput typo), added '_caller' to the test dac and test on chip dac command in global test for cmdcaller

* undo previous test simulator debug change

* add documentation for the generated code

* reducing the comment to be replaced in length so formatting does not split into 2 lines

* removed formatting specific style of C++11 in gen_commands.py to keep with the top level clang format of the project
* regeneratign code for commands

* automation generated

* Redirect deprecated commands (#872)

* working implementation, need to fix dac

* fixed deprecation redirect for dac command

* Detector specific autocomplete (#873)

* working implementation, need to fix dac

* fixed deprecation redirect for dac command

* detector specific completion for dac

* added autocomplete using detector specific

* fixed error when autocompleting partial words

* Generate commands/fix commands (#875)

* fix vm_a, im_a etc have deg Celsius suffix, also help missing or changed in some places

* dac: require det id for all, arg0 to be printed at output, help for onchip dac and dac, onchipdac: spacing

* getscan detid and blocking trigger help

* udp_Dstlist det_id fixed, but rx_id invalid

* cmdApp in line with cmdLineApp (missing version, receiver_id, not creating det object in help action

* added set_command to differentiate between check_det_id and require_det_id (mixed up), args: -1 needs to check for at least one argument

* reordering

* reordering and checked till integer_command_hex

* fixed a lot more commands

* fix caller tests for eiger

* changes to tests after Bechir left

* changing .cmd to .cmdcall for the caller commands

* fixed tests for caller, still warning for setexptime about cast input

* autocomplete ran

* add moench test

* regenerating autocomplete and commands

* fixing other things from merge conflicts (renaming slsDetectorDefs to defs in commands.yaml)

* formatting

* added code injection to help (#876)

* updated 3 commands to have get output that can be put into put (#877)

* updated some commands to have get output that can be put into put

* fix tests for clkdiv

* adding help to free (#878)

* removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy) (#879)

* More helpful error messages for unsupported actions (#880)

* removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy)

* Added specific help for unsupported actions

* fixed a vetofile get special exception message. more specific warning for special exception message instead of no function warning

* added condition checking true in exceptions for special message

---------
Co-authored-by: Bechir Brahem <bachbrahem@gmail.com>
Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
2023-12-13 14:43:38 +01:00
d72c9e29a4 dev: moench: min exptime (#865)
* moench: remove min clock cycles for setting exptime (had been ported from jf)
2023-11-27 15:22:16 +01:00
62dc0e1a34 removed zmq as dependency for slsdet (#870) 2023-11-24 09:09:29 +01:00
d7aa3305d1 forward declare zmq_msg_t and moved include (#869)
* forward declare zmq_msg_t and moved include

* removed zmq from pkg list
2023-11-20 11:43:30 +01:00
96ed74c47c formatting 2023-11-12 15:35:05 +01:00
4198db8365 documentation and examples 2023-11-12 15:34:58 +01:00
e2d7af28dc added python 3.12 to the conda build variants 2023-11-10 17:34:39 +01:00
66d57c1852 fixed doc 2023-11-10 17:34:32 +01:00
aa4bf6e7f9 updating docs 2023-11-10 17:34:28 +01:00
7f0868f344 minor fix for test_simulator 2023-11-10 11:39:03 +01:00
e57cf49c49 Dev: trigger signal issues handled at acquire (#864)
* if blocking and handling sync, only master gets blocking acq, slaves get non blocking as they are first and so dont get status or error caught when slaves dont get trigger (due to not connected etc) and acq returns with slaves still in waiting status. so check status of all in blocking acq

* for all dets with sync, ensure atleast one master when starting acq

* docs updated about sync
2023-11-10 11:38:06 +01:00
66baaf1ebd dev: fix server logic in checking detector idle (#861)
* fix buggy logic in checking detector idle and an argument check
2023-11-09 15:07:34 +01:00
7d7ac26c30 execute command inside server fixed (from fix simulator tests and exec command PR) (#857) 2023-11-08 09:26:11 +01:00
1a7c74fe4e tests for jf (#835) 2023-11-07 15:01:22 +01:00
01e4bcb47e formatting 2023-11-07 14:52:14 +01:00
397e846509 Dev: fix py virtual test (#846)
* draft to fix virtual test when it fails

* catching errors in tests and removing sigchild ignore so servers (process in background) executing commands will not fail (pclose no child processes, if sigchld is ignored) fixed

* uncommented python loading config

* somehow killal slsReciever in second detector test fails even though no receiver running

* fixing script for virtual simlator test:fixed issue with check if process running, fixed moench tests
2023-11-07 09:30:46 +01:00
314a8a0daa handling inconsistent fnums to be -1 in gui, so when one sets 0 (change of value) will also give an exception (#854) 2023-11-06 16:11:52 +01:00
ebb352b13a Dev: : gui acq finished callback for different status (#850)
* fix acquisition finished status to have different status for different modules, but does not have to be error. for eg. jf sync fw (2.4.1 gives idle for master and stopped for slaves when stopping acquiistion)
2023-11-06 16:08:07 +01:00
9b5d44f0b3 fix warning for prev_val (variable size array) in tests (#838) 2023-10-23 15:56:22 +02:00
1892963fcb eiger required fw version to 32: fix for blocking trigger in quad (#834) 2023-10-18 17:04:39 +02:00
62f45b15d2 dev jf: reconfigure chip when touching electron collection mode bit (#831)
* jf: if bit 14 in reg 0x5d (electron mode collection bit) is changed, configure chip if v1.1 and powered on. so touch writeregister (setbit/clearbit also calls write register in the end). replace when electroncollectionmode command introduced
2023-10-18 10:52:22 +02:00
82ac45873c dev jf: change status reg bits (#829)
* jf: rewrite of status reg bits, waiting state includes both wati for trigger and start frame, blocking trigger only waits if its not in waiting for trigger and run busy enabled, error state connected in firmware
2023-10-18 10:47:52 +02:00
2b2e50916c dev: jf sync: stopping master gives idle (#824)
* jf sync mode master could return idle when stopped and so not all modules return the same value and must check for 'stopped or idle', Also must throw if any of the module gives an error

* added contains_only to sls::Result (#827)

* added variadic template for checking if a result contains only specified values

* fix for gcc4.8

* renamed to Result::contains_only

* updated condition in Detector.cpp

* stop on only the positions

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2023-10-13 15:25:41 +02:00
d34f396ef8 Dev/jf/fix pedestal (#821)
* jf pedestal fix: touch enable bit last
2023-10-05 10:29:33 +02:00
f9c4405da6 dev: update 2d gain plot color map (if no x and ymin/max changes or window resizing): setFixedWidth was updating for window resize, updated virtual servers for g2 and jungfrau to keep changing gain and data for every frame. the data value (#819) 2023-10-03 17:22:32 +02:00
82 changed files with 1346 additions and 634 deletions

View File

@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libhdf5-dev qtbase5-dev qt5-qmake libqt5svg5-dev
packages: libhdf5-dev qtbase5-dev qt5-qmake libqt5svg5-dev libpng-dev libtiff-dev
version: 1.0
- name: Configure CMake

View File

@ -1 +0,0 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file

View File

@ -249,8 +249,8 @@ endif()
if(SLS_USE_SANITIZER)
target_compile_options(slsProjectOptions INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer)
target_link_libraries(slsProjectOptions INTERFACE -fsanitize=address,undefined)
# target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread)
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
#target_compile_options(slsProjectOptions INTERFACE -fsanitize=thread -fno-omit-frame-pointer)
#target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
endif()

View File

@ -1,284 +1,139 @@
SLS Detector Package Major Release 9.0.0 released on 26.11.2024
SLS Detector Package Minor Release 9.1.0 released on 15.03.2025
===============================================================
This document describes the differences between v9.0.0 and v8.0.2
This document describes the differences between v9.1.0 and v9.0.0
CONTENTS
--------
1 Compilation Changes
2 New or Changed Features
2.1 Breaking API
2.2 Resolved or Changed Features
2.3 New Features
3 On-board Detector Server Compatibility
4 Firmware Requirements
5 Kernel Requirements
6 Download, Documentation & Support
1 Changes
1.1 New or Changed Features
1.2 Resolved Features
2 On-board Detector Server Compatibility
3 Firmware Requirements
4 Kernel Requirements
5 Download, Documentation & Support
2 Compilation Changes
=====================
* Python version
Minimum python version is changed from 3.6 to 3.8
* Pybind11 version
In-built version and the one picked up from github
updated from v2.11.0 to v2.13.6
* Python lib versioning
slsdet.__version__ now returns the package release version.
* Python version in conda build
Added python 3.13 also to conda build
1 Changes
==========
2 New, Changed or Resolved Features
=====================================
2.1 Breaking API
==================
1.1 New or Changed Features
============================
Receiver
--------
* Receiver callbacks
Brought much more metadata to receiver callbacks to construct the image.
Update MultiReceiverApp to reflect this change.
* Frame Synchronizer (experimental)
Added a new binary, similar to slsMultiReceiver, to collect images from
several receivers and stream them out as a ZMQ multipart message
(one part for each UDP port). No reconstuction of the image. Includeds start
and end ZMQ messages as well for the start and end callback parameters.
* File path
At start of acquisition or at rx_start command, the file path is only
then verified if it exists and created if it does not.
Documentation
-------------
Client
------
* Command line - multi module and multi detector indices
Help on this topic has been added to the 'Command line' topic.
* Removed receiver/publisher ZMQ IP
Command line: rx_zmqip gives a warning and does nothing
Python : rx_zmqip removed
C++ API: get/setRxZmqIP removed
Publisher zmq IP set to '0.0.0.0' or to listen on all interfaces.
The publisher will determine which interface to stream out from based on
the network route to the subscriber IP. Hence, receiver zmq IP is not
required.
* Write register, Set or Clear bit
Validation for this advanced feature has been removed by default.
One can force validation by using --validate in the command line or by
setting the validate option in the API.
ZMQ
---
* Publisher socket constructor does not take an IP anymore.
The details are above under 'Removed receiver/publisher ZMQ IP'.
GUI/ Client Callback
--------------------
* completeImage member in detectorData attribute now returns false only
if any the sub images (from different udp ports) have completeImage
set to false in the JSON header. This is set if therea are any missing
packets for that udp port on slsReceiver/slsMultiReceiver.
The different subimages are anyway not synchronized. This errs when
there are different missing images across multiple UDP ports.
The Gui does not show "complete image" in the status bar anymore.
If any of the udp ports have missing packets for that current disaplayed
image, then the "missing packets" will show in red in the status bar.
Detector Server
---------------
* [Mythen3] Only run clock can be set
Clock 0 is now the run clock and the only one that can be set.
The others are be read only.
This affects the following commands:
Command line or python API: clkdiv, clkfreq, clkphase, maxclkphaseshift
C++ API: get/setClockDivider, getClockFrequency, get/setClockPhase,
getMaxClockPhaseShift
* [Jungfrau] Temperature Control
Temperature control is enabled by default at on-board detector server
startup.
As before, the default temperature threshold is 65°C and crossing this
value will set a temperature event.
* Row and column index (UDP header or callback)
Help on how this is determined from the hostname is added to the 'UDP
Header' and the 'Quick Start Guide' topics. Also added to the help in '
hostname' command line help. Please note that this can be overwritten by
corresponding row and column commands.
2.2 Resolved or Changed Features
================================
1.2 Resolved Features
======================
Compilation
-----------
* cmake_source_dir
Fixed compilation error when using python and adding the slsDetectorPackage
as a subfolder due to cmake source directory changing.
Client
------
* Command line Code Generation
The command line parsing code is now generated from a yaml file. This is
transparent to the user.
* Clearer error message about freeing shared memory.
Detector Server
---------------
* [Gotthard2] Chip reconfiguration
- Powering off/on the chip will now switch off chip configuration
property/ configure the chip every time.
- Switching off high voltage from a non zero value will now wait
10s to return for safety reasons.
- Powering off the chip requires high voltage to have been
switched off prior.
- Acquisition requires chip to have been configured prior.
* [Gotthard2] Burst mode options restricted
Burst mode external and continuous mode internal are not allowed to be set
anymore as they are anyway not implemented.
Receiver
--------
* [Gotthard I] fixed header stripping fixing segfault.
* Error or help message for invalid arguments to slsMultiReceiver.
Simulator
Firmware
---------
* Refactored stop server to have better start up.
* [Jungfrau] Column select and filter resistor
Configuration fix for chip v1.1 for these parameters
* Fixed possible memory leak when taking non blocking acquisitions.
Firmware &/ On-board Detector Server
------------------------------------
* [Jungfrau] Valid gain values in data sent out. Previously, 2 was also sent out.
* [Jungfrau] Timing Info Decoder
Only allowed for hardware v2.0 now.
* [Jungfrau] Auto Comparator Disable - chip v1.0
Previously, this mode for chip v1.0 automatically disabled the on-chip
gain switching compatator after a fixed portion of the exposure time.
Now, one must set also the comparator disable time using 'compdisabletime'
just as in chip v1.1.
* [Mythen3] Default period on server start up is 0 now.
Client
-------
* Command line - Multi detector index inside file
Multi detector index '[index]-' was ignored silently in the config/parameter
file since 5.0.0. Now, it will throw an exception. Please use the multi
detector index on the 'config' or 'parameter' command instead.
* [Mythen3] patternX command autocompletes the argument to a path now.
Receiver
--------
* Multiple Receiver objects in multiple threads
slsMultiReceiver uses child processes, but if user rewrote to use multiple
receiver objects in multiple threads instead, a callback mutex is now
implemented to handle the locking mechanism between threads for the callbacks.
* Removed potentially unsafe str().c_str() calls.
ZMQ
---
* Publiser socket constructor
- enables keep alive socket options to send heartbeat messages to prevent
discarded TCP flows if there is no packet for a longer period.
- enables IPv6 interfaces
* Prints specific error for ENOENT (endpoint does not exist)
* [Moench] Reduced significant print out in zmq processing using energy
threshold.
2.3 New Features
================
* [Moench] Zmq dummy packet restreaming command did nothing
Temporary solution was to move from 'stop' to 'rx_stop' as 'stop' did not
go further if module is idle.
Client
------
* [Moench] Too many Zmq dummy packets- unclear end in acquire
Give time to process dummy packet before restreaming it and wait more
before restreaming to reduce amoutn of zmq dummy packets to process.
* Auto completion
bash_autocomplete.sh or zsh_autocomplete.sh must be sourced from the
main package folder to enable auto completion of commands and arguments
for the command line on that shell.
Simulators
-----------
* sls_detector
New executable that can be used instead of 'sls_detector_get' and
'sls_detector_put' for most commands. It will infer from the number of
arguments, which executable (sls_detector_put or sls_detector_get) to use.
For the rare commands that cannot be inferred from the number of arguments,
it will complain accordingly.
* [Jungfrau] Timing Info Decoder (Advanced configuration)
Command line or python API: timing_info_decoder
C++ API: get/setTimingInfoDecoder. Options: SWISSFEL (Default), SHINE
* [Jungfrau] Collection Mode (Advanced configuration)
Command line or python API: collectionmode
C++ API: get/setCollectionMode. Options: ELECTRON, HOLE (Default)
If chip v1.1, also configures the chip afterwards.
* [Gotthard2] Next frame number
'Stop' in G2 25um is not synchronous and hence might trigger an extra set
of frames in the slave module, resulting in the next acquiistion starting
with inconsistent frame numbers between master and slave. Solved by
setting next frame number to the larger value (max + 1) after a stop command.
Requires a firmware update.
Command line or python API: nextframenumber
C++ API: get/setNextFrameNumber
Can set/get the starting frame number for the next acquistion.
* [Mythen3] Readout speed
Command line, python API: readoutspeed. Options: full_speed (10MHz),
half_speed (20MHz, default), quarter_speed (40MHz)
C++ API: get/setReadoutSpeed
Also affect:
Command line, python API: readoutspeedlist
C++ API: getReadoutSpeedList
* Sleep
Command line, python/ C++ API: sleep
Client sleeps for required time. Advanced command mainly for firmware
developers to use in config files.
* Xilinx Chip Test Board added
* [Jungfrau][Moench] Slightly faster transmistting time by removing sleeping
only if there is a transmission delay
@ -287,8 +142,8 @@ This document describes the differences between v9.0.0 and v8.0.2
Eiger 9.0.0
Jungfrau 9.0.0
Mythen3 9.0.0
Jungfrau 9.1.0
Mythen3 9.1.0
Gotthard2 9.0.0
Gotthard 9.0.0
Moench 9.0.0
@ -317,8 +172,8 @@ This document describes the differences between v9.0.0 and v8.0.2
Eiger 02.10.2023 (v32) (updated in 7.0.3)
Jungfrau 20.09.2023 (v1.5, HW v1.0) (updated in 8.0.0)
21.09.2023 (v2.5, HW v2.0) (updated in 8.0.0)
Jungfrau 09.02.2025 (v1.6, HW v1.0) (updated in 9.1.0)
08.02.2025 (v2.6, HW v2.0) (updated in 9.1.0)
Mythen3 13.11.2024 (v2.0) (updated in 9.0.0)
@ -360,6 +215,7 @@ This document describes the differences between v9.0.0 and v8.0.2
4 Kernel Requirements
======================
Blackfin
--------
Latest version: Fri Oct 29 00:00:00 2021
@ -367,10 +223,12 @@ This document describes the differences between v9.0.0 and v8.0.2
Older ones will work, but might have issues with programming firmware via
the package.
Nios
-----
Compatible version: Mon May 10 18:00:21 CEST 2021
Kernel Upgrade
---------------
Eiger via bit files

View File

@ -1 +1 @@
9.0.0
9.1.0

View File

@ -6,3 +6,9 @@ python:
- 3.12
- 3.13
c_stdlib:
- sysroot # [linux]
c_stdlib_version: # [linux]
- 2.17 # [linux]

View File

@ -11,6 +11,7 @@ cp build/install/lib/* $PREFIX/lib/
#Binaries
cp build/install/bin/sls_detector_acquire $PREFIX/bin/.
cp build/install/bin/sls_detector_acquire_zmq $PREFIX/bin/.
cp build/install/bin/sls_detector_get $PREFIX/bin/.
cp build/install/bin/sls_detector_put $PREFIX/bin/.
cp build/install/bin/sls_detector_help $PREFIX/bin/.

View File

@ -15,36 +15,19 @@ build:
requirements:
build:
- {{ compiler('c') }}
- {{stdlib('c')}}
- {{compiler('cxx')}}
- cmake
- ninja
- qt 5.*
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
- {{ cdt('mesa-libgl-devel') }} # [linux]
- {{ cdt('mesa-libegl-devel') }} # [linux]
- {{ cdt('mesa-dri-drivers') }} # [linux]
- {{ cdt('libselinux') }} # [linux]
- {{ cdt('libxdamage') }} # [linux]
- {{ cdt('libxxf86vm') }} # [linux]
- expat
host:
- libstdcxx-ng
- libgcc-ng
- xorg-libx11
- xorg-libice
- xorg-libxext
- xorg-libsm
- xorg-libxau
- xorg-libxrender
- xorg-libxfixes
- expat
- libgl-devel
- libtiff
- zlib
run:
- libstdcxx-ng
- libgcc-ng
@ -123,3 +106,4 @@ outputs:
run:
- {{ pin_subpackage('slsdetlib', exact=True) }}
- expat

View File

@ -63,4 +63,4 @@ html_static_path = ['static']
def setup(app):
app.add_stylesheet('css/extra.css') # may also be an URL
app.add_css_file('css/extra.css') # may also be an URL

View File

@ -4,11 +4,54 @@ Command line interface
Usage
-------------
Commands can be used either with sls_detector_get or sls_detector_put
The syntax is *'[detector index]-[module index]:[command]'*, where the indices are by default '0', when not specified.
Module index
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Modules are indexed based on their order in the hostname command. They are used to configure a specific module within a detector and are followed by a ':' in syntax.
.. code-block::
# Applies to all modules of detector 0
sls_detector_put exptime 5s
# Applies to only the 4th module
sls_detector_put 3:exptime 5s
Detector index
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This index is useful when configuring multiple detectors from a single host. Each detector uses a unique shared memory identified by a detector index, derived again from the hostname command. It is followed by a '-'.
.. code-block::
# For detector with index 2 in shared memory
sls_detector_put 2-hostname bchip133+bchip123+bchip456
# Without '-', the detector index defaults to 0
sls_detector_put hostname bchip133+bchip123+bchip456
# Accessing all modules with detector index 2
sls_detector_put 2-exptime
# Starting acquisition only for detector with index 2
sls_detector_put 2-start
# Applies only to the 2nd detector, 4th module
sls_detector_put 1-3:exptime 5s
Command Execution
^^^^^^^^^^^^^^^^^^^^^^^
Commands can be executed using:
* **sls_detector_put**: setting values
* **sls_detector_get**: getting values
* **sls_detector**: automatically infers based on the number of arguments.
* **sls_detector_help**: gets help on the specific command
* **sls_detector_acquire**: initiates acquisition with the detector. This command blocks until the entire acquisition process is completed.
.. code-block::
sls_detector_get exptime
Help
--------
@ -28,12 +71,15 @@ Help
# list of deprecated commands
list deprecated
# autocompletion
# bash_autocomplete.sh or zsh_autocomplete.sh must be sourced from the
# main package folder to enable auto completion of commands and arguments
# for the command line on that shell.
source bash_autocomplete.sh
Autocompletion
---------------
bash_autocomplete.sh or zsh_autocomplete.sh must be sourced from the main package folder to enable auto completion of commands and arguments for the command line on that shell.
.. code-block::
source bash_autocomplete.sh
Commands

View File

@ -13,7 +13,6 @@ containing results from all modules. (:ref:`Result class<Result Class>`)
Here are some :ref:`examples <Cplusplus Api Examples>` on how to use the API.
.. _Cplusplus Api Examples:
.. doxygenclass:: sls::Detector
:members:
:undoc-members:

View File

@ -39,7 +39,7 @@ Welcome to slsDetectorPackage's documentation!
.. toctree::
:caption: Command line
:maxdepth: 2
:maxdepth: 1
commandline
quick_start_guide

View File

@ -23,11 +23,15 @@ Conda is not only useful to manage python environments but can also
be used as a user space package manager. Dates in the tag (for eg. 2020.07.23.dev0)
are from the developer branch. Please use released tags for stability.
We have three different packages available:
* **slsdetlib** shared libraries and command line utilities
* **slsdetgui** GUI
* **slsdet** Python bindings
We have four different packages available:
============== =============================================
Package Description
============== =============================================
slsdetlib shared libraries and command line utilities
slsdetgui GUI
slsdet Python bindings
moenchzmq moench
============== =============================================
.. code-block:: bash
@ -43,7 +47,7 @@ We have three different packages available:
#ready to use
sls_detector_get exptime
etc ...
...
.. code-block:: bash
@ -55,6 +59,8 @@ We have three different packages available:
conda search slsdet
# gui
conda search slsdetgui
# moench
conda search moenchzmq

View File

@ -1,5 +1,6 @@
.. _master file attributes:
Master File Attributes
=======================

View File

@ -128,6 +128,10 @@ For Multiple Modules
# set file path
fpath /tmp
.. note ::
The **hostname** and **detsize** command in a multi module system can affect the row and column values in the udp/zmq header. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on.
Gui
----

View File

@ -39,13 +39,13 @@ Arguments
.. _Automatic start servers:
Automatic start
------------------
One can start the on-board detector server automatically upon powering on the board.
#. Create a soft link to the binary on board
:
#. Create a soft link to the binary on board:
.. code-block:: bash
ln -sf someDetectorServervx.x.x someDetectorServer
@ -87,8 +87,7 @@ One can start the on-board detector server automatically upon powering on the bo
/root/xxxDetectorServer >> /dev/null &
#. Sync, reboot and verify
:
#. Sync, reboot and verify:
.. code-block:: bash
sync

View File

@ -73,9 +73,9 @@ Description
* **modId**: module ID picked up from det_id_[detector type].txt on the detector cpu.
* **row**: row position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command.
* **row**: row position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on.
* **column**: column position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command.
* **column**: column position of the module in the detector system. It is calculated by the order of the module in hostname command, as well as the detsize command. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on.
* **detType**: detector type from enum of detectorType in the package.

View File

@ -11,4 +11,6 @@ slsDetectorPackage/8.0.1_rh7 stable cmake/3.15.5 Qt/5.12.10
slsDetectorPackage/8.0.1_rh8 stable cmake/3.15.5 Qt/5.12.10
slsDetectorPackage/8.0.2_rh7 stable cmake/3.15.5 Qt/5.12.10
slsDetectorPackage/8.0.2_rh8 stable cmake/3.15.5 Qt/5.12.10
slsDetectorPackage/9.0.0_rh8 stable cmake/3.15.5 Qt/5.12.10

View File

@ -14,6 +14,8 @@ from pyctbgui.utils.defines import Defines
import pyctbgui.utils.pixelmap as pm
from pyctbgui.utils.recordOrApplyPedestal import recordOrApplyPedestal
from slsdet import detectorType
if typing.TYPE_CHECKING:
from pyctbgui.services import AcquisitionTab, PlotTab
@ -30,6 +32,7 @@ class AdcTab(QtWidgets.QWidget):
self.acquisitionTab: AcquisitionTab | None = None
self.legend: LegendItem | None = None
self.logger = logging.getLogger('AdcTab')
self.tengiga = True
def setup_ui(self):
self.plotTab = self.mainWindow.plotTab
@ -42,6 +45,12 @@ class AdcTab(QtWidgets.QWidget):
self.legend.clear()
# subscribe to toggle legend
self.plotTab.subscribeToggleLegend(self.updateLegend)
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
self.view.checkBoxADC0_15Inv.setDisabled(True)
self.view.checkBoxADC16_31Inv.setDisabled(True)
self.view.lineEditADCInversion.setDisabled(True)
self.view.labelADCInversion.setDisabled(True)
def initializeAllAnalogPlots(self):
self.mainWindow.plotAnalogWaveform = pg.plot()
@ -67,7 +76,8 @@ class AdcTab(QtWidgets.QWidget):
def connect_ui(self):
for i in range(Defines.adc.count):
getattr(self.view, f"checkBoxADC{i}Inv").stateChanged.connect(partial(self.setADCInv, i))
if self.det.type == detectorType.CHIPTESTBOARD:
getattr(self.view, f"checkBoxADC{i}Inv").stateChanged.connect(partial(self.setADCInv, i))
getattr(self.view, f"checkBoxADC{i}En").stateChanged.connect(partial(self.setADCEnable, i))
getattr(self.view, f"checkBoxADC{i}Plot").stateChanged.connect(partial(self.setADCEnablePlot, i))
getattr(self.view, f"pushButtonADC{i}").clicked.connect(partial(self.selectADCColor, i))
@ -77,15 +87,17 @@ class AdcTab(QtWidgets.QWidget):
self.view.checkBoxADC0_15Plot.stateChanged.connect(partial(self.setADCEnablePlotRange, 0, Defines.adc.half))
self.view.checkBoxADC16_31Plot.stateChanged.connect(
partial(self.setADCEnablePlotRange, Defines.adc.half, Defines.adc.count))
self.view.checkBoxADC0_15Inv.stateChanged.connect(partial(self.setADCInvRange, 0, Defines.adc.half))
self.view.checkBoxADC16_31Inv.stateChanged.connect(
partial(self.setADCInvRange, Defines.adc.half, Defines.adc.count))
self.view.lineEditADCInversion.editingFinished.connect(self.setADCInvReg)
self.view.lineEditADCEnable.editingFinished.connect(self.setADCEnableReg)
if self.det.type == detectorType.CHIPTESTBOARD:
self.view.checkBoxADC0_15Inv.stateChanged.connect(partial(self.setADCInvRange, 0, Defines.adc.half))
self.view.checkBoxADC16_31Inv.stateChanged.connect(
partial(self.setADCInvRange, Defines.adc.half, Defines.adc.count))
self.view.lineEditADCInversion.editingFinished.connect(self.setADCInvReg)
def refresh(self):
self.updateADCNames()
self.updateADCInv()
if self.det.type == detectorType.CHIPTESTBOARD:
self.updateADCInv()
self.updateADCEnable()
# ADCs Tab functions
@ -196,9 +208,11 @@ class AdcTab(QtWidgets.QWidget):
return decoder.decode(analog_array, pm.moench04_analog())
def getADCEnableReg(self):
retval = self.det.adcenable
if self.det.tengiga:
retval = self.det.adcenable10g
if self.det.type == detectorType.CHIPTESTBOARD:
self.tengiga = self.det.tengiga
retval = self.det.adcenable10g
if not self.tengiga:
retval = self.det.adcenable
self.view.lineEditADCEnable.editingFinished.disconnect()
self.view.lineEditADCEnable.setText("0x{:08x}".format(retval))
self.view.lineEditADCEnable.editingFinished.connect(self.setADCEnableReg)
@ -207,8 +221,8 @@ class AdcTab(QtWidgets.QWidget):
def setADCEnableReg(self):
self.view.lineEditADCEnable.editingFinished.disconnect()
try:
mask = int(self.mainWindow.lineEditADCEnable.text(), 16)
if self.det.tengiga:
mask = int(self.view.lineEditADCEnable.text(), 16)
if self.tengiga:
self.det.adcenable10g = mask
else:
self.det.adcenable = mask
@ -239,7 +253,7 @@ class AdcTab(QtWidgets.QWidget):
def setADCEnable(self, i):
checkBox = getattr(self.view, f"checkBoxADC{i}En")
try:
if self.det.tengiga:
if self.tengiga:
enableMask = manipulate_bit(checkBox.isChecked(), self.det.adcenable10g, i)
self.det.adcenable10g = enableMask
else:
@ -265,7 +279,7 @@ class AdcTab(QtWidgets.QWidget):
for i in range(start_nr, end_nr):
mask = manipulate_bit(checkBox.isChecked(), mask, i)
try:
if self.det.tengiga:
if self.tengiga:
self.det.adcenable10g = mask
else:
self.det.adcenable = mask
@ -344,7 +358,7 @@ class AdcTab(QtWidgets.QWidget):
def setADCInvReg(self):
self.view.lineEditADCInversion.editingFinished.disconnect()
try:
self.det.adcinvert = int(self.mainWindow.lineEditADCInversion.text(), 16)
self.det.adcinvert = int(self.view.lineEditADCInversion.text(), 16)
except Exception as e:
QtWidgets.QMessageBox.warning(self.mainWindow, "ADC Inversion Fail", str(e), QtWidgets.QMessageBox.Ok)
pass
@ -395,7 +409,12 @@ class AdcTab(QtWidgets.QWidget):
self.updateADCInv()
def saveParameters(self) -> list[str]:
return [
f"adcenable {self.view.lineEditADCEnable.text()}",
f"adcinvert {self.view.lineEditADCInversion.text()}",
]
if self.det.type == detectorType.CHIPTESTBOARD:
return [
f"adcenable {self.view.lineEditADCEnable.text()}",
f"adcinvert {self.view.lineEditADCInversion.text()}",
]
else:
return [
f"adcenable {self.view.lineEditADCEnable.text()}"
]

View File

@ -7,7 +7,7 @@ import zmq
from PyQt5 import QtWidgets, uic
import logging
from slsdet import readoutMode, runStatus
from slsdet import readoutMode, runStatus, detectorType
from pyctbgui.utils.defines import Defines
from pyctbgui.utils.numpyWriter.npy_writer import NumpyFileManager
from pyctbgui.utils.numpyWriter.npz_writer import NpzFileWriter
@ -49,20 +49,37 @@ class AcquisitionTab(QtWidgets.QWidget):
self.adcTab = self.mainWindow.adcTab
self.plotTab = self.mainWindow.plotTab
self.toggleStartButton(False)
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
self.view.labelRunF.setDisabled(True)
self.view.labelADCF.setDisabled(True)
self.view.labelADCPhase.setDisabled(True)
self.view.labelADCPipeline.setDisabled(True)
self.view.labelDBITF.setDisabled(True)
self.view.labelDBITPhase.setDisabled(True)
self.view.labelDBITPipeline.setDisabled(True)
self.view.spinBoxRunF.setDisabled(True)
self.view.spinBoxADCF.setDisabled(True)
self.view.spinBoxADCPhase.setDisabled(True)
self.view.spinBoxADCPipeline.setDisabled(True)
self.view.spinBoxDBITF.setDisabled(True)
self.view.spinBoxDBITPhase.setDisabled(True)
self.view.spinBoxDBITPipeline.setDisabled(True)
def connect_ui(self):
# For Acquistions Tab
self.view.comboBoxROMode.currentIndexChanged.connect(self.setReadOut)
self.view.spinBoxRunF.editingFinished.connect(self.setRunFrequency)
self.view.spinBoxTransceiver.editingFinished.connect(self.setTransceiver)
self.view.spinBoxAnalog.editingFinished.connect(self.setAnalog)
self.view.spinBoxDigital.editingFinished.connect(self.setDigital)
self.view.spinBoxADCF.editingFinished.connect(self.setADCFrequency)
self.view.spinBoxADCPhase.editingFinished.connect(self.setADCPhase)
self.view.spinBoxADCPipeline.editingFinished.connect(self.setADCPipeline)
self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
self.view.spinBoxDBITPhase.editingFinished.connect(self.setDBITPhase)
self.view.spinBoxDBITPipeline.editingFinished.connect(self.setDBITPipeline)
if self.det.type == detectorType.CHIPTESTBOARD:
self.view.spinBoxRunF.editingFinished.connect(self.setRunFrequency)
self.view.spinBoxADCF.editingFinished.connect(self.setADCFrequency)
self.view.spinBoxADCPhase.editingFinished.connect(self.setADCPhase)
self.view.spinBoxADCPipeline.editingFinished.connect(self.setADCPipeline)
self.view.spinBoxDBITF.editingFinished.connect(self.setDBITFrequency)
self.view.spinBoxDBITPhase.editingFinished.connect(self.setDBITPhase)
self.view.spinBoxDBITPipeline.editingFinished.connect(self.setDBITPipeline)
self.view.checkBoxFileWriteRaw.stateChanged.connect(self.setFileWrite)
self.view.checkBoxFileWriteNumpy.stateChanged.connect(self.setFileWriteNumpy)
@ -77,16 +94,19 @@ class AcquisitionTab(QtWidgets.QWidget):
def refresh(self):
self.getReadout()
self.getRunFrequency()
self.getTransceiver()
self.getAnalog()
self.getDigital()
self.getADCFrequency()
self.getADCPhase()
self.getADCPipeline()
self.getDBITFrequency()
self.getDBITPhase()
self.getDBITPipeline()
if self.det.type == detectorType.CHIPTESTBOARD:
self.getRunFrequency()
self.getADCFrequency()
self.getADCPhase()
self.getADCPipeline()
self.getDBITFrequency()
self.getDBITPhase()
self.getDBITPipeline()
self.getFileWrite()
self.getFileName()
self.getFilePath()
@ -697,23 +717,39 @@ class AcquisitionTab(QtWidgets.QWidget):
self.socket.subscribe("")
def saveParameters(self) -> list[str]:
return [
f'romode {self.view.comboBoxROMode.currentText().lower()}',
f'runclk {self.view.spinBoxRunF.value()}',
f'adcclk {self.view.spinBoxADCF.value()}',
f'adcphase {self.view.spinBoxADCPhase.value()}',
f'adcpipeline {self.view.spinBoxADCPipeline.value()}',
f'dbitclk {self.view.spinBoxDBITF.value()}',
f'dbitphase {self.view.spinBoxDBITPhase.value()}',
f'dbitpipeline {self.view.spinBoxDBITPipeline.value()}',
f'fwrite {int(self.view.checkBoxFileWriteRaw.isChecked())}',
f'fname {self.view.lineEditFileName.text()}',
f'fpath {self.view.lineEditFilePath.text()}',
f'findex {self.view.spinBoxAcquisitionIndex.value()}',
f'frames {self.view.spinBoxFrames.value()}',
f'triggers {self.view.spinBoxTriggers.value()}',
f'period {self.view.spinBoxPeriod.value()} {self.view.comboBoxPeriod.currentText().lower()}',
f'asamples {self.view.spinBoxAnalog.value()}',
f'dsamples {self.view.spinBoxDigital.value()}',
f'tsamples {self.view.spinBoxTransceiver.value()}',
]
if self.det.type == detectorType.CHIPTESTBOARD:
return [
f'romode {self.view.comboBoxROMode.currentText().lower()}',
f'runclk {self.view.spinBoxRunF.value()}',
f'adcclk {self.view.spinBoxADCF.value()}',
f'adcphase {self.view.spinBoxADCPhase.value()}',
f'adcpipeline {self.view.spinBoxADCPipeline.value()}',
f'dbitclk {self.view.spinBoxDBITF.value()}',
f'dbitphase {self.view.spinBoxDBITPhase.value()}',
f'dbitpipeline {self.view.spinBoxDBITPipeline.value()}',
f'fwrite {int(self.view.checkBoxFileWriteRaw.isChecked())}',
f'fname {self.view.lineEditFileName.text()}',
f'fpath {self.view.lineEditFilePath.text()}',
f'findex {self.view.spinBoxAcquisitionIndex.value()}',
f'frames {self.view.spinBoxFrames.value()}',
f'triggers {self.view.spinBoxTriggers.value()}',
f'period {self.view.spinBoxPeriod.value()} {self.view.comboBoxPeriod.currentText().lower()}',
f'asamples {self.view.spinBoxAnalog.value()}',
f'dsamples {self.view.spinBoxDigital.value()}',
f'tsamples {self.view.spinBoxTransceiver.value()}',
]
else:
return [
f'romode {self.view.comboBoxROMode.currentText().lower()}',
f'fwrite {int(self.view.checkBoxFileWriteRaw.isChecked())}',
f'fname {self.view.lineEditFileName.text()}',
f'fpath {self.view.lineEditFilePath.text()}',
f'findex {self.view.spinBoxAcquisitionIndex.value()}',
f'frames {self.view.spinBoxFrames.value()}',
f'triggers {self.view.spinBoxTriggers.value()}',
f'period {self.view.spinBoxPeriod.value()} {self.view.comboBoxPeriod.currentText().lower()}',
f'asamples {self.view.spinBoxAnalog.value()}',
f'dsamples {self.view.spinBoxDigital.value()}',
f'tsamples {self.view.spinBoxTransceiver.value()}',
]

View File

@ -4,7 +4,7 @@ from pathlib import Path
from PyQt5 import QtWidgets, uic
from pyctbgui.utils.defines import Defines
from slsdet import dacIndex
from slsdet import dacIndex, detectorType
class DacTab(QtWidgets.QWidget):
@ -19,7 +19,14 @@ class DacTab(QtWidgets.QWidget):
dac = getattr(dacIndex, f"DAC_{i}")
getattr(self.view, f"spinBoxDAC{i}").setValue(self.det.getDAC(dac)[0])
if self.det.highvoltage == 0:
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
self.view.checkBoxHighVoltage.setDisabled(True)
self.view.spinBoxHighVoltage.setDisabled(True)
self.view.labelHighVoltage.setDisabled(True)
self.view.labelADCVppDacName.setDisabled(True)
self.view.labelADCVpp.setDisabled(True)
self.view.comboBoxADCVpp.setDisabled(True)
elif self.det.highvoltage == 0:
self.view.spinBoxHighVoltage.setDisabled(True)
self.view.checkBoxHighVoltage.setChecked(False)
@ -30,9 +37,11 @@ class DacTab(QtWidgets.QWidget):
getattr(self.view, f"checkBoxDAC{i}").stateChanged.connect(partial(self.setDACTristate, i))
getattr(self.view, f"checkBoxDAC{i}mV").stateChanged.connect(partial(self.getDAC, i))
self.view.comboBoxADCVpp.currentIndexChanged.connect(self.setADCVpp)
self.view.spinBoxHighVoltage.editingFinished.connect(self.setHighVoltage)
self.view.checkBoxHighVoltage.stateChanged.connect(self.setHighVoltage)
if self.view.comboBoxADCVpp.isEnabled():
self.view.comboBoxADCVpp.currentIndexChanged.connect(self.setADCVpp)
if self.view.checkBoxHighVoltage.isEnabled():
self.view.spinBoxHighVoltage.editingFinished.connect(self.setHighVoltage)
self.view.checkBoxHighVoltage.stateChanged.connect(self.setHighVoltage)
def refresh(self):
self.updateDACNames()
@ -40,8 +49,10 @@ class DacTab(QtWidgets.QWidget):
self.getDACTristate(i)
self.getDAC(i)
self.getADCVpp()
self.getHighVoltage()
if self.view.comboBoxADCVpp.isEnabled():
self.getADCVpp()
if self.view.checkBoxHighVoltage.isEnabled():
self.getHighVoltage()
def updateDACNames(self):
for i, name in enumerate(self.det.getDacNames()):
@ -165,6 +176,8 @@ class DacTab(QtWidgets.QWidget):
unit = " mV" if inMV else ""
commands.append(f"dac {i} {value}{unit}")
commands.append(f"adcvpp {self.view.comboBoxADCVpp.currentText()} mV")
commands.append(f"highvoltage {self.view.spinBoxHighVoltage.value()}")
if self.view.comboBoxADCVpp.isEnabled():
commands.append(f"adcvpp {self.view.comboBoxADCVpp.currentText()} mV")
if self.view.checkBoxHighVoltage.isEnabled():
commands.append(f"highvoltage {self.view.spinBoxHighVoltage.value()}")
return commands

View File

@ -4,7 +4,7 @@ from pathlib import Path
from PyQt5 import QtWidgets, uic
from pyctbgui.utils.defines import Defines
from slsdet import dacIndex
from slsdet import dacIndex, detectorType
class PowerSuppliesTab(QtWidgets.QWidget):
@ -18,7 +18,8 @@ class PowerSuppliesTab(QtWidgets.QWidget):
self.updateVoltageNames()
for i in Defines.powerSupplies:
self.getVoltage(i)
self.getCurrent(i)
if self.det.type == detectorType.CHIPTESTBOARD:
self.getCurrent(i)
def connect_ui(self):
for i in Defines.powerSupplies:
@ -38,6 +39,12 @@ class PowerSuppliesTab(QtWidgets.QWidget):
if retval == 0:
checkBox.setChecked(False)
spinBox.setDisabled(True)
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
label = getattr(self.view, f"labelI{i}")
label.setDisabled(True)
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
self.view.spinBoxVChip.setDisabled(True)
def updateVoltageNames(self):
retval = self.det.getPowerNames()
@ -56,7 +63,10 @@ class PowerSuppliesTab(QtWidgets.QWidget):
spinBox.editingFinished.disconnect()
checkBox.stateChanged.disconnect()
retval = self.det.getMeasuredPower(voltageIndex)[0]
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
retval = self.det.getPower(voltageIndex)[0]
else:
retval = self.det.getMeasuredPower(voltageIndex)[0]
# spinBox.setValue(retval)
if retval > 1:
checkBox.setChecked(True)
@ -68,8 +78,9 @@ class PowerSuppliesTab(QtWidgets.QWidget):
spinBox.editingFinished.connect(partial(self.setVoltage, i))
checkBox.stateChanged.connect(partial(self.setVoltage, i))
self.getVChip()
if self.det.type == detectorType.CHIPTESTBOARD:
self.getVChip()
# TODO: handle multiple events when pressing enter (twice)
@ -91,7 +102,8 @@ class PowerSuppliesTab(QtWidgets.QWidget):
# TODO: (properly) disconnecting and connecting to handle multiple events (out of focus and pressing enter).
spinBox.editingFinished.connect(partial(self.setVoltage, i))
self.getVoltage(i)
self.getCurrent(i)
if self.det.type == detectorType.CHIPTESTBOARD:
self.getCurrent(i)
def getCurrent(self, i):
label = getattr(self.view, f"labelI{i}")

View File

@ -4,7 +4,7 @@ from pathlib import Path
from PyQt5 import uic, QtWidgets
from pyctbgui.utils.defines import Defines
from slsdet import dacIndex
from slsdet import dacIndex, detectorType
class SlowAdcTab(QtWidgets.QWidget):
@ -17,7 +17,8 @@ class SlowAdcTab(QtWidgets.QWidget):
self.det = None
def setup_ui(self):
pass
if self.det.type == detectorType.XILINX_CHIPTESTBOARD:
self.view.pushButtonTemp.setDisabled(True)
def connect_ui(self):
for i in range(Defines.slowAdc.count):
@ -28,7 +29,8 @@ class SlowAdcTab(QtWidgets.QWidget):
self.updateSlowAdcNames()
for i in range(Defines.slowAdc.count):
self.updateSlowAdc(i)
self.updateTemperature()
if self.det.type == detectorType.CHIPTESTBOARD:
self.updateTemperature()
def updateSlowAdcNames(self):
for i, name in enumerate(self.mainWindow.det.getSlowADCNames()):

View File

@ -817,7 +817,7 @@ Only pressing enter on spinbox will set DAC (with this condition).</string>
</widget>
</item>
<item row="18" column="0">
<widget class="QLabel" name="label_125">
<widget class="QLabel" name="labelADCVppDacName">
<property name="text">
<string>ADC_VPP</string>
</property>

View File

@ -118,7 +118,7 @@
</widget>
</item>
<item row="1" column="4">
<widget class="QLabel" name="label_70">
<widget class="QLabel" name="labelRunF">
<property name="text">
<string>Run Clock Frequency (MHz):</string>
</property>
@ -218,7 +218,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="2" column="3">
<widget class="QLabel" name="label_74">
<widget class="QLabel" name="labelDBITF">
<property name="minimumSize">
<size>
<width>200</width>
@ -231,7 +231,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_71">
<widget class="QLabel" name="labelADCF">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -278,7 +278,7 @@
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_76">
<widget class="QLabel" name="labelDBITPipeline">
<property name="text">
<string>DBIT Pipeline:</string>
</property>
@ -338,21 +338,21 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_73">
<widget class="QLabel" name="labelADCPipeline">
<property name="text">
<string>ADC Pipeline:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_72">
<widget class="QLabel" name="labelADCPhase">
<property name="text">
<string>ADC Clock Phase (a.u.):</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_75">
<widget class="QLabel" name="labelDBITPhase">
<property name="text">
<string>DBIT Clock Phase (a.u.):</string>
</property>

View File

@ -19,7 +19,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="frame_7">
<widget class="QFrame" name="frame_ADC">
<property name="geometry">
<rect>
<x>0</x>
@ -3142,7 +3142,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_20">
<item row="0" column="0">
<widget class="QLabel" name="label_67">
<widget class="QLabel" name="labelADCInversion">
<property name="font">
<font>
<pointsize>10</pointsize>
@ -3188,7 +3188,7 @@
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_68">
<widget class="QLabel" name="labelADCEnable">
<property name="font">
<font>
<pointsize>10</pointsize>

View File

@ -19,7 +19,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QFrame" name="frame_4">
<widget class="QFrame" name="frame_slowadcs">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -0,0 +1,19 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
# Script to get combined zmq packets from frame synchronizer using pull zmq sockets
import json
import zmq
c = zmq.Context()
s = c.socket(zmq.PULL)
s.connect("tcp://127.0.0.1:5555")
while True:
m = s.recv_multipart()
for p in m:
if p.startswith(b"{"):
print(p.decode().strip())
else:
print("binary")
print("--------")

View File

@ -123,6 +123,9 @@ def visit(node):
if node.kind == cindex.CursorKind.CLASS_DECL:
if node.displayname == "Detector":
for child in node.get_children():
# Skip assignment operators
if child.kind == cindex.CursorKind.CXX_METHOD and child.spelling == "operator=":
continue
if (
child.kind == cindex.CursorKind.CXX_METHOD
and child.access_specifier == cindex.AccessSpecifier.PUBLIC

View File

@ -151,6 +151,10 @@ class Detector(CppDetectorApi):
def hostname(self):
"""Frees shared memory and sets hostname (or IP address) of all modules concatenated by +
Virtual servers can already use the port in hostname separated by ':' and ports incremented by 2 to accomodate the stop server as well.
Note
-----
The row and column values in the udp/zmq header are affected by the order in this command and the detsize command. The modules are stacked row by row until they reach the y-axis limit set by detsize (if specified). Then, stacking continues in the next column and so on. This only affects row and column in udp/zmq header.
Example
-------
@ -2566,7 +2570,7 @@ class Detector(CppDetectorApi):
Note
-----
By default, the on-chip gain switching is active during the entire exposure. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us). The % is only for chipv1.0, the duration can be set for chipv1.1.\n
By default, the on-chip gain switching is active during the entire exposure. This mode disables the on-chip gain switching comparator automatically and the duration is set using compdisabletime.\n
Default is 0 or this mode disabled (comparator enabled throughout). 1 enables mode. 0 disables mode.
"""
return self.getAutoComparatorDisable()
@ -2580,10 +2584,6 @@ class Detector(CppDetectorApi):
def compdisabletime(self):
"""[Jungfrau] Time before end of exposure when comparator is disabled.
Note
-----
It is only possible for chipv1.1.
:getter: always returns in seconds. To get in DurationWrapper, use getComparatorDisableTime
Example
@ -2913,7 +2913,7 @@ class Detector(CppDetectorApi):
@property
@element
def timing_info_decoder(self):
"""[Jungfrau] [Jungfrau] Advanced Command and only for SWISSFEL and SHINE. Sets the bunch id or timing info decoder. Default is SWISSFEL.
"""[Jungfrau] [Jungfrau] Advanced Command and only for SWISSFEL and SHINE. Sets the bunch id or timing info decoder. Default is SWISSFEL. Only allowed for pcbv2.0.
Enum: timingInfoDecoder
"""
return self.getTimingInfoDecoder()

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv9.1.0

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServerv9.1.0

View File

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

View File

@ -0,0 +1 @@
../slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv9.1.0

View File

@ -1 +0,0 @@
../slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServerv9.0.0

View File

@ -0,0 +1 @@
../slsDetectorServers/xilinx_ctbDetectorServer/bin/xilinx_ctbDetectorServerv9.1.0

View File

@ -503,6 +503,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
}
#endif
if (ee == PHOTON && val[iy * nx + ix] == max) {
good = 1;
ee = PHOTON_MAX;
// cout << "**" <<id<< " " << iframe << " " << nDark << " "
// << ix << " " << iy << " " << rms << " " << max << " " <<
@ -536,7 +537,6 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
cout << max << " " << val[iy * nx + ix] << endl;
}
//else (clusters + nph)->print();
good = 1;
if (eMin > 0 && tot < eMin)
good = 0;
if (eMax > 0 && tot > eMax)

View File

@ -61,7 +61,9 @@ class qDefs : public QWidget {
}
}
template <class CT> struct NonDeduced { using type = CT; };
template <class CT> struct NonDeduced {
using type = CT;
};
template <class S, typename RT, typename... CT>
static void HandleExceptions(const std::string emsg, const std::string src,
S *s, RT (S::*somefunc)(CT...),

View File

@ -17,7 +17,7 @@
#define BUFFERSIZE 16
#define I2C_DEVICE_FILE "/dev/i2c-0"
#define I2C_DEVICE_ADDRESS 0x4C
//#define I2C_DEVICE_ADDRESS 0x48
// #define I2C_DEVICE_ADDRESS 0x48
#define I2C_REGISTER_ADDRESS 0x40
int i2c_open(const char *file, unsigned int addr) {

View File

@ -98,8 +98,8 @@
// everything at ~200 kHz (200 kHz MHz ddr readout)
#define DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED 0x000c0000
//#define DAQ_FIFO_ENABLE 0x00100000 commented out as it
// is not used anywhere
// #define DAQ_FIFO_ENABLE 0x00100000 commented out as it
// is not used anywhere
#define DAQ_REG_CHIP_CMDS_INT_TRIGGER 0x00100000
// direct chip commands to the DAQ_REG_CHIP_CMDS register
@ -131,8 +131,9 @@
#define DAQ_NEXPOSURERS_ACTIVATE_AUTO_SUBIMAGING 0x20000000
#define DAQ_NEXPOSURERS_ACTIVATE_RATE_CORRECTION 0x40000000
//#define DAQ_MASTER_HALF_MODULE 0x80000000 currently not
// used
// #define DAQ_MASTER_HALF_MODULE 0x80000000 currently
// not
// used
// chips static bits
#define DAQ_STATIC_BIT_PROGRAM 0x00000001

View File

@ -2,7 +2,7 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
//#include "types.h"
// #include "types.h"
#include <stdint.h>
/******************************************************************************/
/* types */

View File

@ -92,7 +92,7 @@ XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR
#define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_HIGHADDR 0xC410FFFF
/* Definitions for a new memory */
//#define XPAR_PLB_LL_NEW_MEMORY 0xD1000000//0xD1000084//0xC4200000
// #define XPAR_PLB_LL_NEW_MEMORY 0xD1000000//0xD1000084//0xC4200000
/* Definitions for peripheral PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT */
#define XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR 0xC4110000

View File

@ -22,13 +22,13 @@
((0x1 << GAIN_CONFGAIN_OFST) & GAIN_CONFGAIN_MSK)
/** Flow Control register */
//#define FLOW_CONTROL_REG (0x11 << MEM_MAP_SHIFT)
// #define FLOW_CONTROL_REG (0x11 << MEM_MAP_SHIFT)
/** Flow Status register */
//#define FLOW_STATUS_REG (0x12 << MEM_MAP_SHIFT)
// #define FLOW_STATUS_REG (0x12 << MEM_MAP_SHIFT)
/** Frame register */
//#define FRAME_REG (0x13 << MEM_MAP_SHIFT)
// #define FRAME_REG (0x13 << MEM_MAP_SHIFT)
/** Multi Purpose register */
#define MULTI_PURPOSE_REG (0x14 << MEM_MAP_SHIFT)
@ -79,7 +79,7 @@
((0x0007f << DAQ_PCKT_LNGTH_OFST) & DAQ_PCKT_LNGTH_MSK)
/** Time From Start register */
//#define TIME_FROM_START_REG (0x16 << MEM_MAP_SHIFT)
// #define TIME_FROM_START_REG (0x16 << MEM_MAP_SHIFT)
/** DAC Control register */
#define SPI_REG (0x17 << MEM_MAP_SHIFT)
@ -139,7 +139,7 @@
((0x1b << ADC_SYNC_ENET_DELAY_OFST) & ADC_SYNC_ENET_DELAY_MSK)
/** Time From Start register */
//#define MU_TIME_REG (0x1a << MEM_MAP_SHIFT)
// #define MU_TIME_REG (0x1a << MEM_MAP_SHIFT)
/** Temperatre SPI In register */
#define TEMP_SPI_IN_REG (0x1b << MEM_MAP_SHIFT)
@ -171,7 +171,7 @@
#define ENET_CONF_REG (0x1e << MEM_MAP_SHIFT)
/** Write TSE Shadow register */
//#define WRITE_TSE_SHADOW_REG (0x1f << MEM_MAP_SHIFT)
// #define WRITE_TSE_SHADOW_REG (0x1f << MEM_MAP_SHIFT)
/** High Voltage register */
#define HV_REG (0x20 << MEM_MAP_SHIFT)
@ -288,10 +288,10 @@
((0x4 << EXT_SIGNAL_OFST) & EXT_SIGNAL_MSK)
/** Look at me register */
//#define LOOK_AT_ME_REG (0x28 << MEM_MAP_SHIFT)
// #define LOOK_AT_ME_REG (0x28 << MEM_MAP_SHIFT)
/** FPGA SVN register */
//#define FPGA_SVN_REG (0x29 << MEM_MAP_SHIFT)
// #define FPGA_SVN_REG (0x29 << MEM_MAP_SHIFT)
/** Chip of Interest register */
#define CHIP_OF_INTRST_REG (0x2a << MEM_MAP_SHIFT)
@ -303,7 +303,7 @@
(0x0000FFFF << CHIP_OF_INTRST_NUM_CHNNLS_OFST)
/** Out MUX register */
//#define OUT_MUX_REG (0x2b << MEM_MAP_SHIFT)
// #define OUT_MUX_REG (0x2b << MEM_MAP_SHIFT)
/** Board Version register */
#define BOARD_REVISION_REG (0x2c << MEM_MAP_SHIFT)
@ -312,29 +312,29 @@
#define BOARD_REVISION_MSK (0x0000FFFF << BOARD_REVISION_OFST)
#define DETECTOR_TYPE_OFST (16)
#define DETECTOR_TYPE_MSK (0x0000000F << DETECTOR_TYPE_OFST)
//#define DETECTOR_TYPE_GOTTHARD_VAL (??)
// #define DETECTOR_TYPE_GOTTHARD_VAL (??)
#define DETECTOR_TYPE_MOENCH_VAL (2)
/** Memory Test register */
//#define MEMORY_TEST_REG (0x2d << MEM_MAP_SHIFT)
// #define MEMORY_TEST_REG (0x2d << MEM_MAP_SHIFT)
/** Hit Threshold register */
//#define HIT_THRESHOLD_REG (0x2e << MEM_MAP_SHIFT)
// #define HIT_THRESHOLD_REG (0x2e << MEM_MAP_SHIFT)
/** Hit Count register */
//#define HIT_COUNT_REG (0x2f << MEM_MAP_SHIFT)
// #define HIT_COUNT_REG (0x2f << MEM_MAP_SHIFT)
/* 16 bit Fifo Data register */
#define FIFO_DATA_REG (0x50 << MEM_MAP_SHIFT) // Not used in FW and SW (16bit)
/** Dacs Set 1 register */
//#define DACS_SET_1_REG (0x65 << MEM_MAP_SHIFT)
// #define DACS_SET_1_REG (0x65 << MEM_MAP_SHIFT)
/** Dacs Set 2 register */
//#define DACS_SET_2_REG (0x66 << MEM_MAP_SHIFT)
// #define DACS_SET_2_REG (0x66 << MEM_MAP_SHIFT)
/** Dacs Set 3 register */
//#define DACS_SET_3_REG (0x67 << MEM_MAP_SHIFT)
// #define DACS_SET_3_REG (0x67 << MEM_MAP_SHIFT)
/* Set Delay 64 bit register */
#define SET_DELAY_LSB_REG (0x68 << MEM_MAP_SHIFT)
@ -377,12 +377,12 @@
#define GET_EXPTIME_MSB_REG (0x7b << MEM_MAP_SHIFT)
/* Set Gates 64 bit register */
//#define SET_GATES_LSB_REG (0x7c << MEM_MAP_SHIFT)
//#define SET_GATES_MSB_REG (0x7d << MEM_MAP_SHIFT)
// #define SET_GATES_LSB_REG (0x7c << MEM_MAP_SHIFT)
// #define SET_GATES_MSB_REG (0x7d << MEM_MAP_SHIFT)
/* Set Gates 64 bit register */
//#define GET_GATES_LSB_REG (0x7e << MEM_MAP_SHIFT)
//#define GET_GATES_MSB_REG (0x7f << MEM_MAP_SHIFT)
// #define GET_GATES_LSB_REG (0x7e << MEM_MAP_SHIFT)
// #define GET_GATES_MSB_REG (0x7f << MEM_MAP_SHIFT)
/* Dark Image starting address */
#define DARK_IMAGE_REG (0x81 << MEM_MAP_SHIFT)

View File

@ -1974,9 +1974,6 @@ int autoCompDisable(int on) {
}
int setComparatorDisableTime(int64_t val) {
if (getChipVersion() != 11) {
return FAIL;
}
if (val < 0) {
LOG(logERROR,
("Invalid comp disable time: %lld ns\n", (long long int)val));
@ -2817,7 +2814,8 @@ void *start_timer(void *arg) {
getNextFrameNumber(&frameNr);
int iRxEntry = firstDest;
for (int iframes = 0; iframes != numFrames; ++iframes) {
usleep(transmissionDelayUs);
if (transmissionDelayUs)
usleep(transmissionDelayUs);
// check if manual stop
if (sharedMemory_getStop() == 1) {

View File

@ -5,8 +5,8 @@
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x230920 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x230921 // 2.0 pcb (version = 011)
#define REQRD_FRMWRE_VRSN_BOARD2 0x250209 // 1.0 pcb (version = 010)
#define REQRD_FRMWRE_VRSN 0x250208 // 2.0 pcb (version = 011)
#define NUM_HARDWARE_VERSIONS (2)
#define HARDWARE_VERSION_NUMBERS \

View File

@ -1927,7 +1927,8 @@ void *start_timer(void *arg) {
getNextFrameNumber(&frameNr);
int iRxEntry = firstDest;
for (int iframes = 0; iframes != numFrames; ++iframes) {
usleep(transmissionDelayUs);
if (transmissionDelayUs)
usleep(transmissionDelayUs);
// check if manual stop
if (sharedMemory_getStop() == 1) {

View File

@ -39,8 +39,8 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
patword = clearBit(SIGNAL_resCounter, patword);
for (int i = 0; i < 8; i++)
pat->word[iaddr++] = patword;
//#This version of the serializer pushes in the MSB first (compatible with
// the CSR bit numbering)
// #This version of the serializer pushes in the MSB first (compatible with
// the CSR bit numbering)
for (int ib = nbits - 1; ib >= 0; ib--) {
if (csr & (1 << ib))
patword = setBit(SIGNAL_serialIN, patword);

View File

@ -38,11 +38,11 @@
#define CSR_invpol 4
#define CSR_dpulse 5
#define CSR_interp 6
#define _CSR_C10pre 7 //#default, negative polarity
#define _CSR_C10pre 7 // #default, negative polarity
#define CSR_pumprobe 8
#define CSR_apulse 9
#define CSR_C15sh 10
#define CSR_C30sh 11 //#default
#define CSR_C30sh 11 // #default
#define CSR_C50sh 12
#define CSR_C225ACsh \
13 // Connects 225fF SHAPER AC cap (1: 225 to shaper, 225 to GND. 0: 450 to

View File

@ -50,7 +50,7 @@
#define DEFAULT_NUM_CYCLES (1)
#define DEFAULT_GATE_WIDTH (100 * 1000 * 1000) // ns
#define DEFAULT_GATE_DELAY (0)
#define DEFAULT_PERIOD (2 * 1000 * 1000) // ns
#define DEFAULT_PERIOD (0) // ns
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
#define DEFAULT_HIGH_VOLTAGE (0)
#define DEFAULT_TIMING_MODE (AUTO_TIMING)

View File

@ -106,9 +106,9 @@
(0x0000FFFF << I2C_SDA_HOLD_COUNT_PERIOD_OFST)
/** Receive Data Fifo Level register */
//#define I2C_RX_DATA_FIFO_LVL_OFST (0)
//#define I2C_RX_DATA_FIFO_LVL_MSK (0x000000FF <<
// I2C_RX_DATA_FIFO_LVL_OFST)
// #define I2C_RX_DATA_FIFO_LVL_OFST (0)
// #define I2C_RX_DATA_FIFO_LVL_MSK (0x000000FF <<
// I2C_RX_DATA_FIFO_LVL_OFST)
// defines in the fpga
uint32_t I2C_Control_Reg = 0x0;

View File

@ -622,7 +622,7 @@ void getIpAddressinString(char *cip, uint32_t ip) {
inet_ntop(AF_INET, &ip, cip, INET_ADDRSTRLEN);
#else
sprintf(cip, "%d.%d.%d.%d", (ip >> 24) & 0xff, (ip >> 16) & 0xff,
(ip >> 8) & 0xff, (ip)&0xff);
(ip >> 8) & 0xff, (ip) & 0xff);
#endif
}

View File

@ -2013,102 +2013,106 @@ int acquire(int blocking, int file_des) {
#if defined(JUNGFRAUD)
// chipv1.1 has to be configured before acquisition
if (getChipVersion() == 11 && !isChipConfigured()) {
ret = FAIL;
strcpy(mess, "Could not start acquisition. Chip is not configured. "
"Power it on to configure it.\n");
LOG(logERROR, (mess));
} else
ret = FAIL;
strcpy(mess,
"Could not start acquisition. Chip is not configured. "
"Power it on to configure it.\n");
LOG(logERROR, (mess));
} else
#endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
getReadoutMode() == ANALOG_ONLY) &&
(getNumAnalogSamples() <= 0)) {
ret = FAIL;
sprintf(mess,
"Could not start acquisition. Invalid number of analog "
"samples: %d.\n",
getNumAnalogSamples());
LOG(logERROR, (mess));
} else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
getReadoutMode() == DIGITAL_ONLY ||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
(getNumDigitalSamples() <= 0)) {
ret = FAIL;
sprintf(mess,
if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
getReadoutMode() == ANALOG_ONLY) &&
(getNumAnalogSamples() <= 0)) {
ret = FAIL;
sprintf(mess,
"Could not start acquisition. Invalid number of analog "
"samples: %d.\n",
getNumAnalogSamples());
LOG(logERROR, (mess));
} else if ((getReadoutMode() == ANALOG_AND_DIGITAL ||
getReadoutMode() == DIGITAL_ONLY ||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
(getNumDigitalSamples() <= 0)) {
ret = FAIL;
sprintf(
mess,
"Could not start acquisition. Invalid number of digital "
"samples: %d.\n",
getNumDigitalSamples());
LOG(logERROR, (mess));
} else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
(getNumTransceiverSamples() <= 0)) {
ret = FAIL;
sprintf(mess,
"Could not start acquisition. Invalid number of "
"transceiver "
"samples: %d.\n",
getNumTransceiverSamples());
LOG(logERROR, (mess));
} else
LOG(logERROR, (mess));
} else if ((getReadoutMode() == TRANSCEIVER_ONLY ||
getReadoutMode() == DIGITAL_AND_TRANSCEIVER) &&
(getNumTransceiverSamples() <= 0)) {
ret = FAIL;
sprintf(mess,
"Could not start acquisition. Invalid number of "
"transceiver "
"samples: %d.\n",
getNumTransceiverSamples());
LOG(logERROR, (mess));
} else
#endif
#ifdef EIGERD
// check for hardware mac and hardware ip
if (udpDetails[0].srcmac != getDetectorMAC()) {
ret = FAIL;
uint64_t sourcemac = getDetectorMAC();
char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf(mess,
"Invalid udp source mac address for this detector. "
"Must be "
"same as hardware detector mac address %s\n",
src_mac);
LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails[0].srcip != getDetectorIP())) {
ret = FAIL;
uint32_t sourceip = getDetectorIP();
char src_ip[INET_ADDRSTRLEN];
getIpAddressinString(src_ip, sourceip);
sprintf(mess,
"Invalid udp source ip address for this detector. Must "
"be "
"same as hardware detector ip address %s in 1G readout "
"mode \n",
src_ip);
LOG(logERROR, (mess));
} else
#endif
if (configured == FAIL) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because a scan is "
"already running!\n");
LOG(logERROR, (mess));
} else {
memset(scanErrMessage, 0, MAX_STR_LENGTH);
sharedMemory_setScanStop(0);
sharedMemory_setScanStatus(IDLE); // if it was error
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
&blocking)) {
ret = FAIL;
strcpy(mess, "Could not start acquisition thread!\n");
LOG(logERROR, (mess));
} else {
// wait for blocking always (scan or not)
// non blocking-no scan also wait (for error message)
// non blcoking-scan dont wait (there is
// scanErrorMessage)
if (blocking || !scan) {
pthread_join(pthread_tid, NULL);
// check for hardware mac and hardware ip
if (udpDetails[0].srcmac != getDetectorMAC()) {
ret = FAIL;
uint64_t sourcemac = getDetectorMAC();
char src_mac[MAC_ADDRESS_SIZE];
getMacAddressinString(src_mac, MAC_ADDRESS_SIZE, sourcemac);
sprintf(mess,
"Invalid udp source mac address for this detector. "
"Must be "
"same as hardware detector mac address %s\n",
src_mac);
LOG(logERROR, (mess));
} else if (!enableTenGigabitEthernet(GET_FLAG) &&
(udpDetails[0].srcip != getDetectorIP())) {
ret = FAIL;
uint32_t sourceip = getDetectorIP();
char src_ip[INET_ADDRSTRLEN];
getIpAddressinString(src_ip, sourceip);
sprintf(
mess,
"Invalid udp source ip address for this detector. Must "
"be "
"same as hardware detector ip address %s in 1G readout "
"mode \n",
src_ip);
LOG(logERROR, (mess));
} else
pthread_detach(pthread_tid);
}
}
#endif
if (configured == FAIL) {
ret = FAIL;
strcpy(mess, "Could not start acquisition because ");
strcat(mess, configureMessage);
LOG(logERROR, (mess));
} else if (sharedMemory_getScanStatus() == RUNNING) {
ret = FAIL;
strcpy(mess,
"Could not start acquisition because a scan is "
"already running!\n");
LOG(logERROR, (mess));
} else {
memset(scanErrMessage, 0, MAX_STR_LENGTH);
sharedMemory_setScanStop(0);
sharedMemory_setScanStatus(IDLE); // if it was error
if (pthread_create(&pthread_tid, NULL, &start_state_machine,
&blocking)) {
ret = FAIL;
strcpy(mess, "Could not start acquisition thread!\n");
LOG(logERROR, (mess));
} else {
// wait for blocking always (scan or not)
// non blocking-no scan also wait (for error message)
// non blcoking-scan dont wait (there is
// scanErrorMessage)
if (blocking || !scan) {
pthread_join(pthread_tid, NULL);
} else
pthread_detach(pthread_tid);
}
}
}
return Server_SendResult(file_des, INT32, NULL, 0);
}
@ -9086,16 +9090,9 @@ int get_comp_disable_time(int file_des) {
functionNotImplemented();
#else
// get only
if (getChipVersion() != 11) {
ret = FAIL;
strcpy(mess,
"Cannot get comparator disable time. Only valid for chipv1.1\n");
LOG(logERROR, (mess));
} else {
retval = getComparatorDisableTime();
LOG(logDEBUG1,
("retval comp disable time %lld ns\n", (long long int)retval));
}
retval = getComparatorDisableTime();
LOG(logDEBUG1,
("retval comp disable time %lld ns\n", (long long int)retval));
#endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
}
@ -9113,23 +9110,16 @@ int set_comp_disable_time(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
if (getChipVersion() != 11) {
ret = FAIL;
strcpy(mess, "Cannot get comparator disable time. Only valid for "
"chipv1.1\n");
ret = setComparatorDisableTime(arg);
int64_t retval = getComparatorDisableTime();
LOG(logDEBUG1,
("retval get comp disable time %lld ns\n", (long long int)retval));
if (ret == FAIL) {
sprintf(mess,
"Could not set comp disable time. Set %lld ns, read "
"%lld ns.\n",
(long long int)arg, (long long int)retval);
LOG(logERROR, (mess));
} else {
ret = setComparatorDisableTime(arg);
int64_t retval = getComparatorDisableTime();
LOG(logDEBUG1, ("retval get comp disable time %lld ns\n",
(long long int)retval));
if (ret == FAIL) {
sprintf(mess,
"Could not set comp disable time. Set %lld ns, read "
"%lld ns.\n",
(long long int)arg, (long long int)retval);
LOG(logERROR, (mess));
}
}
}
#endif
@ -11100,11 +11090,18 @@ int get_timing_info_decoder(int file_des) {
functionNotImplemented();
#else
// get only
ret = getTimingInfoDecoder(&retval);
LOG(logDEBUG1, ("retval timing info decoder: %d\n", retval));
if (ret == FAIL) {
strcpy(mess, "Could not get timing info decoder\n");
if (isHardwareVersion_1_0()) {
ret = FAIL;
sprintf(mess, "Could not get timing info decoder. Not supported "
"for hardware version 1.0\n");
LOG(logERROR, (mess));
} else {
ret = getTimingInfoDecoder(&retval);
LOG(logDEBUG1, ("retval timing info decoder: %d\n", retval));
if (ret == FAIL) {
strcpy(mess, "Could not get timing info decoder\n");
LOG(logERROR, (mess));
}
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
@ -11132,6 +11129,12 @@ int set_timing_info_decoder(int file_des) {
modeNotImplemented("Timing info decoder index", (int)arg);
break;
}
if (ret == OK && isHardwareVersion_1_0()) {
ret = FAIL;
sprintf(mess, "Could not set timing info decoder. Not supported "
"for hardware version 1.0\n");
LOG(logERROR, (mess));
}
if (ret == OK) {
ret = setTimingInfoDecoder(arg);
if (ret == FAIL) {

View File

@ -7,7 +7,12 @@ support_lib = ../../slsSupportLib/include/
det_lib = ../../slsDetectorSoftware/include/sls/
md5_dir = ../../slsSupportLib/src/
CROSS = aarch64-none-linux-gnu-
ifeq ($(shell uname -m),aarch64)
# no cross compilation needed when on aarch64
CROSS =
else
CROSS = aarch64-none-linux-gnu-
endif
CC = $(CROSS)gcc
#TODO: allow these warnings and fix code
CFLAGS += -Wall -std=gnu99 -Wno-format-overflow -Wno-format-truncation -DXILINX_CHIPTESTBOARDD -DARMPROCESSOR -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(det_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE

View File

@ -1056,7 +1056,7 @@ int getPower(enum DACINDEX ind) {
// dac powered off
if (dacValues[ind] == LTC2620_D_GetPowerDownValue()) {
LOG(logWARNING, ("Power V%s powered down\n", powerNames[pwrIndex]));
LOG(logWARNING, ("Power V%s is powered down\n", powerNames[pwrIndex]));
return LTC2620_D_GetPowerDownValue();
}

View File

@ -1505,6 +1505,7 @@ fi
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
IS_PATH=1
fi
fi
return 0
@ -1514,6 +1515,7 @@ FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
IS_PATH=1
fi
fi
return 0

View File

@ -1429,6 +1429,7 @@ fi
if [[ ${IS_GET} -eq 0 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
IS_PATH=1
fi
fi
return 0
@ -1438,6 +1439,7 @@ FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
IS_PATH=1
fi
fi
return 0

View File

@ -468,7 +468,7 @@ subdeadtime:
function: setSubDeadTime
compdisabletime:
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of exposure when comparator is disabled. It is only possible for chipv1.1."
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of exposure when comparator is disabled."
inherit_actions: TIME_COMMAND
actions:
GET:
@ -1123,7 +1123,7 @@ temp_control:
input_types: [ bool ]
autocompdisable:
help: "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically after 93.75% (only for chipv1.0) of exposure time (only for longer than 100us). It is possible to set the duration for chipv1.1 using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. "
help: "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically and the duration is set using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. "
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@ -1210,7 +1210,7 @@ polarity:
input_types: [ defs::polarity ]
timing_info_decoder:
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel."
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed for pcbv2.0."
inherit_actions: INTEGER_COMMAND_VEC_ID
actions:
GET:
@ -3429,7 +3429,7 @@ udp_dstlist:
output: [ ToString(args) ]
txdelay:
help: "[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided.Sets up \n\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 *num_modules * n_delay)\n\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay) for every module."
help: "[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided.Sets up \n\t[Eiger] txdelay_left to (2 * mod_index * n_delay), \n\t[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 * num_modules * n_delay)\n\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay) for every module."
actions:
GET:
argc: 0
@ -3884,8 +3884,8 @@ patternX:
require_det_id: true
function: setPattern
input: [ 'args[0]' ]
arg_types: [special::path]
input_types: [ std::string ]
cast_input: [ false ]
output: [ 'args.front()' ]
patword:

View File

@ -762,10 +762,9 @@ autocompdisable:
function_alias: autocompdisable
help: "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By default, the on-chip\
\ gain switching is active during the entire exposure.This mode disables the on\
\ - chip gain switching comparator automatically after 93.75% (only for chipv1.0)\
\ of exposure time (only for longer than 100us). It is possible to set the duration\
\ for chipv1.1 using compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator\
\ enabled throughout). 1 enables mode. 0 disables mode. "
\ - chip gain switching comparator automatically and the duration is set using\
\ compdisabletime command.\n\tDefault is 0 or this mode disabled(comparator enabled\
\ throughout). 1 enables mode. 0 disables mode. "
infer_action: true
template: true
badchannels:
@ -1607,7 +1606,7 @@ compdisabletime:
command_name: compdisabletime
function_alias: compdisabletime
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] Time before end of\
\ exposure when comparator is disabled. It is only possible for chipv1.1."
\ exposure when comparator is disabled."
infer_action: true
template: true
confadc:
@ -6539,7 +6538,7 @@ patternX:
PUT:
args:
- arg_types:
- std::string
- special::path
argc: 1
cast_input:
- false
@ -11488,7 +11487,8 @@ timing_info_decoder:
command_name: timing_info_decoder
function_alias: timing_info_decoder
help: "[swissfel|shine]\n\t[Jungfrau] Advanced Command and only for Swissfel and\
\ Shine. Sets the bunch id or timing info decoder. Default is swissfel."
\ Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed\
\ for pcbv2.0."
infer_action: true
template: true
timinglist:
@ -11915,7 +11915,7 @@ txdelay:
help: "[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for\
\ all modules in the detector using the step size provided.Sets up \n\t[Eiger]\
\ txdelay_left to (2 * mod_index * n_delay), \n\t[Eiger] txdelay_right to ((2\
\ * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 *num_modules\
\ * mod_index + 1) * n_delay) and \n\t[Eiger] txdelay_frame to (2 * num_modules\
\ * n_delay)\n\t[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay)\
\ for every module."
infer_action: true

View File

@ -65,7 +65,12 @@ class Detector {
Result<std::string> getHostname(Positions pos = {}) const;
/**Frees shared memory, adds detectors to the list. */
/**Frees shared memory, adds detectors to the list. The row and column
* values in the udp/zmq header are affected by the order in this command
* and the setDetectorSize function. The modules are stacked row by row
* until they reach the y-axis limit set by detsize (if specified). Then,
* stacking continues in the next column and so on. This only affects row
* and column in udp/zmq header.*/
void setHostname(const std::vector<std::string> &hostname);
/** connects to n servers at local host starting at specific control port.
@ -1304,11 +1309,9 @@ class Detector {
* //TODO naming
* By default, the on-chip gain switching is active during the
* entire exposure. This mode disables the on-chip gain switching comparator
* automatically after 93.75% of exposure time (only for longer than 100us).
* The % is for chipv1.0. One can set the duration for chipv1.1 using
* setComparatorDisableTime\n Default is false or this mode
* disabled(comparator enabled throughout). true enables mode. 0 disables
* mode.
* automatically and the duration is set using setComparatorDisableTime\n
* Default is false or this mode disabled(comparator enabled throughout).
* true enables mode. 0 disables mode.
*/
void setAutoComparatorDisable(bool value, Positions pos = {});
@ -1316,7 +1319,7 @@ class Detector {
Result<ns> getComparatorDisableTime(Positions pos = {}) const;
/** [Jungfrau] Time before end of exposure when comparator is
* disabled. It is only possible for chipv1.1.*/
* disabled.*/
void setComparatorDisableTime(ns t, Positions pos = {});
/** [Jungfrau] Advanced TODO naming */
@ -1382,7 +1385,7 @@ class Detector {
Result<defs::timingInfoDecoder>
getTimingInfoDecoder(Positions pos = {}) const;
/** [Jungfrau] Advanced Command! */
/** [Jungfrau] Advanced Command! Only for pcb v2.0 */
void setTimingInfoDecoder(defs::timingInfoDecoder value,
Positions pos = {});
@ -1749,7 +1752,8 @@ class Detector {
Result<std::vector<int>> getRxDbitList(Positions pos = {}) const;
/** [CTB] list contains the set of digital signal bits (0-63) to save, must
* be non repetitive */
* be non repetitive. Note: data will be rearranged according to signal bits
*/
void setRxDbitList(const std::vector<int> &list, Positions pos = {});
/** [CTB] */

View File

@ -1018,7 +1018,7 @@ std::string Caller::autocompdisable(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([0, 1]
[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically after 93.75% (only for chipv1.0) of exposure time (only for longer than 100us). It is possible to set the duration for chipv1.1 using compdisabletime command.
[Jungfrau] Auto comparator disable mode. By default, the on-chip gain switching is active during the entire exposure.This mode disables the on - chip gain switching comparator automatically and the duration is set using compdisabletime command.
Default is 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. )V0G0N"
<< std::endl;
return os.str();
@ -2108,7 +2108,7 @@ std::string Caller::compdisabletime(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s]
[Jungfrau] Time before end of exposure when comparator is disabled. It is only possible for chipv1.1. )V0G0N"
[Jungfrau] Time before end of exposure when comparator is disabled. )V0G0N"
<< std::endl;
return os.str();
}
@ -14744,7 +14744,7 @@ std::string Caller::timing_info_decoder(int action) {
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << R"V0G0N([swissfel|shine]
[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. )V0G0N"
[Jungfrau] Advanced Command and only for Swissfel and Shine. Sets the bunch id or timing info decoder. Default is swissfel. Only allowed for pcbv2.0. )V0G0N"
<< std::endl;
return os.str();
}
@ -15365,7 +15365,7 @@ std::string Caller::txdelay(int action) {
[Eiger][Jungfrau][Moench][Mythen3] Set transmission delay for all modules in the detector using the step size provided.Sets up
[Eiger] txdelay_left to (2 * mod_index * n_delay),
[Eiger] txdelay_right to ((2 * mod_index + 1) * n_delay) and
[Eiger] txdelay_frame to (2 *num_modules * n_delay)
[Eiger] txdelay_frame to (2 * num_modules * n_delay)
[Jungfrau][Moench][Mythen3] txdelay_frame to (num_modules * n_delay) for every module. )V0G0N"
<< std::endl;
return os.str();

View File

@ -210,7 +210,12 @@ std::string Caller::hostname(int action) {
os << "\n\tFrees shared memory and sets hostname (or IP address) of "
"all modules concatenated by +.\n\t Virtual servers can already "
"use the port in hostname separated by ':' and ports incremented "
"by 2 to accomodate the stop server as well."
"by 2 to accomodate the stop server as well. The row and column "
"values in the udp/zmq header are affected by the order in this "
"command and the detsize command. The modules are stacked row by "
"row until they reach the y-axis limit set by detsize (if "
"specified). Then, stacking continues in the next column and so "
"on. This only affects row and column in udp/zmq header."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
@ -1020,10 +1025,16 @@ std::string Caller::slowadc(int action) {
std::string Caller::rx_dbitlist(int action) {
std::ostringstream os;
if (action == defs::HELP_ACTION) {
os << "[all] or [i0] [i1] [i2]... \n\t[Ctb] List of digital signal "
"bits read out. If all is used instead of a list, all digital "
"bits (64) enabled. Each element in list can be 0 - 63 and must "
"be non repetitive."
os << "[all] or [none] or [i0] [i1] [i2]... \n\t[Ctb] List of digital "
"signal bits enabled and rearranged according to the signals "
"(all samples of each signal is put together). If 'all' is used "
"instead of a list, all digital bits (64) enabled. Each element "
"in list can be 0 - 63 and must be non repetitive. The option "
"'none' will still spit out all data as is from the detector, "
"but without rearranging it. Please note that when using the "
"receiver list, the data size will be bigger if the number of "
"samples is not divisible by 8 as every signal bit is padded to "
"the next byte when combining all the samples in the receiver."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
@ -1041,7 +1052,9 @@ std::string Caller::rx_dbitlist(int action) {
for (unsigned int i = 0; i < 64; ++i) {
t[i] = i;
}
} else {
}
// 'none' option already covered as t is empty by default
else if (args[0] != "none") {
unsigned int ntrim = args.size();
t.resize(ntrim);
for (unsigned int i = 0; i < ntrim; ++i) {

View File

@ -99,6 +99,12 @@ void Detector::loadParameters(const std::vector<std::string> &parameters) {
CmdParser parser;
for (const auto &current_line : parameters) {
parser.Parse(current_line);
if (parser.multi_id() != 0) {
throw RuntimeError(
"Multi-detector indices [" + std::to_string(parser.multi_id()) +
"] are not allowed in the file. Instead, use the index for "
"'config' or 'parameters' command?");
}
caller.call(parser.command(), parser.arguments(), parser.detector_id(),
defs::PUT_ACTION, std::cout, parser.receiver_id());
}

View File

@ -1177,9 +1177,19 @@ int DetectorImpl::acquire() {
if (dataReady == nullptr) {
setJoinThreadFlag(true);
} else if (receiver) {
while (numZmqRunning != 0) {
Parallel(&Module::restreamStopFromReceiver, {});
std::this_thread::sleep_for(std::chrono::milliseconds(200));
// wait for postprocessor to process dummies
if (dataReady != nullptr) {
// process dummy from stop receier
if (numZmqRunning != 0)
std::this_thread::sleep_for(std::chrono::milliseconds(200));
while (numZmqRunning != 0) {
Parallel(&Module::restreamStopFromReceiver, {});
// time to process restream dummy
std::this_thread::sleep_for(std::chrono::milliseconds(200));
// increase time for fewer dummies and to catch up
if (numZmqRunning != 0)
std::this_thread::sleep_for(std::chrono::seconds(2));
}
}
}
dataProcessingThread.join();

View File

@ -79,7 +79,9 @@ class DetectorImpl : public virtual slsDetectorDefs {
explicit DetectorImpl(int detector_index = 0, bool verify = true,
bool update = true);
template <class CT> struct NonDeduced { using type = CT; };
template <class CT> struct NonDeduced {
using type = CT;
};
template <typename RT, typename... CT>
Result<RT> Parallel(RT (Module::*somefunc)(CT...),
std::vector<int> positions,

View File

@ -905,8 +905,13 @@ void Module::startReceiver() {
}
void Module::stopReceiver() {
auto rxStatusPrior = getReceiverStatus();
sendToReceiver(F_STOP_RECEIVER, static_cast<int>(shm()->stoppedFlag),
nullptr);
if (rxStatusPrior == IDLE && getReceiverStreaming()) {
restreamStopFromReceiver();
}
}
void Module::startAcquisition() {
@ -920,26 +925,8 @@ void Module::startReadout() {
}
void Module::stopAcquisition() {
// get det status before stopping acq
runStatus detStatus = ERROR;
try {
detStatus = getRunStatus();
} catch (...) {
}
sendToDetectorStop(F_STOP_ACQUISITION);
shm()->stoppedFlag = true;
// restream dummy header, if rxr streaming and det idle before stop
try {
if (shm()->useReceiverFlag && getReceiverStreaming()) {
if (detStatus == IDLE && getReceiverStatus() == IDLE) {
restreamStopFromReceiver();
}
}
} catch (...) {
}
}
void Module::restreamStopFromReceiver() {

View File

@ -262,8 +262,7 @@ TEST_CASE("compdisabletime", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU &&
det.getChipVersion().squash() * 10 == 11) {
if (det_type == defs::JUNGFRAU) {
auto prev_val = det.getComparatorDisableTime();
{
std::ostringstream oss;
@ -670,7 +669,8 @@ TEST_CASE("pedestalmode", "[.cmdcall]") {
TEST_CASE("timing_info_decoder", "[.cmdcall]") {
Detector det;
Caller caller(&det);
if (det.getDetectorType().squash() == defs::JUNGFRAU) {
if (det.getDetectorType().squash() == defs::JUNGFRAU &&
det.getHardwareVersion().squash() == "2.0") {
auto prev_val = det.getTimingInfoDecoder();
/*{
std::ostringstream oss;

View File

@ -3323,7 +3323,7 @@ TEST_CASE("reg", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);
@ -3379,7 +3379,7 @@ TEST_CASE("setbit", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);
@ -3409,7 +3409,7 @@ TEST_CASE("clearbit", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);
@ -3439,7 +3439,7 @@ TEST_CASE("getbit", "[.cmdcall]") {
addr = 0x80;
}
if (det_type == defs::GOTTHARD2) {
addr = 0x20;
addr = 0x298;
}
std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr);

View File

@ -138,13 +138,34 @@ if (SLS_USE_RECEIVER_BINARIES)
slsProjectWarnings
)
install(TARGETS slsReceiver slsMultiReceiver
add_executable(slsFrameSynchronizer
src/FrameSynchronizerApp.cpp
)
set_target_properties(slsFrameSynchronizer PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
if((CMAKE_BUILD_TYPE STREQUAL "Release") AND SLS_LTO_AVAILABLE)
set_property(TARGET slsFrameSynchronizer PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
target_link_libraries(slsFrameSynchronizer
PUBLIC
slsReceiverStatic
pthread
rt
PRIVATE
slsProjectWarnings
"$<BUILD_INTERFACE:libzmq-static>"
)
install(TARGETS slsReceiver slsMultiReceiver slsFrameSynchronizer
EXPORT "${TARGETS_EXPORT_NAME}"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sls
)
)
endif(SLS_USE_RECEIVER_BINARIES)

View File

@ -33,6 +33,8 @@ using Interface = ServerInterface;
#define gettid() syscall(SYS_gettid)
#endif
std::mutex ClientInterface::callbackMutex;
ClientInterface::~ClientInterface() {
killTcpThread = true;
LOG(logINFO) << "Shutting down TCP Socket on port " << portNumber;
@ -55,12 +57,14 @@ std::string ClientInterface::getReceiverVersion() { return APIRECEIVER; }
/***callback functions***/
void ClientInterface::registerCallBackStartAcquisition(
int (*func)(const startCallbackHeader, void *), void *arg) {
std::lock_guard<std::mutex> lock(callbackMutex);
startAcquisitionCallBack = func;
pStartAcquisition = arg;
}
void ClientInterface::registerCallBackAcquisitionFinished(
void (*func)(const endCallbackHeader, void *), void *arg) {
std::lock_guard<std::mutex> lock(callbackMutex);
acquisitionFinishedCallBack = func;
pAcquisitionFinished = arg;
}
@ -69,6 +73,7 @@ void ClientInterface::registerCallBackRawDataReady(
void (*func)(sls_receiver_header &, dataCallbackHeader, char *, size_t &,
void *),
void *arg) {
std::lock_guard<std::mutex> lock(callbackMutex);
rawDataReadyCallBack = func;
pRawDataReady = arg;
}
@ -461,15 +466,18 @@ void ClientInterface::setDetectorType(detectorType arg) {
std::string(e.what()) + ']');
}
// callbacks after (in setdetectortype, the object is reinitialized)
if (startAcquisitionCallBack != nullptr)
impl()->registerCallBackStartAcquisition(startAcquisitionCallBack,
pStartAcquisition);
if (acquisitionFinishedCallBack != nullptr)
impl()->registerCallBackAcquisitionFinished(acquisitionFinishedCallBack,
pAcquisitionFinished);
if (rawDataReadyCallBack != nullptr)
impl()->registerCallBackRawDataReady(rawDataReadyCallBack,
pRawDataReady);
{
std::lock_guard<std::mutex> lock(callbackMutex);
if (startAcquisitionCallBack != nullptr)
impl()->registerCallBackStartAcquisition(startAcquisitionCallBack,
pStartAcquisition);
if (acquisitionFinishedCallBack != nullptr)
impl()->registerCallBackAcquisitionFinished(
acquisitionFinishedCallBack, pAcquisitionFinished);
if (rawDataReadyCallBack != nullptr)
impl()->registerCallBackRawDataReady(rawDataReadyCallBack,
pRawDataReady);
}
impl()->setThreadIds(parentThreadId, tcpThreadId);
}

View File

@ -194,6 +194,8 @@ class ClientInterface : private virtual slsDetectorDefs {
pid_t tcpThreadId{0};
std::vector<std::string> udpips =
std::vector<std::string>(MAX_NUMBER_OF_LISTENING_THREADS);
// necessary if Receiver objects using threads with callbacks
static std::mutex callbackMutex;
};
} // namespace sls

View File

@ -0,0 +1,622 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/* Creates the slsFrameSynchronizer for running multiple receivers in different
* threads form a single binary that will spit out zmq streams without
* reconstructing image. Sample python script for pull socket for this combiner
* in python/scripts folder. TODO: Not handling empty frames from one socket
*/
#include "sls/Receiver.h"
#include "sls/ToString.h"
#include "sls/container_utils.h"
#include "sls/logger.h"
#include "sls/sls_detector_defs.h"
#include <csignal> //SIGINT
#include <cstdio>
#include <cstring>
#include <iostream>
#include <mutex>
#include <ostream>
#include <semaphore.h>
#include <sys/socket.h>
#include <sys/wait.h> //wait
#include <thread>
#include <unistd.h>
#include <set>
#include <vector>
#include <zmq.h>
std::vector<std::thread> threads;
std::vector<sem_t *> semaphores;
sls::TLogLevel printHeadersLevel = sls::logDEBUG;
/** Define Colors to print data call back in different colors for different
* recievers */
#define PRINT_IN_COLOR(c, f, ...) \
printf("\033[%dm" f RESET, 30 + c + 1, ##__VA_ARGS__)
/** Structure handling different threads */
using ZmqMsgList = std::vector<zmq_msg_t *>;
using FrameMap = std::map<uint64_t, ZmqMsgList>;
using PortFrameMap = std::map<uint16_t, FrameMap>;
struct FrameStatus {
bool starting = true;
bool terminate = false;
int num_receivers;
sem_t available;
std::mutex mtx;
ZmqMsgList headers;
PortFrameMap frames;
ZmqMsgList ends;
FrameStatus(bool start, bool term, int num_recv)
: starting(start), terminate(term), num_receivers(num_recv) {
sem_init(&available, 0, 0);
}
};
FrameStatus *global_frame_status = nullptr;
/**
* Control+C Interrupt Handler
* to let all the processes know to exit properly
*/
void sigInterruptHandler(int p) {
for (size_t i = 0; i != semaphores.size(); ++i) {
sem_post(semaphores[i]);
}
}
void cleanup() {
if (global_frame_status) {
std::lock_guard<std::mutex> lock(global_frame_status->mtx);
for (auto &outer_pair : global_frame_status->frames) {
for (auto &inner_pair : outer_pair.second) {
for (zmq_msg_t *msg : inner_pair.second) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
inner_pair.second.clear();
}
outer_pair.second.clear();
}
global_frame_status->frames.clear();
}
}
/**
* prints usage of this example program
*/
std::string getHelpMessage() {
std::ostringstream os;
os << "\nUsage:\n"
"./slsFrameSynchronizer [start tcp port] [num recevers] [print "
"callback headers (optional)]\n"
<< "\t - tcp port has to be non-zero and 16 bit\n"
<< "\t - print callback headers option is 0 (disabled) by default\n";
return os.str();
}
void zmq_free(void *data, void *hint) { delete[] static_cast<char *>(data); }
void print_frames(const PortFrameMap &frame_port_map) {
LOG(sls::logDEBUG) << "Printing frames";
for (const auto &it : frame_port_map) {
uint16_t udpPort = it.first;
const auto &frame_map = it.second;
LOG(sls::logDEBUG) << "UDP port: " << udpPort;
for (const auto &frame : frame_map) {
uint64_t fnum = frame.first;
const auto &msg_list = frame.second;
LOG(sls::logDEBUG)
<< " acq index: " << fnum << '[' << msg_list.size() << ']';
}
}
}
/** Valid frame numbers mean they exist across all ports or
* has at least a larger fnum in the port with the missing fnum **/
std::set<uint64_t> get_valid_fnums(const PortFrameMap &port_frame_map) {
// empty list
std::set<uint64_t> valid_fnums;
if (port_frame_map.empty()) {
return valid_fnums;
}
// collect all unique frame numbers from all ports
std::set<uint64_t> unique_fnums;
for (auto it = port_frame_map.begin(); it != port_frame_map.begin(); ++it) {
const FrameMap &frame_map = it->second;
for (auto frame = frame_map.begin(); frame != frame_map.end();
++frame) {
unique_fnums.insert(frame->first);
}
}
// collect valid frame numbers
for (auto &fnum : unique_fnums) {
bool is_valid = true;
for (auto it = port_frame_map.begin(); it != port_frame_map.end();
++it) {
uint16_t port = it->first;
const FrameMap &frame_map = it->second;
auto frame = frame_map.find(fnum);
// invalid: fnum missing in one port
if (frame == frame_map.end()) {
LOG(sls::logDEBUG)
<< "Fnum " << fnum << " is missing in port " << port;
// invalid: fnum greater than all in that port
auto last_frame = std::prev(frame_map.end());
auto last_fnum = last_frame->first;
if (fnum > last_fnum) {
LOG(sls::logDEBUG) << "And no larger fnum found. Fnum "
<< fnum << " is invalid.\n";
is_valid = false;
break;
}
}
}
if (is_valid) {
valid_fnums.insert(fnum);
}
}
return valid_fnums;
}
int zmq_send_multipart(void *socket, const ZmqMsgList &messages) {
size_t num_messages = messages.size();
for (size_t i = 0; i != num_messages; ++i) {
zmq_msg_t *msg = messages[i];
// determine flags: ZMQ_SNDMORE for all messages except the last
int flags = (i == num_messages - 1) ? 0 : ZMQ_SNDMORE;
if (zmq_msg_send(msg, socket, flags) == -1) {
LOG(sls::logERROR)
<< "Error sending message: " << zmq_strerror(zmq_errno());
return slsDetectorDefs::FAIL;
}
}
return slsDetectorDefs::OK;
}
void Correlate(FrameStatus *stat) {
void *context = zmq_ctx_new();
void *socket = zmq_socket(context, ZMQ_PUSH);
int rc = zmq_bind(socket, "tcp://*:5555");
if (rc != 0) {
LOG(sls::logERROR) << "failed to bind";
}
while (true) {
sem_wait(&(stat->available));
{
std::lock_guard<std::mutex> lock(stat->mtx);
if (stat->terminate) {
break;
}
if (stat->starting) {
// sending all start packets
if (static_cast<int>(stat->headers.size()) ==
stat->num_receivers) {
stat->starting = false;
// clean up
zmq_send_multipart(socket, stat->headers);
for (zmq_msg_t *msg : stat->headers) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
stat->headers.clear();
}
} else {
// print_frames(stat->frames);
auto valid_fnums = get_valid_fnums(stat->frames);
// sending all valid fnum data packets
for (const auto &fnum : valid_fnums) {
ZmqMsgList msg_list;
PortFrameMap &port_frame_map = stat->frames;
for (auto it = port_frame_map.begin();
it != port_frame_map.end(); ++it) {
uint16_t port = it->first;
const FrameMap &frame_map = it->second;
auto frame = frame_map.find(fnum);
if (frame != frame_map.end()) {
msg_list.insert(msg_list.end(),
stat->frames[port][fnum].begin(),
stat->frames[port][fnum].end());
// clean up
for (zmq_msg_t *msg : stat->frames[port][fnum]) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
stat->frames[port].erase(fnum);
}
}
LOG(printHeadersLevel)
<< "Sending data packets for fnum " << fnum;
zmq_send_multipart(socket, msg_list);
}
}
// sending all end packets
if (static_cast<int>(stat->ends.size()) == stat->num_receivers) {
zmq_send_multipart(socket, stat->ends);
// clean up
for (zmq_msg_t *msg : stat->ends) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
stat->ends.clear();
}
}
}
zmq_close(socket);
zmq_ctx_destroy(context);
}
int StartAcquisitionCallback(
const slsDetectorDefs::startCallbackHeader callbackHeader,
void *objectPointer) {
LOG(printHeadersLevel)
<< "Start Acquisition:"
<< "\n\t["
<< "\n\tUDP Port : " << sls::ToString(callbackHeader.udpPort)
<< "\n\tDynamic Range : " << callbackHeader.dynamicRange
<< "\n\tDetector Shape : "
<< sls::ToString(callbackHeader.detectorShape)
<< "\n\tImage Size : " << callbackHeader.imageSize
<< "\n\tFile Path : " << callbackHeader.filePath
<< "\n\tFile Name : " << callbackHeader.fileName
<< "\n\tFile Index : " << callbackHeader.fileIndex
<< "\n\tQuad Enable : " << callbackHeader.quad
<< "\n\tAdditional Json Header : "
<< sls::ToString(callbackHeader.addJsonHeader).c_str() << "\n\t]";
std::ostringstream oss;
oss << "{\"htype\":\"header\""
<< ", \"udpPorts\":" << sls::ToString(callbackHeader.udpPort)
<< ", \"bitmode\":" << callbackHeader.dynamicRange
<< ", \"filePath\":\"" << callbackHeader.filePath
<< "\", \"fileName\":\"" << callbackHeader.fileName
<< "\", \"fileIndex\":" << callbackHeader.fileIndex
<< ", \"detshape\":" << sls::ToString(callbackHeader.detectorShape)
<< ", \"size\":" << callbackHeader.imageSize
<< ", \"quad\":" << (callbackHeader.quad ? 1 : 0);
if (!callbackHeader.addJsonHeader.empty()) {
oss << ", \"addJsonHeader\": {";
for (auto it = callbackHeader.addJsonHeader.begin();
it != callbackHeader.addJsonHeader.end(); ++it) {
if (it != callbackHeader.addJsonHeader.begin()) {
oss << ", ";
}
oss << "\"" << it->first.c_str() << "\":\"" << it->second.c_str()
<< "\"";
}
oss << " } ";
}
oss << "}\n";
std::string message = oss.str();
LOG(sls::logDEBUG) << "Start Acquisition message:" << std::endl << message;
int length = message.length();
char *hdata = new char[length];
memcpy(hdata, message.c_str(), length);
zmq_msg_t *hmsg = new zmq_msg_t;
zmq_msg_init_data(hmsg, hdata, length, zmq_free, NULL);
// push zmq msg into stat to be processed
FrameStatus *stat = static_cast<FrameStatus *>(objectPointer);
{
std::lock_guard<std::mutex> lock(stat->mtx);
stat->headers.push_back(hmsg);
stat->starting = true;
// clean up old frames
for (int port : callbackHeader.udpPort) {
for (auto &frame_map : stat->frames[port]) {
for (zmq_msg_t *msg : frame_map.second) {
if (msg) {
zmq_msg_close(msg);
delete msg;
}
}
frame_map.second.clear();
}
stat->frames[port].clear();
}
}
sem_post(&stat->available);
return slsDetectorDefs::OK; // TODO: change return to void
}
void AcquisitionFinishedCallback(
const slsDetectorDefs::endCallbackHeader callbackHeader,
void *objectPointer) {
LOG(printHeadersLevel) << "Acquisition Finished:"
<< "\n\t["
<< "\n\tUDP Port : "
<< sls::ToString(callbackHeader.udpPort)
<< "\n\tComplete Frames : "
<< sls::ToString(callbackHeader.completeFrames)
<< "\n\tLast Frame Index : "
<< sls::ToString(callbackHeader.lastFrameIndex)
<< "\n\t]";
std::ostringstream oss;
oss << "{\"htype\":\"series_end\""
<< ", \"udpPorts\":" << sls::ToString(callbackHeader.udpPort)
<< ", \"comleteFrames\":"
<< sls::ToString(callbackHeader.completeFrames)
<< ", \"lastFrameIndex\":"
<< sls::ToString(callbackHeader.lastFrameIndex) << "}\n";
std::string message = oss.str();
int length = message.length();
LOG(sls::logDEBUG) << "Acquisition Finished message:" << std::endl
<< message;
char *hdata = new char[length];
memcpy(hdata, message.c_str(), length);
zmq_msg_t *hmsg = new zmq_msg_t;
zmq_msg_init_data(hmsg, hdata, length, zmq_free, NULL);
// push zmq msg into stat to be processed
FrameStatus *stat = static_cast<FrameStatus *>(objectPointer);
{
std::lock_guard<std::mutex> lock(stat->mtx);
stat->ends.push_back(hmsg);
}
sem_post(&stat->available);
}
void GetDataCallback(slsDetectorDefs::sls_receiver_header &header,
slsDetectorDefs::dataCallbackHeader callbackHeader,
char *dataPointer, size_t &imageSize,
void *objectPointer) {
slsDetectorDefs::sls_detector_header detectorHeader = header.detHeader;
if (printHeadersLevel < sls::logDEBUG) {
// print in different color for each udp port
PRINT_IN_COLOR((callbackHeader.udpPort % 10),
"Data: "
"\n\tCallback Header: "
"\n\t["
"\n\tUDP Port: %u"
"\n\tShape: [%u, %u]"
"\n\tAcq Index : %lu"
"\n\tFrame Index :%lu"
"\n\tProgress : %.2f%%"
"\n\tComplete Image :%s"
"\n\tFlip Rows :%s"
"\n\tAdditional Json Header : %s"
"\n\t]"
"\n\ttReceiver Header: "
"\n\t["
"\n\tFrame Number : %lu"
"\n\tExposure Length :%u"
"\n\tPackets Caught :%u"
"\n\tDetector Specific 1: %lu"
"\n\tTimestamp : %lu"
"\n\tModule Id :%u"
"\n\tRow : %u"
"\n\tColumn :%u"
"\n\tDetector Specific 2 : %u"
"\n\tDetector Specific 3 : %u"
"\n\tDetector Specific 4 : %u"
"\n\tDetector Type : %s"
"\n\tVersion: %u"
"\n\t]"
"\n\tFirst Byte Data: 0x%x"
"\n\tImage Size: %zu\n\n",
callbackHeader.udpPort, callbackHeader.shape.x,
callbackHeader.shape.y, callbackHeader.acqIndex,
callbackHeader.frameIndex, callbackHeader.progress,
sls::ToString(callbackHeader.completeImage).c_str(),
sls::ToString(callbackHeader.flipRows).c_str(),
sls::ToString(callbackHeader.addJsonHeader).c_str(),
detectorHeader.frameNumber, detectorHeader.expLength,
detectorHeader.packetNumber, detectorHeader.detSpec1,
detectorHeader.timestamp, detectorHeader.modId,
detectorHeader.row, detectorHeader.column,
detectorHeader.detSpec2, detectorHeader.detSpec3,
detectorHeader.detSpec4,
sls::ToString(detectorHeader.detType).c_str(),
detectorHeader.version,
// header->packetsMask.to_string().c_str(),
((uint8_t)(*((uint8_t *)(dataPointer)))), imageSize);
}
std::ostringstream oss;
oss << "{\"htype\":\"module\""
<< ", \"port\":" << callbackHeader.udpPort
<< ", \"shape\":" << sls::ToString(callbackHeader.shape)
<< ", \"acqIndex\":" << callbackHeader.acqIndex
<< ", \"frameIndex\":" << callbackHeader.frameIndex
<< ", \"flipRows\":" << (callbackHeader.flipRows ? 1 : 0)
<< ", \"progress\":" << callbackHeader.progress
<< ", \"completeImage\":" << (callbackHeader.completeImage ? 1 : 0)
<< ", \"imageSize\":" << imageSize
<< ", \"frameNumber\":" << detectorHeader.frameNumber
<< ", \"expLength\":" << detectorHeader.expLength
<< ", \"packetNumber\":" << detectorHeader.packetNumber
<< ", \"detSpec1\":" << detectorHeader.detSpec1
<< ", \"timestamp\":" << detectorHeader.timestamp
<< ", \"modId\":" << detectorHeader.modId
<< ", \"row\":" << detectorHeader.row
<< ", \"column\":" << detectorHeader.column
<< ", \"detSpec2\":" << detectorHeader.detSpec2
<< ", \"detSpec3\":" << detectorHeader.detSpec3
<< ", \"detSpec4\":" << detectorHeader.detSpec4
<< ", \"detType\":" << static_cast<int>(detectorHeader.detType)
<< ", \"version\":" << static_cast<int>(detectorHeader.version);
if (!callbackHeader.addJsonHeader.empty()) {
oss << ", \"addJsonHeader\": {";
for (auto it = callbackHeader.addJsonHeader.begin();
it != callbackHeader.addJsonHeader.end(); ++it) {
if (it != callbackHeader.addJsonHeader.begin()) {
oss << ", ";
}
oss << "\"" << it->first.c_str() << "\":\"" << it->second.c_str()
<< "\"";
}
oss << " } ";
}
oss << "}\n";
std::string message = oss.str();
LOG(sls::logDEBUG) << "Data message:" << std::endl << message;
// creating header part of data packet
int length = message.length();
char *hdata = new char[length];
memcpy(hdata, message.c_str(), length);
zmq_msg_t *hmsg = new zmq_msg_t;
zmq_msg_init_data(hmsg, hdata, length, zmq_free, NULL);
// created data part of data packet
char *data = new char[imageSize];
zmq_msg_t *msg = new zmq_msg_t;
zmq_msg_init_data(msg, data, imageSize, zmq_free, NULL);
// push both parts into stat to be processed
FrameStatus *stat = static_cast<FrameStatus *>(objectPointer);
{
std::lock_guard<std::mutex> lock(stat->mtx);
stat->frames[callbackHeader.udpPort][header.detHeader.frameNumber]
.push_back(hmsg);
stat->frames[callbackHeader.udpPort][header.detHeader.frameNumber]
.push_back(msg);
}
sem_post(&stat->available);
}
/**
* Example of main program using the Receiver class
*
* - Defines in file for:
* - Default Number of receivers is 1
* - Default Start TCP port is 1954
*/
int main(int argc, char *argv[]) {
/** - set default values */
int numReceivers = 1;
uint16_t startTCPPort = DEFAULT_TCP_RX_PORTNO;
bool printHeaders = false;
/** - get number of receivers and start tcp port from command line
* arguments */
if (argc > 1) {
try {
if (argc == 3 || argc == 4) {
startTCPPort = sls::StringTo<uint16_t>(argv[1]);
if (startTCPPort == 0) {
throw std::runtime_error("Invalid start tcp port");
}
numReceivers = std::stoi(argv[2]);
if (numReceivers > 1024) {
cprintf(RED,
"Did you mix up the order of the arguments?\n%s\n",
getHelpMessage().c_str());
return EXIT_FAILURE;
}
if (numReceivers == 0) {
cprintf(RED, "Invalid number of receivers.\n%s\n",
getHelpMessage().c_str());
return EXIT_FAILURE;
}
if (argc == 4) {
printHeaders = sls::StringTo<bool>(argv[3]);
if (printHeaders) {
printHeadersLevel = sls::logINFOBLUE;
}
}
} else
throw std::runtime_error("Invalid number of arguments");
} catch (const std::exception &e) {
cprintf(RED, "Error: %s\n%s\n", e.what(), getHelpMessage().c_str());
return EXIT_FAILURE;
}
}
cprintf(RESET, "Number of Receivers: %d\n", numReceivers);
cprintf(RESET, "Start TCP Port: %hu\n", startTCPPort);
cprintf(RESET, "Print Callback Headers: %s\n\n",
(printHeaders ? "Enabled" : "Disabled"));
/** - Catch signal SIGINT to close files and call destructors properly */
struct sigaction sa;
sa.sa_flags = 0; // no flags
sa.sa_handler = sigInterruptHandler; // handler function
sigemptyset(&sa.sa_mask); // dont block additional signals during invocation
// of handler
if (sigaction(SIGINT, &sa, nullptr) == -1) {
cprintf(RED, "Could not set handler function for SIGINT\n");
}
/** - Ignore SIG_PIPE, prevents global signal handler, handle locally,
instead of a server crashing due to client crash when writing, it just
gives error */
struct sigaction asa;
asa.sa_flags = 0; // no flags
asa.sa_handler = SIG_IGN; // handler function
sigemptyset(&asa.sa_mask); // dont block additional signals during
// invocation of handler
if (sigaction(SIGPIPE, &asa, nullptr) == -1) {
cprintf(RED, "Could not set handler function for SIGPIPE\n");
}
FrameStatus stat{true, false, numReceivers};
// store pointer for signal handler
global_frame_status = &stat;
// thread synchronizing all packets
void *user_data = static_cast<void *>(&stat);
std::thread combinerThread(Correlate, &stat);
for (int i = 0; i != numReceivers; ++i) {
sem_t *semaphore = new sem_t;
sem_init(semaphore, 1, 0);
semaphores.push_back(semaphore);
uint16_t port = startTCPPort + i;
threads.emplace_back([i, semaphore, port, user_data]() {
sls::Receiver receiver(port);
receiver.registerCallBackStartAcquisition(StartAcquisitionCallback,
user_data);
receiver.registerCallBackAcquisitionFinished(
AcquisitionFinishedCallback, user_data);
receiver.registerCallBackRawDataReady(GetDataCallback, user_data);
/** - as long as no Ctrl+C */
sem_wait(semaphore);
sem_destroy(semaphore);
delete semaphore;
// clean up frames
if (i == 0)
cleanup();
});
}
for (auto &thread : threads) {
thread.join();
}
{
std::lock_guard<std::mutex> lock(stat.mtx);
stat.terminate = true;
sem_post(&stat.available);
}
combinerThread.join();
sem_destroy(&stat.available);
LOG(sls::logINFOBLUE) << "Goodbye!";
return EXIT_SUCCESS;
}

View File

@ -149,12 +149,12 @@ void Listener::CreateUDPSocket(int &actualSize) {
packetSize = generalData->vetoPacketSize;
}
std::string ip =
(eth.length() ? InterfaceNameToIp(eth).str().c_str() : "");
std::string ip;
if (eth.length() > 0)
ip = InterfaceNameToIp(eth).str();
udpSocket = nullptr;
udpSocket = make_unique<UdpRxSocket>(
udpPortNumber, packetSize, (ip.length() ? ip.c_str() : nullptr),
udpPortNumber, packetSize, (ip.empty() ? nullptr : ip.c_str()),
generalData->udpSocketBufferSize);
LOG(logINFO) << index << ": UDP port opened at port " << udpPortNumber
<< " (" << (ip.length() ? ip : "any") << ')';
@ -213,10 +213,13 @@ void Listener::CreateDummySocketForUDPSocketBufferSize(int s, int &actualSize) {
try {
// to allowe ports to be bound from udpsocket
udpSocket.reset();
UdpRxSocket g(
udpPortNumber, packetSize,
(eth.length() ? InterfaceNameToIp(eth).str().c_str() : nullptr),
generalData->udpSocketBufferSize);
std::string ip;
if (eth.length() > 0)
ip = InterfaceNameToIp(eth).str();
UdpRxSocket g(udpPortNumber, packetSize,
(ip.empty() ? nullptr : ip.c_str()),
generalData->udpSocketBufferSize);
// doubled due to kernel bookkeeping (could also be less due to
// permissions)

View File

@ -16,6 +16,8 @@ enum TLogLevel {
logINFOBLUE,
logINFOGREEN,
logINFORED,
logINFOCYAN,
logINFOMAGENTA,
logINFO,
logDEBUG,
logDEBUG1,
@ -60,16 +62,25 @@ class Logger {
// Danger this buffer need as many elements as TLogLevel
static const char *Color(TLogLevel level) noexcept {
static const char *const colors[] = {
RED BOLD, YELLOW BOLD, BLUE, GREEN, RED, RESET,
RESET, RESET, RESET, RESET, RESET, RESET};
RED BOLD, YELLOW BOLD, BLUE, GREEN, RED, CYAN, MAGENTA,
RESET, RESET, RESET, RESET, RESET, RESET, RESET};
// out of bounds
if (level < 0 || level >= sizeof(colors) / sizeof(colors[0])) {
return RESET;
}
return colors[level];
}
// Danger this buffer need as many elements as TLogLevel
static std::string ToString(TLogLevel level) {
static const char *const buffer[] = {
"ERROR", "WARNING", "INFO", "INFO", "INFO", "INFO",
"DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"};
"ERROR", "WARNING", "INFO", "INFO", "INFO",
"INFO", "INFO", "INFO", "DEBUG", "DEBUG1",
"DEBUG2", "DEBUG3", "DEBUG4", "DEBUG5"};
// out of bounds
if (level < 0 || level >= sizeof(buffer) / sizeof(buffer[0])) {
return "UNKNOWN";
}
return buffer[level];
}

View File

@ -130,7 +130,7 @@ extern "C" {
ll = (c)->D; \
(void)HOST_l2c(ll, (s)); \
} while (0)
#define ROTATE(a, n) (((a) << (n)) | (((a)&0xffffffff) >> (32 - (n))))
#define ROTATE(a, n) (((a) << (n)) | (((a) & 0xffffffff) >> (32 - (n))))
#if defined(DATA_ORDER_IS_BIG_ENDIAN)
#define HOST_c2l(c, l) \

View File

@ -1,13 +1,13 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
/** API versions */
#define APICTB "9.0.0 0x241121"
#define APIGOTTHARD "9.0.0 0x241121"
#define APIGOTTHARD2 "9.0.0 0x241121"
#define APIJUNGFRAU "9.0.0 0x241121"
#define APIMOENCH "9.0.0 0x241121"
#define APIXILINXCTB "9.0.0 0x241121"
#define APIEIGER "9.0.0 0x241121"
#define APIMYTHEN3 "9.0.0 0x241121"
#define APILIB "9.0.0 0x241126"
#define APIRECEIVER "9.0.0 0x241126"
#define APICTB "9.1.0 0x250204"
#define APIXILINXCTB "9.1.0 0x250204"
#define APIMYTHEN3 "9.1.0 0x250304"
#define APILIB "9.1.0 0x250311"
#define APIRECEIVER "9.1.0 0x250311"
#define APIJUNGFRAU "9.1.0 0x250318"