diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 92c682694..284ba0801 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -58,6 +58,13 @@ set(SPHINX_SOURCE_FILES src/udpheader.rst src/udpconfig.rst src/udpdetspec.rst + src/fileformat.rst + src/slsreceiverheaderformat.rst + src/masterfileattributes.rst + src/binaryfileformat.rst + src/hdf5fileformat.rst + src/zmqjsonheaderformat.rst + src/ctbframeformat.rst ) foreach(filename ${SPHINX_SOURCE_FILES}) diff --git a/docs/src/binaryfileformat.rst b/docs/src/binaryfileformat.rst new file mode 100644 index 000000000..67f041ae8 --- /dev/null +++ b/docs/src/binaryfileformat.rst @@ -0,0 +1,438 @@ +Binary File Format +==================== + +This is the default file format that can be configured using command `fformat `_. + + .. code-block:: bash + + sls_detector_put fformat binary + + +Master File +-------------- + +* File Name: [fpath]/[fname]_master_[findex].json :ref:`Details here` + +* It is in json format and created for every acquisition. + +* It contains :ref:`attributes` relevant to the acquisition. This can vary with detector type shown in :ref:`master json file examples ` here. + +* It shows the :ref:`**SLS Receiver Header** ` format used in data files. + +* Enabled/disabled using command `fmaster `_. + + +Data File +---------- + +* File Name: [fpath]/[fname]_dx_fy_[findex].raw :ref:`Details here` + +* It store multiple frames sequentially, with total number of frames determined by `rx_framesperfile `_ parameter. + +* Each frame includes a :ref:`**sls_receiver_header** ` structure, followed by the actual frame data. + + + +.. _json master file examples: + +JSON Master File Examples +--------------------------------------------------- + +Eiger +^^^^^ + +.. code-block:: text + + { + "Version": 7.2, + "Timestamp": "Wed Nov 13 15:46:30 2024", + "Detector Type": "Eiger", + "Timing Mode": "auto", + "Geometry": { + "x": 2, + "y": 1 + }, + "Image Size in bytes": 262144, + "Pixels": { + "x": 512, + "y": 256 + }, + "Max Frames Per File": 10000, + "Frame Discard Policy": "nodiscard", + "Frame Padding": 1, + "Scan Parameters": "[disabled]", + "Total Frames": 1, + "Receiver Roi": { + "xmin": 4294967295, + "xmax": 4294967295, + "ymin": 4294967295, + "ymax": 4294967295 + }, + "Dynamic Range": 16, + "Ten Giga": 0, + "Exptime": "1s", + "Period": "1s", + "Threshold Energy": -1, + "Sub Exptime": "2.62144ms", + "Sub Period": "2.62144ms", + "Quad": 0, + "Number of rows": 256, + "Rate Corrections": "[0]", + "Frames in File": 1, + "Frame Header Format": { + "Frame Number": "8 bytes", + "SubFrame Number/ExpLength": "4 bytes", + "Packet Number": "4 bytes", + "Bunch ID": "8 bytes", + "Timestamp": "8 bytes", + "Module Id": "2 bytes", + "Row": "2 bytes", + "Column": "2 bytes", + "Reserved": "2 bytes", + "Debug": "4 bytes", + "Round Robin Number": "2 bytes", + "Detector Type": "1 byte", + "Header Version": "1 byte", + "Packets Caught Mask": "64 bytes" + } + } + + + +Jungfrau +^^^^^^^^ + +.. code-block:: text + + { + "Version": 7.2, + "Timestamp": "Wed Nov 13 13:03:53 2024", + "Detector Type": "Jungfrau", + "Timing Mode": "auto", + "Geometry": { + "x": 1, + "y": 1 + }, + "Image Size in bytes": 1048576, + "Pixels": { + "x": 1024, + "y": 512 + }, + "Max Frames Per File": 10000, + "Frame Discard Policy": "nodiscard", + "Frame Padding": 1, + "Scan Parameters": "[disabled]", + "Total Frames": 1000, + "Receiver Roi": { + "xmin": 4294967295, + "xmax": 4294967295, + "ymin": 4294967295, + "ymax": 4294967295 + }, + "Exptime": "10us", + "Period": "2ms", + "Number of UDP Interfaces": 1, + "Number of rows": 512, + "Frames in File": 10, + "Frame Header Format": { + "Frame Number": "8 bytes", + "SubFrame Number/ExpLength": "4 bytes", + "Packet Number": "4 bytes", + "Bunch ID": "8 bytes", + "Timestamp": "8 bytes", + "Module Id": "2 bytes", + "Row": "2 bytes", + "Column": "2 bytes", + "Reserved": "2 bytes", + "Debug": "4 bytes", + "Round Robin Number": "2 bytes", + "Detector Type": "1 byte", + "Header Version": "1 byte", + "Packets Caught Mask": "64 bytes" + } + } + + +Gotthard2 +^^^^^^^^^^^^ + +.. code-block:: text + + { + "Version": 7.2, + "Timestamp": "Wed Nov 13 14:18:17 2024", + "Detector Type": "Gotthard2", + "Timing Mode": "auto", + "Geometry": { + "x": 1, + "y": 1 + }, + "Image Size in bytes": 2560, + "Pixels": { + "x": 1280, + "y": 1 + }, + "Max Frames Per File": 20000, + "Frame Discard Policy": "nodiscard", + "Frame Padding": 1, + "Scan Parameters": "[disabled]", + "Total Frames": 10, + "Receiver Roi": { + "xmin": 4294967295, + "xmax": 4294967295, + "ymin": 4294967295, + "ymax": 4294967295 + }, + "Exptime": "0ns", + "Period": "0ns", + "Burst Mode": "burst_internal", + "Frames in File": 10, + "Frame Header Format": { + "Frame Number": "8 bytes", + "SubFrame Number/ExpLength": "4 bytes", + "Packet Number": "4 bytes", + "Bunch ID": "8 bytes", + "Timestamp": "8 bytes", + "Module Id": "2 bytes", + "Row": "2 bytes", + "Column": "2 bytes", + "Reserved": "2 bytes", + "Debug": "4 bytes", + "Round Robin Number": "2 bytes", + "Detector Type": "1 byte", + "Header Version": "1 byte", + "Packets Caught Mask": "64 bytes" + } + } + +Mythen3 +^^^^^^^ + +.. code-block:: text + + { + "Version": 7.2, + "Timestamp": "Wed Nov 13 14:39:14 2024", + "Detector Type": "Mythen3", + "Timing Mode": "auto", + "Geometry": { + "x": 1, + "y": 1 + }, + "Image Size in bytes": 15360, + "Pixels": { + "x": 3840, + "y": 1 + }, + "Max Frames Per File": 10000, + "Frame Discard Policy": "nodiscard", + "Frame Padding": 1, + "Scan Parameters": "[disabled]", + "Total Frames": 1, + "Receiver Roi": { + "xmin": 4294967295, + "xmax": 4294967295, + "ymin": 4294967295, + "ymax": 4294967295 + }, + "Dynamic Range": 32, + "Ten Giga": 1, + "Period": "2ms", + "Counter Mask": "0x7", + "Exptime1": "0.1s", + "Exptime2": "0.1s", + "Exptime3": "0.1s", + "GateDelay1": "0ns", + "GateDelay2": "0ns", + "GateDelay3": "0ns", + "Gates": 1, + "Threshold Energies": "[-1, -1, -1]", + "Frames in File": 1, + "Frame Header Format": { + "Frame Number": "8 bytes", + "SubFrame Number/ExpLength": "4 bytes", + "Packet Number": "4 bytes", + "Bunch ID": "8 bytes", + "Timestamp": "8 bytes", + "Module Id": "2 bytes", + "Row": "2 bytes", + "Column": "2 bytes", + "Reserved": "2 bytes", + "Debug": "4 bytes", + "Round Robin Number": "2 bytes", + "Detector Type": "1 byte", + "Header Version": "1 byte", + "Packets Caught Mask": "64 bytes" + } + } + + +Moench +^^^^^^ + +.. code-block:: text + + { + "Version": 7.2, + "Timestamp": "Wed Nov 13 14:41:32 2024", + "Detector Type": "Moench", + "Timing Mode": "auto", + "Geometry": { + "x": 1, + "y": 1 + }, + "Image Size in bytes": 320000, + "Pixels": { + "x": 400, + "y": 400 + }, + "Max Frames Per File": 100000, + "Frame Discard Policy": "discardpartial", + "Frame Padding": 1, + "Scan Parameters": "[disabled]", + "Total Frames": 1, + "Receiver Roi": { + "xmin": 4294967295, + "xmax": 4294967295, + "ymin": 4294967295, + "ymax": 4294967295 + }, + "Exptime": "10us", + "Period": "2ms", + "Number of UDP Interfaces": 1, + "Number of rows": 400, + "Frames in File": 1, + "Frame Header Format": { + "Frame Number": "8 bytes", + "SubFrame Number/ExpLength": "4 bytes", + "Packet Number": "4 bytes", + "Bunch ID": "8 bytes", + "Timestamp": "8 bytes", + "Module Id": "2 bytes", + "Row": "2 bytes", + "Column": "2 bytes", + "Reserved": "2 bytes", + "Debug": "4 bytes", + "Round Robin Number": "2 bytes", + "Detector Type": "1 byte", + "Header Version": "1 byte", + "Packets Caught Mask": "64 bytes" + } + } + +Gotthard I +^^^^^^^^^^^ + +.. code-block:: text + + { + "Version": 7.2, + "Timestamp": "Wed Nov 13 15:16:19 2024", + "Detector Type": "Gotthard", + "Timing Mode": "auto", + "Geometry": { + "x": 1, + "y": 1 + }, + "Image Size in bytes": 2560, + "Pixels": { + "x": 1280, + "y": 1 + }, + "Max Frames Per File": 20000, + "Frame Discard Policy": "nodiscard", + "Frame Padding": 1, + "Scan Parameters": "[disabled]", + "Total Frames": 1, + "Receiver Roi": { + "xmin": 4294967295, + "xmax": 4294967295, + "ymin": 4294967295, + "ymax": 4294967295 + }, + "Exptime": "1.00001ms", + "Period": "1s", + "Detector Roi": { + "xmin": 4294967295, + "xmax": 4294967295 + }, + "Frames in File": 1, + "Frame Header Format": { + "Frame Number": "8 bytes", + "SubFrame Number/ExpLength": "4 bytes", + "Packet Number": "4 bytes", + "Bunch ID": "8 bytes", + "Timestamp": "8 bytes", + "Module Id": "2 bytes", + "Row": "2 bytes", + "Column": "2 bytes", + "Reserved": "2 bytes", + "Debug": "4 bytes", + "Round Robin Number": "2 bytes", + "Detector Type": "1 byte", + "Header Version": "1 byte", + "Packets Caught Mask": "64 bytes" + } + } + +Chip Test Board +^^^^^^^^^^^^^^^ + +.. code-block:: text + + { + "Version": 7.2, + "Timestamp": "Wed Nov 13 15:32:59 2024", + "Detector Type": "ChipTestBoard", + "Timing Mode": "auto", + "Geometry": { + "x": 1, + "y": 1 + }, + "Image Size in bytes": 48018, + "Pixels": { + "x": 3, + "y": 1 + }, + "Max Frames Per File": 20000, + "Frame Discard Policy": "nodiscard", + "Frame Padding": 1, + "Scan Parameters": "[disabled]", + "Total Frames": 1, + "Receiver Roi": { + "xmin": 4294967295, + "xmax": 4294967295, + "ymin": 4294967295, + "ymax": 4294967295 + }, + "Exptime": "0ns", + "Period": "0.18s", + "Ten Giga": 0, + "ADC Mask": "0x2202", + "Analog Flag": 1, + "Analog Samples": 8003, + "Digital Flag": 0, + "Digital Samples": 1000, + "Dbit Offset": 0, + "Dbit Bitset": 0, + "Transceiver Mask": "0x3", + "Transceiver Flag": 0, + "Transceiver Samples": 1, + "Frames in File": 1, + "Frame Header Format": { + "Frame Number": "8 bytes", + "SubFrame Number/ExpLength": "4 bytes", + "Packet Number": "4 bytes", + "Bunch ID": "8 bytes", + "Timestamp": "8 bytes", + "Module Id": "2 bytes", + "Row": "2 bytes", + "Column": "2 bytes", + "Reserved": "2 bytes", + "Debug": "4 bytes", + "Round Robin Number": "2 bytes", + "Detector Type": "1 byte", + "Header Version": "1 byte", + "Packets Caught Mask": "64 bytes" + } + } diff --git a/docs/src/ctbframeformat.rst b/docs/src/ctbframeformat.rst new file mode 100644 index 000000000..b782583d3 --- /dev/null +++ b/docs/src/ctbframeformat.rst @@ -0,0 +1,81 @@ +Chip Test Board Frame Format +================================ + +Contents of a frame +-------------------- + +Each frame consists of 3 types of data in the following order: + + .. code-block:: text + + # only data from enabled modes are included + [ Analog Data ] + [ Digital Data ] + [ Transceiver Data ] + + +Each Data type is further divided into: + + .. code-block:: text + + [ Sample 0 for all enabled Channels ] + [ Sample 1 for all enabled Channels ] + ... + [ Sample N for all enabled Channels ] + + +Digital data +------------------- + +The chip test board sends out all digital data. + +Only the receiver can filter them using the command `rx_dbitlist `_. + + .. code-block:: text + + # filtered and reordered digital data from receiver + # Any signal that is not a byte is filled with 0's to make up a byte + + [all samples of list signal 0] + [all samples of list signal 1] + ... + [all samples of list signal N] + + + + +Parameters of readout modes +--------------------------------- + +.. list-table:: + :widths: 25 40 20 30 + :header-rows: 1 + + * - Readout mode + - Enable Channels + - Number of samples + - Number of bytes + * - Analog + - 1G: `adcenable `_ + + 10G: `adcenable10g `_ + - `asamples `_ + - 2 bytes per channel, + + max 32 channels + * - Digital + - `rx_dbitlist `_ + + [filtered only by receiver, module sends out all digital data] + - `dsamples `_ + - 1 bit per signal, + + max 64 signals + * - Transceiver + - `transceiverenable `_ + - `tsamples `_ + - 8 bytes per channel, + + max 4 channels + + diff --git a/docs/src/fileformat.rst b/docs/src/fileformat.rst new file mode 100644 index 000000000..f35498d0c --- /dev/null +++ b/docs/src/fileformat.rst @@ -0,0 +1,62 @@ +File format +================================ + +If `fwrite `_ is enabled, the receiver will write data to files. + +Number of Files +---------------- + +Every acquisition will create a master file and data files. + +An acquisition can have multiple data files for a single frame. The number of files is determined by the number of UDP ports per module and the number of modules. + + * Every modules has its own receiver process. Every receiver process can have 1 or 2 UDP ports. + * Each UDP port will create its own file. Therefore, each receiver can write 1 or 2 files. + * So, for example a detector with 4 modules with 2 UDP ports each will create a total of 8 files with file names containing UDP port index **'_d0'** to **'_d7'**. + +A new file containing **'_f[file_index]'** in file name is also created when reaching the maximum frames per file. Configured using `rx_framesperfile `_. + +.. _file name format: + +Naming +------- +| Master File Name: [fpath]/[fname]_master_[findex].[ext] + + +| Data File Name: [fpath]/[fname]_dx_fy_[findex].[ext] + + * fpath: file path set using command `fpath `_. Default: '/' + * fname: file name prefix using command `fname `_. Default: "run" + * findex: acquisition index using command `findex `_. Automatically incremented for every acquisition with `sls_detector_acquire `_ (if `fwrite `_ enabled). + * x: unique udp port index. New file per UDP port. + * y: file index. New file created after reaching max frames per file. + * ext: file extension. Default: "raw"(data file) or "json"(master file) + + +Some file name examples: + + .. code-block:: bash + + # first file + path-to-file/run_d0_f0_0.raw + + # first file for second UDP port + path-to-file/run_d1_f0_0.raw + + # second file after reaching max frames in first file + path-to-file/run_d0_f1_0.raw + + # second acquisition, first file + path-to-file/run_d0_f0_1.raw + + +Formats +-------- + +There are 2 file formats supported by the receiver: + + * Binary - extension .json (master file) or .raw (data files) + * HDF5 - extension .h5 + +The default is binary. HDF5 can be enabled by compiling the package with HDF5 option enabled. The file format is set using the command `fformat `_. + diff --git a/docs/src/firmware.rst b/docs/src/firmware.rst index a372ecb04..0a9bc9296 100644 --- a/docs/src/firmware.rst +++ b/docs/src/firmware.rst @@ -98,7 +98,7 @@ Upgrade * 6.1.2 server has a fix for seamless fpga programming - * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'. + * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command `updatedetectorserver `_. * Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release. @@ -257,7 +257,7 @@ Upgrade * 6.1.2 server has a fix for seamless fpga programming - * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command 'updatedetectorserver' or 'copydetectorserver'. + * We recommend first updating the on-board detector server to 6.1.2 (with client 6.1.x) using command `updatedetectorserver `_. * Then use command 'programfpga' to only update firmware or use command 'update' to update firmware and server to the latest release. diff --git a/docs/src/hdf5fileformat.rst b/docs/src/hdf5fileformat.rst new file mode 100644 index 000000000..892cde3b2 --- /dev/null +++ b/docs/src/hdf5fileformat.rst @@ -0,0 +1,89 @@ + + +HDF5 File Format +================================ + +Compilation +------------- + +#. Compile the package with HDF5 option enabled + + #. Using cmk script: ./cmk.sh -hj9 -d [path of hdf5 dir] (-d is optional and for custom installation folder) + + #. Enable using cmake option **-DSLS_USE_HDF5=ON** and **-DCMAKE_INSTALL_PREFIX=/path/to/custom/hdf/installation** (optional). + + +Setup +------- + +#. Start Receiver process + +#. Load config file + +#. Set file format using command `fformat `_. + + .. code-block:: bash + + sls_detector_put fformat hdf5 + + +Master File +------------- + +* File Name: [fpath]/[fname]_master_[findex].h5 :ref:`Details here` + +* It contains :ref:`attributes` relevant to the acquisition. This can vary with detector type. + +.. code-block:: text + + / # Root level + |---> entry # entry group + | |---> data # data group + | |---> column # dataset of each sls_receiver_header member + | |---> data + | |---> detector header version + | |---> detector specific 1 + | |---> detector specific 2 + | |---> detector specific 3 + | |---> detector specific 4 + | |---> detector type + | |---> exp length or sub exposure time + | |---> frame number + | |---> mod id + | |---> packets caught + | |---> packets caught bit mask + | |---> row + | |---> timestamp + | |---> instrument # instrument group + | |---> beam # beam group + | |---> detector # detector group + | |---> Master File Attribute 1 # dataset of each master file attribute + | |---> Master File Attribute 2 + | |---> Master File Attribute 3 + | |---> Master File Attribute .. + | |---> sample # sample group + + +If more than 1 data file per frame: + * The dataset of each :ref:`**SLS Receiver Header** ` member is a virtual dataset. + * **data** dataset is a virtual dataset. + + +More details regarding master file attributes can be found :ref:`here`. + +Data File +----------- + +* File Name: [fpath]/[fname]_dx_fy_[findex].h5 :ref:`Details here` + + +Virtual Data File +------------------ + +* File Name: [fpath]/[fname]_virtual_[findex].h5 :ref:`Details here` + +* For multiple modules, a virtual file linking data from all the modules is created. The individual files are expected to be present. + +* It is linked in the master file. + + diff --git a/docs/src/index.rst b/docs/src/index.rst index 1bdca9dd1..25503e70d 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -82,6 +82,23 @@ Welcome to slsDetectorPackage's documentation! receivers slsreceiver +.. toctree:: + :caption: Receiver Files + :maxdepth: 3 + + fileformat + slsreceiverheaderformat + ctbframeformat + masterfileattributes + binaryfileformat + hdf5fileformat + +.. toctree:: + :caption: Receiver ZMQ Stream + :maxdepth: 2 + + zmqjsonheaderformat + .. toctree:: :caption: Troubleshooting diff --git a/docs/src/installation.rst b/docs/src/installation.rst index c8717851f..30c7376fd 100644 --- a/docs/src/installation.rst +++ b/docs/src/installation.rst @@ -201,6 +201,7 @@ Build slsDetectorGui (Qt5) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Using pre-built binary on conda + .. code-block:: bash conda create -n myenv slsdetgui=7.0.0 @@ -208,13 +209,22 @@ Build slsDetectorGui (Qt5) 2. Using system installation on RHEL7 + .. code-block:: bash yum install qt5-qtbase-devel.x86_64 yum install qt5-qtsvg-devel.x86_64 +3. Using system installation on RHEL8 + + .. code-block:: bash + + yum install qt5-qtbase-devel.x86_64 + yum install qt5-qtsvg-devel.x86_64 + yum install expat-devel.x86_64 + +4. Using conda -3. Using conda .. code-block:: bash #Add channels for dependencies and our library @@ -312,7 +322,7 @@ Pybind and Zeromq | * or use advanced option SLS_FETCH_ZMQ_FROM_GITHUB [`link `__]. | | v7.x.x and older: -| zeromq must be installed and one can hint its location using +| zeromq-devel must be installed and one can hint its location using | * cmake option:'-DZeroMQ_HINT=/usr/lib64' or | * option '-q' in cmk.sh script: : ./cmk.sh -cbj5 -q /usr/lib64 | * 'zeromq' dependency added when installing using conda diff --git a/docs/src/masterfileattributes.rst b/docs/src/masterfileattributes.rst new file mode 100644 index 000000000..fb3aba0e5 --- /dev/null +++ b/docs/src/masterfileattributes.rst @@ -0,0 +1,408 @@ + +.. _master file attributes: +Master File Attributes +======================= + +These attributes are the same in binary and HDF5 file, but vary depending on detector type. + + +Eiger +^^^^^ + + +-----------------------+-------------------------------------------------+ + | **Key** | **Description** | + +-----------------------+-------------------------------------------------+ + | Version | Version of the master file | + | | Current value:8.0 | + +-----------------------+-------------------------------------------------+ + | Timestamp | Timestamp of creation of master file | + +-----------------------+-------------------------------------------------+ + | Detector Type | Detector type | + +-----------------------+-------------------------------------------------+ + | Timing Mode | Timing Mode | + +-----------------------+-------------------------------------------------+ + | Geometry | Number of UDP ports in x and y dimension for | + | | complete detector | + +-----------------------+-------------------------------------------------+ + | Image Size in bytes | Image size in bytes per UDP port | + +-----------------------+-------------------------------------------------+ + | Pixels | Number of pixels in x and y dimension | + | | per UDP port | + +-----------------------+-------------------------------------------------+ + | Max Frames Per File | Maximum frames per file | + +-----------------------+-------------------------------------------------+ + | Frame Discard Policy | Receiever Frame discard policy | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Frame Padding | Receiver Frame padding enable | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Scan Parameters | Scanning mode on detector | + +-----------------------+-------------------------------------------------+ + | Total Frames | Total number of frames and triggers expected | + +-----------------------+-------------------------------------------------+ + | Receiver Roi | Receiver ROI in file including xmax and ymax | + +-----------------------+-------------------------------------------------+ + | Dynamic Range | Bits per pixel | + +-----------------------+-------------------------------------------------+ + | Ten Giga | 10GbE enable for data | + +-----------------------+-------------------------------------------------+ + | Exptime | Exposure time | + +-----------------------+-------------------------------------------------+ + | Period | Period between frames | + +-----------------------+-------------------------------------------------+ + | Threshold Energy | Threshold energy | + +-----------------------+-------------------------------------------------+ + | Sub Exptime | Sub exposure time in 32 bit mode | + +-----------------------+-------------------------------------------------+ + | Sub Period | Sub period between frames in 32 bit mode | + +-----------------------+-------------------------------------------------+ + | Quad | Quad enable (hardware) | + +-----------------------+-------------------------------------------------+ + | Number of rows | Number of rows enabled for readout | + +-----------------------+-------------------------------------------------+ + | Rate Corrections | Rate Corrections | + +-----------------------+-------------------------------------------------+ + | Frames in File | Number of frames written to file by Receiver 0 | + +-----------------------+-------------------------------------------------+ + | Frame Header Format | Expected frame header format for the data files | + +-----------------------+-------------------------------------------------+ + + +Jungfrau +^^^^^^^^ + + +-----------------------+-------------------------------------------------+ + | **Key** | **Description** | + +-----------------------+-------------------------------------------------+ + | Version | Version of the master file | + | | Current value:8.0 | + +-----------------------+-------------------------------------------------+ + | Timestamp | Timestamp of creation of master file | + +-----------------------+-------------------------------------------------+ + | Detector Type | Detector type | + +-----------------------+-------------------------------------------------+ + | Timing Mode | Timing Mode | + +-----------------------+-------------------------------------------------+ + | Geometry | Number of UDP ports in x and y dimension for | + | | complete detector | + +-----------------------+-------------------------------------------------+ + | Image Size in bytes | Image size in bytes per UDP port | + +-----------------------+-------------------------------------------------+ + | Pixels | Number of pixels in x and y dimension | + | | per UDP port | + +-----------------------+-------------------------------------------------+ + | Max Frames Per File | Maximum frames per file | + +-----------------------+-------------------------------------------------+ + | Frame Discard Policy | Receiever Frame discard policy | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Frame Padding | Receiver Frame padding enable | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Scan Parameters | Scanning mode on detector | + +-----------------------+-------------------------------------------------+ + | Total Frames | Total number of frames and triggers expected | + +-----------------------+-------------------------------------------------+ + | Receiver Roi | Receiver ROI in file including xmax and ymax | + +-----------------------+-------------------------------------------------+ + | Exptime | Exposure time | + +-----------------------+-------------------------------------------------+ + | Period | Period between frames | + +-----------------------+-------------------------------------------------+ + | Number of UDP | Number of UDP Interfaces enabled per module | + | Interfaces | | + +-----------------------+-------------------------------------------------+ + | Number of rows | Number of rows enabled for readout | + +-----------------------+-------------------------------------------------+ + | Frames in File | Number of frames written to file by Receiver 0 | + +-----------------------+-------------------------------------------------+ + | Frame Header Format | Expected frame header format for the data files | + +-----------------------+-------------------------------------------------+ + +Gotthard II +^^^^^^^^^^^^ + + +-----------------------+-------------------------------------------------+ + | **Key** | **Description** | + +-----------------------+-------------------------------------------------+ + | Version | Version of the master file | + | | Current value:8.0 | + +-----------------------+-------------------------------------------------+ + | Timestamp | Timestamp of creation of master file | + +-----------------------+-------------------------------------------------+ + | Detector Type | Detector type | + +-----------------------+-------------------------------------------------+ + | Timing Mode | Timing Mode | + +-----------------------+-------------------------------------------------+ + | Geometry | Number of UDP ports in x and y dimension for | + | | complete detector | + +-----------------------+-------------------------------------------------+ + | Image Size in bytes | Image size in bytes per UDP port | + +-----------------------+-------------------------------------------------+ + | Pixels | Number of pixels in x and y dimension | + | | per UDP port | + +-----------------------+-------------------------------------------------+ + | Max Frames Per File | Maximum frames per file | + +-----------------------+-------------------------------------------------+ + | Frame Discard Policy | Receiever Frame discard policy | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Frame Padding | Receiver Frame padding enable | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Scan Parameters | Scanning mode on detector | + +-----------------------+-------------------------------------------------+ + | Total Frames | Total number of frames and triggers expected | + +-----------------------+-------------------------------------------------+ + | Receiver Roi | Receiver ROI in file including xmax and ymax | + +-----------------------+-------------------------------------------------+ + | Exptime | Exposure time | + +-----------------------+-------------------------------------------------+ + | Period | Period between frames | + +-----------------------+-------------------------------------------------+ + | Burst Mode | Burst mode of detector | + +-----------------------+-------------------------------------------------+ + | Frames in File | Number of frames written to file by Receiver 0 | + +-----------------------+-------------------------------------------------+ + | Frame Header Format | Expected frame header format for the data files | + +-----------------------+-------------------------------------------------+ + +Mythen3 +^^^^^^^ + + + +-----------------------+-------------------------------------------------+ + | **Key** | **Description** | + +-----------------------+-------------------------------------------------+ + | Version | Version of the master file | + | | Current value:8.0 | + +-----------------------+-------------------------------------------------+ + | Timestamp | Timestamp of creation of master file | + +-----------------------+-------------------------------------------------+ + | Detector Type | Detector type | + +-----------------------+-------------------------------------------------+ + | Timing Mode | Timing Mode | + +-----------------------+-------------------------------------------------+ + | Geometry | Number of UDP ports in x and y dimension for | + | | complete detector | + +-----------------------+-------------------------------------------------+ + | Image Size in bytes | Image size in bytes per UDP port | + +-----------------------+-------------------------------------------------+ + | Pixels | Number of pixels in x and y dimension | + | | per UDP port | + +-----------------------+-------------------------------------------------+ + | Max Frames Per File | Maximum frames per file | + +-----------------------+-------------------------------------------------+ + | Frame Discard Policy | Receiever Frame discard policy | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Frame Padding | Receiver Frame padding enable | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Scan Parameters | Scanning mode on detector | + +-----------------------+-------------------------------------------------+ + | Total Frames | Total number of frames and triggers expected | + +-----------------------+-------------------------------------------------+ + | Receiver Roi | Receiver ROI in file including xmax and ymax | + +-----------------------+-------------------------------------------------+ + | Dynamic Range | Bits per pixel | + +-----------------------+-------------------------------------------------+ + | Ten Giga | 10GbE enable for data | + +-----------------------+-------------------------------------------------+ + | Period | Period between frames | + +-----------------------+-------------------------------------------------+ + | Counter Mask | Mask of counters enabled | + +-----------------------+-------------------------------------------------+ + | Exptime1 | Exposure time of counter 1 | + +-----------------------+-------------------------------------------------+ + | Exptime2 | Exposure time of counter 2 | + +-----------------------+-------------------------------------------------+ + | Exptime3 | Exposure time of counter 3 | + +-----------------------+-------------------------------------------------+ + | GateDelay1 | Gate delay of counter 1 | + +-----------------------+-------------------------------------------------+ + | GateDelay2 | Gate delay of counter 2 | + +-----------------------+-------------------------------------------------+ + | GateDelay3 | Gate delay of counter 3 | + +-----------------------+-------------------------------------------------+ + | Gates | Number of gates | + +-----------------------+-------------------------------------------------+ + | Threshold energies | Threshold energy of all 3 counters | + +-----------------------+-------------------------------------------------+ + | Frames in File | Number of frames written to file by Receiver 0 | + +-----------------------+-------------------------------------------------+ + | Frame Header Format | Expected frame header format for the data files | + +-----------------------+-------------------------------------------------+ + + +Moench +^^^^^^ + + +-----------------------+-------------------------------------------------+ + | **Key** | **Description** | + +-----------------------+-------------------------------------------------+ + | Version | Version of the master file | + | | Current value:8.0 | + +-----------------------+-------------------------------------------------+ + | Timestamp | Timestamp of creation of master file | + +-----------------------+-------------------------------------------------+ + | Detector Type | Detector type | + +-----------------------+-------------------------------------------------+ + | Timing Mode | Timing Mode | + +-----------------------+-------------------------------------------------+ + | Geometry | Number of UDP ports in x and y dimension for | + | | complete detector | + +-----------------------+-------------------------------------------------+ + | Image Size in bytes | Image size in bytes per UDP port | + +-----------------------+-------------------------------------------------+ + | Pixels | Number of pixels in x and y dimension | + | | per UDP port | + +-----------------------+-------------------------------------------------+ + | Max Frames Per File | Maximum frames per file | + +-----------------------+-------------------------------------------------+ + | Frame Discard Policy | Receiever Frame discard policy | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Frame Padding | Receiver Frame padding enable | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Scan Parameters | Scanning mode on detector | + +-----------------------+-------------------------------------------------+ + | Total Frames | Total number of frames and triggers expected | + +-----------------------+-------------------------------------------------+ + | Receiver Roi | Receiver ROI in file including xmax and ymax | + +-----------------------+-------------------------------------------------+ + | Exptime | Exposure time | + +-----------------------+-------------------------------------------------+ + | Period | Period between frames | + +-----------------------+-------------------------------------------------+ + | Number of UDP | Number of UDP Interfaces enabled per module | + | Interfaces | | + +-----------------------+-------------------------------------------------+ + | Number of rows | Number of rows enabled for readout | + +-----------------------+-------------------------------------------------+ + | Frames in File | Number of frames written to file by Receiver 0 | + +-----------------------+-------------------------------------------------+ + | Frame Header Format | Expected frame header format for the data files | + +-----------------------+-------------------------------------------------+ + +Gotthard I +^^^^^^^^^^^ + + +-----------------------+-------------------------------------------------+ + | **Key** | **Description** | + +-----------------------+-------------------------------------------------+ + | Version | Version of the master file | + | | Current value:8.0 | + +-----------------------+-------------------------------------------------+ + | Timestamp | Timestamp of creation of master file | + +-----------------------+-------------------------------------------------+ + | Detector Type | Detector type | + +-----------------------+-------------------------------------------------+ + | Timing Mode | Timing Mode | + +-----------------------+-------------------------------------------------+ + | Geometry | Number of UDP ports in x and y dimension for | + | | complete detector | + +-----------------------+-------------------------------------------------+ + | Image Size in bytes | Image size in bytes per UDP port | + +-----------------------+-------------------------------------------------+ + | Pixels | Number of pixels in x and y dimension | + | | per UDP port | + +-----------------------+-------------------------------------------------+ + | Max Frames Per File | Maximum frames per file | + +-----------------------+-------------------------------------------------+ + | Frame Discard Policy | Receiever Frame discard policy | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Frame Padding | Receiver Frame padding enable | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Scan Parameters | Scanning mode on detector | + +-----------------------+-------------------------------------------------+ + | Total Frames | Total number of frames and triggers expected | + +-----------------------+-------------------------------------------------+ + | Receiver Roi | Receiver ROI in file including xmax and ymax | + +-----------------------+-------------------------------------------------+ + | Exptime | Exposure time | + +-----------------------+-------------------------------------------------+ + | Period | Period between frames | + +-----------------------+-------------------------------------------------+ + | Detector Roi | Roi in detector restricted to an ADC. | + | | Includes xmax | + +-----------------------+-------------------------------------------------+ + | Burst Mode | Burst mode of detector | + +-----------------------+-------------------------------------------------+ + | Frames in File | Number of frames written to file by Receiver 0 | + +-----------------------+-------------------------------------------------+ + | Frame Header Format | Expected frame header format for the data files | + +-----------------------+-------------------------------------------------+ + +Chip Test Board +^^^^^^^^^^^^^^^ + + + +-----------------------+-------------------------------------------------+ + | **Key** | **Description** | + +-----------------------+-------------------------------------------------+ + | Version | Version of the master file | + | | Current value:8.0 | + +-----------------------+-------------------------------------------------+ + | Timestamp | Timestamp of creation of master file | + +-----------------------+-------------------------------------------------+ + | Detector Type | Detector type | + +-----------------------+-------------------------------------------------+ + | Timing Mode | Timing Mode | + +-----------------------+-------------------------------------------------+ + | Geometry | Number of UDP ports in x and y dimension for | + | | complete detector | + +-----------------------+-------------------------------------------------+ + | Image Size in bytes | Image size in bytes per UDP port | + +-----------------------+-------------------------------------------------+ + | Pixels | Number of pixels in x and y dimension | + | | per UDP port | + +-----------------------+-------------------------------------------------+ + | Max Frames Per File | Maximum frames per file | + +-----------------------+-------------------------------------------------+ + | Frame Discard Policy | Receiever Frame discard policy | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Frame Padding | Receiver Frame padding enable | + | | for partial frames | + +-----------------------+-------------------------------------------------+ + | Scan Parameters | Scanning mode on detector | + +-----------------------+-------------------------------------------------+ + | Total Frames | Total number of frames and triggers expected | + +-----------------------+-------------------------------------------------+ + | Receiver Roi | Receiver ROI in file including xmax and ymax | + +-----------------------+-------------------------------------------------+ + | Exptime | Exposure time | + +-----------------------+-------------------------------------------------+ + | Period | Period between frames | + +-----------------------+-------------------------------------------------+ + | Ten Giga | Ten giga enable | + +-----------------------+-------------------------------------------------+ + | ADC Mask | Mask of channels enabled in ADC | + +-----------------------+-------------------------------------------------+ + | Analog Flag | Analog readout enable | + +-----------------------+-------------------------------------------------+ + | Analog Samples | Number of analog samples | + +-----------------------+-------------------------------------------------+ + | Digital Flag | Digital readout enable | + +-----------------------+-------------------------------------------------+ + | Digital Samples | Number of digital samples | + +-----------------------+-------------------------------------------------+ + | Dbit Offset | Digital offset of valid data in bytes | + +-----------------------+-------------------------------------------------+ + | Dbit Bitset | Digital 64 bit mask of bits enabled in receiver | + +-----------------------+-------------------------------------------------+ + | Transceiver Mask | Mask of channels enabled in Transceiver | + +-----------------------+-------------------------------------------------+ + | Transceiver Flag | Transceiver readout enable | + +-----------------------+-------------------------------------------------+ + | Transceiver Samples | Number of transceiver samples | + +-----------------------+-------------------------------------------------+ + | Frames in File | Number of frames written to file by Receiver 0 | + +-----------------------+-------------------------------------------------+ + | Frame Header Format | Expected frame header format for the data files | + +-----------------------+-------------------------------------------------+ \ No newline at end of file diff --git a/docs/src/slsreceiver.rst b/docs/src/slsreceiver.rst index 09f9f782f..0413eb10a 100644 --- a/docs/src/slsreceiver.rst +++ b/docs/src/slsreceiver.rst @@ -91,245 +91,6 @@ Client Commands sls_detector_get -h rx_framescaught -ZMQ: Json Header Format ------------------------- - - -**Change in field names from slsDetectorPackage v6.x.x to v7.0.0** - -* detSpec1 <- bunchId -* detSpec2 <- reserved -* detSpec3 <- debug -* detSpec4 <- roundRNumber - - -**Format** - - .. code-block:: bash - - { - "jsonversion": unsigned int, - "bitmode": unsigned int, - "fileIndex": unsigned long int, - "detshape": [ - unsigned int, - unsigned int - ], - "shape": [ - unsigned int, - unsigned int - ], - "size": unsigned int, - "acqIndex": unsigned long int, - "frameIndex": unsigned long int, - "progress": double, - "fname": string, - "data": unsigned int, - "completeImage": unsigned int, - - "frameNumber": unsigned long long int, - "expLength": unsigned int, - "packetNumber": unsigned int, - "detSpec1": unsigned long int, - "timestamp": unsigned long int, - "modId": unsigned int, - "row": unsigned int, - "column": unsigned int, - "detSpec2": unsigned int, - "detSpec3": unsigned int, - "detSpec4": unsigned int, - "detType": unsigned int, - "version": unsigned int, - - "flipRows": unsigned int, - "quad": unsigned int, - "addJsonHeader": { - string : string - } - } - - +--------------+----------------------------------------------+ - | Field | Description | - +--------------+----------------------------------------------+ - | jsonversion | Version of the json header. | - | | Value at 4 for v6.x.x and v7.x.x | - +--------------+----------------------------------------------+ - | bitmode | Bits per pixel [4|8|16|32] | - +--------------+----------------------------------------------+ - | fileIndex | Current file acquisition index | - +--------------+----------------------------------------------+ - | detshape | Geometry of the entire detector | - +--------------+----------------------------------------------+ - | shape | Geometry of the current port streamed out | - +--------------+----------------------------------------------+ - | size | Size of image of current port in bytesout | - +--------------+----------------------------------------------+ - | acqIndex | Frame number from the detector (redundant) | - +--------------+----------------------------------------------+ - | frameIndex | Frame number of current acquisition | - | | (Starting at 0) | - +--------------+----------------------------------------------+ - | progress | Progress of current acquisition in % | - +--------------+----------------------------------------------+ - | fname | Current file name | - +--------------+----------------------------------------------+ - | data | 1 if there is data following | - | | 0 if dummy header | - +--------------+----------------------------------------------+ - | completeImage| 1 if no missing packets for this frame | - | | in this port, else 0 | - +--------------+----------------------------------------------+ - | frameNumber | Frame number | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | expLength | subframe number (32 bit eiger) | - | | or real time exposure time in 100ns (others) | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | packetNumber | Number of packets caught for that frame | - +--------------+----------------------------------------------+ - | detSpec1 | See :ref:`here` | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | timestamp | Timestamp with 10 MHz clock | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | modId | Module Id | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | row | Row number in detector | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | column | Column number in detector | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | detSpec2 | See :ref:`here` | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | detSpec3 | See :ref:`here` | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | detSpec4 | See :ref:`here` | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | detType | Detector type enum | - | detSpec3 | See :ref:`Detector enum` | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | version | Detector header version. At 2 | - | | [From detector udp header] | - +--------------+----------------------------------------------+ - | flipRows | 1 if rows should be flipped. | - | | Usually for Eiger bottom. | - +--------------+----------------------------------------------+ - | quad | 1 if its an Eiger quad. | - +--------------+----------------------------------------------+ - | addJsonHeader| Optional custom parameters that is required | - | | for processing code. | - +--------------+----------------------------------------------+ - - -SLS Receiver Header Format --------------------------- - -It is 112 bytes and consists of: - * 48 bytes of the SLS Detector Header (described in :ref:`the current detector header `) - * 64 bytes of packet mask - -.. code-block:: cpp - - typedef struct { - uint64_t frameNumber; - uint32_t expLength; - uint32_t packetNumber; - uint64_t detSpec1; - uint64_t timestamp; - uint16_t modId; - uint16_t row; - uint16_t column; - uint16_t detSpec2; - uint32_t detSpec3; - uint16_t detSpec4; - uint8_t detType; - uint8_t version; - } sls_detector_header; - - struct sls_receiver_header { - sls_detector_header detHeader; /**< is the detector header */ - sls_bitset packetsMask; /**< is the packets caught bit mask */ - }; - - -.. note :: - - | The packetNumber in the SLS Receiver Header will be modified to number of packets caught by receiver for that frame. For eg. Jungfrau will have 128 packets per frame. If it is less, then this is a partial frame due to missing packets. - - | Furthermore, the bit mask will specify which packets have been received. - - - - -File format --------------- - -Master file is in json format. - -The file name format is [fpath]/[fname]_dx_fy_[findex].raw, where x is module index and y is file index. **fname** is file name prefix and by default "run". **fpath** is '/' by default. - - -Each acquisition will have an increasing acquisition index or findex (if file write enabled). This can be retrieved by using **findex** command. - - -Each acquisition can have multiple files (the file index number **y**), with **rx_framesperfile** being the maximum number of frames per file. The default varies for each detector type. - - -Some file name examples: - - .. code-block:: bash - - # first file - path-to-file/run_d0_f0_0.raw - - # second file after reaching max frames in first file - path-to-file/run_d0_f1_0.raw - - # second acquisition, first file - path-to-file/run_d0_f0_1.raw - - -Each acquisition will create a master file that can be enabled/disabled using **fmaster**. This should have parameters relevant to the acquisition. - - -**Binary file format** - -This is the default file format. - - -Each data file will consist of frames, each consisting of slsReceiver Header followed by data for 1 frame. - - -Master file is of ASCII format and will also include the format of the slsReceiver Header. - - -**HDF5 file formats** - -#. Compile the package with HDF5 option enabled - - #. Using cmk script: ./cmk.sh -hj9 -d [path of hdf5 dir] - - #. Enable using cmake **-DCMAKE_INSTALL_PREFIX=/path/to/hdf/installation** and **-DSLS_USE_HDF5=ON** - -#. Start Receiver process - -#. Load config file - -#. Set file format from client or in config file - .. code-block:: bash - - sls_detector_put fformat hdf5 - - -| For multiple, modules, a virtual file linking all the modules is created. Both the data files and virtual files are linked in the master file. Performance diff --git a/docs/src/slsreceiverheaderformat.rst b/docs/src/slsreceiverheaderformat.rst new file mode 100644 index 000000000..9449db88f --- /dev/null +++ b/docs/src/slsreceiverheaderformat.rst @@ -0,0 +1,40 @@ + +.. _sls receiver header format: + +SLS Receiver Header Format +==================================================== + +It is 112 bytes and consists of: + * 48 bytes of the SLS Detector Header + * 64 bytes of packet mask + +.. code-block:: cpp + + typedef struct { + uint64_t frameNumber; + uint32_t expLength; + uint32_t packetNumber; + uint64_t detSpec1; + uint64_t timestamp; + uint16_t modId; + uint16_t row; + uint16_t column; + uint16_t detSpec2; + uint32_t detSpec3; + uint16_t detSpec4; + uint8_t detType; + uint8_t version; + } sls_detector_header; + + struct sls_receiver_header { + sls_detector_header detHeader; /**< is the detector header */ + sls_bitset packetsMask; /**< is the packets caught bit mask */ + }; + + + +| **sls_detector_header** (described in :ref:`the current detector header `) + +| The **packetNumber** from detector UDP header is modified in **sls_receiver_header** to number of packets caught by receiver for that frame and the bit mask for each packet caught is the **packetsMask**. The packetsMask is a total of 512 bits due to the largest number of packets per frame among our detectors. + +| For eg. Jungfrau has 128 packets per frame. If **packetNumeber** is 128, then this frame is complete. If it is 127 or less, it is a partial frame due to missing packets. If one would still like to use it, the **packetsMask** will specify which packet has been received or is missing. diff --git a/docs/src/udpheader.rst b/docs/src/udpheader.rst index 720aff2a9..56e59a387 100644 --- a/docs/src/udpheader.rst +++ b/docs/src/udpheader.rst @@ -3,7 +3,7 @@ Format ======= -The UDP data format for the packets consist of a common header for all detectors, followed by the data for that one packet. +The UDP data format for the packets consist of a common header of 48 bytes for all detectors, followed by the data for that one packet. Current Version @@ -11,6 +11,25 @@ Current Version **v2.0 (slsDetectorPackage v7.0.0+)** +.. code-block:: cpp + + typedef struct { + uint64_t frameNumber; + uint32_t expLength; + uint32_t packetNumber; + uint64_t detSpec1; + uint64_t timestamp; + uint16_t modId; + uint16_t row; + uint16_t column; + uint16_t detSpec2; + uint32_t detSpec3; + uint16_t detSpec4; + uint8_t detType; + uint8_t version; + } sls_detector_header; + + .. table:: <---------------------------------------------------- 8 bytes per row ---------------------------------------------> :align: center :widths: 30,30,30,15,15 diff --git a/docs/src/zmqjsonheaderformat.rst b/docs/src/zmqjsonheaderformat.rst new file mode 100644 index 000000000..c898f97c2 --- /dev/null +++ b/docs/src/zmqjsonheaderformat.rst @@ -0,0 +1,137 @@ +ZMQ: Json Header Format +======================== + + +**Change in field names from slsDetectorPackage v6.x.x to v7.0.0** + +* detSpec1 <- bunchId +* detSpec2 <- reserved +* detSpec3 <- debug +* detSpec4 <- roundRNumber + + +**Format** + + .. code-block:: bash + + { + "jsonversion": unsigned int, + "bitmode": unsigned int, + "fileIndex": unsigned long int, + "detshape": [ + unsigned int, + unsigned int + ], + "shape": [ + unsigned int, + unsigned int + ], + "size": unsigned int, + "acqIndex": unsigned long int, + "frameIndex": unsigned long int, + "progress": double, + "fname": string, + "data": unsigned int, + "completeImage": unsigned int, + + "frameNumber": unsigned long long int, + "expLength": unsigned int, + "packetNumber": unsigned int, + "detSpec1": unsigned long int, + "timestamp": unsigned long int, + "modId": unsigned int, + "row": unsigned int, + "column": unsigned int, + "detSpec2": unsigned int, + "detSpec3": unsigned int, + "detSpec4": unsigned int, + "detType": unsigned int, + "version": unsigned int, + + "flipRows": unsigned int, + "quad": unsigned int, + "addJsonHeader": { + string : string + } + } + + +--------------+----------------------------------------------+ + | Field | Description | + +--------------+----------------------------------------------+ + | jsonversion | Version of the json header. | + | | Value at 4 for v6.x.x and v7.x.x | + +--------------+----------------------------------------------+ + | bitmode | Bits per pixel [4|8|16|32] | + +--------------+----------------------------------------------+ + | fileIndex | Current file acquisition index | + +--------------+----------------------------------------------+ + | detshape | Geometry of the entire detector | + +--------------+----------------------------------------------+ + | shape | Geometry of the current port streamed out | + +--------------+----------------------------------------------+ + | size | Size of image of current port in bytesout | + +--------------+----------------------------------------------+ + | acqIndex | Frame number from the detector (redundant) | + +--------------+----------------------------------------------+ + | frameIndex | Frame number of current acquisition | + | | (Starting at 0) | + +--------------+----------------------------------------------+ + | progress | Progress of current acquisition in % | + +--------------+----------------------------------------------+ + | fname | Current file name | + +--------------+----------------------------------------------+ + | data | 1 if there is data following | + | | 0 if dummy header | + +--------------+----------------------------------------------+ + | completeImage| 1 if no missing packets for this frame | + | | in this port, else 0 | + +--------------+----------------------------------------------+ + | frameNumber | Frame number | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | expLength | subframe number (32 bit eiger) | + | | or real time exposure time in 100ns (others) | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | packetNumber | Number of packets caught for that frame | + +--------------+----------------------------------------------+ + | detSpec1 | See :ref:`here` | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | timestamp | Timestamp with 10 MHz clock | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | modId | Module Id | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | row | Row number in detector | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | column | Column number in detector | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | detSpec2 | See :ref:`here` | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | detSpec3 | See :ref:`here` | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | detSpec4 | See :ref:`here` | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | detType | Detector type enum | + | detSpec3 | See :ref:`Detector enum` | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | version | Detector header version. At 2 | + | | [From detector udp header] | + +--------------+----------------------------------------------+ + | flipRows | 1 if rows should be flipped. | + | | Usually for Eiger bottom. | + +--------------+----------------------------------------------+ + | quad | 1 if its an Eiger quad. | + +--------------+----------------------------------------------+ + | addJsonHeader| Optional custom parameters that is required | + | | for processing code. | + +--------------+----------------------------------------------+ + diff --git a/slsDetectorSoftware/generator/commands.yaml b/slsDetectorSoftware/generator/commands.yaml index 75fc3ef02..edcd1972d 100644 --- a/slsDetectorSoftware/generator/commands.yaml +++ b/slsDetectorSoftware/generator/commands.yaml @@ -688,7 +688,7 @@ column: function: setColumn timing: - help: "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]" + help: "[auto|trigger|gating|burst_trigger|trigger_gating]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]" inherit_actions: INTEGER_COMMAND_VEC_ID actions: GET: @@ -1736,7 +1736,7 @@ readout: rx_clearroi: inherit_actions: EXECUTE_SET_COMMAND_NOID - help: "Resets Region of interest in receiver. Default is all channels/pixels enabled." + help: "\n\tResets Region of interest in receiver. Default is all channels/pixels enabled." actions: PUT: function: clearRxROI @@ -3147,7 +3147,7 @@ maxclkphaseshift: function: getMaxClockPhaseShift clkdiv: - help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0" + help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.\n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock index range: 0" actions: GET: extra_variables: @@ -3560,7 +3560,7 @@ temp_event: output: [ '"cleared"' ] pedestalmode: - help: " [frames] [loops]\n\t\t[Jungfrau] Enable pedestal mode. \n\t\tThe number of frames or triggers is overwritten by: \n\t\t(#pedestal_frames x #pedestal_loops x 2). \n\t\tIn auto timing mode or in trigger mode with #frames > 1, \n\t\t#frames is overwritten and #triggers = 1, \n\t\telse #triggers is overwritten and #frames = 1. \n\t\tOne cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown).\n\npedestalmode [0]\n\t\t[Jungfrau] Disable pedestal mode.\n\t\tDisabling pedestal mode will set back the normal mode values of #frames and #triggers." + help: " [frames] [loops]\n\t\t[Jungfrau] Enable pedestal mode. \n\t\tThe number of frames or triggers is overwritten by: \n\t\t(#pedestal_frames x #pedestal_loops x 2). \n\t\tIn auto timing mode or in trigger mode with #frames > 1, \n\t\t#frames is overwritten and #triggers = 1, \n\t\telse #triggers is overwritten and #frames = 1. \n\t\tOne cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown).\n\tpedestalmode [0]\n\t\t[Jungfrau] Disable pedestal mode.\n\t\tDisabling pedestal mode will set back the normal mode values of #frames and #triggers." actions: GET: argc: 0 diff --git a/slsDetectorSoftware/generator/extended_commands.yaml b/slsDetectorSoftware/generator/extended_commands.yaml index 91e3b3a4a..2dfd091bb 100644 --- a/slsDetectorSoftware/generator/extended_commands.yaml +++ b/slsDetectorSoftware/generator/extended_commands.yaml @@ -1292,7 +1292,7 @@ clkdiv: command_name: clkdiv function_alias: clkdiv help: "[n_clock] [n_divider]\n\t[Gotthard2][Mythen3] Clock Divider of clock n_clock.\ - \ Must be greater than 1.n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock\ + \ Must be greater than 1.\n\t[Gotthard2] Clock index range: 0-5\n\t[Mythen3] Clock\ \ index range: 0" infer_action: true clkfreq: @@ -7171,7 +7171,7 @@ pedestalmode: \ x #pedestal_loops x 2). \n\t\tIn auto timing mode or in trigger mode with #frames\ \ > 1, \n\t\t#frames is overwritten and #triggers = 1, \n\t\telse #triggers is\ \ overwritten and #frames = 1. \n\t\tOne cannot set #frames, #triggers or timing\ - \ mode in pedestal mode (exception thrown).\n\npedestalmode [0]\n\t\t[Jungfrau]\ + \ mode in pedestal mode (exception thrown).\n\tpedestalmode [0]\n\t\t[Jungfrau]\ \ Disable pedestal mode.\n\t\tDisabling pedestal mode will set back the normal\ \ mode values of #frames and #triggers." infer_action: true @@ -8441,7 +8441,8 @@ rx_clearroi: store_result_in_t: false command_name: rx_clearroi function_alias: rx_clearroi - help: Resets Region of interest in receiver. Default is all channels/pixels enabled. + help: "\n\tResets Region of interest in receiver. Default is all channels/pixels\ + \ enabled." infer_action: true template: true rx_dbitlist: @@ -11445,9 +11446,9 @@ timing: store_result_in_t: false command_name: timing function_alias: timing - help: "[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx\ - \ Ctb] [auto|trigger]\n\t[Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger]\ - \ [auto|trigger|gating|burst_trigger]" + help: "[auto|trigger|gating|burst_trigger|trigger_gating]\n\tTiming Mode of detector.\n\ + \t[Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger]\n\t\ + [Mythen3] [auto|trigger|gating|trigger_gating]\n\t[Eiger] [auto|trigger|gating|burst_trigger]" infer_action: true template: true timing_info_decoder: diff --git a/slsDetectorSoftware/src/Caller.cpp b/slsDetectorSoftware/src/Caller.cpp index d1ea4d30f..850178da0 100644 --- a/slsDetectorSoftware/src/Caller.cpp +++ b/slsDetectorSoftware/src/Caller.cpp @@ -1673,7 +1673,8 @@ std::string Caller::clkdiv(int action) { // print help if (action == slsDetectorDefs::HELP_ACTION) { os << R"V0G0N([n_clock] [n_divider] - [Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1.n [Gotthard2] Clock index range: 0-5 + [Gotthard2][Mythen3] Clock Divider of clock n_clock. Must be greater than 1. + [Gotthard2] Clock index range: 0-5 [Mythen3] Clock index range: 0 )V0G0N" << std::endl; return os.str(); @@ -9006,8 +9007,7 @@ std::string Caller::pedestalmode(int action) { #frames is overwritten and #triggers = 1, else #triggers is overwritten and #frames = 1. One cannot set #frames, #triggers or timing mode in pedestal mode (exception thrown). - -pedestalmode [0] + pedestalmode [0] [Jungfrau] Disable pedestal mode. Disabling pedestal mode will set back the normal mode values of #frames and #triggers. )V0G0N" << std::endl; @@ -10844,7 +10844,8 @@ std::string Caller::rx_clearroi(int action) { std::ostringstream os; // print help if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N(Resets Region of interest in receiver. Default is all channels/pixels enabled. )V0G0N" + os << R"V0G0N( + Resets Region of interest in receiver. Default is all channels/pixels enabled. )V0G0N" << std::endl; return os.str(); } @@ -14676,7 +14677,7 @@ std::string Caller::timing(int action) { std::ostringstream os; // print help if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([auto|trigger|gating|burst_trigger] + os << R"V0G0N([auto|trigger|gating|burst_trigger|trigger_gating] Timing Mode of detector. [Jungfrau][Moench][Gotthard][Ctb][Gotthard2][Xilinx Ctb] [auto|trigger] [Mythen3] [auto|trigger|gating|trigger_gating] diff --git a/slsDetectorSoftware/src/CallerSpecial.cpp b/slsDetectorSoftware/src/CallerSpecial.cpp index 80b2a9867..fc0a2bfa3 100644 --- a/slsDetectorSoftware/src/CallerSpecial.cpp +++ b/slsDetectorSoftware/src/CallerSpecial.cpp @@ -250,8 +250,7 @@ void Caller::EmptyDataCallBack(detectorData *data, uint64_t frameIndex, std::string Caller::acquire(int action) { std::ostringstream os; if (action == defs::HELP_ACTION) { - os << cmd - << "\n\tAcquire the number of frames set up.\n\tBlocking command, " + os << "\n\tAcquire the number of frames set up.\n\tBlocking command, " "where control server is blocked and cannot accept other " "commands until acquisition is done. \n\t- sets acquiring " "flag\n\t- starts the receiver listener (if enabled)\n\t- starts " @@ -371,7 +370,8 @@ std::string Caller::threshold(int action) { if (cmd == "thresholdnotb") { os << "Trimbits are not loaded."; } - os << "\n\nthreshold [eV1] [eV2] [eV3] [(optional settings)]" + os << "\n\t" << cmd + << " [eV1] [eV2] [eV3] [(optional settings)]" "\n\t[Mythen3] Threshold in eV for each counter. It loads trim " "files from settingspath. An energy of -1 will pick up values " " from detector."; @@ -447,10 +447,9 @@ std::string Caller::trimen(int action) { std::ostringstream os; if (action == defs::HELP_ACTION) { os << "[trim_ev1] [trim_Ev2 (optional)] [trim_ev3 (optional)] " - "...\n\t[Eiger][Mythen3] Number of trim energies and list of " - "trim " - "energies, where corresponding default trim files exist in " - "corresponding trim folders." + "...\n\t[Eiger][Mythen3] list of trim energies, where " + "corresponding default trim files exist in corresponding trim " + "folders." << '\n'; } else if (action == defs::GET_ACTION) { if (!args.empty()) { diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index e637d9106..750e83983 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -277,7 +277,19 @@ void DetectorImpl::updateDetectorSize() { if (detSizeX > 1 && detSizeX <= maxChanX) { maxChanX = detSizeX; } + if (maxChanX < modSize.x) { + std::stringstream os; + os << "The max det size in x dim (" << maxChanX + << ") is less than the module size in x dim (" << modSize.x + << "). Probably using shared memory of a different detector " + "type. Please free and try again."; + throw RuntimeError(os.str()); + } nModx = maxChanX / modSize.x; + if (nModx == 0) { + throw RuntimeError( + "number of modules in x dimension is 0. Unable to proceed."); + } nMody = size() / nModx; if ((maxChanX % modSize.x) > 0) { ++nMody; @@ -291,7 +303,18 @@ void DetectorImpl::updateDetectorSize() { if (detSizeY > 1 && detSizeY <= maxChanY) { maxChanY = detSizeY; } + if (maxChanY < modSize.y) { + std::stringstream os; + os << "The max det size in y dim (" << maxChanY + << ") is less than the module size in y dim (" << modSize.y + << "). Probably using shared memory of a different detector " + "type. Please free and try again."; + throw RuntimeError(os.str()); + } nMody = maxChanY / modSize.y; + if (nMody == 0) + throw RuntimeError( + "number of modules in y dimension is 0. Unable to proceed."); nModx = size() / nMody; if ((maxChanY % modSize.y) > 0) { ++nModx; diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 50f17c0d6..fc85109c2 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -2385,7 +2385,6 @@ void Module::setNumberOfAnalogSamples(int value) { // update #nchan, as it depends on #samples, adcmask updateNumberOfChannels(); if (shm()->useReceiverFlag) { - LOG(logINFORED) << "receiver up!"; sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr); } } diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index a28b100ea..f7aed96ef 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -992,7 +992,7 @@ void Implementation::StartMasterWriter() { masterAttributes.dbitoffset = ctbDbitOffset; masterAttributes.dbitlist = 0; for (auto &i : ctbDbitList) { - masterAttributes.dbitlist |= (1 << i); + masterAttributes.dbitlist |= (static_cast(1) << i); } masterAttributes.transceiverSamples = generalData->nTransceiverSamples; diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index c6a0aea18..7dac8952a 100644 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -465,9 +465,9 @@ void Listener::CopyPacket(char *dst, char *src, uint32_t dataSize, // 2nd packet: 4 bytes fnum, previous 1*2 bytes data + 640*2 bytes data case GOTTHARD: if (!pnum) - memcpy(dst, &src[detHeaderSize + 4], dataSize - 2); + memcpy(dst, &src[detHeaderSize + 2], dataSize - 2); else - memcpy(dst + dataSize - 2, &src[detHeaderSize], dataSize + 2); + memcpy(dst + dataSize - 2, &src[detHeaderSize - 2], dataSize + 2); break; case CHIPTESTBOARD: case XILINX_CHIPTESTBOARD: