Compare commits

..

60 Commits

Author SHA1 Message Date
e6eb7af5ae Merge branch '2410-1.0.0.rc-18.fixes' into 'main'
Fixes to version 1.0.0-rc.18

See merge request jungfraujoch/nextgendcu!88
2024-10-17 16:29:39 +02:00
c9eb2ca65d Fixes to version 1.0.0-rc.18 2024-10-17 16:29:38 +02:00
3d9c93c32a Merge branch '2410-1.0.0-rc.18' into 'main'
version 1.0.0-rc.18

See merge request jungfraujoch/nextgendcu!87
2024-10-16 19:52:01 +02:00
1d7e5f173d version 1.0.0-rc.18 2024-10-16 19:52:01 +02:00
bc8afdcb55 Merge branch '2410-fpga-8x10g' into 'main'
Fixes to 8x10g FPGA image and frontend

See merge request jungfraujoch/nextgendcu!86
2024-10-16 09:12:24 +02:00
4ae0668f2f Fixes to 8x10g FPGA image and frontend 2024-10-16 09:12:24 +02:00
4cf20ae71b Merge branch '2410-rc.17-fixes' into 'main'
xbflash.qspi: Add tool from Xilinx to flash cards (it is a nightmare to...

See merge request jungfraujoch/nextgendcu!85
2024-10-15 09:27:22 +02:00
c7d255de6f xbflash.qspi: Add tool from Xilinx to flash cards (it is a nightmare to... 2024-10-15 09:27:22 +02:00
7cc6f4508a Merge branch '2410-1.0.0-rc.17-2' into 'main'
version 1.0.0-rc.17

See merge request jungfraujoch/nextgendcu!84
2024-10-14 15:03:38 +02:00
ce19996874 version 1.0.0-rc.17 2024-10-14 15:03:38 +02:00
ad579f5d22 Merge branch '2410-pistache-version' into 'main'
version1.0.0-rc.16 fixes

See merge request jungfraujoch/nextgendcu!83
2024-10-11 16:43:06 +02:00
26408608d4 version1.0.0-rc.16 fixes 2024-10-11 16:43:06 +02:00
e92169a244 Merge branch '2410-1.0.0-rc.16-fixes' into 'main'
version1.0.0-rc.16 fixes

See merge request jungfraujoch/nextgendcu!82
2024-10-11 13:21:26 +02:00
6aa43e6b7e version1.0.0-rc.16 fixes 2024-10-11 13:21:26 +02:00
2203513ffb Merge branch '2410-1.0.0-rc.16' into 'main'
version 1.0.0-rc.16

See merge request jungfraujoch/nextgendcu!81
2024-10-11 11:11:37 +02:00
b605b95127 version 1.0.0-rc.16 2024-10-11 11:11:37 +02:00
040c43084e Merge branch '2410-eiger-test' into 'main'
version 1.0.0-rc.15

See merge request jungfraujoch/nextgendcu!80
2024-10-08 21:04:09 +02:00
95eaad3d35 version 1.0.0-rc.15 2024-10-08 21:04:09 +02:00
7a23eade30 Merge branch '2410-pedestal-no-window' into 'main'
version 1.0.0-rc.14

See merge request jungfraujoch/nextgendcu!79
2024-10-07 11:56:40 +02:00
3be959f272 version 1.0.0-rc.14 2024-10-07 11:56:40 +02:00
9e21d312b2 Merge branch '2410-first-release' into 'main'
version 1.0.0-rc.13

See merge request jungfraujoch/nextgendcu!78
2024-10-05 13:14:49 +02:00
e812918e2e version 1.0.0-rc.13 2024-10-05 13:14:49 +02:00
e03a41ec73 Merge branch '2408-maxiv-ci' into 'main'
MAXIV CI: Add docker-shared tag

See merge request jungfraujoch/nextgendcu!77
2024-08-08 12:37:51 +02:00
f7ae0546bd MAXIV CI: Add docker-shared tag 2024-08-08 12:18:31 +02:00
e1045ee3b6 Merge branch '2407-minor-fix' into 'main'
1.0.0-rc.12 Minor fixes

See merge request jungfraujoch/nextgendcu!76
2024-07-08 19:58:27 +02:00
3e5ed2e9f9 1.0.0-rc.12 Minor fixes 2024-07-08 19:58:27 +02:00
3a08733872 Merge branch '2407-versioning' into 'main'
1.0.0-rc.12: Fixes to versioning

See merge request jungfraujoch/nextgendcu!75
2024-07-06 10:56:55 +02:00
00be0bb224 1.0.0-rc.12: Fixes to versioning 2024-07-06 10:56:54 +02:00
c4fc178f7a Merge branch '2406-sqroot' into 'main'
Version 1.0.0-rc.12

See merge request jungfraujoch/nextgendcu!74
2024-07-06 09:34:44 +02:00
6b5fddf2b7 Version 1.0.0-rc.12 2024-07-06 09:34:44 +02:00
2b9ce9a26e Merge branch '2406-more-minor-stuff' into 'main'
v1.0.0_rc.11

See merge request jungfraujoch/nextgendcu!73
2024-06-30 17:48:35 +02:00
3035d9e144 v1.0.0_rc.11 2024-06-30 17:48:35 +02:00
53b5a304d3 Merge branch '2406-openapi-python-client' into 'main'
Minor modifications to jfjoch_writer and OpenAPI

See merge request jungfraujoch/nextgendcu!72
2024-06-28 20:44:51 +02:00
30a92d8eb9 Minor modifications to jfjoch_writer and OpenAPI 2024-06-28 20:44:51 +02:00
81df571961 Merge branch '2406-after-crmx' into 'main'
Modifications after CristallinaMX beamtime

See merge request jungfraujoch/nextgendcu!71
2024-06-27 20:26:11 +02:00
1717e171b9 Modifications after CristallinaMX beamtime 2024-06-27 20:26:11 +02:00
4e59930972 Merge branch '2406-crmx' into 'main'
Release 1.0.0_rc.9

See merge request jungfraujoch/nextgendcu!70
2024-06-20 11:26:40 +02:00
a32c7274a6 Release 1.0.0_rc.9 2024-06-20 11:26:40 +02:00
8809b8d0d5 Merge branch '2405-writer-metadata' into 'main'
Extra metadata in HDF5 writer completed file stream

See merge request jungfraujoch/nextgendcu!69
2024-06-05 18:18:12 +02:00
86b3934387 Extra metadata in HDF5 writer completed file stream 2024-06-05 18:18:12 +02:00
7d9dcf2721 Merge branch '2405-maxiv-day-5' into 'main'
Updates after MAX IV experiment

See merge request jungfraujoch/nextgendcu!68
2024-06-03 10:56:43 +02:00
953c3fa972 Updates after MAX IV experiment 2024-06-03 10:56:43 +02:00
5d7a4e1ff2 Merge branch '2405-maxiv-day-3-2' into 'main'
PreviewImage: remove mutex

See merge request jungfraujoch/nextgendcu!67
2024-05-23 22:58:52 +02:00
f85b87bfd2 PreviewImage: remove mutex 2024-05-23 22:58:52 +02:00
500222bdcc Merge branch '2405-maxiv-day-3' into 'main'
Minor modifications

See merge request jungfraujoch/nextgendcu!66
2024-05-23 17:11:14 +02:00
c4d677f05b Minor modifications 2024-05-23 17:11:14 +02:00
76ff39c012 Merge branch '2405-maxiv-day-2' into 'main'
MAX IV experiment day 2 corrections

See merge request jungfraujoch/nextgendcu!65
2024-05-23 12:15:36 +02:00
3ef89483e8 MAX IV experiment day 2 corrections 2024-05-23 12:15:36 +02:00
e185fbb3f5 Merge branch '2405-maxiv-day-1' into 'main'
MAX IV test day 1 modifications

See merge request jungfraujoch/nextgendcu!64
2024-05-21 10:22:37 +02:00
701c083739 MAX IV test day 1 modifications 2024-05-21 10:22:37 +02:00
03662506c6 Merge branch '2405-writer-no-common' into 'main'
Simplify dependencies for jfjoch_writer

See merge request jungfraujoch/nextgendcu!63
2024-05-20 18:05:36 +02:00
1b297babe9 Simplify dependencies for jfjoch_writer 2024-05-20 18:05:36 +02:00
adc7aa7c7d Merge branch '2405-dependencies-3' into 'main'
Build RPM for DKMS driver

See merge request jungfraujoch/nextgendcu!62
2024-05-20 11:40:30 +02:00
27e17c316d Build RPM for DKMS driver 2024-05-20 11:40:30 +02:00
d7d66dc85c Merge branch '2405-dependencies-2' into 'main'
Minor fixes for dependencies

See merge request jungfraujoch/nextgendcu!61
2024-05-19 14:09:00 +02:00
2a8fc3a466 Minor fixes for dependencies 2024-05-19 14:09:00 +02:00
e4acd93b88 Merge branch '2405-dependencies' into 'main'
Change the way dependencies are handled

See merge request jungfraujoch/nextgendcu!60
2024-05-17 19:19:17 +02:00
4ca397bd42 Change the way dependencies are handled 2024-05-17 19:19:17 +02:00
4d780c1dda Merge branch '2405-zmq-preview' into 'main'
1.0.0-rc2: Fixes in preview

See merge request jungfraujoch/nextgendcu!59
2024-05-16 17:41:47 +02:00
949f693311 1.0.0-rc2: Fixes in preview 2024-05-16 17:41:47 +02:00
575 changed files with 72652 additions and 44269 deletions

329
.fpga_gitlab-ci.yml Normal file
View File

@@ -0,0 +1,329 @@
stages:
- build
- test
- synthesis
- release
build:x86:gcc:
stage: build
variables:
CC: gcc
CXX: g++
tags:
- gcc
- x86
needs: []
script:
- mkdir build
- cd build
- source /opt/rh/gcc-toolset-12/enable
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j48
build:x86:gcc_writer:
stage: build
variables:
CC: gcc
CXX: g++
tags:
- gcc
- x86
needs: []
script:
- mkdir build
- cd build
- source /opt/rh/gcc-toolset-12/enable
- cmake -DCMAKE_BUILD_TYPE=Release -DJFJOCH_WRITER_ONLY=ON ..
- make -j48
build:x86:driver:
stage: build
variables:
CC: gcc
CXX: g++
tags:
- gcc
- x86
needs: []
script:
- cd fpga/pcie_driver
- make
build:x86:python_client:
stage: build
needs: []
tags:
- python
script:
- cd python-client
- python3 setup.py sdist bdist_wheel
- mv dist/* ..
artifacts:
paths:
- jfjoch_client-*whl
- jfjoch_client-*tar.gz
expire_in: 1 week
build:x86:vitis_hls:
stage: build
tags:
- x86
needs: []
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "push"
changes:
- fpga/hls/*
- fpga/hdl/*
- fpga/scripts/*
- fpga/xdc/*
- fpga/microblaze/*
- fpga/include/jfjoch_fpga.h
script:
- source /opt/Xilinx/Vitis_HLS/2022.1/settings64.sh
- mkdir build
- cd build
- /usr/bin/cmake ..
- make hls
build:x86:frontend:
stage: build
tags:
- x86
needs: []
script:
- mkdir build
- cd build
- /usr/bin/cmake ..
- make frontend
- cd ../frontend/dist
- tar czf ../../jfjoch_frontend.tar.gz *
artifacts:
paths:
- jfjoch_frontend.tar.gz
expire_in: 1 week
build:x86:rpm:
stage: build
tags:
- x86
needs: []
script:
- mkdir build
- cd build
- source /opt/rh/gcc-toolset-12/enable
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make frontend
- make -j48 package
- mv *.rpm ..
artifacts:
paths:
- "*.rpm"
expire_in: 1 week
test:x86:gcc:
stage: test
timeout: 90m
variables:
CTEST_OUTPUT_ON_FAILURE: 1
CC: gcc
CXX: g++
needs: ["build:x86:gcc"]
dependencies: []
tags:
- gcc
- x86
script:
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j48 jfjoch_test HDF5DatasetWriteTest
- cd tests
- ./jfjoch_test -r junit -o report.xml
- cd ../tools
- ./HDF5DatasetWriteTest ../../tests/test_data/compression_benchmark.h5
artifacts:
expire_in: 1 week
reports:
junit: build/tests/report.xml
test:x86:crystfel:
stage: test
timeout: 90m
variables:
CTEST_OUTPUT_ON_FAILURE: 1
CC: gcc
CXX: g++
needs: ["build:x86:gcc"]
dependencies: []
tags:
- gcc
- x86
- crystfel
script:
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j8 HDF5DatasetWriteTest
- cd ../tests/crystfel
- HDF5DATASET_WRITE_TEST_IMAGES_PER_FILE=0 ../../build/tools/HDF5DatasetWriteTest ../../tests/test_data/compression_benchmark.h5 10
- indexamajig -i writing_test.lst -g jf4m.geom -o x.stream --indexing=xgandalf
test:x86:xds_durin:
stage: test
timeout: 90m
variables:
CTEST_OUTPUT_ON_FAILURE: 1
CC: gcc
CXX: g++
needs: ["build:x86:gcc"]
dependencies: []
tags:
- gcc
- x86
- xds
script:
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j8 HDF5DatasetWriteTest
- cd ../tests/xds_durin
- HDF5DATASET_WRITE_TEST_IMAGES_PER_FILE=0 ../../build/tools/HDF5DatasetWriteTest ../../tests/test_data/compression_benchmark.h5 25
- xds_par |grep -a1 ISa |tail -n1
test:x86:xds_neggia:
stage: test
timeout: 90m
variables:
CTEST_OUTPUT_ON_FAILURE: 1
CC: gcc
CXX: g++
needs: ["build:x86:gcc"]
dependencies: []
tags:
- gcc
- x86
- xds
script:
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j8 HDF5DatasetWriteTest
- cd ../tests/xds_neggia
- HDF5DATASET_WRITE_TEST_IMAGES_PER_FILE=0 ../../build/tools/HDF5DatasetWriteTest ../../tests/test_data/compression_benchmark.h5 25
- xds_par |grep -a1 ISa |tail -n1
test:x86:xia2.ssx:
stage: test
timeout: 90m
variables:
CTEST_OUTPUT_ON_FAILURE: 1
CC: gcc
CXX: g++
needs: ["build:x86:gcc"]
dependencies: []
tags:
- gcc
- x86
- xds
script:
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- mkdir -p dials_test
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j8 HDF5DatasetWriteTest
- cd ../dials_test
- ../build/tools/HDF5DatasetWriteTest ../tests/test_data/compression_benchmark.h5 100
- source /usr/local/dials-v3-17-0/dials_env.sh
- xia2.ssx image=writing_test_master.h5 space_group=P43212 unit_cell=78.551,78.551,36.914,90.000,90.000,90.000
synthesis:vivado_pcie_100g:
stage: synthesis
dependencies: []
variables:
CC: gcc
CXX: g++
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "push"
changes:
- fpga/hls/*
- fpga/hdl/*
- fpga/scripts/*
- fpga/xdc/*
- fpga/pcie_driver/jfjoch_fpga.h
- if: $CI_COMMIT_MESSAGE =~ /^FPGA/
allow_failure: true
tags:
- vivado
retry: 2
artifacts:
paths:
- "jfjoch_fpga_pcie_100g.mcs"
expire_in: 1 week
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/Xilinx/Vivado/2022.1/settings64.sh
- touch jfjoch_fpga_pcie_100g.mcs
- mkdir -p build
- cd build
- /usr/bin/cmake ..
- make -j4 pcie_100g
- mv fpga/jfjoch_fpga_pcie_100g.mcs ..
needs: ["build:x86:gcc", "test:x86:gcc"]
synthesis:vivado_pcie_8x10g:
stage: synthesis
dependencies: []
variables:
CC: gcc
CXX: g++
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "push"
changes:
- fpga/hls/*
- fpga/hdl/*
- fpga/scripts/*
- fpga/xdc/*
- fpga/pcie_driver/jfjoch_fpga.h
- if: $CI_COMMIT_MESSAGE =~ /^FPGA/
allow_failure: true
tags:
- vivado
retry: 2
artifacts:
paths:
- "jfjoch_fpga_pcie_8x10g.mcs"
expire_in: 1 week
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/Xilinx/Vivado/2022.1/settings64.sh
- touch jfjoch_fpga_pcie_8x10g.mcs
- mkdir -p build
- cd build
- /usr/bin/cmake ..
- make -j4 pcie_8x10g
- mv fpga/jfjoch_fpga_pcie_8x10g.mcs ..
needs: [ "build:x86:gcc", "test:x86:gcc" ]
release:
stage: release
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual
tags:
- x86
dependencies:
- synthesis:vivado_pcie_8x10g
- synthesis:vivado_pcie_100g
- build:x86:python_client
- build:x86:frontend
- build:x86:rpm
script:
- bash gitlab_upload_release.sh

View File

@@ -1,7 +1,6 @@
stages:
- build
- test
- synthesis
- release
build:x86:gcc:
@@ -16,7 +15,7 @@ build:x86:gcc:
script:
- mkdir build
- cd build
- source /opt/rh/gcc-toolset-12/enable
- source /opt/rh/gcc-toolset-12/enable
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make -j48
@@ -34,7 +33,7 @@ build:x86:gcc_writer:
- cd build
- source /opt/rh/gcc-toolset-12/enable
- cmake -DCMAKE_BUILD_TYPE=Release -DJFJOCH_WRITER_ONLY=ON ..
- make -j48 jfjoch
- make -j48
build:x86:driver:
stage: build
@@ -45,37 +44,24 @@ build:x86:driver:
- gcc
- x86
needs: []
artifacts:
paths:
- "jfjoch_driver.tar.gz"
expire_in: 1 week
script:
- cd fpga/pcie_driver
- make
- bash pack.sh
- mv jfjoch_driver.tar.gz ../..
build:x86:vitis_hls:
build:x86:python_client:
stage: build
tags:
- x86
needs: []
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "push"
changes:
- fpga/hls/*
- fpga/hdl/*
- fpga/scripts/*
- fpga/xdc/*
- fpga/microblaze/*
- fpga/include/jfjoch_fpga.h
tags:
- python
script:
- source /opt/Xilinx/Vitis_HLS/2022.1/settings64.sh
- mkdir build
- cd build
- /usr/bin/cmake ..
- make hls
- cd python-client
- python3 setup.py sdist bdist_wheel
- mv dist/* ..
artifacts:
paths:
- jfjoch_client-*whl
- jfjoch_client-*tar.gz
expire_in: 1 week
build:x86:frontend:
stage: build
@@ -83,16 +69,35 @@ build:x86:frontend:
- x86
needs: []
script:
- cd frontend_ui
- npm install
- npm run build
- mkdir build
- cd build
- /usr/bin/cmake ..
- make frontend
- cd ../frontend/dist
- tar czf ../../jfjoch_frontend.tar.gz *
artifacts:
paths:
- jfjoch_frontend.tar.gz
expire_in: 1 week
build:x86:rpm:
stage: build
tags:
- x86
needs: []
script:
- mkdir build
- cd build
- source /opt/rh/gcc-toolset-12/enable
- cmake -DCMAKE_BUILD_TYPE=Release ..
- make frontend
- make -j48 package
- mv *.rpm ..
artifacts:
paths:
- "*.rpm"
expire_in: 1 week
test:x86:gcc:
stage: test
timeout: 90m
@@ -106,7 +111,7 @@ test:x86:gcc:
- gcc
- x86
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
@@ -134,7 +139,7 @@ test:x86:crystfel:
- x86
- crystfel
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
@@ -157,7 +162,7 @@ test:x86:xds_durin:
- x86
- xds
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- cd build
- cmake -DCMAKE_BUILD_TYPE=Release ..
@@ -203,7 +208,7 @@ test:x86:xia2.ssx:
- x86
- xds
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/rh/gcc-toolset-12/enable
- mkdir -p build
- mkdir -p dials_test
- cd build
@@ -214,72 +219,6 @@ test:x86:xia2.ssx:
- source /usr/local/dials-v3-17-0/dials_env.sh
- xia2.ssx image=writing_test_master.h5 space_group=P43212 unit_cell=78.551,78.551,36.914,90.000,90.000,90.000
synthesis:vivado_pcie_100g:
stage: synthesis
dependencies: []
variables:
CC: gcc
CXX: g++
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "push"
allow_failure: true
changes:
- fpga/hls/*
- fpga/hdl/*
- fpga/scripts/*
- fpga/xdc/*
- fpga/pcie_driver/jfjoch_fpga.h
tags:
- vivado
artifacts:
paths:
- "jfjoch_fpga_pcie_100g.mcs"
expire_in: 1 week
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/Xilinx/Vivado/2022.1/settings64.sh
- touch jfjoch_fpga_pcie_100g.mcs
- mkdir -p build
- cd build
- /usr/bin/cmake ..
- make -j4 pcie_100g
- mv fpga/jfjoch_fpga_pcie_100g.mcs ..
needs: ["build:x86:gcc", "test:x86:gcc"]
synthesis:vivado_pcie_8x10g:
stage: synthesis
dependencies: []
variables:
CC: gcc
CXX: g++
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_PIPELINE_SOURCE == "push"
changes:
- fpga/hls/*
- fpga/hdl/*
- fpga/scripts/*
- fpga/xdc/*
- fpga/pcie_driver/jfjoch_fpga.h
allow_failure: true
tags:
- vivado
artifacts:
paths:
- "jfjoch_fpga_pcie_8x10g.mcs"
expire_in: 1 week
script:
- source /opt/rh/gcc-toolset-12/enable
- source /opt/Xilinx/Vivado/2022.1/settings64.sh
- touch jfjoch_fpga_pcie_8x10g.mcs
- mkdir -p build
- cd build
- /usr/bin/cmake ..
- make -j4 pcie_8x10g
- mv fpga/jfjoch_fpga_pcie_8x10g.mcs ..
needs: [ "build:x86:gcc", "test:x86:gcc" ]
release:
stage: release
rules:
@@ -288,20 +227,8 @@ release:
tags:
- x86
dependencies:
- synthesis:vivado_pcie_8x10g
- synthesis:vivado_pcie_100g
- build:x86:python_client
- build:x86:frontend
- build:x86:driver
- build:x86:rpm
script:
- export PACKAGE_VERSION=`head -n1 VERSION`
- export PACKAGE_REGISTRY_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/jungfraujoch/${PACKAGE_VERSION}"
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file jfjoch_driver.tar.gz "${PACKAGE_REGISTRY_URL}/jfjoch_driver.tar.gz"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file jfjoch_frontend.tar.gz "${PACKAGE_REGISTRY_URL}/jfjoch_frontend.tar.gz"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file jfjoch_fpga_pcie_100g.mcs "${PACKAGE_REGISTRY_URL}/jfjoch_fpga_pcie_100g.mcs"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file jfjoch_fpga_pcie_8x10g.mcs "${PACKAGE_REGISTRY_URL}/jfjoch_fpga_pcie_8x10g.mcs"'
- >
release-cli create --name "Release $PACKAGE_VERSION" --tag-name $PACKAGE_VERSION
--assets-link "{\"name\":\"jfjoch_driver.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/jfjoch_driver.tar.gz\"}"
--assets-link "{\"name\":\"jfjoch_frontend.tar.gz\",\"url\":\"${PACKAGE_REGISTRY_URL}/jfjoch_frontend.tar.gz\"}"
--assets-link "{\"name\":\"jfjoch_fpga_pcie_8x10g.mcs\",\"url\":\"${PACKAGE_REGISTRY_URL}/jfjoch_fpga_pcie_8x10g.mcs\"}"
--assets-link "{\"name\":\"jfjoch_fpga_pcie_100g.mcs\",\"url\":\"${PACKAGE_REGISTRY_URL}/jfjoch_fpga_pcie_100g.mcs\"}"
- bash gitlab_upload_release.sh

View File

@@ -7,6 +7,8 @@ stages:
mirror-psi:
stage: mirror
tags:
- docker-shared
script:
- SOURCE_REPOSITORY=https://$PSI_PROJECT_GIT_USRNAME:$PSI_PROJECT_GIT_TOKEN@gitlab.psi.ch/jungfraujoch/nextgendcu.git
- DESTINATION_REPOSITORY=https://$MIV_PROJECT_GIT_USRNAME:$MIV_PROJECT_GIT_TOKEN@gitlab.maxiv.lu.se/jungfraujoch/nextgendcu.git

View File

@@ -1,7 +1,9 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.19)
PROJECT(Jungfraujoch VERSION 1.0 LANGUAGES C CXX)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
FILE(STRINGS VERSION JFJOCH_VERSION)
PROJECT(jfjoch VERSION 1.0.0 LANGUAGES C CXX)
SET(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED True)
@@ -9,8 +11,31 @@ SET(CMAKE_CXX_STANDARD_REQUIRED True)
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -Wno-deprecated-enum-enum-conversion")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -march=native -mtune=native")
SET(BUILD_SHARED_LIBS OFF)
SET(BUILD_TESTING OFF)
SET(ZSTD_LEGACY_SUPPORT OFF)
SET(ZSTD_MULTITHREAD_SUPPORT OFF)
SET(ZSTD_BUILD_PROGRAMS OFF)
SET(ZSTD_BUILD_SHARED OFF)
SET(SLS_USE_RECEIVER OFF)
SET(SLS_USE_RECEIVER_BINARIES OFF)
SET(SLS_BUILD_SHARED_LIBRARIES OFF)
SET(BUILD_FAST_INDEXER OFF)
SET(BUILD_FAST_INDEXER_STATIC ON)
SET(HDF5_ENABLE_SZIP_SUPPORT OFF)
SET(HDF5_ENABLE_SZIP_ENCODING OFF)
SET(HDF5_BUILD_EXAMPLES OFF)
SET(HDF5_BUILD_CPP_LIB OFF)
SET(HDF5_ENABLE_Z_LIB_SUPPORT OFF)
SET(HDF5_EXTERNALLY_CONFIGURED 1)
SET(jbig OFF)
SET(zstd OFF)
SET(lzma OFF)
INCLUDE(CheckLanguage)
CHECK_LANGUAGE(CUDA)
@@ -37,10 +62,25 @@ CHECK_INCLUDE_FILE(numa.h HAS_NUMA_H)
include(FetchContent)
FetchContent_Declare(tiff
GIT_REPOSITORY https://github.com/fleon-psi/libtiff
GIT_TAG v4.6.0
EXCLUDE_FROM_ALL)
FetchContent_Declare(hdf5
GIT_REPOSITORY https://github.com/HDFGroup/hdf5/
GIT_TAG hdf5_1.14.4.2
GIT_SHALLOW 1
EXCLUDE_FROM_ALL)
SET(PISTACHE_USE_CONTENT_ENCODING_DEFLATE ON)
SET(PISTACHE_BUILD_TESTS OFF)
FetchContent_Declare(
pistache_http
GIT_REPOSITORY https://github.com/fleon-psi/pistache
GIT_TAG 51553b92cc7bb25ac792462722ddd4fae33d14b1
GIT_TAG 784955df8bbef471924d1631606f0f2a2f93d570
EXCLUDE_FROM_ALL
)
FetchContent_Declare(
@@ -48,6 +88,7 @@ FetchContent_Declare(
GIT_REPOSITORY https://github.com/facebook/zstd
GIT_TAG 794ea1b0afca0f020f4e57b6732332231fb23c70
SOURCE_SUBDIR build/cmake
EXCLUDE_FROM_ALL
)
FetchContent_Declare(
@@ -60,9 +101,10 @@ FetchContent_Declare(
catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2
GIT_TAG 4e8d92b
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(pistache_http zstd sls_detector_package catch2)
FetchContent_MakeAvailable(pistache_http zstd sls_detector_package catch2 hdf5 tiff)
ADD_SUBDIRECTORY(jungfrau)
ADD_SUBDIRECTORY(compression)
@@ -73,8 +115,8 @@ ADD_SUBDIRECTORY(frame_serialize)
ADD_SUBDIRECTORY(detector_control)
IF (JFJOCH_WRITER_ONLY)
MESSAGE(STATUS "Compiling HDF5 writer only")
SET(jfjoch_executables jfjoch_writer)
ELSE()
ADD_SUBDIRECTORY(image_pusher)
ADD_SUBDIRECTORY(broker)
ADD_SUBDIRECTORY(fpga)
ADD_SUBDIRECTORY(acquisition_device)
@@ -83,16 +125,61 @@ ELSE()
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(preview)
SET(jfjoch_executables jfjoch_broker jfjoch_writer jfjoch_test CompressionBenchmark HDF5DatasetWriteTest jfjoch_udp_simulator sls_detector_put sls_detector_get)
ENDIF()
ADD_CUSTOM_COMMAND(OUTPUT frontend_ui/build/index.html
COMMAND npm run build
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/frontend_ui)
ADD_CUSTOM_TARGET(frontend DEPENDS frontend_ui/build/index.html)
IF (NOT JFJOCH_WRITER_ONLY)
ADD_CUSTOM_COMMAND(OUTPUT frontend/dist/index.html
COMMAND npm install
COMMAND npm run build
COMMAND npm run redocly
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/frontend)
ADD_CUSTOM_TARGET(frontend DEPENDS frontend/dist/index.html)
ADD_CUSTOM_TARGET(jfjoch DEPENDS ${jfjoch_executables})
ADD_CUSTOM_TARGET(update_version
COMMAND bash update_version.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/fpga/pcie_driver/
DESTINATION /usr/src/jfjoch-${JFJOCH_VERSION}
COMPONENT driver-dkms
FILES_MATCHING PATTERN "dkms.conf")
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/fpga/pcie_driver/
DESTINATION /usr/src/jfjoch-${JFJOCH_VERSION}/src
COMPONENT driver-dkms
FILES_MATCHING PATTERN "*.c" PATTERN "*.h" PATTERN "Makefile")
FILE(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/frontend/dist/)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/frontend/dist/ DESTINATION share/jfjoch/frontend COMPONENT jfjoch )
ENDIF()
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX /opt/jfjoch CACHE PATH "Default directory" FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Set Package Name
set(CPACK_PACKAGE_NAME "jfjoch")
SET(CPACK_COMPONENTS_ALL jfjoch writer driver-dkms)
SET(CPACK_GENERATOR RPM)
SET(CPACK_RPM_COMPONENT_INSTALL ON)
SET(CPACK_RPM_MAIN_COMPONENT jfjoch)
SET(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
SET(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
SET(CPACK_RPM_PACKAGE_VERSION ${JFJOCH_VERSION})
SET(CPACK_RPM_PACKAGE_RELEASE 1)
SET(CPACK_RPM_PACKAGE_SUMMARY "Jungfraujoch data acquisition system")
SET(CPACK_RPM_PACKAGE_DESCRIPTION "Jungfraujoch")
SET(CPACK_RPM_DRIVER-DKMS_PACKAGE_REQUIRES "dkms, gcc, bash, sed")
SET(CPACK_RPM_DRIVER-DKMS_PACKAGE_ARCHITECTURE "noarch")
SET(CPACK_RPM_DRIVER-DKMS_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/fpga/pcie_driver/postinstall.sh)
SET(CPACK_RPM_DRIVER-DKMS_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/fpga/pcie_driver/preuninstall.sh)
SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/src)
# Set The Vendor Name
SET(CPACK_PACKAGE_VENDOR "Paul Scherrer Institut")
# Set The License Information
SET(CPACK_RPM_PACKAGE_LICENSE "Proprietary")
INCLUDE(CPack)

140
DEPLOYMENT.md Normal file
View File

@@ -0,0 +1,140 @@
# Deployment of Jungfraujoch
To deploy Jungfraujoch, one needs to follow four steps:
1. Install main Jungfraujoch code and frontend web interface
2. Flash the U55C FPGA card with a proper image and install Linux kernel driver
3. Install Jungfraujoch writer
4. Install Python OpenAPI client
Installation procedure depend a lot on the operating system. For RedHat Enterprise Linux 8, Rocky 8, or compatible
installation can be done with prebuilt RPMs and is relatively straightforward. For other systems one needs to build
software from source. Both ways will be presented.
## Install main Jungfraujoch code and frontend web interface
On RHEL 8 systems there is a `jfjoch-<version>-1.el8.x86_64.rpm` that needs to be installed and contains all the necessary software and web interface.
On other OSes one needs to compile Jungfraujoch from source (from the repo directory):
```
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=<directory to install>
$ make
$ sudo make install
```
For manual installation, we recommend to use non-standard directory (like `/opt/jfjoch`), to facilitate upgrades and removal.
Frontend web user interface has to be built separately with:
```
$ cd build
$ make frontend
```
Frontend files (.html and .js) will be placed in `frontend/dist` (outside of `build/` directory!) and has to be copied to a general location, e.g. `/usr/local/jfjoch/frontend` or `/opt/jfjoch/frotend`.
## Flash the U55C FPGA card with a proper image and install Linux kernel driver.
### Firmware flashing
1. Check that the card is detected by OS with "lspci |grep Xilinx" and check the PCIe bus/device/function (BDF) number, `11:00.0` in this case:
```
$ lspci |grep Xilinx
23:00.0 Processing accelerators: Xilinx Corporation Device 3450 (rev 2)
```
Note the device number `3450` that identifies Jungfraujoch device (Jungfraujoch pass is 3450 m above sea level) and `rev 2` identifying release of the firmware.
2. Check the speed of the card, that it is detected as PCIe Gen4x8 device (needs to be done as root, otherwise configuration details are not given):
```
$ sudo lspci -vv -s <PCIe slot number>
23:00.0 Processing accelerators: Xilinx Corporation Device 3450
(...)
LnkSta: Speed 16GT/s (ok), Width x8 (ok)
(...)
```
3. Download the MCS image from release files or build it using Vivado (WARNING! building time can be about 8 hours and doesn't allways reach correct timing).
4. Flash the card with `xbflash.qspi` tool (part of Jungfraujoch). For fresh card use:
```
sudo xbflash.qspi --primary <path to MCS file> --card <PCIe slot from above> --bar-offset 0x1f06000
```
For card that was already flashed with Jungfraujoch images:
```
sudo xbflash.qspi --primary <path to MCS file> --card <PCIe slot from above>
```
It is necessary to confirm the operation by pressing `Y` key or one can add `--force` option to avoid confirmation.
It is safe to run multiple flashing processes in parallel for different cards, for example in separate screen sessions.
5. Cold reboot:
```
sudo ipmitool chassis power cycle
```
### Install PCIe driver
For first run it is though recommended to try the driver without installing to the kernel directory:
```
$ cd fpga/pcie_driver
$ make
$ sudo insmod jfjoch.ko
```
Check with `dmesg` that the device was properly found:
```
$ dmesg |grep jfjoch
[ 431.624933] jfjoch 0000:23:00.0: enabling device (0140 -> 0142)
[ 431.919147] misc jfjoch0: Jungfraujoch FPGA loaded with FW build: 5610030a
```
If things work, it is recommended to install the driver with DKMS, so it is rebuilt for kernel updates.
On RHEL 8 you can install prebuilt RPM provided in the Gitlab package registry. On other systems follow procedure in
[PCIe driver](fpga/pcie_driver/README.md).
NOTE: Driver installation procedure on non-RHEL 8 systems is not well understood/optimized at the moment.
NOTE: In case driver is included in the init RAM-disk image, it is necessary to rebuild the RAM-disk if driver is updated:
```
$ sudo dracut -f
```
### Configure network
Configure switch according to [FPGA network guide](fpga/NETWORK.md) - specifically set manual speed and turn off auto-negotiation
for the port used to connect U55C card and connect card to switch.
### Running Jungfraujoch software
Main Jungfraujoch service is called `jfjoch_broker`. It is responsible for handling data from FPGAs, doing processing, analysis, compression and sending images on ZeroMQ output.
It is recommended to run the service as `systemd` service.
`jfjoch_broker` takes two parameters: JSON configuration file and HTTP port (default is 5232).
Example JSON files are placed in [etc](etc) folder. JSON file format is also explained in the OpenAPI definition, as `jfjoch_settings` data structure.
When running the service can be accessed via HTTP interface from a web browser for configuration and monitoring.
To prepare the configuration file one also needs to reference calibration files: gain files for PSI JUNGFRAU and trim-bit files for PSI EIGER.
These need to be obtained from the PSI Detector Group.
### Card verification
To test that FPGA board is working properly without access to a JUNGFRAU detector, you can use `jfjoch_action_test` tool.
For example to simulate 10M pixel system with 4 FPGA cards and 200k images on a 2 CPU system with 2 GPUs:
```
jfjoch_action_test ~/nextgendcu/ -m20 -s4 -i 200000 -Pn2g2
```
Or 1M pixel system with one FPGA card:
```
jfjoch_action_test ~/nextgendcu/ -m2 -s1 -i 200000
```
## Install Jungfraujoch writer
Jungfraujoch writer is an additional service, that can connect to `jfjoch_broker` ZeroMQ interface and writes files according to NeXus/NXmx HDF5 standard.
At the moment it is better to have a separate machine, with access to distributed file system, for writing images.
Writer can be installed with a dedicated RPM file or compiled from source. For compilation, you can use the following commands:
```
mkdir build
cd build
cmake -DJFJOCH_WRITER_ONLY=ON -DCMAKE_INSTALL_PREFIX=<directory to install> ..
make jfjoch
```
## Install Jungfraujoch Python client
This is under development.

View File

@@ -1,20 +0,0 @@
# MAX IV docker config
FROM harbor.maxiv.lu.se/dockerhub/library/ubuntu:22.04
RUN set -ex; \
apt-get update; \
apt-get install -y pkg-config git cmake make g++ libhdf5-dev libczmq-dev;\
rm -rf /var/lib/apt/lists/*
COPY . /usr/src/nextgendcu
RUN set -ex; \
cd /usr/src/nextgendcu; \
mkdir build; \
cd build; \
cmake -DJFJOCH_WRITER_ONLY=ON .. ;\
make -j8 install;
ENTRYPOINT ["/opt/jfjoch/bin/jfjoch_writer"]

55
HARDWARE.md Normal file
View File

@@ -0,0 +1,55 @@
# Hardware requirements
Operating Jungfraujoch requires the following:
1. High performance server
2. FPGA board(s) installed in the server
3. (optionally) GPU boards
4. (optionally) 100G switch to connect FPGA and the detector
Unfortunately, at the moment it is not possible to purchase server configuration from a major vendor that would include
AMD FPGA boards. Therefore, the two has to be purchases separately. This might have impact on the warranty for the hardware
and has to be clarified with the vendor. PSI only supports the system on the best effort basis and doesn't take any responsibility
for warranty limitations for operating FPGA boards in the server. Having said this - we didn't encounter any hardware issues so far.
## High performance server
PSI is using HPE DL380 Gen11 servers are the moment to operate Jungfraujoch systems. However, this is because of general
preference for this vendor, there is no Jungfraujoch-specific reason to buy from this vendor. We do expect that system
from any other vendor with similar specification should work as well.
At PSI, we use the following configuration of HPE DL380 Gen11 to operate 9M pixel detectors at 2 kHz is as follows:
* 2 x Intel Xeon 8558P
* 512 GB RAM
* 2 x Nvidia L4 GPU (for indexing)
* 1 x Nvidia Connect-X 6 200G ethernet/IB network (for outgoing traffic; this can be substituted according to facility needs)
* Copper 1G/10G network
### PCI slots
When ordering the system it is important to ensure enough PCIe cards can be accommodated in the system.
In case of our system we need to put at least seven PCIe cards: 4 x FPGA, 2x GPU, 1x network
Note - for FPGA x8 lane electrically/x16 lane mechanically PCIe slots are OK.
## FPGA
Jungfraujoch is built for [AMD/Xilinx U55C](https://www.amd.com/en/products/accelerators/alveo/u55c/a-u55c-p00g-pq-g.html)
(A-U55C-P00G-PQ-G) card. Other FPGA cards are currently not supported.
Single U55C card supports roughly 5 detector modules (2.5M pixels) at 2 kHz and 10 detector modules (5M pixels) at 1 kHz.
For detectors operating at lower frame rates (e.g., 100 Hz) larger detectors can be supported by a single U55C card, though it requires
using TX delay functionality in the detector.
## GPUs
Operating fast-feedback indexer code requires operation of a graphic processing unit from Nvidia.
For practical reasons, i.e. power consumption and cost, we choose inference grade card Nvidia L4.
In the past we have also used T4 cards. So, in principle any recent CUDA compatible GPU should work.
## Network switch
Small detectors (up to 4M pixel) can be in principle operated without switch. In this case one needs `8x10g` variant
of the Jungfraujoch FPGA image, which allows to directly connect 4 JUNGFRAU modules to one U55C card.
Such configuration is however
impractical for larger systems or more complex deployments, like multiple detectors operated from one Jungfraujochs server.
In this case one needs a network switch.
We currently use Nvidia/Mellanox SN2100 switch, though there is no reason not to use other models/other vendors.
For switches with only 100G ports it is important to ensure, that these can be split into 4x10G ports to connect the detector.

View File

@@ -1,56 +1,68 @@
# Jungfraujoch
Application to receive data from the JUNGFRAU detector.
Application to receive data from the PSI JUNGFRAU and EIGER detectors.
Citation: F. Leonarski, M. Bruckner, C. Lopez-Cuenca, A. Mozzanica, H.-C. Stadler, Z. Matej, A. Castellane, B. Mesnet, J. Wojdyla, B. Schmitt and M. Wang "Jungfraujoch: hardware-accelerated data-acquisition system for kilohertz pixel-array X-ray detectors" (2023), J. Synchrotron Rad., 30, 227-234 [doi:10.1107/S1600577522010268](https://doi.org/10.1107/S1600577522010268).
The project is supported by :
* Innosuisse via Innovation Project "NextGenDCU high data rate acquisition system for X-ray detectors in structural biology applications" (101.535.1 IP-ENG; Apr 2023 - Sep 2025).
* ETH Domain via Open Research Data Contribute project (Jan - Dec 2023)
* AMD University Program with donation of licenses of Ethernet IP cores and Vivado software
## License
Operating Jungfraujoch requires license from the Paul Scherrer Institute.
Specifically, non-profit research facilities operating PSI JUNGFRAU and PSI EIGER detectors are granted the license to use the
code and binary images within their facilities, as well as to modify the code according to their needs.
Sharing the code requires explicit permission from the Paul Scherrer Institute.
## Hardware requirements
1. JUNGFRAU detector (optimally 4M with 2 kHz enabled read-out boards)
2. Server system with AMD/Xilinx Alveo U55C cards and optionally Nvidia GPUs
## Compatible detectors
Currently, Jungfraujoch supports PSI JUNGFRAU and PSI EIGER detectors.
At the moment only U55C card is supported by Jungfraujoch.
Nvidia L4 GPU is recommended and used for performance tuning.
## Hardware requirements
See [hardware requirements](HARDWARE.md) documentation.
## FPGA bitstream
Instructions see [here](fpga/README.md)
## Software
Recommended operating system is Red Hat Enterprise Linux (RHEL) / Rocky Linux versions 8 and 9 (both are tested on a regular basis).
## Detector
Jungfraujoch supports PSI JUNGFRAU and EIGER detectors. Jungfruajoch controls the detector via statically compiled `slsDetectorPackage` into its source code.
It is important that detector firmware has to match `slsDetectorPackage` version used in Jungfraujoch (8.0.2 at the moment).
See [PSI Detector group website](https://www.psi.ch/en/lxn/software-releases) for details.
## Operating system
Recommended operating system is Red Hat Enterprise Linux (RHEL) / Rocky Linux versions 8.
For this operating system we provide RPMs with pre-built binaries to simplify deployment.
We do also operate one of the systems with Rocky 9 without issues.
Running Jungfraujoch on Red Hat Enterprise Linux 7 is currently not tested and not recommended,
but likely possible with providing multiple packages from external repositories.
but likely possible with providing some packages from external repositories.
There are some limited tests with recent Ubuntu and Fedora distributions, though these are not systematic.
Other linux platforms should work, but no tests were done so far.
### Dependencies
### Software dependencies
Required:
* C++20 compiler and C++20 standard library; recommended GCC 11+ or clang 14+ (Intel OneAPI, AMD AOCC)
* CMake version 3.21 or newer + GNU make tool
* HDF5 library version 1.10 or newer
* TIFF library (with C++ headers)
* JPEG library (turbo-jpeg is also OK)
* CMake version 3.21 or newer + GNU make tool
* JPEG library (turbo-jpeg is OK)
Optional:
* CUDA compiler version 11 or newer - required for MX fast feedback indexer
* NUMA library - to pin threads to nodes/CPUs
* Node.js - to make frontend
Automatically downloaded by CMake:
Automatically downloaded by CMake and statically linked:
* SLS Detector Package - see [github.com/slsdetectorgroup/slsDetectorPackage](https://github.com/slsdetectorgroup/slsDetectorPackage)
* Zstandard (Facebook) - see [github.com/facebook/zstd](https://github.com/facebook/zstd)
* Pistache webserver - see [github.com/pistacheio/pistache](https://github.com/pistacheio/pistache)
* Fast feedback indexer (Hans-Christian Stadler, PSI) - see [github.com/paulscherrerinstitute/fast-feedback-indexer](https://github.com/paulscherrerinstitute/fast-feedback-indexer)
* Catch2 testing library - see [github.com/catchorg/Catch2](https://github.com/catchorg/Catch2)
* HDF5 library - see [github.com/HDFGroup/hdf5](https://github.com/HDFGroup/hdf5)
* TIFF library - see [gitlab.com/libtiff/libtiff](https://gitlab.com/libtiff/libtiff)
Please follow the link provided above to check for LICENSE file
Please follow the link provided above to check for LICENSE file. Building code with dependencies above requires access from the build system to github.com.
Directly included in the repository:
* JSON parser/writer from N. Lohmann - see [github.com/nlohmann/json](https://github.com/nlohmann/json)
@@ -64,6 +76,9 @@ Directly included in the repository:
For license check LICENSE file in respective directory
## Installation guide
Follow [Installation guide](INSTALL.md).
### Software components
* `jfjoch_broker` in `broker` - main service running on the Jungfraujoch server, responsible for control of the detector and data acquisition;
@@ -71,32 +86,6 @@ For license check LICENSE file in respective directory
* `jfjoch_writer` in `writer` - HDF5 writer; HDF5 writer is designed to work on the same or separate server system. It has rather limited requirements in terms of performance and memory.
The goal is to separate data acquisition node with custom FPGA hardware and file system node with stronger security/stability requirements. See [details](writer/README.md).
### Compilation
Use the following commands:
```
mkdir build
cd build
cmake ..
make jfjoch
```
### Compilation (writer only)
In most use cases it is better to have a separate machine, with access to distributed file system, for writing.
Such machine needs only a HDF5 writer service with fewer dependencies. For compilation use the following commands:
```
mkdir build
cd build
cmake -DJFJOCH_WRITER_ONLY=ON ..
make jfjoch
```
## Versions
**FPGA release** is as hexadecimal number indicted in the [jfjoch_fpga.h](fpga/pcie_driver/jfjoch_fpga.h) as JFJOCH_FPGA_RELEASE constant. This number indicated breaking changes in the FPGA firmware interface.
FPGA release has to be consistent between FPGA firmware, kernel driver and `jfjoch_broker` - both kernel driver and software won't work in case of version mismatch.
Commits to `main` branch with the same FPGA release version are OK to mix between components.
## Web Frontend
Jungfraujoch is equipped with React-based web frontend for user-friendly experience. Frontend has the following options:
* Presenting current state of the detector
@@ -105,16 +94,10 @@ Jungfraujoch is equipped with React-based web frontend for user-friendly experie
* JUNGFRAU calibration numbers
* Configuring the detector, as well as pedestal/initialization operations
Frontend is written in TypeScript. For details see [frontend_ui/](frontend_ui) directory.
Frontend is written in TypeScript. For details see [frontend/](frontend) directory.
Jungfraujoch Cmake scripts have an option to start frontend build with the following command:
```
mkdir build
cd build
cmake ..
make frontend
```
Contrary to standard CMake way, frontend will be built in "source" `frontend_ui/build` directory, not in `build/` subdirectory.
## OpenAPI python client
Jungfraujoch is controlled with HTTP/REST interface defined with an OpenAPI specification. For convenience, we provide Python client in [python_client](python_client/) directory.
## Tests

View File

@@ -1 +1 @@
1.0.0-rc.1
1.0.0-rc.18

View File

@@ -41,17 +41,6 @@ void AcquisitionCounters::Reset(const DiffractionExperiment &experiment, uint16_
void AcquisitionCounters::UpdateCounters(const Completion *c) {
std::unique_lock<std::shared_mutex> ul(m);
if (c->pedestal) {
if (c->module_number >= nmodules)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"UpdateCounters wrong module number: " + std::to_string(c->module_number) + " for pedestal SC" + std::to_string(c->frame_number));
if (c->frame_number >= 16)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"UpdateCounters pedestal frame number is out of bounds for storage cells");
handle_for_pedestal.at(c->frame_number * nmodules + c->module_number) = c->handle;
return;
}
if (c->module_number >= nmodules)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"UpdateCounters wrong module number: " + std::to_string(c->module_number) + " for frame " + std::to_string(c->frame_number) +
@@ -158,7 +147,8 @@ int64_t AcquisitionCounters::CalculateDelay(size_t curr_frame, uint16_t module_n
slowest_head_tmp = GetSlowestFrameNumber();
else
slowest_head_tmp = GetCurrFrameNumber(module_number);
if (slowest_head_tmp < curr_frame)
return 0;
return slowest_head_tmp - curr_frame;
}

View File

@@ -75,7 +75,7 @@ void AcquisitionDevice::StartAction(const DiffractionExperiment &experiment, uin
RunInternalGenerator(experiment);
}
void AcquisitionDevice::WaitForActionComplete(bool pedestal_mode) {
void AcquisitionDevice::WaitForActionComplete() {
auto c = work_completion_queue.GetBlocking();
while (c.type != Completion::Type::End) {
@@ -92,9 +92,8 @@ void AcquisitionDevice::WaitForActionComplete(bool pedestal_mode) {
c.module_number = output->module_statistics.module_number;
c.packet_count = output->module_statistics.packet_count;
c.frame_number = output->module_statistics.frame_number;
c.pedestal = output->module_statistics.pedestal;
if ((c.frame_number >= expected_frames) && !c.pedestal) {
if (c.frame_number >= expected_frames) {
Cancel();
// this frame is not of any interest, therefore its location can be immediately released
SendWorkRequest(c.handle);
@@ -104,14 +103,6 @@ void AcquisitionDevice::WaitForActionComplete(bool pedestal_mode) {
logger->Error("Completion with wrong module number data stream {} completion frame number {} module {} handle {}",
data_stream, c.frame_number, c.module_number, c.handle);
SendWorkRequest(c.handle);
} else if (pedestal_mode && !c.pedestal) {
try {
counters.UpdateCounters(&c);
} catch (const JFJochException &e) {
if (logger)
logger->ErrorException(e);
}
SendWorkRequest(c.handle);
} else {
try {
counters.UpdateCounters(&c);
@@ -152,14 +143,6 @@ const DeviceOutput *AcquisitionDevice::GetDeviceOutput(size_t frame_number, uint
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Frame not collected");
}
const DeviceOutput *AcquisitionDevice::GetDeviceOutputPedestal(size_t storage_cell, uint16_t module_number) const {
auto handle = counters.GetPedestalBufferHandle(storage_cell, module_number);
if (handle != HandleNotValid)
return GetDeviceOutput(handle);
else
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Frame not collected");
}
const DeviceOutput *AcquisitionDevice::GetDeviceOutput(size_t handle) const {
if (handle >= buffer_device.size())
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Handle outside of range");
@@ -272,10 +255,6 @@ void AcquisitionDevice::SetIPv4Address(uint32_t ipv4_addr_network_order) {
ipv4_addr = ipv4_addr_network_order;
}
void AcquisitionDevice::SetMACAddress(uint64_t mac_addr_network_order) {
mac_addr = mac_addr_network_order;
}
AcquisitionDeviceNetConfig AcquisitionDevice::GetNetConfig() const {
return {
.mac_addr = GetMACAddress(),

View File

@@ -75,7 +75,7 @@ public:
void StartAction(const DiffractionExperiment &experiment, uint32_t optional_flags = 0);
void PrepareAction(const DiffractionExperiment &experiment);
void WaitForActionComplete(bool pedestal_mode = false);
void WaitForActionComplete();
virtual void Cancel() = 0;
void EnableLogging(Logger *logger);
@@ -87,7 +87,6 @@ public:
virtual DeviceStatus GetDeviceStatus() const;
AcquisitionDeviceStatistics GetStatistics() const;
const DeviceOutput *GetDeviceOutput(size_t frame_number, uint16_t module_number) const;
const DeviceOutput *GetDeviceOutputPedestal(size_t frame_number, uint16_t module_number) const;
void FrameBufferRelease(size_t frame_number, uint16_t module_number);
// Calibration
@@ -104,7 +103,6 @@ public:
void SetSpotFinderParameters(const SpotFindingSettings &settings);
virtual std::string GetIPv4Address() const;
virtual void SetIPv4Address(uint32_t ipv4_addr_network_order);
virtual void SetMACAddress(uint64_t mac_addr_network_order);
virtual std::string GetMACAddress() const;
virtual uint16_t GetUDPPort() const;
virtual int32_t GetNUMANode() const;

View File

@@ -20,8 +20,11 @@ void AcquisitionDeviceGroup::Add(std::unique_ptr<AcquisitionDevice> &&device) {
aq_devices.emplace_back(std::move(device));
}
void AcquisitionDeviceGroup::AddPCIeDevice(const std::string &device_name) {
aq_devices.emplace_back(std::make_unique<PCIExpressDevice>(aq_devices.size(), device_name));
void AcquisitionDeviceGroup::AddPCIeDevice(const std::string &device_name, std::optional<uint32_t> ipv4_addr) {
auto tmp = std::make_unique<PCIExpressDevice>(aq_devices.size(), device_name);
if (ipv4_addr.has_value())
tmp->SetIPv4Address(ipv4_addr.value());
aq_devices.emplace_back(std::move(tmp));
}
void AcquisitionDeviceGroup::AddHLSDevice(int64_t buffer_size_modules) {
@@ -43,4 +46,11 @@ void AcquisitionDeviceGroup::SetDefaultDataSource(AcquisitionDeviceSource id) {
void AcquisitionDeviceGroup::EnableLogging(Logger *logger) {
for (auto &i: aq_devices)
i->EnableLogging(logger);
}
}
std::vector<DeviceStatus> AcquisitionDeviceGroup::GetDeviceStatus() const {
std::vector<DeviceStatus> ret;
for (auto &i: aq_devices)
ret.emplace_back(i->GetDeviceStatus());
return ret;
}

View File

@@ -13,9 +13,10 @@ public:
AcquisitionDevice& operator[](int idx);
size_t size();
void Add(std::unique_ptr<AcquisitionDevice> &&device);
void AddPCIeDevice(const std::string &device_name);
void AddPCIeDevice(const std::string &device_name, std::optional<uint32_t> ipv4_addr = {});
void AddHLSDevice(int64_t buffer_size_modules);
std::vector<AcquisitionDeviceNetConfig> GetNetworkConfig();
std::vector<DeviceStatus> GetDeviceStatus() const;
void SetDefaultDataSource(AcquisitionDeviceSource id);
void EnableLogging(Logger *logger);
};

View File

@@ -17,7 +17,6 @@ struct Completion {
uint16_t packet_count;
uint16_t data_collection_id;
uint16_t module_number;
bool pedestal;
};
Completion parse_hw_completion(uint32_t hw_input);

View File

@@ -221,22 +221,7 @@ void FPGAAcquisitionDevice::FillActionRegister(const DiffractionExperiment& x, D
expected_descriptors_per_module = DMA_DESCRIPTORS_PER_MODULE;
switch (x.GetDetectorMode()) {
case DetectorMode::Conversion:
case DetectorMode::Raw:
break;
case DetectorMode::PedestalG0:
job.mode |= MODE_PEDESTAL_G0;
break;
case DetectorMode::PedestalG1:
job.mode |= MODE_PEDESTAL_G1;
break;
case DetectorMode::PedestalG2:
job.mode |= MODE_PEDESTAL_G2;
break;
}
if (x.IsConversionOnFPGA())
if (x.IsJungfrauConvPhotonCnt())
job.mode |= MODE_CONV;
if (x.IsFixedGainG1())
@@ -245,8 +230,18 @@ void FPGAAcquisitionDevice::FillActionRegister(const DiffractionExperiment& x, D
if (!x.IsPixelSigned())
job.mode |= MODE_UNSIGNED;
if (x.GetPixelDepth() == 4)
if (x.GetByteDepthImage() == 4)
job.mode |= MODE_32BIT;
if (x.GetLossyCompressionPoisson()) {
job.mode |= MODE_SQROOT;
job.sqrtmult = x.GetLossyCompressionPoisson().value();
}
if (x.GetPixelValueLowThreshold()) {
job.mode |= MODE_THRESHOLD;
job.pxlthreshold = x.GetPixelValueLowThreshold().value();
}
}
void FPGAAcquisitionDevice::Start(const DiffractionExperiment &experiment, uint32_t flag) {

View File

@@ -41,9 +41,6 @@ class FPGAAcquisitionDevice : public AcquisitionDevice {
protected:
std::vector<uint16_t> internal_pkt_gen_frame;
explicit FPGAAcquisitionDevice(uint16_t data_stream);
virtual void HW_GetEnvParams(DeviceStatus *status) const {
memset(status, 0, sizeof(DeviceStatus));
}
public:
void InitializeCalibration(const DiffractionExperiment &experiment, const JFCalibration &calib) override;
void InitializeIntegrationMap(const DiffractionExperiment &experiment, const std::vector<uint16_t> &v,

View File

@@ -2,117 +2,29 @@
#include "HLSSimulatedDevice.h"
#include <bitset>
#include <arpa/inet.h>
#include "../fpga/hls/datamover_model.h"
#include "../fpga/hls/hls_jfjoch.h"
uint16_t checksum(const uint16_t *addr, size_t count) {
/* Compute Internet Checksum for "count" bytes
* beginning at location "addr".
*/
long sum = 0;
for (int i = 0; i < count / 2; i++)
sum += addr[i];
/* Add left-over byte, if any */
if (count % 2 == 1)
sum += ((uint8_t *) addr)[count / 2];
/* Fold 32-bit sum to 16 bits */
while (sum>>16)
sum = (sum & 0xffff) + (sum >> 16);
return ~sum;
}
HLSSimulatedDevice::HLSSimulatedDevice(uint16_t data_stream, size_t in_frame_buffer_size_modules, int16_t numa_node)
: FPGAAcquisitionDevice(data_stream),
datamover_in(Direction::Input, nullptr),
datamover_out(Direction::Output, nullptr),
datamover_out_hbm_0(Direction::Output, (char *) hbm.data()),
datamover_out_hbm_1(Direction::Output, (char *) hbm.data()),
datamover_in_hbm_0(Direction::Input, (char *) hbm.data()),
datamover_in_hbm_1(Direction::Input, (char *) hbm.data()),
idle(true), hbm(hbm_if_size / 32 * hbm_if_count),
dma_address_table(65536) {
: FPGAAcquisitionDevice(data_stream) {
mac_addr = 0xCCAA11223344;
ipv4_addr = 0x0132010A;
max_modules = MAX_MODULES_FPGA;
if (data_stream != 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"HLS simulation can only work with 1 data_stream, due to use of static variables");
MapBuffersStandard(in_frame_buffer_size_modules, numa_node);
auto in_mem_location32 = (uint32_t *) dma_address_table.data();
for (int i = 0; i < buffer_device.size(); i++) {
in_mem_location32[2 * i ] = ((uint64_t) buffer_device[i]) & UINT32_MAX;
in_mem_location32[2 * i + 1] = ((uint64_t) buffer_device[i]) >> 32;
}
device = std::make_unique<HLSDevice>(buffer_device);
}
void HLSSimulatedDevice::CreateFinalPacket(const DiffractionExperiment& experiment) {
CreateJFPacket(experiment, UINT64_MAX, 0, 0, nullptr, false);
}
void HLSSimulatedDevice::SendPacket(char *buffer, int len, uint8_t user) {
auto obuff = (ap_uint<512> *)buffer;
for (int i = 0; i < (len + 63) / 64; i++) {
packet_512_t packet_in;
if (i == (len + 63) / 64 - 1) packet_in.last = 1;
else packet_in.last = 0;
packet_in.keep = 0xFFFFFFFFFFFFFFFF;
packet_in.user = user;
packet_in.data = obuff[i];
din_eth.write(packet_in);
}
device->CreateFinalPacket(experiment);
}
void HLSSimulatedDevice::CreateJFPacket(const DiffractionExperiment& experiment, uint64_t frame_number, uint32_t eth_packet,
uint32_t module_number, const uint16_t *data, int8_t adjust_axis, uint8_t user) {
char buff[256*64];
memset(buff, 0, 256*64);
auto packet = (jf_raw_packet *)buff;
packet->ether_type = htons(0x0800);
packet->sour_mac[0] = 0x00; // module 0
uint64_t tmp_mac = mac_addr;
for (int i = 0; i < 6; i++)
packet->dest_mac[i] = (tmp_mac >> (8*i)) % 256;
uint32_t half_module = 2 * module_number | ((eth_packet >= 64) ? 1 : 0);
packet->ipv4_header_h = htons(0x4500); // Big endian in IP header!
packet->ipv4_header_total_length = htons(8268); // Big endian in IP header!
packet->ipv4_header_dest_ip = ipv4_addr;
packet->ipv4_header_sour_ip = experiment.GetSrcIPv4Address(data_stream, half_module);
packet->ipv4_header_ttl_protocol = htons(0x0011);
packet->ipv4_header_checksum = checksum( (uint16_t *) &packet->ipv4_header_h, 20); // checksum is already in network order
packet->udp_dest_port = htons(GetUDPPort()); // module number
packet->udp_sour_port = htons(0xDFAC);
packet->udp_length = htons(8248);
// JF headers are little endian
packet->jf.detectortype = SLS_DETECTOR_TYPE_JUNGFRAU;
packet->jf.timestamp = 0xABCDEF0000FEDCBAL;
packet->jf.bunchid = 0x1234567898765431L;
packet->jf.row = half_module;
packet->jf.column = 0;
packet->jf.framenum = frame_number;
packet->jf.packetnum = eth_packet % 64;
if (data != nullptr) {
for (int i = 0; i < 4096; i++)
packet->jf.data[i] = data[i];
}
packet->udp_checksum = htons(checksum( (uint16_t *) (buff+42), 8192+48));
SendPacket(buff, (130+adjust_axis)*64, user);
device->CreateJFPacket(experiment, frame_number, eth_packet, module_number, data, adjust_axis, user);
}
void HLSSimulatedDevice::CreateJFPackets(const DiffractionExperiment& experiment, uint64_t frame_number_0, uint64_t frames,
@@ -126,635 +38,83 @@ void HLSSimulatedDevice::CreateJFPackets(const DiffractionExperiment& experiment
void HLSSimulatedDevice::CreateEIGERPacket(const DiffractionExperiment &experiment, uint64_t frame_number,
uint32_t eth_packet, uint32_t module_number, uint32_t col, uint32_t row,
const uint16_t *data) {
char buff[256*64];
memset(buff, 0, 256*64);
auto packet = (eiger_raw_packet *)buff;
packet->ether_type = htons(0x0800);
packet->sour_mac[0] = 0x00; // module 0
uint64_t tmp_mac = mac_addr;
for (int i = 0; i < 6; i++)
packet->dest_mac[i] = (tmp_mac >> (8*i)) % 256;
packet->ipv4_header_h = htons(0x4500); // Big endian in IP header!
packet->ipv4_header_total_length = htons(4172); // Big endian in IP header!
packet->ipv4_header_dest_ip = ipv4_addr;
packet->ipv4_header_sour_ip = experiment.GetSrcIPv4Address(data_stream, 0);
packet->ipv4_header_ttl_protocol = htons(0x0011);
packet->ipv4_header_checksum = checksum( (uint16_t *) &packet->ipv4_header_h, 20); // checksum is already in network order
packet->udp_dest_port = htons(GetUDPPort()); // module number
packet->udp_sour_port = htons(0xDFAC);
packet->udp_length = htons(4152);
// JF headers are little endian
packet->eiger.detectortype = SLS_DETECTOR_TYPE_EIGER;
packet->eiger.timestamp = 0xABCDEF0000FEDCBAL;
packet->eiger.bunchid = 0x1234567898765431L;
packet->eiger.row = (2 * module_number) | (row % 2);
packet->eiger.column = col % 2;
packet->eiger.framenum = frame_number;
packet->eiger.packetnum = eth_packet % 64;
if (data != nullptr) {
for (int i = 0; i < 2048; i++)
packet->eiger.data[i] = data[i];
}
packet->udp_checksum = htons(checksum( (uint16_t *) (buff+42), 4096+48));
SendPacket(buff, 66*64, 0);
}
AXI_STREAM & HLSSimulatedDevice::OutputStream() {
return dout_eth;
device->CreateEIGERPacket(experiment, frame_number, eth_packet, module_number, col, row, data);
}
void HLSSimulatedDevice::HW_ReadActionRegister(DataCollectionConfig *job) {
memcpy(job, &cfg, sizeof(DataCollectionConfig));
device->HW_ReadActionRegister(job);
}
void HLSSimulatedDevice::HW_WriteActionRegister(const DataCollectionConfig *job) {
memcpy(&cfg, job, sizeof(DataCollectionConfig));
device->HW_WriteActionRegister(job);
}
void HLSSimulatedDevice::FPGA_StartAction(const DiffractionExperiment &experiment) {
if (action_thread.joinable())
action_thread.join();
run_counter += 1;
run_data_collection = 1;
cancel_data_collection = 0;
idle = false;
while (!din_frame_generator.empty())
din_frame_generator.read();
datamover_out.ClearCompletedDescriptors();
action_thread = std::thread(&HLSSimulatedDevice::HLSMainThread, this );
}
void HLSSimulatedDevice::FrameGeneratorFuture(FrameGeneratorConfig config) {
frame_generator(din_frame_generator,
hbm.data(),
hbm.data(),
hbm_if_size,
mac_addr,
ipv4_addr,
cancel_data_collection,
config);
device->FPGA_StartAction(experiment);
}
void HLSSimulatedDevice::HW_RunInternalGenerator(const FrameGeneratorConfig &config) {
frame_generator_future = std::async(std::launch::async, &HLSSimulatedDevice::FrameGeneratorFuture, this, config);
device->HW_RunInternalGenerator(config);
}
void HLSSimulatedDevice::FPGA_EndAction() {
if (action_thread.joinable())
action_thread.join();
device->FPGA_EndAction();
}
HLSSimulatedDevice::~HLSSimulatedDevice() {
if (action_thread.joinable())
action_thread.join();
}
bool HLSSimulatedDevice::HW_ReadMailbox(uint32_t *values) {
std::unique_lock<std::mutex> ul(completion_mutex);
ap_uint<32> tmp;
bool ret = completion_stream.read_nb(tmp);
values[0] = tmp;
// equivalent to driver functionality
if (ret) {
uint32_t data_collection_id = (values[0] >> 16) & 0xFFFF;
uint32_t handle = values[0] & 0xFFFF;
if (handle == HANDLE_START)
completion_count = 0;
else if ((handle != HANDLE_END) && (data_collection_id != DATA_COLLECTION_ID_PURGE)) {
completion_count++;
while (completion_count * DMA_DESCRIPTORS_PER_MODULE > datamover_out.GetCompletedDescriptors())
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
return ret;
return device->HW_ReadMailbox(values);
}
void HLSSimulatedDevice::Cancel() {
cancel_data_collection = 1;
device->Cancel();
}
bool HLSSimulatedDevice::HW_IsIdle() const {
return idle && datamover_out.IsIdle();
return device->HW_IsIdle();
}
bool HLSSimulatedDevice::HW_SendWorkRequest(uint32_t handle) {
work_request_stream.write(handle);
return true;
}
inline uint32_t float2uint(float f) {
float_uint32 fu;
fu.f = f;
return fu.u;
}
void HLSSimulatedDevice::HLSMainThread() {
ap_uint<1> clear_counters = 0;
uint64_t packets_processed;
std::vector<std::thread> hls_cores;
STREAM_512 ip1, udp1, udp2, icmp1, arp1;
STREAM_512 network0;
STREAM_768 stream_768_0;
STREAM_768 stream_768_1;
STREAM_768 stream_768_2;
STREAM_768 stream_768_3;
STREAM_768 stream_768_4;
STREAM_768 stream_768_5;
STREAM_512 data_0;
hls::stream<ap_axiu<512, 1, 1, 1>, 2> data_1;
hls::stream<ap_axiu<512, 1, 1, 1>, 2> data_2;
STREAM_512 data_3;
STREAM_512 data_4;
STREAM_512 data_5;
STREAM_512 data_6;
STREAM_512 data_7;
STREAM_512 data_8;
STREAM_512 data_9;
STREAM_512 data_10;
STREAM_512 data_12;
STREAM_512 data_13;
hls::stream<axis_addr> addr0;
hls::stream<axis_addr> addr1;
hls::stream<axis_addr> addr2;
hls::stream<axis_addr> addr3;
hls::stream<axis_completion> axi_compl[12];
hls::stream<ap_uint<16>> hbm_handles;
hls::stream<ap_uint<512>> adu_histo_result;
hls::stream<ap_axiu<64,1,1,1>> integration_result_0;
hls::stream<ap_uint<512>> integration_result_1;
hls::stream<ap_axiu<32,1,1,1>> spot_finder_result_0;
hls::stream<ap_axiu<32,1,1,1>> spot_finder_result_1;
hls::stream<ap_uint<32>> spot_finder_conn_0;
hls::stream<ap_axiu<32,1,1,1>> spot_finder_result_2;
hls::stream<ap_uint<512>> spot_finder_result_3;
hls::stream<ap_uint<32>> spot_finder_mask_0;
hls::stream<ap_uint<256>> roi_calc_result_0;
hls::stream<ap_uint<UDP_METADATA_STREAM_WIDTH> > udp_metadata;
volatile ap_uint<1> idle_data_collection = 1;
ap_uint<1> load_to_hbm_idle;
ap_uint<1> save_to_hbm_idle;
ap_uint<1> integration_idle;
ap_uint<1> stream_conv_idle;
ap_uint<1> frame_summation_idle;
volatile bool done = false;
volatile bool udp_done = false; // done AND udp_idle
volatile bool sls_done = false; // done AND sls_idle
// Sent gratuitous ARP message
arp(arp1, dout_eth, mac_addr, ipv4_addr, 1, 1);
Logger logger_hls("HLS");
volatile rcv_state_t state = RCV_INIT;
// Start data collection
data_collection_fsm(data_0, data_1,
addr0, addr1,
run_data_collection,
cancel_data_collection,
idle_data_collection,
cfg.mode,
float2uint(cfg.energy_kev),
cfg.nframes,
cfg.nmodules,
cfg.nstorage_cells,
cfg.nsummation , state);
run_data_collection = 0;
data_collection_fsm(data_0, data_1,
addr0, addr1,
run_data_collection,
cancel_data_collection,
idle_data_collection,
cfg.mode,
float2uint(cfg.energy_kev),
cfg.nframes,
cfg.nmodules,
cfg.nstorage_cells,
cfg.nsummation, state);
hls_cores.emplace_back([&] {
while (!udp_done) {
if (din_eth.empty() && din_frame_generator.empty())
std::this_thread::sleep_for(std::chrono::microseconds(10));
else
stream_merge(din_eth, din_frame_generator, network0, data_source);
}
logger_hls.Info("Stream_merge done");
});
hls_cores.emplace_back([&] {
while (!udp_done) {
if (network0.empty())
std::this_thread::sleep_for(std::chrono::microseconds(10));
else
ethernet(network0, ip1, arp1, mac_addr, eth_packets, clear_counters);
}
logger_hls.Info("ethernet done");
});
hls_cores.emplace_back([&] {
while (!udp_done) {
if (ip1.empty())
std::this_thread::sleep_for(std::chrono::microseconds(10));
else
ipv4(ip1, udp1, icmp1, ipv4_addr);
}
logger_hls.Info("ipv4 done");
});
hls_cores.emplace_back([&] {
ap_uint<1> udp_idle = 1;
while (!done || !udp_idle) {
if (udp1.empty())
std::this_thread::sleep_for(std::chrono::microseconds(10));
else
udp(udp1, udp2, udp_metadata, udp_packets, clear_counters, udp_idle);
}
udp_done = true;
logger_hls.Info("udp done");
});
hls_cores.emplace_back([&] {
ap_uint<1> sls_idle = 1;
while (!done || !sls_idle) {
if (udp2.empty())
std::this_thread::sleep_for(std::chrono::microseconds (10));
else
sls_detector(udp2, udp_metadata, data_0, addr0, sls_packets, udp_eth_err, udp_len_err, current_pulse_id,
clear_counters, sls_idle);
}
sls_done = true;
logger_hls.Info("sls_detector done");
});
// 1. Parse incoming UDP packets
hls_cores.emplace_back([&] {
while ((state != RCV_WAIT_FOR_START) || (idle_data_collection.read() == 0) || (!data_0.empty())) {
data_collection_fsm(data_0, data_1,
addr0, addr1,
run_data_collection,
cancel_data_collection,
idle_data_collection,
cfg.mode,
float2uint(cfg.energy_kev),
cfg.nframes,
cfg.nmodules,
cfg.nstorage_cells,
cfg.nsummation,
state);
}
done = true;
logger_hls.Info("data collection done");
});
// 2. Cache images in HBM
hls_cores.emplace_back([&] { save_to_hbm(addr1, axi_compl[0], hbm_handles,
datamover_out_hbm_0.GetCtrlStream(),
datamover_out_hbm_1.GetCtrlStream(),
save_to_hbm_idle,
hbm_if_size);});
hls_cores.emplace_back([&] { save_to_hbm_data(data_1,
data_3,
datamover_out_hbm_0.GetDataStream(),
datamover_out_hbm_1.GetDataStream());});
hls_cores.emplace_back([&] {frame_summation_reorder_compl(data_3, data_4, axi_compl[0], axi_compl[1]);});
hls_cores.emplace_back([&] { load_from_hbm(data_4, data_5, axi_compl[1], axi_compl[2], hbm_handles,
datamover_in_hbm_0.GetDataStream(), datamover_in_hbm_1.GetDataStream(),
datamover_in_hbm_0.GetCtrlStream(), datamover_in_hbm_1.GetCtrlStream(),
load_to_hbm_idle, hbm_if_size);});
hls_cores.emplace_back([&] { pedestal(data_5, data_6, axi_compl[2], axi_compl[3],
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm_if_size);});
// 3. Calculate histogram of ADU values
hls_cores.emplace_back([&] { adu_histo(data_6, data_7, adu_histo_result, axi_compl[3], axi_compl[4]);});
// 4. Mask missing pixels
hls_cores.emplace_back([&] { mask_missing(data_7, data_8, axi_compl[4], axi_compl[5]);});
// 5. Handle EIGER packets properly
hls_cores.emplace_back([&] { eiger_reorder(data_8, data_9, axi_compl[5], axi_compl[6]);});
// 6. Apply pedestal & gain corrections
hls_cores.emplace_back([&] { jf_conversion(data_9, stream_768_0,
axi_compl[6], axi_compl[7],
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm.data(),
hbm_if_size); });
// 7. Frame summation
hls_cores.emplace_back([&] { frame_summation(stream_768_0, stream_768_1, axi_compl[7], axi_compl[8], frame_summation_idle);});
// 8. Integration of pixels
hls_cores.emplace_back([&] { integration(stream_768_1, stream_768_2, integration_result_0, axi_compl[8], axi_compl[9],
hbm.data(), hbm.data(), hbm.data(), hbm.data(), integration_idle, hbm_if_size);});
hls_cores.emplace_back([&] { axis_64_to_512(integration_result_0, integration_result_1);});
// 9. Spot finding
ap_uint<32> tmp_snr_threshold = float2uint(spot_finder_parameters.snr_threshold);
ap_uint<32> min_d = float2uint(spot_finder_parameters.min_d);
ap_uint<32> max_d = float2uint(spot_finder_parameters.max_d);
ap_int<32> tmp_count_threshold = spot_finder_parameters.count_threshold;
ap_uint<32> min_pix_per_spot = spot_finder_parameters.min_pix_per_spot;
hls_cores.emplace_back([&] {
spot_finder_mask(stream_768_2,
stream_768_3,
spot_finder_mask_0,
axi_compl[9],
axi_compl[10],
hbm.data(),
hbm.data(),
min_d,
max_d,
hbm_if_size);
logger_hls.Info("spot_finder_mask done");
});
hls_cores.emplace_back([&] {
spot_finder(stream_768_3, spot_finder_mask_0, stream_768_4, spot_finder_result_0, tmp_count_threshold, tmp_snr_threshold);
logger_hls.Info("spot_finder done");
});
hls_cores.emplace_back([&] {
spot_finder_connectivity(spot_finder_result_0,
spot_finder_result_1,
spot_finder_conn_0);
logger_hls.Info("spot_finder_connectivity done");
});
hls_cores.emplace_back([&] {
spot_finder_merge(spot_finder_result_1,
spot_finder_conn_0,
spot_finder_result_2,
min_pix_per_spot);
logger_hls.Info("spot_finder_merge done");
});
hls_cores.emplace_back([&] {
axis_32_to_512(spot_finder_result_2, spot_finder_result_3);
logger_hls.Info("axis_32_to_512 done");
});
hls_cores.emplace_back([&] {
roi_calc(stream_768_4,
stream_768_5,
roi_calc_result_0,
axi_compl[10],
axi_compl[11],
hbm.data(),
hbm.data(),
hbm_if_size);
logger_hls.Info("roi_calc done");
});
// 10. Reduce/extend 24-bit stream
hls_cores.emplace_back([&] { stream_24bit_conv(stream_768_5, data_12, stream_conv_idle);});
// 11. Prepare data to write to host memory
hls_cores.emplace_back([&] {
ap_uint<3> state;
host_writer(data_12, adu_histo_result, integration_result_1, spot_finder_result_3, roi_calc_result_0,
axi_compl[11], datamover_out.GetDataStream(),
datamover_out.GetCtrlStream(), work_request_stream, completion_stream,
dma_address_table.data(), packets_processed, host_writer_idle, cancel_data_collection, state);
logger_hls.Info("host_writer done");
});
for (auto &i : hls_cores)
i.join();
if (frame_generator_future.valid())
frame_generator_future.get();
// reset static counter
arp(arp1, dout_eth, mac_addr, ipv4_addr, 0, 1);
try {
while (!din_eth.empty())
din_eth.read();
if (!addr1.empty())
throw std::runtime_error("Addr1 queue not empty");
if (!addr2.empty())
throw std::runtime_error("Addr2 queue not empty");
if (!addr3.empty())
throw std::runtime_error("Addr3 queue not empty");
if (!data_1.empty())
throw std::runtime_error("data_1 queue not empty");
if (!data_2.empty())
throw std::runtime_error("data_2 queue not empty");
if (!data_3.empty())
throw std::runtime_error("data_3 queue not empty");
if (!data_4.empty())
throw std::runtime_error("data_4 queue not empty");
if (!data_5.empty())
throw std::runtime_error("data_5 queue not empty");
if (!data_7.empty())
throw std::runtime_error("data_7 queue not empty");
if (!data_8.empty())
throw std::runtime_error("data_8 queue not empty");
if (!data_9.empty())
throw std::runtime_error("data_9 queue not empty");
if (!data_10.empty())
throw std::runtime_error("data_10 queue not empty");
if (!data_12.empty())
throw std::runtime_error("data_12 queue not empty");
if (!data_13.empty())
throw std::runtime_error("data_13 queue not empty");
for (auto &c: axi_compl) {
if (!c.empty())
throw std::runtime_error("Compl queue not empty");
}
if (!stream_768_0.empty())
throw std::runtime_error("stream_768_0 queue not empty");
if (!stream_768_1.empty())
throw std::runtime_error("stream_768_1 queue not empty");
if (!stream_768_2.empty())
throw std::runtime_error("stream_768_2 queue not empty");
if (!stream_768_3.empty())
throw std::runtime_error("stream_768_3 queue not empty");
if (!stream_768_4.empty())
throw std::runtime_error("stream_768_4 queue not empty");
if (!hbm_handles.empty())
throw std::runtime_error("Handles queue not empty");
if (!integration_result_0.empty())
throw std::runtime_error("Integration result queue not empty");
if (!integration_result_1.empty())
throw std::runtime_error("Integration result queue not empty");
if (!datamover_in.GetDataStream().empty())
throw std::runtime_error("Datamover queue is not empty");
while (!datamover_out.IsIdle())
std::this_thread::sleep_for(std::chrono::milliseconds(100));
} catch (const std::runtime_error &e) {
if (logger)
logger->ErrorException(e);
throw e;
}
if (logger)
logger->Info("Packets Eth {} UDP {} SLS {} Proc {}", eth_packets, udp_packets, sls_packets, packets_processed);
idle = true;
return device->HW_SendWorkRequest(handle);
}
DataCollectionStatus HLSSimulatedDevice::GetDataCollectionStatus() const {
DataCollectionStatus status{};
union {
uint64_t u64;
double d;
} pulse_id_conv;
pulse_id_conv.u64 = current_pulse_id;
status.ctrl_reg = ap_uint<1>(host_writer_idle) ? (1 << 4) : 0;
status.max_modules = max_modules;
status.hbm_size_bytes = hbm_if_size;
status.run_counter = run_counter;
status.current_pulseid = pulse_id_conv.d;
status.packets_udp = udp_packets;
status.packets_eth = eth_packets;
status.packets_sls = sls_packets;
return status;
return device->GetDataCollectionStatus();
}
void HLSSimulatedDevice::HW_LoadCalibration(const LoadCalibrationConfig &config) {
int ret = load_calibration(hbm.data(), hbm.data(),
config,
hbm_if_size,
datamover_in.GetCtrlStream(),
datamover_in.GetDataStream(),
dma_address_table.data());
if (ret)
throw JFJochException(JFJochExceptionCategory::AcquisitionDeviceError,
"Error in loading calibration " + std::to_string(ret));
if (!datamover_in.GetDataStream().empty())
throw std::runtime_error("Datamover queue is not empty");
device->HW_LoadCalibration(config);
}
void HLSSimulatedDevice::HW_SetSpotFinderParameters(const SpotFinderParameters &params) {
spot_finder_parameters = params;
device->HW_SetSpotFinderParameters(params);
}
void HLSSimulatedDevice::HW_SetDataSource(uint32_t val) {
data_source = val;
device->HW_SetDataSource(val);
}
uint32_t HLSSimulatedDevice::HW_GetDataSource() {
return data_source;
return device->HW_GetDataSource();
}
void HLSSimulatedDevice::CreateXfelBunchIDPacket(double pulse_id, uint32_t event_code) {
union {
uint64_t u64;
double d;
} pulse_id_conv;
pulse_id_conv.d = pulse_id;
bunchid_raw_packet packet{};
packet.ether_type = htons(0x0800);
for (int i = 0; i < 6; i++)
packet.dest_mac[i] = 0xFF;
packet.ipv4_header_h = htons(0x4500); // Big endian in IP header!
packet.ipv4_header_total_length = htons(sizeof(bunchid_payload) + 8 + 20); // Big endian in IP header!
packet.ipv4_header_dest_ip = UINT32_MAX;
packet.ipv4_header_ttl_protocol = htons(0x0011);
packet.ipv4_header_checksum = checksum( (uint16_t *) &packet.ipv4_header_h, 20); // checksum is already in network order
packet.udp_length = htons(sizeof(bunchid_payload) + 8);
packet.payload.magicn[0] = BUNCHID_MAGICN;
packet.payload.magicn[1] = BUNCHID_MAGICN;
packet.payload.magicn[2] = BUNCHID_MAGICN;
packet.payload.bunchid_msb[0] = (pulse_id_conv.u64 >> 32) & UINT32_MAX;
packet.payload.bunchid_msb[1] = (pulse_id_conv.u64 >> 32) & UINT32_MAX;
packet.payload.bunchid_lsb[0] = pulse_id_conv.u64 & UINT32_MAX;
packet.payload.bunchid_lsb[1] = pulse_id_conv.u64 & UINT32_MAX;
packet.payload.montrig = event_code;
SendPacket((char *) &packet, sizeof(bunchid_raw_packet));
device->CreateXfelBunchIDPacket(pulse_id, event_code);
}
DeviceStatus HLSSimulatedDevice::GetDeviceStatus() const {
DeviceStatus status{};
strncpy(status.serial_number, "HLS1", sizeof(status.device_number));
strncpy(status.device_number, "HLS device", sizeof(status.device_number));
status.fpga_default_mac_addr = mac_addr;
status.eth_link_count = 1;
status.eth_link_status = 1;
status.packets_sls = device->GetSLSPackets();
status.packets_udp = device->GetUDPPackets();
status.hbm_0_temp_C = 0;
status.hbm_1_temp_C = 0;
status.fpga_temp_C = 0;
return status;
}

View File

@@ -5,61 +5,13 @@
#include <thread>
#include "../fpga/hls/hls_jfjoch.h"
#include "../fpga/hls/datamover_model.h"
#include "../common/DiffractionExperiment.h"
#include "FPGAAcquisitionDevice.h"
#include "../jungfrau/sls_packet.h"
#include "../fpga/hls/HLSDevice.h"
uint16_t checksum(const uint16_t *addr, size_t count);
#include "FPGAAcquisitionDevice.h"
class HLSSimulatedDevice : public FPGAAcquisitionDevice {
AXI_STREAM din_eth;
AXI_STREAM din_frame_generator;
AXI_STREAM dout_eth;
uint32_t run_counter = 0;
ap_uint<2> data_source = STREAM_MERGE_SRC_NETWORK;
SpotFinderParameters spot_finder_parameters;
uint64_t current_pulse_id = 0;
DataCollectionConfig cfg;
volatile bool idle;
constexpr static const size_t hbm_if_count = 32;
constexpr static const size_t hbm_if_size = 32*1024*1024LU;
std::vector<ap_uint<256>> hbm;
hls::stream<ap_uint<32> > work_request_stream;
hls::stream<ap_uint<32> > completion_stream;
std::mutex completion_mutex;
uint32_t completion_count;
std::thread action_thread;
std::future<void> frame_generator_future;
Datamover<512> datamover_in;
Datamover<512> datamover_out;
Datamover<256> datamover_in_hbm_0;
Datamover<256> datamover_in_hbm_1;
Datamover<256, 16> datamover_out_hbm_0;
Datamover<256, 16> datamover_out_hbm_1;
ap_uint<1> run_data_collection;
ap_uint<1> cancel_data_collection;
volatile ap_uint<1> host_writer_idle;
std::vector<uint64_t> dma_address_table;
uint64_t eth_packets = 0;
uint64_t icmp_packets = 0;
uint64_t udp_packets = 0;
uint64_t sls_packets = 0;
uint32_t udp_len_err = 0;
uint32_t udp_eth_err = 0;
std::unique_ptr<HLSDevice> device;
void HW_ReadActionRegister(DataCollectionConfig *job) override;
void HW_WriteActionRegister(const DataCollectionConfig *job) override;
@@ -74,12 +26,9 @@ class HLSSimulatedDevice : public FPGAAcquisitionDevice {
uint32_t HW_GetDataSource() override;
void HW_SetDataSource(uint32_t val) override;
void HW_RunInternalGenerator(const FrameGeneratorConfig &config) override;
void FrameGeneratorFuture(FrameGeneratorConfig config);
void HLSMainThread();
public:
HLSSimulatedDevice(uint16_t data_stream, size_t in_frame_buffer_size_modules, int16_t numa_node = -1);
~HLSSimulatedDevice() override;
void SendPacket(char *buffer, int len, uint8_t user = 0);
~HLSSimulatedDevice() override = default;
void CreateJFPacket(const DiffractionExperiment& experiment, uint64_t frame_number, uint32_t eth_packet,
uint32_t module_number, const uint16_t *data, int8_t adjust_axis = 0, uint8_t user = 0);
void CreateJFPackets(const DiffractionExperiment& experiment, uint64_t frame_number_0, uint64_t frames,
@@ -90,8 +39,8 @@ public:
void CreateXfelBunchIDPacket(double bunchid, uint32_t event_code);
void CreateFinalPacket(const DiffractionExperiment& experiment);
DataCollectionStatus GetDataCollectionStatus() const override;
AXI_STREAM &OutputStream();
void Cancel() override;
DeviceStatus GetDeviceStatus() const override;
};

View File

@@ -70,14 +70,6 @@ std::string PCIExpressDevice::GetMACAddress() const {
return MacAddressToStr(dev.GetMACAddress());
}
void PCIExpressDevice::SetMACAddress(uint64_t mac_addr_network_order) {
dev.SetMACAddress(mac_addr_network_order);
}
void PCIExpressDevice::HW_GetEnvParams(DeviceStatus *status) const {
*status = dev.GetDeviceStatus();
}
uint32_t PCIExpressDevice::GetNumKernelBuffers() const {
return dev.GetBufferCount();
}
@@ -86,12 +78,12 @@ int32_t PCIExpressDevice::GetNUMANode() const {
return dev.GetNumaNode();
}
void PCIExpressDevice::SetDefaultMAC() {
dev.SetDefaultMACAddress();
}
void PCIExpressDevice::SetIPv4Address(uint32_t ipv4_addr_network_order) {
dev.SetIPv4Address(ipv4_addr_network_order);
// Configure all links with the same IPv4 address
auto dev_status = dev.GetDeviceStatus();
for (int i = 0; i < dev_status.eth_link_count; i++)
dev.SetIPv4Address(ipv4_addr_network_order, i);
dev.SetIPv4Address(ipv4_addr_network_order, NET_IF_FRAME_GENERATOR);
}
std::string PCIExpressDevice::GetIPv4Address() const {

View File

@@ -28,12 +28,8 @@ public:
PCIExpressDevice(uint16_t data_stream, const std::string &device_name);
void Cancel() override;
void HW_GetEnvParams(DeviceStatus *status) const override;
int32_t GetNUMANode() const override;
void SetMACAddress(uint64_t mac_addr_network_order) override;
void SetDefaultMAC();
void SetIPv4Address(uint32_t ipv4_addr_network_order) override;
std::string GetMACAddress() const override;

View File

@@ -8,11 +8,15 @@ TARGET_INCLUDE_DIRECTORIES(JFJochAPI PUBLIC gen/model gen/api)
ADD_LIBRARY(JFJochBroker STATIC
JFJochStateMachine.cpp JFJochStateMachine.h
JFJochServices.cpp JFJochServices.h
JFJochBrokerHttp.cpp JFJochBrokerHttp.h JFJochBrokerParser.cpp JFJochBrokerParser.h)
JFJochBrokerHttp.cpp JFJochBrokerHttp.h JFJochBrokerParser.cpp JFJochBrokerParser.h
OpenAPIConvert.h
OpenAPIConvert.cpp)
TARGET_LINK_LIBRARIES(JFJochBroker JFJochReceiver JFJochDetector JFJochCommon JFJochAPI JFJochPreview)
ADD_EXECUTABLE(jfjoch_broker jfjoch_broker.cpp)
TARGET_LINK_LIBRARIES(jfjoch_broker JFJochBroker)
INSTALL(TARGETS jfjoch_broker RUNTIME)
INSTALL(TARGETS jfjoch_broker RUNTIME COMPONENT jfjoch)
INSTALL(FILES redoc-static.html DESTINATION jfjoch/frontend COMPONENT jfjoch )

View File

@@ -1,420 +1,18 @@
// Copyright (2019-2023) Paul Scherrer Institute
// Copyright (2019-2024) Paul Scherrer Institute
// Using OpenAPI licensed with Apache License 2.0
#include <nlohmann/json.hpp>
#include "JFJochBrokerHttp.h"
#include "gen/model/Error_message.h"
// From https://en.cppreference.com/w/cpp/string/byte/tolower
inline std::string str_tolower(std::string s) {
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c){ return std::tolower(c); });
return s;
}
inline SpotFindingSettings Convert(const org::openapitools::server::model::Spot_finding_settings &input) {
SpotFindingSettings ret{};
ret.signal_to_noise_threshold = input.getSignalToNoiseThreshold();
ret.photon_count_threshold = input.getPhotonCountThreshold();
ret.min_pix_per_spot = input.getMinPixPerSpot();
ret.max_pix_per_spot = input.getMaxPixPerSpot();
ret.high_resolution_limit = input.getHighResolutionLimit();
ret.low_resolution_limit = input.getLowResolutionLimit();
ret.enable = input.isEnable();
ret.indexing = input.isIndexing();
ret.indexing_tolerance = input.getIndexingTolerance();
return ret;
}
inline org::openapitools::server::model::Spot_finding_settings Convert(const SpotFindingSettings &input) {
org::openapitools::server::model::Spot_finding_settings ret;
ret.setSignalToNoiseThreshold(input.signal_to_noise_threshold);
ret.setPhotonCountThreshold(input.photon_count_threshold);
ret.setMinPixPerSpot(input.min_pix_per_spot);
ret.setMaxPixPerSpot(input.max_pix_per_spot);
ret.setHighResolutionLimit(input.high_resolution_limit);
ret.setLowResolutionLimit(input.low_resolution_limit);
ret.setEnable(input.enable);
ret.setIndexing(input.indexing);
ret.setIndexingTolerance(input.indexing_tolerance);
return ret;
}
inline org::openapitools::server::model::Measurement_statistics Convert(const MeasurementStatistics &input) {
org::openapitools::server::model::Measurement_statistics ret{};
if (!input.file_prefix.empty())
ret.setFilePrefix(input.file_prefix);
ret.setImagesExpected(input.images_expected);
ret.setImagesCollected(input.images_collected);
ret.setImagesSent(input.images_sent);
ret.setImagesDiscardedLossyCompression(input.images_skipped);
ret.setMaxImageNumberSent(input.max_image_number_sent);
if (input.collection_efficiency)
ret.setCollectionEfficiency(input.collection_efficiency.value());
if (input.compression_ratio)
ret.setCompressionRatio(input.compression_ratio.value());
ret.setCancelled(input.cancelled);
ret.setMaxReceiverDelay(input.max_receive_delay);
ret.setDetectorWidth(input.detector_width);
ret.setDetectorHeight(input.detector_height);
ret.setDetectorPixelDepth(input.detector_pixel_depth);
if (input.indexing_rate)
ret.setIndexingRate(input.indexing_rate.value());
if (input.bkg_estimate)
ret.setBkgEstimate(input.bkg_estimate.value());
return ret;
}
inline DetectorSettings Convert(const org::openapitools::server::model::Detector_settings &input) {
DetectorSettings ret{};
ret.frame_time_us = input.getFrameTimeUs();
if (input.countTimeUsIsSet())
ret.count_time_us = input.getCountTimeUs();
ret.storage_cell_count = input.getStorageCellCount();
ret.use_internal_packet_generator = input.isInternalFrameGenerator();
ret.collect_raw_data = input.isCollectRawData();
ret.fixed_gain_g1 = input.isFixedGainG1();
ret.use_gain_hg0 = input.isUseGainHg0();
if (input.pedestalG0FramesIsSet())
ret.pedestal_g0_frames = input.getPedestalG0Frames();
if (input.pedestalG1FramesIsSet())
ret.pedestal_g1_frames = input.getPedestalG1Frames();
if (input.pedestalG2FramesIsSet())
ret.pedestal_g2_frames = input.getPedestalG2Frames();
if (input.storageCellDelayUsIsSet() && std::isfinite(input.getStorageCellDelayUs()))
ret.storage_cell_delay_ns = std::round(input.getStorageCellDelayUs() * 1000.0f);
if (input.detectorTriggerDelayUsIsSet() && std::isfinite(input.getDetectorTriggerDelayUs()))
ret.detector_delay_ns = std::round(input.getDetectorTriggerDelayUs() * 1000.0f);
if (input.internalFrameGeneratorImagesIsSet())
ret.internal_packet_generator_images = input.getInternalFrameGeneratorImages();
return ret;
}
inline org::openapitools::server::model::Detector_settings Convert(const DetectorSettings &input) {
org::openapitools::server::model::Detector_settings ret{};
ret.setFrameTimeUs(input.frame_time_us);
if (input.count_time_us)
ret.setCountTimeUs(input.count_time_us.value());
ret.setStorageCellCount(input.storage_cell_count);
ret.setInternalFrameGenerator(input.use_internal_packet_generator);
ret.setCollectRawData(input.collect_raw_data);
ret.setFixedGainG1(input.fixed_gain_g1);
ret.setUseGainHg0(input.use_gain_hg0);
if (input.pedestal_g0_frames)
ret.setPedestalG0Frames(input.pedestal_g0_frames.value());
if (input.pedestal_g1_frames)
ret.setPedestalG1Frames(input.pedestal_g1_frames.value());
if (input.pedestal_g2_frames)
ret.setPedestalG2Frames(input.pedestal_g2_frames.value());
if (input.storage_cell_delay_ns)
ret.setStorageCellDelayUs(static_cast<float>(input.storage_cell_delay_ns.value()) / 1000.0f);
if (input.detector_delay_ns)
ret.setDetectorTriggerDelayUs(static_cast<float>(input.detector_delay_ns.value()) / 1000.0f);
if (input.internal_packet_generator_images)
ret.setInternalFrameGeneratorImages(input.internal_packet_generator_images.value());
return ret;
}
inline org::openapitools::server::model::Broker_status Convert(const BrokerStatus& input) {
org::openapitools::server::model::Broker_status ret;
switch (input.broker_state) {
case JFJochState::Inactive:
ret.setState("Inactive");
break;
case JFJochState::Idle:
ret.setState("Idle");
break;
case JFJochState::Measuring:
ret.setState("Measuring");
break;
case JFJochState::Error:
ret.setState("Error");
break;
case JFJochState::Busy:
ret.setState("Busy");
break;
case JFJochState::Pedestal:
ret.setState("Pedestal");
break;
}
if (input.progress.has_value())
ret.setProgress(input.progress.value());
if (input.indexing_rate.has_value() && (input.indexing_rate >= 0.0))
ret.setIndexingRate(input.indexing_rate.value());
return ret;
}
inline org::openapitools::server::model::Calibration_statistics_inner Convert(const JFCalibrationModuleStatistics& input) {
org::openapitools::server::model::Calibration_statistics_inner output;
output.setModuleNumber(input.module_number);
output.setMaskedPixels(input.bad_pixels);
output.setStorageCellNumber(input.storage_cell_number);
output.setGainG0Mean(input.gain_g0_mean);
output.setGainG1Mean(input.gain_g1_mean);
output.setGainG2Mean(input.gain_g2_mean);
output.setPedestalG0Mean(input.pedestal_g0_mean);
output.setPedestalG1Mean(input.pedestal_g1_mean);
output.setPedestalG2Mean(input.pedestal_g2_mean);
return output;
}
inline org::openapitools::server::model::Detector_status Convert(const DetectorStatus &input) {
org::openapitools::server::model::Detector_status output;
output.setServerVersion(input.detector_server_version);
output.setNumberOfTriggersLeft(input.remaining_triggers);
output.setFpgaTempDegC(input.temperature_fpga_degC);
output.setHighVoltageV(input.high_voltage_V);
switch (input.power_state) {
case DetectorPowerState::ON:
output.setPowerchip("On");
break;
case DetectorPowerState::OFF:
output.setPowerchip("Off");
break;
case DetectorPowerState::PARTIAL:
output.setPowerchip("Partial");
break;
}
switch (input.detector_state) {
case DetectorState::IDLE:
output.setState("Idle");
break;
case DetectorState::ERROR:
output.setState("Error");
break;
case DetectorState::BUSY:
output.setState("Busy");
break;
case DetectorState::WAITING:
output.setState("Waiting");
break;
}
return output;
}
inline org::openapitools::server::model::Detector_list Convert(const DetectorList &input) {
org::openapitools::server::model::Detector_list ret;
std::vector<org::openapitools::server::model::Detector_list_detectors_inner> dets;
for (int i = 0; i < input.detector.size(); i++) {
org::openapitools::server::model::Detector_list_detectors_inner d;
d.setId(i);
d.setDescription(input.detector[i].description);
d.setNmodules(input.detector[i].nmodules);
d.setHeight(input.detector[i].height);
d.setWidth(input.detector[i].width);
dets.emplace_back(std::move(d));
}
ret.setDetectors(dets);
ret.setCurrentId(input.current_id);
return ret;
}
inline org::openapitools::server::model::Plots Convert(const MultiLinePlot& input) {
std::vector<org::openapitools::server::model::Plot> tmp(input.size());
for (int i = 0; i < input.size(); i++) {
tmp[i].setTitle(input[i].title);
tmp[i].setX(input[i].x);
tmp[i].setY(input[i].y);
}
org::openapitools::server::model::Plots output;
output.setPlot(tmp);
return output;
}
inline RadialIntegrationSettings Convert(const org::openapitools::server::model::Rad_int_settings& input) {
RadialIntegrationSettings ret{};
ret.solid_angle_correction = input.isSolidAngleCorr();
if (input.polarizationFactorIsSet())
ret.polarization_factor = input.getPolarizationFactor();
ret.q_spacing = input.getQSpacing();
ret.low_q_recipA = input.getLowQRecipA();
ret.high_q_recipA = input.getHighQRecipA();
return ret;
}
inline org::openapitools::server::model::Rad_int_settings Convert(const RadialIntegrationSettings& settings) {
org::openapitools::server::model::Rad_int_settings ret{};
ret.setSolidAngleCorr(settings.solid_angle_correction);
if (settings.polarization_factor)
ret.setPolarizationFactor(settings.polarization_factor.value());
ret.setHighQRecipA(settings.high_q_recipA);
ret.setLowQRecipA(settings.low_q_recipA);
ret.setQSpacing(settings.q_spacing);
return ret;
}
inline std::vector<ROIBox> Convert(const org::openapitools::server::model::Roi_box_list& input) {
std::vector<ROIBox> ret;
for (const auto &i: input.getRois())
ret.emplace_back(ROIBox(i.getName(), i.getMinXPxl(), i.getMaxXPxl(), i.getMinYPxl(), i.getMaxYPxl()));
return ret;
}
inline std::vector<ROICircle> Convert(const org::openapitools::server::model::Roi_circle_list& input) {
std::vector<ROICircle> ret;
for (const auto &i: input.getRois())
ret.emplace_back(ROICircle(i.getName(), i.getCenterXPxl(), i.getCenterYPxl(), i.getRadiusPxl()));
return ret;
}
inline org::openapitools::server::model::Roi_circle_list Convert(const std::vector<ROICircle> &input) {
org::openapitools::server::model::Roi_circle_list ret{};
std::vector<org::openapitools::server::model::Roi_circle> tmp;
for (const auto &i: input) {
org::openapitools::server::model::Roi_circle elem;
elem.setName(i.GetName());
elem.setCenterXPxl(i.GetX());
elem.setCenterYPxl(i.GetY());
elem.setRadiusPxl(i.GetRadius_pxl());
tmp.emplace_back(elem);
}
ret.setRois(tmp);
return ret;
}
inline org::openapitools::server::model::Roi_box_list Convert(const std::vector<ROIBox> &input) {
org::openapitools::server::model::Roi_box_list ret{};
std::vector<org::openapitools::server::model::Roi_box> tmp;
for (const auto &i: input) {
org::openapitools::server::model::Roi_box elem;
elem.setName(i.GetName());
elem.setMinXPxl(i.GetXMin());
elem.setMaxXPxl(i.GetXMax());
elem.setMinYPxl(i.GetYMin());
elem.setMaxYPxl(i.GetYMax());
tmp.emplace_back(elem);
}
ret.setRois(tmp);
return ret;
}
inline PreviewJPEGSettings Convert(const org::openapitools::server::model::Preview_settings& input) {
PreviewJPEGSettings ret{};
ret.show_spots = input.isShowSpots();
ret.jpeg_quality = input.getJpegQuality();
ret.saturation_value = input.getSaturation();
ret.show_roi = input.isShowRoi();
ret.show_indexed = input.isShowIndexed();
if (input.resolutionRingIsSet())
ret.resolution_ring = input.getResolutionRing();
return ret;
}
inline DatasetSettings Convert(const org::openapitools::server::model::Dataset_settings& input) {
DatasetSettings ret;
ret.ImagesPerTrigger(input.getImagesPerTrigger());
ret.NumTriggers(input.getNtrigger());
if (!input.fpgaOutputIsSet())
ret.FPGAOutputMode(FPGAPixelOutput::Auto);
else {
std::string out = str_tolower(input.getFpgaOutput());
if (out == "auto")
ret.FPGAOutputMode(FPGAPixelOutput::Auto);
else if (out == "int16")
ret.FPGAOutputMode(FPGAPixelOutput::Int16);
else if (out == "uint16")
ret.FPGAOutputMode(FPGAPixelOutput::Uint16);
else if (out == "int32")
ret.FPGAOutputMode(FPGAPixelOutput::Int32);
else if (out == "uint32")
ret.FPGAOutputMode(FPGAPixelOutput::Uint32);
else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Unknown output format");
}
ret.Summation(input.getSummation());
ret.BeamX_pxl(input.getBeamXPxl());
ret.BeamY_pxl(input.getBeamYPxl());
ret.DetectorDistance_mm(input.getDetectorDistanceMm());
ret.PhotonEnergy_keV(input.getPhotonEnergyKeV());
ret.PhotonEnergyMultiplayer(input.getPhotonEnergyMultiplier());
ret.FilePrefix(input.getFilePrefix());
if (!input.compressionIsSet())
ret.Compression(CompressionAlgorithm::BSHUF_LZ4);
else {
std::string compr = str_tolower(input.getCompression());
if (compr == "bslz4")
ret.Compression(CompressionAlgorithm::BSHUF_LZ4);
else if (compr == "bszstd")
ret.Compression(CompressionAlgorithm::BSHUF_ZSTD);
else if (compr == "bszstd_rle")
ret.Compression(CompressionAlgorithm::BSHUF_ZSTD_RLE);
else if (compr == "none")
ret.Compression(CompressionAlgorithm::NO_COMPRESSION);
else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Unknown compression");
}
if (input.unitCellIsSet())
ret.SetUnitCell(UnitCell{
.a = input.getUnitCell().getA(),
.b = input.getUnitCell().getB(),
.c = input.getUnitCell().getC(),
.alpha = input.getUnitCell().getAlpha(),
.beta = input.getUnitCell().getBeta(),
.gamma = input.getUnitCell().getGamma()
});
if (input.totalFluxIsSet())
ret.TotalFlux(input.getTotalFlux());
if (input.transmissionIsSet())
ret.AttenuatorTransmission(input.getTransmission());
if (input.omegaIsSet()) {
ret.OmegaStep(input.getOmega().getStep());
ret.OmegaStart(input.getOmega().getStart());
if (input.getOmega().getVector().size() == 3) {
auto v = input.getOmega().getVector();
ret.OmegaAxis(Coord(v[0], v[1], v[2]));
}
}
ret.SpaceGroupNumber(input.getSpaceGroupNumber());
ret.SampleName(input.getSampleName());
ret.HeaderAppendix(input.getHeaderAppendix());
ret.ImageAppendix(input.getImageAppendix());
ret.ImagesPerFile(input.getImagesPerFile());
if (input.dataReductionFactorSerialmxIsSet())
ret.DataReductionFactorSerialMX(input.getDataReductionFactorSerialmx());
return ret;
}
#include "../common/GitInfo.h"
#include "OpenAPIConvert.h"
JFJochBrokerHttp::JFJochBrokerHttp(const DiffractionExperiment &experiment, std::shared_ptr<Pistache::Rest::Router> &rtr)
: DefaultApi(rtr) {
: DefaultApi(rtr) {
Pistache::Rest::Routes::Get(*rtr, "/", Pistache::Rest::Routes::bind(&JFJochBrokerHttp::GetStaticFile, this));
Pistache::Rest::Routes::Get(*rtr, "/frontend", Pistache::Rest::Routes::bind(&JFJochBrokerHttp::GetStaticFile, this));
Pistache::Rest::Routes::Get(*rtr, "/frontend/*", Pistache::Rest::Routes::bind(&JFJochBrokerHttp::GetStaticFile, this));
Pistache::Rest::Routes::Get(*rtr, "/frontend/static/js/*", Pistache::Rest::Routes::bind(&JFJochBrokerHttp::GetStaticFile, this));
Pistache::Rest::Routes::Get(*rtr, "/frontend/static/css/*", Pistache::Rest::Routes::bind(&JFJochBrokerHttp::GetStaticFile, this));
Pistache::Rest::Routes::Get(*rtr, "/frontend/assets/*", Pistache::Rest::Routes::bind(&JFJochBrokerHttp::GetStaticFile, this));
state_machine.NotThreadSafe_Experiment() = experiment;
init();
@@ -446,6 +44,8 @@ void JFJochBrokerHttp::initialize_post(Pistache::Http::ResponseWriter &response)
void JFJochBrokerHttp::start_post(const org::openapitools::server::model::Dataset_settings &datasetSettings,
Pistache::Http::ResponseWriter &response) {
nlohmann::json j = datasetSettings;
logger.Info("Start {}", j.dump());
state_machine.Start(Convert(datasetSettings));
response.send(Pistache::Http::Code::Ok);
}
@@ -454,8 +54,21 @@ void JFJochBrokerHttp::status_get(Pistache::Http::ResponseWriter &response) {
ProcessOutput(Convert(state_machine.GetStatus()), response);
}
void JFJochBrokerHttp::wait_till_done_post(Pistache::Http::ResponseWriter &response) {
auto state = state_machine.WaitTillMeasurementDone(std::chrono::seconds(5));
void JFJochBrokerHttp::wait_till_done_post(const std::optional<int32_t> &timeout,
Pistache::Http::ResponseWriter &response) {
JFJochState state;
if (!timeout)
state = state_machine.WaitTillMeasurementDone(std::chrono::minutes(1));
else if ((timeout.value() > 3600) || (timeout.value() < 0)) {
response.send(Pistache::Http::Code::Bad_Request);
return;
} else if (timeout.value() == 0)
state = state_machine.GetState();
else
state = state_machine.WaitTillMeasurementDone(std::chrono::seconds(timeout.value()));
switch (state) {
case JFJochState::Idle:
response.send(Pistache::Http::Code::Ok);
@@ -494,11 +107,11 @@ void JFJochBrokerHttp::config_detector_put(const org::openapitools::server::mode
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::config_rad_int_get(Pistache::Http::ResponseWriter &response) {
void JFJochBrokerHttp::config_azim_int_get(Pistache::Http::ResponseWriter &response) {
ProcessOutput(Convert(state_machine.GetRadialIntegrationSettings()), response);
}
void JFJochBrokerHttp::config_rad_int_put(const org::openapitools::server::model::Rad_int_settings &radIntSettings,
void JFJochBrokerHttp::config_azim_int_put(const org::openapitools::server::model::Azim_int_settings &radIntSettings,
Pistache::Http::ResponseWriter &response) {
state_machine.SetRadialIntegrationSettings(Convert(radIntSettings));
response.send(Pistache::Http::Code::Ok);
@@ -526,31 +139,15 @@ void JFJochBrokerHttp::config_spot_finding_put(
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::plot_indexing_rate_per_file_get(Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::IndexingRatePerTimePoint, 0, response);
}
void JFJochBrokerHttp::plot_rad_int_get(Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::RadInt, 0, response);
}
void JFJochBrokerHttp::plot_rad_int_per_file_get(Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::RadIntPerTimePoint, 0, response);
void JFJochBrokerHttp::plot_azim_int_get(const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::AzInt, 0, compression, response);
}
void JFJochBrokerHttp::statistics_calibration_get(Pistache::Http::ResponseWriter &response) {
auto calib = state_machine.GetCalibrationStatistics();
nlohmann::json j;
for (const auto &i: calib) {
auto output = Convert(i);
std::stringstream s;
assert(output.validate(s));
nlohmann::json j_elem;
to_json(j_elem, output);
j.push_back(j_elem);
}
for (const auto &d: Convert(state_machine.GetCalibrationStatistics()))
j.push_back(d);
response.send(Pistache::Http::Code::Ok, j.dump(), MIME(Application, Json));
}
@@ -593,9 +190,21 @@ void JFJochBrokerHttp::GetStaticFile(const Pistache::Rest::Request &request, Pis
if ((request.resource() == "/")
|| (request.resource() == "/frontend")
|| (request.resource() == "/frontend/"))
Pistache::Http::serveFile(response, frontend_directory + "/index.html");
else if (request.resource().substr(0, 10) == "/frontend/")
Pistache::Http::serveFile(response, frontend_directory + "/" + request.resource().substr(10));
Pistache::Http::serveFile(response, frontend_directory + "/index.html", MIME(Text, Html));
else if (request.resource().starts_with("/frontend/")) {
if (request.resource().ends_with(".js"))
Pistache::Http::serveFile(response, frontend_directory + "/" + request.resource().substr(10),
MIME(Text,Javascript));
else if (request.resource().ends_with(".css"))
Pistache::Http::serveFile(response, frontend_directory + "/" + request.resource().substr(10),
MIME(Text,Css));
else if (request.resource().ends_with(".html"))
Pistache::Http::serveFile(response, frontend_directory + "/" + request.resource().substr(10),
MIME(Text,Html));
else
Pistache::Http::serveFile(response, frontend_directory + "/" + request.resource().substr(10));
}
else response.send(Pistache::Http::Code::Not_Found);
} catch (const std::exception &e) {
logger.Error(e.what());
@@ -654,18 +263,33 @@ void JFJochBrokerHttp::preview_image_tiff_get(Pistache::Http::ResponseWriter &re
void JFJochBrokerHttp::config_internal_generator_image_put(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter &response) {
int64_t image_number = 0;
auto number_query = request.query().get("number");
auto number_query = request.query().get("id");
if (number_query)
image_number = std::stoi(number_query.value());
if ((image_number < 0) || (image_number > 127))
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "image_number must be in range 0-127");
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "id must be in range 0-127");
state_machine.LoadInternalGeneratorImage(request.body().data(), request.body().size(), image_number);
logger.Info("Internal generator image #{} loaded", image_number);
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::config_internal_generator_image_tiff_put(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter &response) {
int64_t image_number = 0;
auto number_query = request.query().get("id");
if (number_query)
image_number = std::stoi(number_query.value());
if ((image_number < 0) || (image_number > 127))
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "id must be in range 0-127");
state_machine.LoadInternalGeneratorImageTIFF(request.body(), image_number);
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::roi_box_get(Pistache::Http::ResponseWriter &response) {
ProcessOutput(Convert(state_machine.GetBoxROI()), response);
}
@@ -704,7 +328,7 @@ void JFJochBrokerHttp::xfel_pulse_id_get(Pistache::Http::ResponseWriter &respons
void JFJochBrokerHttp::preview_pedestal_tiff_get(const std::optional<int32_t> &gainLevel,
const std::optional<int32_t> &sc,
Pistache::Http::ResponseWriter &response) {
Pistache::Http::ResponseWriter &response) {
if (!gainLevel)
response.send(Pistache::Http::Code::Bad_Request);
std::string s = state_machine.GetPedestalTIFF(gainLevel.value(), sc ? sc.value() : 0);
@@ -715,7 +339,10 @@ void JFJochBrokerHttp::preview_pedestal_tiff_get(const std::optional<int32_t> &g
}
void JFJochBrokerHttp::GenericPlot(PlotType plot_type, const std::optional<int32_t> &binning,
const std::optional<bool>& in_compression,
Pistache::Http::ResponseWriter &response) {
bool compression = !in_compression.has_value() || in_compression.value();
PlotRequest req{.type = plot_type, .binning = 0};
if (binning) {
if (binning.value() < 0)
@@ -724,60 +351,172 @@ void JFJochBrokerHttp::GenericPlot(PlotType plot_type, const std::optional<int32
req.binning = binning.value();
}
auto plot = state_machine.GetPlots(req);
ProcessOutput(Convert(plot), response);
ProcessOutput(Convert(plot), response, compression);
}
void JFJochBrokerHttp::plot_bkg_estimate_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::BkgEstimate, binning, response);
GenericPlot(PlotType::BkgEstimate, binning, compression, response);
}
void JFJochBrokerHttp::plot_error_pixel_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ErrorPixels, binning, response);
GenericPlot(PlotType::ErrorPixels, binning, compression, response);
}
void JFJochBrokerHttp::plot_image_collection_efficiency_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ImageCollectionEfficiency, binning, response);
GenericPlot(PlotType::ImageCollectionEfficiency, binning, compression, response);
}
void JFJochBrokerHttp::plot_indexing_rate_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::IndexingRate, binning, response);
GenericPlot(PlotType::IndexingRate, binning, compression, response);
}
void JFJochBrokerHttp::plot_receiver_delay_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ReceiverDelay, binning, response);
GenericPlot(PlotType::ReceiverDelay, binning, compression, response);
}
void JFJochBrokerHttp::plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ReceiverFreeSendBuf, binning, response);
GenericPlot(PlotType::ReceiverFreeSendBuf, binning, compression, response);
}
void JFJochBrokerHttp::plot_roi_max_count_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ROIMaxCount, binning, response);
GenericPlot(PlotType::ROIMaxCount, binning, compression, response);
}
void JFJochBrokerHttp::plot_roi_sum_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ROISum, binning, response);
GenericPlot(PlotType::ROISum, binning, compression, response);
}
void JFJochBrokerHttp::plot_roi_valid_pixels_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ROIPixels, binning, response);
GenericPlot(PlotType::ROIPixels, binning, compression, response);
}
void JFJochBrokerHttp::plot_spot_count_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::SpotCount, binning, response);
GenericPlot(PlotType::SpotCount, binning, compression, response);
}
void JFJochBrokerHttp::plot_strong_pixel_get(const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::StrongPixels, binning, response);
GenericPlot(PlotType::StrongPixels, binning, compression, response);
}
void JFJochBrokerHttp::config_mask_tiff_get(Pistache::Http::ResponseWriter &response) {
std::string s = state_machine.GetFullPixelMaskTIFF();
response.send(Pistache::Http::Code::Ok, s, Pistache::Http::Mime::MediaType::fromString("image/tiff"));
}
void JFJochBrokerHttp::config_user_mask_tiff_get(Pistache::Http::ResponseWriter &response) {
std::string s = state_machine.GetUserPixelMaskTIFF();
response.send(Pistache::Http::Code::Ok, s, Pistache::Http::Mime::MediaType::fromString("image/tiff"));
}
void JFJochBrokerHttp::config_user_mask_tiff_put(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter &response) {
state_machine.SetUserPixelMask(request.body());
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::version_get(Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, jfjoch_version(), MIME(Text, Plain));
}
void JFJochBrokerHttp::config_instrument_get(Pistache::Http::ResponseWriter &response) {
ProcessOutput(Convert(state_machine.GetInstrumentMetadata()), response);
}
void JFJochBrokerHttp::config_instrument_put(const org::openapitools::server::model::Instrument_metadata
&instrumentMetadata,Pistache::Http::ResponseWriter &response) {
state_machine.LoadInstrumentMetadata(Convert(instrumentMetadata));
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::config_image_format_get(Pistache::Http::ResponseWriter &response) {
ProcessOutput(Convert(state_machine.GetImageFormatSettings()), response);
}
void JFJochBrokerHttp::config_image_format_put(
const org::openapitools::server::model::Image_format_settings &imageFormatSettings,
Pistache::Http::ResponseWriter &response) {
state_machine.LoadImageFormatSettings(Convert(imageFormatSettings));
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::config_image_format_conversion_post(Pistache::Http::ResponseWriter &response) {
state_machine.ConvImageFormatSettings();
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::config_image_format_raw_post(Pistache::Http::ResponseWriter &response) {
state_machine.RawImageFormatSettings();
response.send(Pistache::Http::Code::Ok);
}
void JFJochBrokerHttp::fpga_status_get(Pistache::Http::ResponseWriter &response) {
nlohmann::json j;
for (const auto &d: Convert(state_machine.GetDeviceStatus()))
j.push_back(d);
response.send(Pistache::Http::Code::Ok, j.dump(), MIME(Application, Json));
}
void JFJochBrokerHttp::statistics_get(const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) {
org::openapitools::server::model::Jfjoch_statistics statistics;
auto data_collection_statistics = state_machine.GetMeasurementStatistics();
if (data_collection_statistics)
statistics.setMeasurement(Convert(data_collection_statistics.value()));
statistics.setFpga(Convert(state_machine.GetDeviceStatus()));
statistics.setCalibration(Convert(state_machine.GetCalibrationStatistics()));
statistics.setBroker(Convert(state_machine.GetStatus()));
auto det_status = state_machine.GetDetectorStatus();
if (det_status.has_value())
statistics.setDetector(Convert(det_status.value()));
statistics.setDetectorSettings(Convert(state_machine.GetDetectorSettings()));
statistics.setDetectorList(Convert(state_machine.GetDetectorsList()));
statistics.setDataProcessingSettings(Convert(state_machine.GetSpotFindingSettings()));
statistics.setInstrumentMetadata(Convert(state_machine.GetInstrumentMetadata()));
statistics.setImageFormatSettings(Convert(state_machine.GetImageFormatSettings()));
auto zeromq_prev = state_machine.GetPreviewSocketSettings();
if (!zeromq_prev.address.empty())
statistics.setZeromqPreview(Convert(zeromq_prev));
nlohmann::json j = statistics;
if (!compression.has_value() || compression.value())
response.setCompression(Pistache::Http::Header::Encoding::Deflate);
response.send(Pistache::Http::Code::Ok, j.dump(), MIME(Application, Json));
}
void JFJochBrokerHttp::config_zeromq_preview_get(Pistache::Http::ResponseWriter &response) {
ProcessOutput(Convert(state_machine.GetPreviewSocketSettings()), response);
}
void JFJochBrokerHttp::config_zeromq_preview_put(
const org::openapitools::server::model::Zeromq_preview_settings &zeromqPreviewSettings,
Pistache::Http::ResponseWriter &response) {
state_machine.SetPreviewSocketSettings(Convert(zeromqPreviewSettings));
response.send(Pistache::Http::Code::Ok);
}

View File

@@ -17,6 +17,14 @@
class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
Logger logger{"JFJochBroker"};
JFJochServices services {logger};
void config_image_format_get(Pistache::Http::ResponseWriter &response) override;
void config_image_format_put(const org::openapitools::server::model::Image_format_settings &imageFormatSettings,
Pistache::Http::ResponseWriter &response) override;
void fpga_status_get(Pistache::Http::ResponseWriter &response) override;
JFJochStateMachine state_machine {services, logger};
std::string frontend_directory;
@@ -25,9 +33,9 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
void config_detector_put(const org::openapitools::server::model::Detector_settings &detectorSettings,
Pistache::Http::ResponseWriter &response) override;
void config_rad_int_get(Pistache::Http::ResponseWriter &response) override;
void config_azim_int_get(Pistache::Http::ResponseWriter &response) override;
void config_rad_int_put(const org::openapitools::server::model::Rad_int_settings &radIntSettings,
void config_azim_int_put(const org::openapitools::server::model::Azim_int_settings &radIntSettings,
Pistache::Http::ResponseWriter &response) override;
void config_select_detector_get(Pistache::Http::ResponseWriter &response) override;
@@ -43,37 +51,34 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
Pistache::Http::ResponseWriter &response) override;
void GenericPlot(PlotType plot_type,
const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response);
const std::optional<int32_t> &binning,
const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response);
void plot_bkg_estimate_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_error_pixel_get(const std::optional<int32_t> &binning,
void plot_bkg_estimate_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_error_pixel_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_image_collection_efficiency_get(const std::optional<int32_t> &binning,
void plot_image_collection_efficiency_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_indexing_rate_get(const std::optional<int32_t> &binning,
void plot_indexing_rate_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_receiver_delay_get(const std::optional<int32_t> &binning,
void plot_receiver_delay_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning,
void plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_roi_max_count_get(const std::optional<int32_t> &binning,
void plot_roi_max_count_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_roi_sum_get(const std::optional<int32_t> &binning,
void plot_roi_sum_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_roi_valid_pixels_get(const std::optional<int32_t> &binning,
void plot_roi_valid_pixels_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_spot_count_get(const std::optional<int32_t> &binning,
void plot_spot_count_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_strong_pixel_get(const std::optional<int32_t> &binning,
void plot_strong_pixel_get(const std::optional<int32_t> &binning, const std::optional<bool>& compression,
Pistache::Http::ResponseWriter &response) override;
void plot_indexing_rate_per_file_get(Pistache::Http::ResponseWriter &response) override;
void plot_rad_int_get(Pistache::Http::ResponseWriter &response) override;
void plot_rad_int_per_file_get(Pistache::Http::ResponseWriter &response) override;
void plot_azim_int_get(const std::optional<bool>& compression, Pistache::Http::ResponseWriter &response) override;
void statistics_calibration_get(Pistache::Http::ResponseWriter &response) override;
@@ -90,7 +95,7 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
void status_get(Pistache::Http::ResponseWriter &response) override;
void wait_till_done_post(Pistache::Http::ResponseWriter &response) override;
void wait_till_done_post(const std::optional<int32_t> &timeoutMs, Pistache::Http::ResponseWriter &response) override;
void trigger_post(Pistache::Http::ResponseWriter &response) override;
void pedestal_post(Pistache::Http::ResponseWriter &response) override;
@@ -118,21 +123,52 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
void xfel_event_code_get(Pistache::Http::ResponseWriter &response) override;
void xfel_pulse_id_get(Pistache::Http::ResponseWriter &response) override;
void config_mask_tiff_get(Pistache::Http::ResponseWriter &response) override;
void config_user_mask_tiff_get(Pistache::Http::ResponseWriter &response) override;
void config_user_mask_tiff_put(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter &response) override;
void config_internal_generator_image_tiff_put(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter &response) override;
void config_instrument_get(Pistache::Http::ResponseWriter &response) override;
void config_instrument_put(const org::openapitools::server::model::Instrument_metadata &instrumentMetadata,
Pistache::Http::ResponseWriter &response) override;
void GetStaticFile(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::pair<Pistache::Http::Code, std::string> handleOperationException(const std::exception &ex) const noexcept override;
template <class T>
void ProcessOutput(const T& output, Pistache::Http::ResponseWriter &response) {
void ProcessOutput(const T& output, Pistache::Http::ResponseWriter &response, bool compression = false) {
std::stringstream s;
if(!output.validate(s)) {
logger.Error(s.str());
response.send(Pistache::Http::Code::Internal_Server_Error, s.str(), MIME(Text, Plain));
}
nlohmann::json j;
to_json(j, output);
nlohmann::json j = output;
if (compression)
response.setCompression(Pistache::Http::Header::Encoding::Deflate);
response.send(Pistache::Http::Code::Ok, j.dump(), MIME(Application, Json));
}
void version_get(Pistache::Http::ResponseWriter &response) override;
void config_image_format_conversion_post(Pistache::Http::ResponseWriter &response) override;
void config_image_format_raw_post(Pistache::Http::ResponseWriter &response) override;
void statistics_get(const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) override;
void config_zeromq_preview_get(Pistache::Http::ResponseWriter &response) override;
void
config_zeromq_preview_put(const org::openapitools::server::model::Zeromq_preview_settings &zeromqPreviewSettings,
Pistache::Http::ResponseWriter &response) override;
public:
JFJochBrokerHttp(const DiffractionExperiment& experiment, std::shared_ptr<Pistache::Rest::Router> &rtr);
void AddDetectorSetup(const DetectorSetup &setup);

View File

@@ -2,392 +2,176 @@
#include "JFJochBrokerParser.h"
#include "../common/NetworkAddressConvert.h"
#include "../image_pusher/ZMQStream2Pusher.h"
#include "../image_pusher/CBORFilePusher.h"
#include "../image_pusher/HDF5FilePusher.h"
#include "OpenAPIConvert.h"
#include "Detector_type.h"
#include "../image_pusher/NonePusher.h"
inline bool CHECK_ARRAY(const nlohmann::json &j, const std::string& tag) {
if (j.contains(tag)) {
if (!j[tag].is_array())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be array");
return true;
} else
return false;
DetectorGeometry ParseStandardDetectorGeometry(const org::openapitools::server::model::Detector &j) {
auto s = j.getStandardGeometry();
return {s.getNmodules(), s.getModulesInRow(), s.getGapX(), s.getGapY(), false};
}
inline bool CHECK_OBJECT(const nlohmann::json &j, const std::string& tag) {
if (j.contains(tag)) {
if (!j[tag].is_object())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be object");
return true;
} else
return false;
}
inline int64_t GET_I64(const nlohmann::json &j, const std::string& tag, int64_t def) {
if (j.contains(tag)) {
if (!j[tag].is_number_integer())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be integer");
try {
return j[tag].get<int64_t>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
return def;
}
inline int32_t GET_I32(const nlohmann::json &j, const std::string& tag) {
if (j.contains(tag)) {
if (!j[tag].is_number_integer())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be integer");
try {
return j[tag].get<int32_t>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " is compulsory");
}
inline int32_t GET_I32(const nlohmann::json &j, const std::string& tag, int32_t def) {
if (j.contains(tag)) {
if (!j[tag].is_number_integer())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be integer");
try {
return j[tag].get<int32_t>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
return def;
}
inline float GET_FLOAT(const nlohmann::json &j, const std::string& tag, float def) {
if (j.contains(tag)) {
if (!j[tag].is_number())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be float");
try {
return j[tag].get<float>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
return def;
}
inline bool GET_BOOL(const nlohmann::json &j, const std::string& tag, bool def) {
if (j.contains(tag)) {
if (!j[tag].is_boolean())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be integer");
try {
return j[tag].get<bool>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
return def;
}
inline std::string GET_STR(const nlohmann::json &j, const std::string& tag, const std::string& def) {
if (j.contains(tag)) {
if (!j[tag].is_string())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be string");
try {
return j[tag].get<std::string>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
return def;
}
inline std::string GET_STR(const nlohmann::json &j, const std::string& tag) {
if (j.contains(tag)) {
if (!j[tag].is_string())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be string");
try {
return j[tag].get<std::string>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " is compulsory");
}
inline int64_t GET_I64(const nlohmann::json &j, const std::string& tag) {
if (j.contains(tag)) {
if (!j[tag].is_number_integer())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be integer");
try {
return j[tag].get<int64_t>();
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " is compulsory");
}
inline std::vector<std::string> GET_STR_ARR(const nlohmann::json &j, const std::string& tag) {
std::vector<std::string> ret;
if (CHECK_ARRAY(j, tag)) {
try {
for (const auto &iter: j[tag])
ret.push_back(iter.get<std::string>());
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
}
return ret;
}
inline std::vector<std::int64_t> GET_I64_ARR(const nlohmann::json &j, const std::string& tag) {
std::vector<std::int64_t> ret;
if (CHECK_ARRAY(j, tag)) {
try {
for (const auto &iter: j[tag])
ret.push_back(iter.get<int64_t>());
} catch (std::exception &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + ": " + e.what());
}
}
return ret;
}
DetectorModuleGeometry::Direction GET_DIRECTION(const nlohmann::json &j, const std::string& tag) {
if (j.contains(tag)) {
if (!j[tag].is_string())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be string");
if (j[tag] == "Xp")
DetectorModuleGeometry::Direction Convert(const org::openapitools::server::model::Detector_module_direction& d) {
switch (d.getValue()) {
case org::openapitools::server::model::Detector_module_direction::eDetector_module_direction::XP:
return DetectorModuleGeometry::Direction::Xpos;
if (j[tag] == "Xn")
case org::openapitools::server::model::Detector_module_direction::eDetector_module_direction::XN:
return DetectorModuleGeometry::Direction::Xneg;
if (j[tag] == "Yp")
case org::openapitools::server::model::Detector_module_direction::eDetector_module_direction::YP:
return DetectorModuleGeometry::Direction::Ypos;
if (j[tag] == "Yn")
case org::openapitools::server::model::Detector_module_direction::eDetector_module_direction::YN:
return DetectorModuleGeometry::Direction::Yneg;
else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Allowed values for direction: Xp, Xn, Yp, Yn");
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " is compulsory");
default:
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "invalid detector direction");
}
}
inline int64_t TimeToUs(const std::string &unit) {
if ((unit == "us") || unit.empty()) return 1L;
else if (unit == "ms") return 1000L;
else if ((unit == "s") || (unit == "sec")) return 1000*1000L;
else
throw JFJochException(JFJochExceptionCategory::WrongUnit,
"Only us, ms and s (or sec) are viable units for time");
DetectorType Convert(const org::openapitools::server::model::Detector_type &d) {
switch (d.getValue()) {
case org::openapitools::server::model::Detector_type::eDetector_type::EIGER:
return DetectorType::EIGER;
case org::openapitools::server::model::Detector_type::eDetector_type::JUNGFRAU:
return DetectorType::JUNGFRAU;
default:
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "invalid detector type");
}
}
inline std::chrono::microseconds GET_TIME(const nlohmann::json &j, const std::string& tag) {
if (j.contains(tag)) {
if (j[tag].is_number())
return std::chrono::microseconds (std::lround(j[tag].get<double>() * 1000.0 * 1000.0));
else if (j[tag].is_string()) {
std::string::size_type pos;
auto text = j[tag].get<std::string>();
// Check if floating point
pos = text.find_first_of('.');
if (pos != std::string::npos)
throw JFJochException(JFJochExceptionCategory::WrongNumber,
"Time must be provided as <integer> {s|ms|us|Hz} - no floating point allowed");
// Convert integer part
int64_t val = std::stol(text, &pos);
if (pos == 0)
throw JFJochException(JFJochExceptionCategory::WrongNumber,
"Time must be provided as <integer> {s|ms|us|Hz}");
pos = text.find_first_not_of(' ', pos);
if (pos != std::string::npos) {
if (text.substr(pos) == "Hz")
val = 1000*1000L / val;
else
val *= TimeToUs(text.substr(pos));
}
return std::chrono::microseconds(val);
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " must be number in seconds or string with time units s|ms|us");
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, tag + " is compulsory");
}
DetectorGeometry ParseStandardDetectorGeometry(const nlohmann::json &j) {
int32_t nmodules = GET_I64(j, "nmodules");
int32_t gap_x = GET_I64(j, "gap_x", 8);
int32_t gap_y = GET_I64(j, "gap_y", 36);
int32_t h_stacking = GET_I64(j, "horizontal_stacking", 2);
bool mirror_y = GET_BOOL(j, "mirror_y", true);
return {nmodules, h_stacking, gap_x, gap_y, mirror_y};
}
DetectorGeometry ParseCustomDetectorGeometry(const nlohmann::json &j, bool mirror_y) {
DetectorGeometry ParseCustomDetectorGeometry(const org::openapitools::server::model::Detector &j) {
std::vector<DetectorModuleGeometry> modules;
for (const auto &iter: j) {
if (!iter.is_object())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"custom_geometry element must be JSON object");
int64_t x0 = GET_I64(iter, "x0");
int64_t y0 = GET_I64(iter, "y0");
auto fast = GET_DIRECTION(iter, "fast_axis");
auto slow = GET_DIRECTION(iter, "slow_axis");
modules.emplace_back(x0, y0, fast, slow);
for (const auto &iter: j.getCustomGeometry()) {
auto fast = Convert(iter.getFastAxis());
auto slow = Convert(iter.getSlowAxis());
modules.emplace_back(iter.getX0(), iter.getY0(), fast, slow);
}
return {modules, mirror_y};
return {modules, false};
}
DetectorGeometry ParseDetectorGeometry(const nlohmann::json &j) {
if (CHECK_OBJECT(j, "standard_geometry"))
return ParseStandardDetectorGeometry(j["standard_geometry"]);
else if (CHECK_ARRAY(j, "custom_geometry")) {
return ParseCustomDetectorGeometry(j["custom_geometry"], GET_BOOL(j, "custom_geometry_mirror_y", false));
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"It is compulsory to have either standard_detector or custom_detector declared.");
DetectorGeometry ParseDetectorGeometry(const org::openapitools::server::model::Detector &d) {
if (d.standardGeometryIsSet() && d.customGeometryIsSet())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Need to set EITHER standard or custom geometry");
if (d.standardGeometryIsSet())
return ParseStandardDetectorGeometry(d);
else if (d.customGeometryIsSet())
return ParseCustomDetectorGeometry(d);
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Need to set EITHER standard or custom geometry");
}
DetectorSetup ParseDetectorSetup(const nlohmann::json &j) {
if (!j.is_object())
throw JFJochException(JFJochExceptionCategory::JSON, "Expecting JSON object for detector setup");
DetectorSetup ParseDetectorSetup(const org::openapitools::server::model::Detector &d) {
DetectorGeometry geom = ParseDetectorGeometry(d);
if (d.isMirrorY())
geom.VerticalFlip();
DetectorGeometry geom = ParseDetectorGeometry(j);
DetectorType detector_type = Convert(d.getType());
DetectorSetup setup(geom, detector_type, d.getDescription(), d.getHostname());
std::string description = GET_STR(j, "description");
auto module_hostname = GET_STR_ARR(j, "module_hostname");
DetectorType detector_type;
const std::string detector_type_str = GET_STR(j, "type", "jungfrau");
if (detector_type_str == "jungfrau")
detector_type = DetectorType::JUNGFRAU;
else if (detector_type_str == "eiger")
detector_type = DetectorType::EIGER;
else
throw JFJochException(JFJochExceptionCategory::JSON, "type must be \"jungfrau\" or \"eiger\" ");
DetectorSetup setup(geom, detector_type, description, module_hostname);
if (detector_type == DetectorType::JUNGFRAU) {
auto gain_files = GET_STR_ARR(j, "gain_files");
if (!gain_files.empty())
setup.LoadGain(gain_files);
} else if (detector_type == DetectorType::EIGER) {
auto trim_files = GET_STR_ARR(j, "trim_files");
if (!trim_files.empty())
setup.SetTrimFiles(trim_files);
auto calib = d.getCalibrationFile();
if (!calib.empty()) {
if (detector_type == DetectorType::JUNGFRAU)
setup.LoadGain(calib);
else if (detector_type == DetectorType::EIGER)
setup.SetTrimFiles(calib);
}
if (j.contains("high_voltage"))
setup.HighVoltage(GET_I32(j,"high_voltage"));
if ((detector_type == DetectorType::EIGER) || (detector_type == DetectorType::JUNGFRAU))
setup.PixelSize_um(75.0f);
setup.UDPInterfaceCount(GET_I64(j, "udp_interface_count", 2))
.SensorThickness_um(GET_FLOAT(j, "sensor_thickness_um", 320.0f))
.PixelSize_um(GET_FLOAT(j, "pixel_size_um", 75.0f))
.SensorMaterial(GET_STR(j, "sensor_material", "Si"));
if (d.highVoltageVIsSet())
setup.HighVoltage(d.getHighVoltageV());
if (j.contains("tx_delay"))
setup.TxDelay(GET_I64_ARR(j, "tx_delay"));
setup.UDPInterfaceCount(d.getUdpInterfaceCount())
.SensorThickness_um(d.getSensorThicknessUm())
// .PixelSize_um(GET_FLOAT(j, "pixel_size_um", 75.0f))
.SensorMaterial(d.getSensorMaterial())
.SerialNumber(d.getSerialNumber())
.ModuleSync(d.isModuleSync());
if (d.baseDataIpv4AddressIsSet())
setup.BaseIPv4Addr(d.getBaseDataIpv4Address());
if (d.txDelayIsSet())
setup.TxDelay(d.getTxDelay());
return setup;
}
void ParseDetectorSetup(const nlohmann::json &j, const std::string& tag, JFJochBrokerHttp& broker) {
if (CHECK_ARRAY(j, tag)) {
for (const auto &iter : j[tag])
broker.AddDetectorSetup(ParseDetectorSetup(iter));
} else
throw JFJochException(JFJochExceptionCategory::JSON, "Detector setup not found");
void ParseFacilityConfiguration(const org::openapitools::server::model::Jfjoch_settings &j, DiffractionExperiment &experiment) {
if (j.instrumentIsSet())
experiment.ImportInstrumentMetadata(Convert(j.getInstrument()));
if (j.detectorSettingsIsSet())
experiment.ImportDetectorSettings(Convert(j.getDetectorSettings()));
if (j.azimIntIsSet())
experiment.ImportRadialIntegrationSettings(Convert(j.getAzimInt()));
if (j.imageFormatIsSet())
experiment.ImportImageFormatSettings(Convert(j.getImageFormat()));
}
void ParseFacilityConfiguration(const nlohmann::json &input, const std::string& tag, DiffractionExperiment &experiment) {
if (CHECK_OBJECT(input, tag)) {
auto j = input[tag];
experiment.SourceName(GET_STR(j, "source_name"));
experiment.SourceNameShort(GET_STR(j, "source_name_short"));
experiment.InstrumentName(GET_STR(j, "instrument_name"));
experiment.InstrumentNameShort(GET_STR(j, "instrument_name_short"));
std::unique_ptr<ImagePusher> ParseZMQImagePusher(const org::openapitools::server::model::Jfjoch_settings &j) {
if (!j.zeromqIsSet())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "ZeroMQ settings must be provided");
experiment.PulsedSource(GET_BOOL(j, "pulsed_source", false));
std::optional<int32_t> send_buffer_size;
if (j.getZeromq().sendBufferSizeIsSet())
send_buffer_size = j.getZeromq().getSendBufferSize();
if (j.contains("omega_axis")) {
if (j["omega_axis"].is_array() && (j["omega_axis"].size() == 3))
experiment.DefaultOmegaAxis(Coord(j["omega_axis"][0].get<float>(),
j["omega_axis"][1].get<float>(),
j["omega_axis"][2].get<float>()));
else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"omega_axis must be float array of 3");
}
std::optional<int32_t> send_watermark;
if (j.getZeromq().sendWatermarkIsSet())
send_watermark = j.getZeromq().getSendWatermark();
if (j.contains("pedestal_g0_frames"))
experiment.PedestalG0Frames(GET_I64(j, "pedestal_g0_frames"));
if (j.contains("pedestal_g1_frames"))
experiment.PedestalG1Frames(GET_I64(j, "pedestal_g1_frames"));
if (j.contains("pedestal_g2_frames"))
experiment.PedestalG2Frames(GET_I64(j, "pedestal_g2_frames"));
if (j.contains("detector_trigger_delay_us"))
experiment.DetectorDelay(GET_TIME(j, "detector_trigger_delay_us"));
auto tmp = std::make_unique<ZMQStream2Pusher>(j.getZeromq().getImageSocket(),
send_watermark,
send_buffer_size);
experiment.FrameTime(GET_TIME(j, "frame_time_us"), GET_TIME(j, "count_time_us"));
if (j.contains("preview_period_us"))
experiment.PreviewPeriod(GET_TIME(j, "preview_period_us"));
experiment.UseInternalPacketGenerator(GET_BOOL(j, "internal_frame_generator", false));
if (experiment.IsUsingInternalPacketGen())
experiment.ConversionOnFPGA(false);
experiment.IPv4BaseAddr(GET_STR(j, "detector_ipv4"));
} else
throw JFJochException(JFJochExceptionCategory::JSON, "Default configuration not found");
if (j.getZeromq().writerNotificationSocketIsSet())
tmp->WriterNotificationSocket(j.getZeromq().getWriterNotificationSocket());
return std::move(tmp);
}
void ParseAcquisitionDeviceGroup(const nlohmann::json &input, const std::string& tag,
AcquisitionDeviceGroup &aq_devices) {
if (CHECK_OBJECT(input, tag)) {
const auto &j = input[tag];
std::string dev_type = GET_STR(j, "type");
if (dev_type == "pcie") {
std::vector<std::string> devices = GET_STR_ARR(j, "devices");
if (devices.empty())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"At least one PCIe device must be provided");
for (auto &d: devices)
aq_devices.AddPCIeDevice(d);
} else if (dev_type == "hls") {
int64_t buffer_size = GET_I64(j, "buffer_size", 1024);
if ((buffer_size < 16) || (buffer_size > 65536))
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Buffer size must be in range 16-65536");
aq_devices.AddHLSDevice(buffer_size);
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Device type unknown");
aq_devices.SetDefaultDataSource(AcquisitionDeviceSource::NETWORK);
std::vector<std::string> ipv4_addr = GET_STR_ARR(j, "ipv4_addr");
if (ipv4_addr.size() != aq_devices.size())
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Mismatch between number of devices and number of IPv4 addresses");
for (int i = 0; i < ipv4_addr.size(); i++)
aq_devices[i].SetIPv4Address(IPv4AddressFromStr(ipv4_addr[i]));
std::unique_ptr<ImagePusher> ParseImagePusher(const org::openapitools::server::model::Jfjoch_settings &j) {
switch (j.getImagePusher().getValue()) {
case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::ZEROMQ:
return ParseZMQImagePusher(j);
case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::HDF5:
return std::make_unique<HDF5FilePusher>();
case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::NONE:
return std::make_unique<NonePusher>();
case org::openapitools::server::model::Image_pusher_type::eImage_pusher_type::CBOR:
return std::make_unique<CBORFilePusher>();
default:
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Invalid value");
}
}
std::vector<std::string> ParseStringArray(const nlohmann::json &input, const std::string& tag) {
return GET_STR_ARR(input, tag);
void ParseAcquisitionDeviceGroup(const org::openapitools::server::model::Jfjoch_settings &input,
AcquisitionDeviceGroup &aq_devices) {
if (!input.pcieIsSet())
aq_devices.AddHLSDevice(256);
else for (auto &p: input.getPcie()) {
std::optional<uint32_t> ipv4_addr = {};
if (p.ipv4IsSet())
ipv4_addr = IPv4AddressFromStr(p.getIpv4());
aq_devices.AddPCIeDevice(p.getBlk(), ipv4_addr);
}
}
std::string ParseString(const nlohmann::json &input, const std::string& tag, const std::string &def) {
return GET_STR(input, tag, def);
}
void ParseReceiverSettings(const org::openapitools::server::model::Jfjoch_settings &input, JFJochReceiverService &service) {
std::string numa_policy = input.getNumaPolicy();
if (!numa_policy.empty())
service.NUMAPolicy(numa_policy);
int64_t ParseInt64(const nlohmann::json &input, const std::string& tag, int64_t def) {
return GET_I64(input, tag, def);
}
// Using default in case
service.NumThreads(input.getReceiverThreads());
int32_t ParseInt32(const nlohmann::json &input, const std::string& tag, int32_t def) {
return GET_I32(input, tag, def);
if (input.zeromqPreviewIsSet()) {
service.PreviewSocket(input.getZeromqPreview().getSocketAddress());
service.PreviewSocketSettings(Convert(input.getZeromqPreview()));
}
}

View File

@@ -3,22 +3,22 @@
#ifndef JUNGFRAUJOCH_JFJOCHBROKERPARSER_H
#define JUNGFRAUJOCH_JFJOCHBROKERPARSER_H
#include <nlohmann/json.hpp>
#include "../common/DiffractionExperiment.h"
#include "JFJochBrokerHttp.h"
#include "../acquisition_device/AcquisitionDeviceGroup.h"
#include "../image_pusher/ImagePusher.h"
#include "../receiver/JFJochReceiverService.h"
#include "gen/model/Jfjoch_settings.h"
DetectorGeometry ParseStandardDetectorGeometry(const nlohmann::json &j);
DetectorGeometry ParseCustomDetectorGeometry(const nlohmann::json &j);
DetectorGeometry ParseDetectorGeometry(const nlohmann::json &j);
DetectorSetup ParseDetectorSetup(const nlohmann::json &j);
void ParseDetectorSetup(const nlohmann::json &j, const std::string& tag, JFJochBrokerHttp& broker);
void ParseFacilityConfiguration(const nlohmann::json &j, const std::string& tag, DiffractionExperiment &experiment);
DetectorGeometry ParseStandardDetectorGeometry(const org::openapitools::server::model::Detector &j);
DetectorGeometry ParseCustomDetectorGeometry(const org::openapitools::server::model::Detector &j);
DetectorGeometry ParseDetectorGeometry(const org::openapitools::server::model::Detector &j);
DetectorSetup ParseDetectorSetup(const org::openapitools::server::model::Detector &j);
void ParseAcquisitionDeviceGroup(const nlohmann::json &input, const std::string& tag, AcquisitionDeviceGroup &aq_devices);
std::vector<std::string> ParseStringArray(const nlohmann::json &input, const std::string& tag);
std::string ParseString(const nlohmann::json &input, const std::string& tag, const std::string& def);
int64_t ParseInt64(const nlohmann::json &input, const std::string& tag, int64_t def);
int32_t ParseInt32(const nlohmann::json &input, const std::string& tag, int32_t def);
void ParseFacilityConfiguration(const org::openapitools::server::model::Jfjoch_settings &j, DiffractionExperiment &experiment);
std::unique_ptr<ImagePusher> ParseImagePusher(const org::openapitools::server::model::Jfjoch_settings &j);
void ParseAcquisitionDeviceGroup(const org::openapitools::server::model::Jfjoch_settings &input, AcquisitionDeviceGroup &aq_devices);
void ParseReceiverSettings(const org::openapitools::server::model::Jfjoch_settings &input, JFJochReceiverService &service);
#endif //JUNGFRAUJOCH_JFJOCHBROKERPARSER_H

View File

@@ -5,15 +5,17 @@
JFJochServices::JFJochServices(Logger &in_logger) : logger(in_logger) {}
void JFJochServices::Start(const DiffractionExperiment& experiment, const JFCalibration &calibration) {
void JFJochServices::Start(const DiffractionExperiment& experiment,
const PixelMask &pixel_mask,
const JFCalibration &calibration) {
logger.Info("Measurement start for: {}", experiment.GetFilePrefix());
if (receiver != nullptr) {
logger.Info(" ... receiver start");
if (experiment.GetDetectorMode() == DetectorMode::Conversion)
receiver->Start(experiment, &calibration);
if (experiment.IsJungfrauConvPhotonCnt())
receiver->Start(experiment, pixel_mask, &calibration);
else
receiver->Start(experiment, nullptr);
receiver->Start(experiment, pixel_mask, nullptr);
if (detector && !experiment.IsUsingInternalPacketGen()) {
logger.Info(" ... detector start");
@@ -116,12 +118,18 @@ JFJochServices &JFJochServices::Receiver(JFJochReceiverService *input) {
return *this;
}
std::optional<JFJochReceiverStatus> JFJochServices::GetReceiverStatus() {
std::optional<JFJochReceiverStatus> JFJochServices::GetReceiverStatus() const {
if (receiver == nullptr)
return {};
return receiver->GetStatus();
}
std::optional<float> JFJochServices::GetReceiverProgress() const {
if (receiver == nullptr)
return {};
return receiver->GetProgress();
}
MultiLinePlot JFJochServices::GetPlots(const PlotRequest &request) {
if (receiver == nullptr)
return {};
@@ -185,3 +193,22 @@ void JFJochServices::GetXFELEventCode(std::vector<uint64_t> &v) const {
if (receiver)
receiver->GetXFELPulseID(v);
}
std::vector<DeviceStatus> JFJochServices::GetDeviceStatus() const {
std::vector<DeviceStatus> ret;
if (receiver)
ret = receiver->GetDeviceStatus();
return ret;
}
ZMQPreviewSettings JFJochServices::GetPreviewSocketSettings() {
if (receiver)
return receiver->GetPreviewSocketSettings();
else
return {};
}
void JFJochServices::SetPreviewSocketSettings(const ZMQPreviewSettings &input) {
if (receiver)
receiver->PreviewSocketSettings(input);
}

View File

@@ -23,7 +23,9 @@ public:
void On(const DiffractionExperiment& experiment);
void Off();
void ConfigureDetector(const DiffractionExperiment& experiment);
void Start(const DiffractionExperiment& experiment, const JFCalibration &calibration);
void Start(const DiffractionExperiment& experiment,
const PixelMask &pixel_mask,
const JFCalibration &calibration);
JFJochServicesOutput Stop();
void Cancel();
void Trigger();
@@ -31,7 +33,8 @@ public:
void LoadInternalGeneratorImage(const DiffractionExperiment &experiment,
const std::vector<uint16_t> &image,
uint64_t image_number);
std::optional<JFJochReceiverStatus> GetReceiverStatus();
std::optional<JFJochReceiverStatus> GetReceiverStatus() const;
std::optional<float> GetReceiverProgress() const;
MultiLinePlot GetPlots(const PlotRequest &request);
void SetSpotFindingSettings(const SpotFindingSettings &settings);
@@ -44,6 +47,11 @@ public:
void GetXFELPulseID(std::vector<uint64_t> &v) const;
void GetXFELEventCode(std::vector<uint64_t> &v) const;
std::vector<DeviceStatus> GetDeviceStatus() const;
void SetPreviewSocketSettings(const ZMQPreviewSettings &input);
ZMQPreviewSettings GetPreviewSocketSettings();
};

View File

@@ -3,71 +3,13 @@
#include <thread>
#include "JFJochStateMachine.h"
#include "../preview/WriteTIFF.h"
void ApplyDetectorSettings(DiffractionExperiment& experiment, const DetectorSettings &settings) {
auto tmp = experiment;
try {
if (settings.count_time_us)
experiment.FrameTime(std::chrono::microseconds(settings.frame_time_us),
std::chrono::microseconds(settings.count_time_us.value()));
else
experiment.FrameTime(std::chrono::microseconds(settings.frame_time_us));
experiment.StorageCells(settings.storage_cell_count);
experiment.UseInternalPacketGenerator(settings.use_internal_packet_generator);
// If internal packet generator is used --> no conversion on FPGA
experiment.ConversionOnFPGA(!settings.use_internal_packet_generator);
if (settings.collect_raw_data)
experiment.Mode(DetectorMode::Raw);
else
experiment.Mode(DetectorMode::Conversion);
experiment.UsingGainHG0(settings.use_gain_hg0);
experiment.FixedGainG1(settings.fixed_gain_g1);
if (settings.pedestal_g0_frames)
experiment.PedestalG0Frames(settings.pedestal_g0_frames.value());
if (settings.pedestal_g1_frames)
experiment.PedestalG1Frames(settings.pedestal_g1_frames.value());
if (settings.pedestal_g2_frames)
experiment.PedestalG2Frames(settings.pedestal_g2_frames.value());
if (settings.storage_cell_delay_ns)
experiment.StorageCellDelay(std::chrono::nanoseconds(settings.storage_cell_delay_ns.value()));
if (settings.detector_delay_ns)
experiment.DetectorDelay(std::chrono::nanoseconds(settings.detector_delay_ns.value()));
if (settings.internal_packet_generator_images)
experiment.InternalPacketGeneratorImages(settings.internal_packet_generator_images.value());
} catch (...) {
experiment = tmp;
throw;
}
}
void ApplyRadialIntegrationSettings(DiffractionExperiment& experiment, const RadialIntegrationSettings &settings) {
auto tmp = experiment;
try {
if (settings.polarization_factor) {
experiment.ApplyPolarizationCorr(true);
experiment.PolarizationFactor(settings.polarization_factor.value());
} else
experiment.ApplyPolarizationCorr(false);
experiment.ApplySolidAngleCorr(settings.solid_angle_correction);
experiment.LowQForAzimInt_recipA(settings.low_q_recipA);
experiment.HighQForAzimInt_recipA(settings.high_q_recipA);
experiment.QSpacingForAzimInt_recipA(settings.q_spacing);
} catch (...) {
experiment = tmp;
throw;
}
}
#include "../preview/JFJochTIFF.h"
JFJochStateMachine::JFJochStateMachine(JFJochServices &in_services, Logger &in_logger)
: services(in_services), logger(in_logger),
data_processing_settings(DiffractionExperiment::DefaultDataProcessingSettings()) {
: services(in_services),
logger(in_logger),
data_processing_settings(DiffractionExperiment::DefaultDataProcessingSettings()),
pixel_mask(experiment) {
}
@@ -104,6 +46,13 @@ bool JFJochStateMachine::ImportPedestalG1G2(const JFJochReceiverOutput &receiver
}
void JFJochStateMachine::TakePedestalInternalAll(std::unique_lock<std::mutex> &ul) {
if (experiment.GetDetectorSetup().GetDetectorType() == DetectorType::EIGER) {
logger.Info("EIGER configuration");
services.ConfigureDetector(experiment);
logger.Info(" ... done ");
return;
}
calibration = std::make_unique<JFCalibration>(experiment);
if (!gain_calibration.empty()) {
@@ -112,7 +61,7 @@ void JFJochStateMachine::TakePedestalInternalAll(std::unique_lock<std::mutex> &u
for (int i = 0; i < gain_calibration.size(); i++)
calibration->GainCalibration(i) = gain_calibration[i];
}
cancel_sequence = false;
logger.Info("Pedestal sequence started");
@@ -126,6 +75,7 @@ void JFJochStateMachine::TakePedestalInternalAll(std::unique_lock<std::mutex> &u
}
}
services.ConfigureDetector(experiment);
pixel_mask.LoadDetectorBadPixelMask(calibration->CalculateMask());
} catch (const std::exception &e) {
logger.Error("Pedestal sequence error {}", e.what());
state = JFJochState::Error;
@@ -158,7 +108,7 @@ void JFJochStateMachine::TakePedestalInternalG0(std::unique_lock<std::mutex> &ul
state = JFJochState::Pedestal;
services.ConfigureDetector(local_experiment);
services.Start(local_experiment, *calibration);
services.Start(local_experiment, pixel_mask, *calibration);
services.Trigger();
@@ -168,7 +118,6 @@ void JFJochStateMachine::TakePedestalInternalG0(std::unique_lock<std::mutex> &ul
auto pedestal_output = services.Stop();
ul.lock();
SetFullMeasurementOutput(pedestal_output);
if (ImportPedestalG0(pedestal_output.receiver_output))
state = JFJochState::Idle;
else
@@ -197,7 +146,7 @@ void JFJochStateMachine::TakePedestalInternalG1(std::unique_lock<std::mutex> &ul
state = JFJochState::Pedestal;
services.ConfigureDetector(local_experiment);
services.Start(local_experiment, *calibration);
services.Start(local_experiment, pixel_mask, *calibration);
services.Trigger();
@@ -207,7 +156,6 @@ void JFJochStateMachine::TakePedestalInternalG1(std::unique_lock<std::mutex> &ul
auto pedestal_output = services.Stop();
ul.lock();
SetFullMeasurementOutput(pedestal_output);
if (ImportPedestalG1G2(pedestal_output.receiver_output, 1, storage_cell))
state = JFJochState::Idle;
else
@@ -236,7 +184,7 @@ void JFJochStateMachine::TakePedestalInternalG2(std::unique_lock<std::mutex> &ul
state = JFJochState::Pedestal;
services.ConfigureDetector(local_experiment);
services.Start(local_experiment, *calibration);
services.Start(local_experiment, pixel_mask, *calibration);
services.Trigger();
@@ -246,7 +194,6 @@ void JFJochStateMachine::TakePedestalInternalG2(std::unique_lock<std::mutex> &ul
auto pedestal_output = services.Stop();
ul.lock();
SetFullMeasurementOutput(pedestal_output);
if (ImportPedestalG1G2(pedestal_output.receiver_output, 2, storage_cell))
state = JFJochState::Idle;
else
@@ -268,7 +215,6 @@ void JFJochStateMachine::Initialize() {
state = JFJochState::Busy;
ClearMeasurementStatistics();
measurement = std::async(std::launch::async, &JFJochStateMachine::InitializeThread, this, std::move(ul));
}
@@ -313,20 +259,18 @@ void JFJochStateMachine::Start(const DatasetSettings& settings) {
experiment.ImportDatasetSettings(settings);
ClearAndSetMeasurementStatistics();
cancel_sequence = false;
if (experiment.GetStorageCellNumber() == 1)
experiment.StorageCellStart(15);
else
experiment.StorageCellStart(0);
experiment.IncrementSeriesID();
experiment.IncrementRunNumber();
try {
state = JFJochState::Busy;
services.SetSpotFindingSettings(GetSpotFindingSettings());
services.Start(experiment, *calibration);
services.Start(experiment, pixel_mask, *calibration);
state = JFJochState::Measuring;
measurement = std::async(std::launch::async, &JFJochStateMachine::MeasurementThread, this);
@@ -337,16 +281,9 @@ void JFJochStateMachine::Start(const DatasetSettings& settings) {
}
}
void JFJochStateMachine::WaitTillMeasurementDone() {
std::unique_lock<std::mutex> ul(m);
c.wait(ul, [&] { return !IsRunning(); });
}
void JFJochStateMachine::MeasurementThread() {
try {
auto tmp_output = services.Stop();
SetFullMeasurementOutput(tmp_output);
{
std::unique_lock<std::mutex> ul(m);
state = JFJochState::Idle;
@@ -392,60 +329,21 @@ JFJochStateMachine::~JFJochStateMachine() {
} catch (...) {}
}
void JFJochStateMachine::SetFullMeasurementOutput(const JFJochServicesOutput &output) {
std::unique_lock<std::mutex> ul(last_receiver_output_mutex);
MeasurementStatistics tmp{}; // reset last measurement statistics
tmp.file_prefix = experiment.GetFilePrefix();
tmp.detector_width = experiment.GetXPixelsNum();
tmp.detector_height = experiment.GetYPixelsNum();
tmp.detector_pixel_depth = experiment.GetPixelDepth();
tmp.images_expected = experiment.GetImageNum();
tmp.compression_ratio = output.receiver_output.status.compressed_ratio;
tmp.collection_efficiency = output.receiver_output.efficiency;
tmp.images_collected = output.receiver_output.status.images_collected;
tmp.images_sent = output.receiver_output.status.images_sent;
tmp.images_skipped = output.receiver_output.status.images_skipped;
tmp.cancelled = output.receiver_output.status.cancelled;
tmp.max_image_number_sent = output.receiver_output.status.max_image_number_sent;
tmp.max_receive_delay = output.receiver_output.status.max_receive_delay;
tmp.indexing_rate = output.receiver_output.status.indexing_rate;
tmp.bkg_estimate = output.receiver_output.status.bkg_estimate;
measurement_statistics = tmp;
}
void JFJochStateMachine::ClearAndSetMeasurementStatistics() {
std::unique_lock<std::mutex> ul(last_receiver_output_mutex);
std::optional<MeasurementStatistics> JFJochStateMachine::GetMeasurementStatistics() const {
MeasurementStatistics tmp{};
tmp.file_prefix = experiment.GetFilePrefix();
tmp.detector_height = experiment.GetXPixelsNum();
tmp.detector_width = experiment.GetYPixelsNum();
tmp.detector_pixel_depth = experiment.GetPixelDepth();
tmp.run_number = experiment.GetRunNumber();
tmp.experiment_group = experiment.GetExperimentGroup();
tmp.detector_width = experiment.GetXPixelsNum();
tmp.detector_height = experiment.GetYPixelsNum();
tmp.detector_pixel_depth = experiment.GetByteDepthImage();
tmp.images_expected = experiment.GetImageNum();
measurement_statistics = tmp;
}
void JFJochStateMachine::ClearMeasurementStatistics() {
std::unique_lock<std::mutex> ul(last_receiver_output_mutex);
measurement_statistics.reset();
}
std::optional<MeasurementStatistics> JFJochStateMachine::GetMeasurementStatistics() const {
tmp.unit_cell = experiment.GetUnitCellString();
auto rcv_status = services.GetReceiverStatus();
if (rcv_status) {
MeasurementStatistics tmp;
tmp.file_prefix = experiment.GetFilePrefix();
tmp.detector_width = experiment.GetXPixelsNum();
tmp.detector_height = experiment.GetYPixelsNum();
tmp.detector_pixel_depth = experiment.GetPixelDepth();
tmp.images_expected = experiment.GetImageNum();
tmp.compression_ratio = rcv_status->compressed_ratio;
tmp.images_collected = rcv_status->images_collected;
tmp.images_sent = rcv_status->images_sent;
@@ -455,11 +353,9 @@ std::optional<MeasurementStatistics> JFJochStateMachine::GetMeasurementStatistic
tmp.max_receive_delay = rcv_status->max_receive_delay;
tmp.indexing_rate = rcv_status->indexing_rate;
tmp.bkg_estimate = rcv_status->bkg_estimate;
return tmp;
} else {
std::unique_lock<std::mutex> ul(last_receiver_output_mutex);
return measurement_statistics;
tmp.collection_efficiency = rcv_status->efficiency;
}
return tmp;
}
std::vector<JFCalibrationModuleStatistics> JFJochStateMachine::GetCalibrationStatistics() const {
@@ -475,21 +371,7 @@ void JFJochStateMachine::SetCalibrationStatistics(const std::vector<JFCalibratio
DetectorSettings JFJochStateMachine::GetDetectorSettings() const {
std::unique_lock<std::mutex> ul(m);
DetectorSettings ret;
ret.frame_time_us = experiment.GetFrameTime().count();
ret.count_time_us = experiment.GetFrameCountTime().count();
ret.collect_raw_data = (experiment.GetDetectorMode() != DetectorMode::Conversion);
ret.use_internal_packet_generator = experiment.IsUsingInternalPacketGen();
ret.storage_cell_count = experiment.GetStorageCellNumber();
ret.pedestal_g0_frames = experiment.GetPedestalG0Frames();
ret.pedestal_g1_frames = experiment.GetPedestalG1Frames();
ret.pedestal_g2_frames = experiment.GetPedestalG2Frames();
ret.storage_cell_delay_ns = experiment.GetStorageCellDelay().count();
ret.detector_delay_ns = experiment.GetDetectorDelay().count();
ret.fixed_gain_g1 = experiment.IsFixedGainG1();
ret.use_gain_hg0 = experiment.IsUsingGainHG0();
ret.internal_packet_generator_images = experiment.GetInternalPacketGeneratorImages();
return ret;
return experiment.GetDetectorSettings();
}
void JFJochStateMachine::LoadDetectorSettings(const DetectorSettings &settings) {
@@ -497,11 +379,11 @@ void JFJochStateMachine::LoadDetectorSettings(const DetectorSettings &settings)
switch (state) {
case JFJochState::Inactive:
case JFJochState::Error:
ApplyDetectorSettings(experiment, settings);
experiment.ImportDetectorSettings(settings);
break;
case JFJochState::Idle:
state = JFJochState::Busy;
ApplyDetectorSettings(experiment, settings);
experiment.ImportDetectorSettings(settings);
measurement = std::async(std::launch::async, &JFJochStateMachine::PedestalThread, this, std::move(ul));
break;
case JFJochState::Measuring:
@@ -517,16 +399,8 @@ DiffractionExperiment &JFJochStateMachine::NotThreadSafe_Experiment() {
BrokerStatus JFJochStateMachine::GetStatus() const {
BrokerStatus ret{};
ret.broker_state = state;
try {
auto rcv_status = services.GetReceiverStatus();
if (rcv_status) {
ret.progress = rcv_status.value().progress;
ret.indexing_rate = rcv_status.value().indexing_rate;
}
} catch (JFJochException &e) {} // ignore exception in getting receiver status (don't really care, e.g. if receiver is down)
ret.progress = services.GetReceiverProgress();
return ret;
}
@@ -557,6 +431,7 @@ void JFJochStateMachine::AddDetectorSetup(const DetectorSetup &setup) {
experiment.Detector(setup);
gain_calibration = setup.GetGainCalibration();
current_detector_setup = 0;
pixel_mask = PixelMask(setup);
}
detector_setup.emplace_back(setup);
}
@@ -571,6 +446,9 @@ DetectorList JFJochStateMachine::GetDetectorsList() const {
tmp.nmodules = i.GetModulesNum();
tmp.width = i.GetGeometry().GetWidth();
tmp.height = i.GetGeometry().GetHeight();
tmp.serial_number = i.GetSerialNumber();
tmp.base_ipv4_addr = i.GetBaseIPv4Addr();
tmp.udp_interface_count = i.GetUDPInterfaceCount();
ret.detector.emplace_back(std::move(tmp));
}
@@ -594,6 +472,7 @@ void JFJochStateMachine::SelectDetector(int64_t id) {
try {
experiment.Detector(detector_setup[id]);
gain_calibration = detector_setup[id].GetGainCalibration();
pixel_mask = PixelMask(detector_setup[id]);
state = JFJochState::Inactive;
current_detector_setup = id;
} catch (JFJochException &e) {
@@ -602,27 +481,18 @@ void JFJochStateMachine::SelectDetector(int64_t id) {
}
}
void JFJochStateMachine::SetRadialIntegrationSettings(const RadialIntegrationSettings &settings) {
void JFJochStateMachine::SetRadialIntegrationSettings(const AzimuthalIntegrationSettings &settings) {
std::unique_lock<std::mutex> ul(m);
if (IsRunning())
throw WrongDAQStateException ("Cannot change radial integration settings during data collection");
ApplyRadialIntegrationSettings(experiment, settings);
experiment.ImportRadialIntegrationSettings(settings);
}
RadialIntegrationSettings JFJochStateMachine::GetRadialIntegrationSettings() const {
RadialIntegrationSettings ret;
if (experiment.GetApplyPolarizationCorr())
ret.polarization_factor = experiment.GetPolarizationFactor();
ret.solid_angle_correction = experiment.GetApplySolidAngleCorr();
ret.q_spacing = experiment.GetQSpacingForAzimInt_recipA();
ret.low_q_recipA = experiment.GetLowQForAzimInt_recipA();
ret.high_q_recipA = experiment.GetHighQForAzimInt_recipA();
return ret;
AzimuthalIntegrationSettings JFJochStateMachine::GetRadialIntegrationSettings() const {
std::unique_lock<std::mutex> ul(m);
return experiment.GetRadialIntegrationSettings();
}
bool JFJochStateMachine::IsRunning() const {
@@ -640,6 +510,14 @@ bool JFJochStateMachine::IsRunning() const {
}
}
JFJochState JFJochStateMachine::WaitTillMeasurementDone() {
std::unique_lock<std::mutex> ul(m);
c.wait(ul, [&] { return !IsRunning(); });
return state;
}
JFJochState JFJochStateMachine::WaitTillMeasurementDone(std::chrono::milliseconds timeout) {
std::unique_lock<std::mutex> ul(m);
@@ -700,6 +578,21 @@ void JFJochStateMachine::LoadInternalGeneratorImage(const void *data, size_t siz
services.LoadInternalGeneratorImage(experiment, image, image_number);
}
void JFJochStateMachine::LoadInternalGeneratorImageTIFF(const std::string &s, uint64_t image_number) {
std::unique_lock<std::mutex> ul(m);
if (state != JFJochState::Idle)
throw WrongDAQStateException ("Can change internal generator image only when detector in Idle state");
uint32_t cols, lines;
auto v = ReadTIFFFromString16(s, cols, lines);
if (((cols == experiment.GetXPixelsNum()) && (lines == experiment.GetYPixelsNum()))
|| ((cols == RAW_MODULE_SIZE) && (lines == RAW_MODULE_LINES * experiment.GetModulesNum())))
services.LoadInternalGeneratorImage(experiment, v, image_number);
else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Image size doesn't match current detector");
}
void JFJochStateMachine::SetBoxROI(const std::vector<ROIBox> &input) {
std::unique_lock<std::mutex> ul(m);
@@ -739,3 +632,91 @@ std::vector<uint64_t> JFJochStateMachine::GetXFELEventCode() const {
services.GetXFELEventCode(ret);
return ret;
}
std::string JFJochStateMachine::GetFullPixelMaskTIFF() const {
std::unique_lock<std::mutex> ul(m);
std::vector v = pixel_mask.GetMask(experiment);
return WriteTIFFToString(v.data(), experiment.GetXPixelsNum(), experiment.GetYPixelsNum(),
sizeof(uint32_t), false);
}
std::string JFJochStateMachine::GetUserPixelMaskTIFF() const {
std::unique_lock<std::mutex> ul(m);
std::vector v = pixel_mask.GetUserMask(experiment);
return WriteTIFFToString(v.data(), experiment.GetXPixelsNum(), experiment.GetYPixelsNum(),
sizeof(uint32_t), false);
}
void JFJochStateMachine::SetUserPixelMask(const std::string &s) {
std::unique_lock<std::mutex> ul(m);
if (state != JFJochState::Idle)
throw WrongDAQStateException ("User mask can be only modified in Idle state");
try {
uint32_t cols, lines;
auto v = ReadTIFFFromString32(s, cols, lines);
pixel_mask.LoadUserMask(experiment, v);
} catch (const JFJochException &e) {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Problem handling user mask " + std::string(e.what()));
}
}
InstrumentMetadata JFJochStateMachine::GetInstrumentMetadata() const {
std::unique_lock<std::mutex> ul(m);
return experiment.GetInstrumentMetadata();
}
void JFJochStateMachine::LoadInstrumentMetadata(const InstrumentMetadata &settings) {
std::unique_lock<std::mutex> ul(m);
if (IsRunning())
throw WrongDAQStateException ("Cannot change instrument metadata during data collection");
experiment.ImportInstrumentMetadata(settings);
}
ImageFormatSettings JFJochStateMachine::GetImageFormatSettings() const {
std::unique_lock<std::mutex> ul(m);
return experiment.GetImageFormatSettings();
}
void JFJochStateMachine::LoadImageFormatSettings(const ImageFormatSettings &settings) {
std::unique_lock<std::mutex> ul(m);
if (IsRunning())
throw WrongDAQStateException ("Cannot change instrument metadata during data collection");
experiment.ImportImageFormatSettings(settings);
}
void JFJochStateMachine::RawImageFormatSettings() {
std::unique_lock<std::mutex> ul(m);
if (IsRunning())
throw WrongDAQStateException ("Cannot change instrument metadata during data collection");
experiment.Raw();
}
void JFJochStateMachine::ConvImageFormatSettings() {
std::unique_lock<std::mutex> ul(m);
if (IsRunning())
throw WrongDAQStateException ("Cannot change instrument metadata during data collection");
experiment.Conversion();
}
std::vector<DeviceStatus> JFJochStateMachine::GetDeviceStatus() const {
return services.GetDeviceStatus();
}
void JFJochStateMachine::SetPreviewSocketSettings(const ZMQPreviewSettings &input) {
services.SetPreviewSocketSettings(input);
}
ZMQPreviewSettings JFJochStateMachine::GetPreviewSocketSettings() {
return services.GetPreviewSocketSettings();
}

View File

@@ -20,11 +20,13 @@ enum class JFJochState {Inactive, Idle, Measuring, Error, Busy, Pedestal};
struct BrokerStatus {
JFJochState broker_state;
std::optional<float> progress;
std::optional<float> indexing_rate;
};
struct DetectorListElement {
std::string description;
std::string serial_number;
std::string base_ipv4_addr;
int64_t udp_interface_count;
int64_t nmodules;
int64_t width;
int64_t height;
@@ -37,6 +39,9 @@ struct DetectorList {
struct MeasurementStatistics {
std::string file_prefix;
std::string experiment_group;
int64_t run_number;
int64_t images_expected;
int64_t images_collected;
int64_t images_sent;
@@ -56,32 +61,8 @@ struct MeasurementStatistics {
std::optional<float> bkg_estimate;
std::optional<std::pair<float, float>> beam_center_drift_pxl;
};
struct DetectorSettings {
int64_t frame_time_us;
std::optional<int64_t> count_time_us;
int64_t storage_cell_count;
bool use_internal_packet_generator;
bool collect_raw_data;
bool use_gain_hg0;
bool fixed_gain_g1;
std::optional<int64_t> pedestal_g0_frames;
std::optional<int64_t> pedestal_g1_frames;
std::optional<int64_t> pedestal_g2_frames;
std::optional<int64_t> storage_cell_delay_ns;
std::optional<int64_t> detector_delay_ns;
std::optional<int64_t> internal_packet_generator_images;
};
struct RadialIntegrationSettings {
bool solid_angle_correction;
std::optional<float> polarization_factor;
float high_q_recipA;
float low_q_recipA;
float q_spacing;
std::string unit_cell;
};
class JFJochStateMachine {
@@ -96,6 +77,8 @@ class JFJochStateMachine {
volatile JFJochState state = JFJochState::Inactive;
volatile bool cancel_sequence = false;
std::unique_ptr<JFCalibration> calibration;
PixelMask pixel_mask;
std::vector<JFModuleGainCalibration> gain_calibration;
std::vector<DetectorSetup> detector_setup;
int64_t current_detector_setup;
@@ -105,12 +88,6 @@ class JFJochStateMachine {
mutable std::mutex calibration_statistics_mutex;
std::vector<JFCalibrationModuleStatistics> calibration_statistics;
mutable std::mutex last_receiver_output_mutex;
std::optional<MeasurementStatistics> measurement_statistics;
void SetFullMeasurementOutput(const JFJochServicesOutput &output);
void ClearMeasurementStatistics();
void ClearAndSetMeasurementStatistics();
mutable std::mutex data_processing_settings_mutex;
SpotFindingSettings data_processing_settings;
@@ -134,7 +111,7 @@ public:
void Pedestal();
void Deactivate();
void Start(const DatasetSettings& settings);
void WaitTillMeasurementDone();
JFJochState WaitTillMeasurementDone();
JFJochState WaitTillMeasurementDone(std::chrono::milliseconds timeout);
void Trigger();
@@ -145,6 +122,14 @@ public:
DetectorSettings GetDetectorSettings() const;
void LoadDetectorSettings(const DetectorSettings& settings);
InstrumentMetadata GetInstrumentMetadata() const;
void LoadInstrumentMetadata(const InstrumentMetadata& settings);
ImageFormatSettings GetImageFormatSettings() const;
void LoadImageFormatSettings(const ImageFormatSettings& settings);
void RawImageFormatSettings();
void ConvImageFormatSettings();
// return by value to ensure thread safety
std::optional<MeasurementStatistics> GetMeasurementStatistics() const;
std::vector<JFCalibrationModuleStatistics> GetCalibrationStatistics() const;
@@ -162,14 +147,15 @@ public:
void SelectDetector(int64_t id);
std::optional<DetectorStatus> GetDetectorStatus() const;
void SetRadialIntegrationSettings(const RadialIntegrationSettings& settings);
RadialIntegrationSettings GetRadialIntegrationSettings() const;
void SetRadialIntegrationSettings(const AzimuthalIntegrationSettings& settings);
AzimuthalIntegrationSettings GetRadialIntegrationSettings() const;
std::string GetPreviewJPEG(const PreviewJPEGSettings& settings) const;
std::string GetPreviewTIFF(bool calibration) const;
std::string GetPedestalTIFF(size_t gain_level, size_t sc) const;
void LoadInternalGeneratorImage(const void *data, size_t size, uint64_t image_number);
void LoadInternalGeneratorImageTIFF(const std::string &s, uint64_t image_number);
// Not thread safe - only for configuration in serial context
DiffractionExperiment& NotThreadSafe_Experiment();
@@ -185,6 +171,14 @@ public:
std::vector<uint64_t> GetXFELPulseID() const;
std::vector<uint64_t> GetXFELEventCode() const;
std::string GetFullPixelMaskTIFF() const;
std::string GetUserPixelMaskTIFF() const;
void SetUserPixelMask(const std::string &v);
std::vector<DeviceStatus> GetDeviceStatus() const;
void SetPreviewSocketSettings(const ZMQPreviewSettings &input);
ZMQPreviewSettings GetPreviewSocketSettings();
};

577
broker/OpenAPIConvert.cpp Normal file
View File

@@ -0,0 +1,577 @@
// Copyright (2019-2024) Paul Scherrer Institute
#include "OpenAPIConvert.h"
// From https://en.cppreference.com/w/cpp/string/byte/tolower
std::string str_tolower(std::string s) {
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c){ return std::tolower(c); });
return s;
}
SpotFindingSettings Convert(const org::openapitools::server::model::Spot_finding_settings &input) {
SpotFindingSettings ret{};
ret.signal_to_noise_threshold = input.getSignalToNoiseThreshold();
ret.photon_count_threshold = input.getPhotonCountThreshold();
ret.min_pix_per_spot = input.getMinPixPerSpot();
ret.max_pix_per_spot = input.getMaxPixPerSpot();
ret.high_resolution_limit = input.getHighResolutionLimit();
ret.low_resolution_limit = input.getLowResolutionLimit();
ret.enable = input.isEnable();
ret.indexing = input.isIndexing();
ret.indexing_tolerance = input.getIndexingTolerance();
if (input.filterPowderRingsIsSet())
ret.filter_spots_powder_ring = input.isFilterPowderRings();
if (input.minSpotCountPowderRingIsSet())
ret.min_spot_count_powder_ring = input.getMinSpotCountPowderRing();
return ret;
}
org::openapitools::server::model::Spot_finding_settings Convert(const SpotFindingSettings &input) {
org::openapitools::server::model::Spot_finding_settings ret;
ret.setSignalToNoiseThreshold(input.signal_to_noise_threshold);
ret.setPhotonCountThreshold(input.photon_count_threshold);
ret.setMinPixPerSpot(input.min_pix_per_spot);
ret.setMaxPixPerSpot(input.max_pix_per_spot);
ret.setHighResolutionLimit(input.high_resolution_limit);
ret.setLowResolutionLimit(input.low_resolution_limit);
ret.setEnable(input.enable);
ret.setIndexing(input.indexing);
ret.setIndexingTolerance(input.indexing_tolerance);
ret.setFilterPowderRings(input.filter_spots_powder_ring);
ret.setMinSpotCountPowderRing(input.min_spot_count_powder_ring);
return ret;
}
org::openapitools::server::model::Measurement_statistics Convert(const MeasurementStatistics &input) {
org::openapitools::server::model::Measurement_statistics ret{};
if (!input.file_prefix.empty())
ret.setFilePrefix(input.file_prefix);
ret.setExperimentGroup(input.experiment_group);
ret.setImagesExpected(input.images_expected);
ret.setImagesCollected(input.images_collected);
ret.setImagesSent(input.images_sent);
ret.setImagesDiscardedLossyCompression(input.images_skipped);
ret.setMaxImageNumberSent(input.max_image_number_sent);
if (input.collection_efficiency)
ret.setCollectionEfficiency(input.collection_efficiency.value());
if (input.compression_ratio)
ret.setCompressionRatio(input.compression_ratio.value());
ret.setCancelled(input.cancelled);
ret.setMaxReceiverDelay(input.max_receive_delay);
ret.setDetectorWidth(input.detector_width);
ret.setDetectorHeight(input.detector_height);
ret.setDetectorPixelDepth(input.detector_pixel_depth);
if (input.indexing_rate)
ret.setIndexingRate(input.indexing_rate.value());
if (input.bkg_estimate)
ret.setBkgEstimate(input.bkg_estimate.value());
ret.setUnitCell(input.unit_cell);
ret.setRunNumber(input.run_number);
return ret;
}
DetectorTiming Convert(const org::openapitools::server::model::Detector_timing& input) {
switch (input.getValue()) {
case org::openapitools::server::model::Detector_timing::eDetector_timing::AUTO:
return DetectorTiming::Auto;
case org::openapitools::server::model::Detector_timing::eDetector_timing::TRIGGER:
return DetectorTiming::Trigger;
case org::openapitools::server::model::Detector_timing::eDetector_timing::BURST:
return DetectorTiming::Burst;
case org::openapitools::server::model::Detector_timing::eDetector_timing::GATED:
return DetectorTiming::Gated;
default:
case org::openapitools::server::model::Detector_timing::eDetector_timing::INVALID_VALUE_OPENAPI_GENERATED:
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "invalid input");
}
}
org::openapitools::server::model::Detector_timing Convert(DetectorTiming input) {
org::openapitools::server::model::Detector_timing val;
switch (input) {
case DetectorTiming::Auto:
val.setValue(org::openapitools::server::model::Detector_timing::eDetector_timing::AUTO);
break;
case DetectorTiming::Trigger:
val.setValue(org::openapitools::server::model::Detector_timing::eDetector_timing::TRIGGER);
break;
case DetectorTiming::Burst:
val.setValue(org::openapitools::server::model::Detector_timing::eDetector_timing::BURST);
break;
case DetectorTiming::Gated:
val.setValue(org::openapitools::server::model::Detector_timing::eDetector_timing::GATED);
break;
default:
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "invalid input");
}
return val;
}
DetectorSettings Convert(const org::openapitools::server::model::Detector_settings &input) {
DetectorSettings ret{};
if (input.countTimeUsIsSet())
ret.FrameTime(std::chrono::microseconds(input.getFrameTimeUs()),
std::chrono::microseconds(input.getCountTimeUs()));
else
ret.FrameTime(std::chrono::microseconds(input.getFrameTimeUs()));
ret.InternalGeneratorEnable(input.isInternalFrameGenerator());
ret.InternalGeneratorImages(input.getInternalFrameGeneratorImages());
ret.DetectorDelay(std::chrono::nanoseconds(input.getDetectorTriggerDelayNs()));
ret.StorageCells(input.getJungfrauStorageCellCount());
ret.StorageCellDelay(std::chrono::nanoseconds(input.getJungfrauStorageCellDelayNs()));
ret.FixGainG1(input.isJungfrauFixedGainG1());
ret.UseGainHG0(input.isJungfrauUseGainHg0());
ret.PedestalG0Frames(input.getJungfrauPedestalG0Frames());
ret.PedestalG1Frames(input.getJungfrauPedestalG1Frames());
ret.PedestalG2Frames(input.getJungfrauPedestalG2Frames());
ret.PedestalMinImageCount(input.getJungfrauPedestalMinImageCount());
ret.PedestalG0RMSLimit(input.getJungfrauPedestalG0RmsLimit());
if (input.eigerThresholdKeVIsSet())
ret.EigerThreshold_keV(input.getEigerThresholdKeV());
if (input.timingIsSet())
ret.Timing(Convert(input.getTiming()));
else
ret.Timing(DetectorTiming::Trigger);
return ret;
}
org::openapitools::server::model::Detector_settings Convert(const DetectorSettings &input) {
org::openapitools::server::model::Detector_settings ret{};
ret.setFrameTimeUs(input.GetFrameTime().count());
if (input.GetCountTime().has_value())
ret.setCountTimeUs(input.GetCountTime()->count());
ret.setDetectorTriggerDelayNs(input.GetDetectorDelay().count());
ret.setInternalFrameGeneratorImages(input.GetInternalGeneratorImages());
ret.setInternalFrameGenerator(input.IsInternalGeneratorEnable());
ret.setJungfrauStorageCellCount(input.GetStorageCells());
ret.setJungfrauFixedGainG1(input.IsFixGainG1());
ret.setJungfrauUseGainHg0(input.IsUseGainHG0());
ret.setJungfrauPedestalG0Frames(input.GetPedestalG0Frames());
ret.setJungfrauPedestalG1Frames(input.GetPedestalG1Frames());
ret.setJungfrauPedestalG2Frames(input.GetPedestalG2Frames());
ret.setJungfrauPedestalMinImageCount(input.GetPedestalMinImageCount());
ret.setJungfrauStorageCellDelayNs(input.GetStorageCellDelay().count());
ret.setJungfrauPedestalG0RmsLimit(input.GetPedestalG0RMSLimit());
if (input.GetEIGERThreshold_keV().has_value())
ret.setEigerThresholdKeV(input.GetEIGERThreshold_keV().value());
ret.setTiming(Convert(input.GetTiming()));
return ret;
}
org::openapitools::server::model::Broker_status Convert(const BrokerStatus& input) {
org::openapitools::server::model::Broker_status ret;
switch (input.broker_state) {
case JFJochState::Inactive:
ret.setState("Inactive");
break;
case JFJochState::Idle:
ret.setState("Idle");
break;
case JFJochState::Measuring:
ret.setState("Measuring");
break;
case JFJochState::Error:
ret.setState("Error");
break;
case JFJochState::Busy:
ret.setState("Busy");
break;
case JFJochState::Pedestal:
ret.setState("Pedestal");
break;
}
if (input.progress.has_value())
ret.setProgress(input.progress.value());
return ret;
}
org::openapitools::server::model::Calibration_statistics_inner Convert(const JFCalibrationModuleStatistics& input) {
org::openapitools::server::model::Calibration_statistics_inner output;
output.setModuleNumber(input.module_number);
output.setMaskedPixels(input.bad_pixels);
output.setStorageCellNumber(input.storage_cell_number);
output.setGainG0Mean(input.gain_g0_mean);
output.setGainG1Mean(input.gain_g1_mean);
output.setGainG2Mean(input.gain_g2_mean);
output.setPedestalG0Mean(input.pedestal_g0_mean);
output.setPedestalG1Mean(input.pedestal_g1_mean);
output.setPedestalG2Mean(input.pedestal_g2_mean);
return output;
}
std::vector<org::openapitools::server::model::Calibration_statistics_inner> Convert(const std::vector<JFCalibrationModuleStatistics>& input) {
std::vector<org::openapitools::server::model::Calibration_statistics_inner> ret;
for (const auto &i: input)
ret.push_back(Convert(i));
return ret;
}
org::openapitools::server::model::Instrument_metadata Convert(const InstrumentMetadata& input) {
org::openapitools::server::model::Instrument_metadata output;
output.setInstrumentName(input.GetInstrumentName());
output.setSourceName(input.GetSourceName());
output.setSourceType(input.GetSourceType());
output.setPulsedSource(input.IsPulsedSource());
return output;
}
InstrumentMetadata Convert(const org::openapitools::server::model::Instrument_metadata &input) {
InstrumentMetadata output;
output.InstrumentName(input.getInstrumentName())
.SourceName(input.getSourceName())
.SourceType(input.getSourceType())
.PulsedSource(input.isPulsedSource());
return output;
}
org::openapitools::server::model::Detector_state Convert(DetectorState input) {
org::openapitools::server::model::Detector_state ret;
switch (input) {
case DetectorState::IDLE:
ret.setValue(org::openapitools::server::model::Detector_state::eDetector_state::IDLE);
break;
case DetectorState::ERROR:
ret.setValue(org::openapitools::server::model::Detector_state::eDetector_state::ERROR);
break;
case DetectorState::BUSY:
ret.setValue(org::openapitools::server::model::Detector_state::eDetector_state::BUSY);
break;
case DetectorState::WAITING:
ret.setValue(org::openapitools::server::model::Detector_state::eDetector_state::WAITING);
break;
default:
case DetectorState::NOT_CONNECTED:
ret.setValue(org::openapitools::server::model::Detector_state::eDetector_state::NOT_CONNECTED);
break;
}
return ret;
}
org::openapitools::server::model::Detector_power_state Convert(DetectorPowerState input) {
org::openapitools::server::model::Detector_power_state ret;
switch (input) {
case DetectorPowerState::ON:
ret.setValue(org::openapitools::server::model::Detector_power_state::eDetector_power_state::POWERON);
break;
case DetectorPowerState::PARTIAL:
ret.setValue(org::openapitools::server::model::Detector_power_state::eDetector_power_state::PARTIAL);
break;
default:
case DetectorPowerState::OFF:
ret.setValue(org::openapitools::server::model::Detector_power_state::eDetector_power_state::POWEROFF);
break;
}
return ret;
}
org::openapitools::server::model::Detector_status Convert(const DetectorStatus &input) {
org::openapitools::server::model::Detector_status output;
output.setServerVersion(input.detector_server_version);
output.setNumberOfTriggersLeft(input.remaining_triggers);
output.setFpgaTempDegC(input.temperature_fpga_degC);
output.setHighVoltageV(input.high_voltage_V);
output.setPowerchip(Convert(input.power_state));
output.setState(Convert(input.detector_state));
return output;
}
org::openapitools::server::model::Detector_list Convert(const DetectorList &input) {
org::openapitools::server::model::Detector_list ret;
std::vector<org::openapitools::server::model::Detector_list_detectors_inner> dets;
for (int i = 0; i < input.detector.size(); i++) {
org::openapitools::server::model::Detector_list_detectors_inner d;
d.setId(i);
d.setDescription(input.detector[i].description);
d.setNmodules(input.detector[i].nmodules);
d.setHeight(input.detector[i].height);
d.setWidth(input.detector[i].width);
d.setSerialNumber(input.detector[i].serial_number);
d.setBaseIpv4Addr(input.detector[i].base_ipv4_addr);
d.setUdpInterfaceCount(input.detector[i].udp_interface_count);
dets.emplace_back(std::move(d));
}
ret.setDetectors(dets);
ret.setCurrentId(input.current_id);
return ret;
}
org::openapitools::server::model::Plots Convert(const MultiLinePlot& input) {
std::vector<org::openapitools::server::model::Plot> tmp(input.size());
for (int i = 0; i < input.size(); i++) {
tmp[i].setTitle(input[i].title);
tmp[i].setX(input[i].x);
tmp[i].setY(input[i].y);
}
org::openapitools::server::model::Plots output;
output.setPlot(tmp);
return output;
}
AzimuthalIntegrationSettings Convert(const org::openapitools::server::model::Azim_int_settings& input) {
AzimuthalIntegrationSettings ret{};
ret.SolidAngleCorrection(input.isSolidAngleCorr());
if (input.polarizationFactorIsSet())
ret.PolarizationFactor(input.getPolarizationFactor());
ret.QSpacing_recipA(input.getQSpacing());
ret.LowQ_recipA(input.getLowQRecipA());
ret.HighQ_recipA(input.getHighQRecipA());
return ret;
}
org::openapitools::server::model::Azim_int_settings Convert(const AzimuthalIntegrationSettings& settings) {
org::openapitools::server::model::Azim_int_settings ret{};
ret.setSolidAngleCorr(settings.IsSolidAngleCorrection());
if (settings.GetPolarizationFactor().has_value())
ret.setPolarizationFactor(settings.GetPolarizationFactor().value());
ret.setHighQRecipA(settings.GetHighQ_recipA());
ret.setLowQRecipA(settings.GetLowQ_recipA());
ret.setQSpacing(settings.GetQSpacing_recipA());
return ret;
}
std::vector<ROIBox> Convert(const org::openapitools::server::model::Roi_box_list& input) {
std::vector<ROIBox> ret;
for (const auto &i: input.getRois())
ret.emplace_back(ROIBox(i.getName(), i.getMinXPxl(), i.getMaxXPxl(), i.getMinYPxl(), i.getMaxYPxl()));
return ret;
}
std::vector<ROICircle> Convert(const org::openapitools::server::model::Roi_circle_list& input) {
std::vector<ROICircle> ret;
for (const auto &i: input.getRois())
ret.emplace_back(ROICircle(i.getName(), i.getCenterXPxl(), i.getCenterYPxl(), i.getRadiusPxl()));
return ret;
}
org::openapitools::server::model::Roi_circle_list Convert(const std::vector<ROICircle> &input) {
org::openapitools::server::model::Roi_circle_list ret{};
std::vector<org::openapitools::server::model::Roi_circle> tmp;
for (const auto &i: input) {
org::openapitools::server::model::Roi_circle elem;
elem.setName(i.GetName());
elem.setCenterXPxl(i.GetX());
elem.setCenterYPxl(i.GetY());
elem.setRadiusPxl(i.GetRadius_pxl());
tmp.emplace_back(elem);
}
ret.setRois(tmp);
return ret;
}
org::openapitools::server::model::Roi_box_list Convert(const std::vector<ROIBox> &input) {
org::openapitools::server::model::Roi_box_list ret{};
std::vector<org::openapitools::server::model::Roi_box> tmp;
for (const auto &i: input) {
org::openapitools::server::model::Roi_box elem;
elem.setName(i.GetName());
elem.setMinXPxl(i.GetXMin());
elem.setMaxXPxl(i.GetXMax());
elem.setMinYPxl(i.GetYMin());
elem.setMaxYPxl(i.GetYMax());
tmp.emplace_back(elem);
}
ret.setRois(tmp);
return ret;
}
PreviewJPEGSettings Convert(const org::openapitools::server::model::Preview_settings& input) {
PreviewJPEGSettings ret{};
ret.show_spots = input.isShowSpots();
ret.jpeg_quality = input.getJpegQuality();
ret.saturation_value = input.getSaturation();
ret.show_roi = input.isShowRoi();
ret.show_indexed = input.isShowIndexed();
ret.show_user_mask = input.isShowUserMask();
if (input.resolutionRingIsSet())
ret.resolution_ring = input.getResolutionRing();
return ret;
}
ImageFormatSettings Convert(const org::openapitools::server::model::Image_format_settings& input) {
ImageFormatSettings ret{};
ret.GeometryTransformed(input.isGeometryTransform());
ret.AutoSummation(input.isSummation());
ret.JungfrauConversion(input.isJungfrauConversion());
ret.MaskChipEdges(input.isMaskChipEdges());
ret.MaskModuleEdges(input.isMaskModuleEdges());
if (input.signedOutputIsSet())
ret.PixelSigned(input.isSignedOutput());
if (input.jungfrauConversionFactorKeVIsSet())
ret.JungfrauConvFactor_keV(input.getJungfrauConversionFactorKeV());
if (input.bitDepthImageIsSet())
ret.BitDepthImage(input.getBitDepthImage());
return ret;
}
org::openapitools::server::model::Image_format_settings Convert(const ImageFormatSettings& input) {
org::openapitools::server::model::Image_format_settings ret{};
ret.setGeometryTransform(input.IsGeometryTransformed());
ret.setSummation(input.IsAutoSummation());
ret.setJungfrauConversion(input.IsJungfrauConversion());
ret.setMaskChipEdges(input.IsMaskChipEdges());
ret.setMaskModuleEdges(input.IsMaskModuleEdges());
if (input.IsPixelSigned().has_value())
ret.setSignedOutput(input.IsPixelSigned().value());
if (input.GetJungfrauConvFactor_keV().has_value())
ret.setJungfrauConversionFactorKeV(input.GetJungfrauConvFactor_keV().value());
if (input.GetBitDepthImage().has_value())
ret.setBitDepthImage(input.GetBitDepthImage().value());
return ret;
}
DatasetSettings Convert(const org::openapitools::server::model::Dataset_settings& input) {
DatasetSettings ret;
ret.ImagesPerTrigger(input.getImagesPerTrigger());
ret.NumTriggers(input.getNtrigger());
if (input.runNumberIsSet())
ret.RunNumber(input.getRunNumber());
if (input.runNameIsSet())
ret.RunName(input.getRunName());
ret.ExperimentGroup(input.getExperimentGroup());
if (input.imageTimeUsIsSet())
ret.ImageTime(std::chrono::microseconds(input.getImageTimeUs()));
ret.BeamX_pxl(input.getBeamXPxl());
ret.BeamY_pxl(input.getBeamYPxl());
ret.DetectorDistance_mm(input.getDetectorDistanceMm());
ret.PhotonEnergy_keV(input.getIncidentEnergyKeV());
ret.FilePrefix(input.getFilePrefix());
if (!input.compressionIsSet())
ret.Compression(CompressionAlgorithm::BSHUF_LZ4);
else {
std::string compr = str_tolower(input.getCompression());
if (compr == "bslz4")
ret.Compression(CompressionAlgorithm::BSHUF_LZ4);
else if (compr == "bszstd")
ret.Compression(CompressionAlgorithm::BSHUF_ZSTD);
else if (compr == "bszstd_rle")
ret.Compression(CompressionAlgorithm::BSHUF_ZSTD_RLE);
else if (compr == "none")
ret.Compression(CompressionAlgorithm::NO_COMPRESSION);
else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Unknown compression");
}
if (input.poissonCompressionIsSet())
ret.LossyCompressionPoisson(input.getPoissonCompression());
if (input.unitCellIsSet())
ret.SetUnitCell(UnitCell{
.a = input.getUnitCell().getA(),
.b = input.getUnitCell().getB(),
.c = input.getUnitCell().getC(),
.alpha = input.getUnitCell().getAlpha(),
.beta = input.getUnitCell().getBeta(),
.gamma = input.getUnitCell().getGamma()
});
if (input.totalFluxIsSet())
ret.TotalFlux(input.getTotalFlux());
if (input.transmissionIsSet())
ret.AttenuatorTransmission(input.getTransmission());
if (input.goniometerIsSet()) {
ret.Goniometer(GoniometerAxis{
.name = input.getGoniometer().getName(),
.increment = input.getGoniometer().getStep(),
.start = input.getGoniometer().getStart()
});
if (input.getGoniometer().getVector().size() == 3) {
auto v = input.getGoniometer().getVector();
ret.RotationAxis(Coord(v[0], v[1], v[2]));
} else
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Rotation axis must be provided");
}
if (input.spaceGroupNumberIsSet())
ret.SpaceGroupNumber(input.getSpaceGroupNumber());
ret.SampleName(input.getSampleName());
ret.HeaderAppendix(input.getHeaderAppendix());
ret.ImageAppendix(input.getImageAppendix());
ret.ImagesPerFile(input.getImagesPerFile());
if (input.dataReductionFactorSerialmxIsSet())
ret.LossyCompressionSerialMX(input.getDataReductionFactorSerialmx());
if (input.pixelValueLowThresholdIsSet())
ret.PixelValueLowThreshold(input.getPixelValueLowThreshold());
if (input.saveCalibrationIsSet())
ret.SaveCalibration(input.isSaveCalibration());
ret.WriteNXmxHDF5Master(input.isWriteNxmxHdf5Master());
return ret;
}
std::vector<org::openapitools::server::model::Fpga_status_inner> Convert(const std::vector<DeviceStatus> &input) {
std::vector<org::openapitools::server::model::Fpga_status_inner> ret;
for (const auto &d: input) {
org::openapitools::server::model::Fpga_status_inner tmp;
tmp.setPciDevId(d.device_number);
tmp.setSerialNumber(d.serial_number);
tmp.setBaseMacAddr(MacAddressToStr(d.fpga_default_mac_addr));
tmp.setPacketsSls(d.packets_sls);
tmp.setPacketsUdp(d.packets_udp);
tmp.setEthLinkCount(d.eth_link_count);
tmp.setEthLinkStatus(d.eth_link_status);
tmp.setFpgaTempC(static_cast<float>(d.fpga_temp_C));
tmp.setHbmTempC(static_cast<float>(d.hbm_0_temp_C));
tmp.setPowerUsageW(static_cast<float>(d.fpga_pcie_12V_I_mA * d.fpga_pcie_12V_V_mV + d.fpga_pcie_3p3V_I_mA
* d.fpga_pcie_3p3V_V_mV) / (1000.0f * 1000.0f));
tmp.setIdle(d.idle);
ret.emplace_back(std::move(tmp));
}
return ret;
}
ZMQPreviewSettings Convert(const org::openapitools::server::model::Zeromq_preview_settings &input) {
ZMQPreviewSettings ret;
if (input.isEnabled())
ret.period = std::chrono::milliseconds(input.getPeriodMs());
else
ret.period = {};
ret.address = "";
return ret;
}
org::openapitools::server::model::Zeromq_preview_settings Convert(const ZMQPreviewSettings &settings) {
org::openapitools::server::model::Zeromq_preview_settings ret;
ret.setEnabled(settings.period.has_value());
if (settings.period.has_value())
ret.setPeriodMs(settings.period.value().count() / 1000);
ret.setSocketAddress(settings.address);
return ret;
}

64
broker/OpenAPIConvert.h Normal file
View File

@@ -0,0 +1,64 @@
// Copyright (2019-2024) Paul Scherrer Institute
#ifndef JFJOCH_OPENAPICONVERT_H
#define JFJOCH_OPENAPICONVERT_H
#include "gen/model/Spot_finding_settings.h"
#include "gen/model/Measurement_statistics.h"
#include "gen/model/Detector_settings.h"
#include "gen/model/Broker_status.h"
#include "gen/model/Calibration_statistics_inner.h"
#include "gen/model/Instrument_metadata.h"
#include "gen/model/Detector_list.h"
#include "gen/model/Detector_status.h"
#include "gen/model/Plots.h"
#include "gen/model/Azim_int_settings.h"
#include "gen/model/Roi_box_list.h"
#include "gen/model/Roi_circle_list.h"
#include "gen/model/Image_format_settings.h"
#include "gen/model/Preview_settings.h"
#include "gen/model/Dataset_settings.h"
#include "gen/model/Fpga_status_inner.h"
#include "../common/DatasetSettings.h"
#include "../common/ImageFormatSettings.h"
#include "../image_analysis/SpotFindingSettings.h"
#include "JFJochStateMachine.h"
#include "../common/DetectorSettings.h"
#include "../jungfrau/JFCalibration.h"
#include "../common/InstrumentMetadata.h"
#include "Zeromq_preview_settings.h"
SpotFindingSettings Convert(const org::openapitools::server::model::Spot_finding_settings &input);
org::openapitools::server::model::Spot_finding_settings Convert(const SpotFindingSettings &input);
org::openapitools::server::model::Measurement_statistics Convert(const MeasurementStatistics &input);
DetectorSettings Convert(const org::openapitools::server::model::Detector_settings &input);
org::openapitools::server::model::Detector_settings Convert(const DetectorSettings &input);
org::openapitools::server::model::Broker_status Convert(const BrokerStatus& input);
org::openapitools::server::model::Calibration_statistics_inner Convert(const JFCalibrationModuleStatistics& input);
std::vector<org::openapitools::server::model::Calibration_statistics_inner> Convert(const std::vector<JFCalibrationModuleStatistics>& input);
org::openapitools::server::model::Instrument_metadata Convert(const InstrumentMetadata& input);
InstrumentMetadata Convert(const org::openapitools::server::model::Instrument_metadata &input);
org::openapitools::server::model::Detector_status Convert(const DetectorStatus &input);
org::openapitools::server::model::Detector_list Convert(const DetectorList &input);
org::openapitools::server::model::Plots Convert(const MultiLinePlot& input);
AzimuthalIntegrationSettings Convert(const org::openapitools::server::model::Azim_int_settings& input);
org::openapitools::server::model::Azim_int_settings Convert(const AzimuthalIntegrationSettings& settings);
std::vector<ROIBox> Convert(const org::openapitools::server::model::Roi_box_list& input);
std::vector<ROICircle> Convert(const org::openapitools::server::model::Roi_circle_list& input);
org::openapitools::server::model::Roi_circle_list Convert(const std::vector<ROICircle> &input);
org::openapitools::server::model::Roi_box_list Convert(const std::vector<ROIBox> &input);
PreviewJPEGSettings Convert(const org::openapitools::server::model::Preview_settings& input);
ImageFormatSettings Convert(const org::openapitools::server::model::Image_format_settings& input);
org::openapitools::server::model::Image_format_settings Convert(const ImageFormatSettings& input);
DatasetSettings Convert(const org::openapitools::server::model::Dataset_settings& input);
std::vector<org::openapitools::server::model::Fpga_status_inner> Convert(const std::vector<DeviceStatus> &input);
org::openapitools::server::model::Zeromq_preview_settings Convert(const ZMQPreviewSettings& settings);
ZMQPreviewSettings Convert(const org::openapitools::server::model::Zeromq_preview_settings& input);
#endif //JFJOCH_OPENAPICONVERT_H

View File

@@ -6,11 +6,20 @@
* Configuring FPGA firmware
* Building images from FPGA output and forwarding the results over ZeroMQ
Description of OpenAPI is presented in the `redoc-static.html` file.
## External interfaces
Broker operates three external interfaces.
**Data interface** ZeroMQ PULL socket with CBOR serialization is used to send images, metadata and processing results for writing or downstream
processing. See [here](../frame_serialize/README.md) for description of the format.
**Preview interface** as above, but limited to subset of frames (1 image/s by default).
**Configuration, status and results** HTTP/REST interface described in the OpenAPI format.
Description of the API is presented in the `redoc-static.html` file.
Due to limitations of GitLab/GitHub the file cannot be viewed directly from the repository, but needs to be downloaded.
## Broker configuration
'jfjoch_broker' requires JSON configuration files. At the moment the format of the configuration file is not properly documented.
Till this happens, it is recommended to go through example files in the [etc/](../etc/).
'jfjoch_broker' requires JSON configuration files. The file is described by OpenAPI structure `jfjoch_settings` defined in [jfjoch_api.yaml](jfjoch_api.yaml) file.
It is recommended to go through example files in the [etc/](../etc/).
## Setting up a local test for Jungfraujoch
For development, it is possible to setup a local installation of Jungfraujoch.

39
broker/gen/api/ApiBase.h Normal file
View File

@@ -0,0 +1,39 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* ApiBase.h
*
* Generalization of the Api classes
*/
#ifndef ApiBase_H_
#define ApiBase_H_
#include <pistache/router.h>
#include <memory>
namespace org::openapitools::server::api
{
class ApiBase {
public:
explicit ApiBase(const std::shared_ptr<Pistache::Rest::Router>& rtr) : router(rtr) {};
virtual ~ApiBase() = default;
virtual void init() = 0;
protected:
const std::shared_ptr<Pistache::Rest::Router> router;
};
} // namespace org::openapitools::server::api
#endif /* ApiBase_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -19,6 +19,8 @@
#define DefaultApi_H_
#include "ApiBase.h"
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
@@ -26,6 +28,7 @@
#include <optional>
#include <utility>
#include "Azim_int_settings.h"
#include "Broker_status.h"
#include "Calibration_statistics_inner.h"
#include "Dataset_settings.h"
@@ -34,23 +37,28 @@
#include "Detector_settings.h"
#include "Detector_status.h"
#include "Error_message.h"
#include "Fpga_status_inner.h"
#include "Image_format_settings.h"
#include "Instrument_metadata.h"
#include "Jfjoch_statistics.h"
#include "Measurement_statistics.h"
#include "Plots.h"
#include "Preview_settings.h"
#include "Rad_int_settings.h"
#include "Roi_box_list.h"
#include "Roi_circle_list.h"
#include "Spot_finding_settings.h"
#include "Zeromq_preview_settings.h"
#include <string>
#include <vector>
namespace org::openapitools::server::api
{
class DefaultApi {
class DefaultApi : public ApiBase {
public:
explicit DefaultApi(const std::shared_ptr<Pistache::Rest::Router>& rtr);
virtual ~DefaultApi() = default;
void init();
~DefaultApi() override = default;
void init() override;
static const std::string base;
@@ -58,26 +66,37 @@ private:
void setupRoutes();
void cancel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_azim_int_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_azim_int_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_detector_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_detector_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_image_format_conversion_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_image_format_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_image_format_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_image_format_raw_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_instrument_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_instrument_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_internal_generator_image_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_rad_int_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_rad_int_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_internal_generator_image_tiff_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_mask_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_select_detector_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_select_detector_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_spot_finding_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_spot_finding_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_user_mask_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_user_mask_tiff_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_zeromq_preview_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void config_zeromq_preview_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void deactivate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void detector_status_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void fpga_status_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void initialize_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void pedestal_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_azim_int_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_bkg_estimate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_error_pixel_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_image_collection_efficiency_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_indexing_rate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_indexing_rate_per_file_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_rad_int_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_rad_int_per_file_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_receiver_delay_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_receiver_free_send_buffers_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void plot_roi_max_count_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
@@ -97,14 +116,21 @@ private:
void start_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void statistics_calibration_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void statistics_data_collection_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void statistics_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void status_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void trigger_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void version_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void wait_till_done_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void xfel_event_code_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void xfel_pulse_id_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void default_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
const std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing and validation.
/// May be overridden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual void handleParsingException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing and validation.
@@ -113,6 +139,13 @@ private:
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleParsingException(const std::exception& ex) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during processing of the request in handler functions.
/// May be overridden to return custom error formats. This is called inside a catch block.
/// Important: When overriding, do not call `throw ex;`, but instead use `throw;`.
/// </summary>
virtual void handleOperationException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during processing of the request in handler functions.
/// May be overridden to return custom error formats. This is called inside a catch block.
@@ -128,6 +161,21 @@ private:
/// </remarks>
virtual void cancel_post(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get radial integration configuration
/// </summary>
/// <remarks>
/// Can be done anytime
/// </remarks>
virtual void config_azim_int_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Configure radial integration
/// </summary>
/// <remarks>
/// Can be done when detector is Inactive or Idle
/// </remarks>
/// <param name="azimIntSettings"> (optional)</param>
virtual void config_azim_int_put(const org::openapitools::server::model::Azim_int_settings &azimIntSettings, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get detector configuration
/// </summary>
/// <remarks>
@@ -143,6 +191,50 @@ private:
/// <param name="detectorSettings"> (optional)</param>
virtual void config_detector_put(const org::openapitools::server::model::Detector_settings &detectorSettings, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Configure format for data collection with full conversion
/// </summary>
/// <remarks>
/// This can only be done when detector is &#x60;Idle&#x60;, &#x60;Error&#x60; or &#x60;Inactive&#x60; states.
/// </remarks>
virtual void config_image_format_conversion_post(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get image output format
/// </summary>
/// <remarks>
/// Can be done anytime
/// </remarks>
virtual void config_image_format_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Change image output format
/// </summary>
/// <remarks>
/// This can only be done when detector is &#x60;Idle&#x60;, &#x60;Error&#x60; or &#x60;Inactive&#x60; states.
/// </remarks>
/// <param name="imageFormatSettings"> (optional)</param>
virtual void config_image_format_put(const org::openapitools::server::model::Image_format_settings &imageFormatSettings, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Configure format for raw data collection
/// </summary>
/// <remarks>
/// This can only be done when detector is &#x60;Idle&#x60;, &#x60;Error&#x60; or &#x60;Inactive&#x60; states.
/// </remarks>
virtual void config_image_format_raw_post(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get instrument metadata
/// </summary>
/// <remarks>
/// Can be done anytime
/// </remarks>
virtual void config_instrument_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Change instrument metadata
/// </summary>
/// <remarks>
/// This can only be done when detector is &#x60;Idle&#x60;, &#x60;Error&#x60; or &#x60;Inactive&#x60; states.
/// </remarks>
/// <param name="instrumentMetadata"> (optional)</param>
virtual void config_instrument_put(const org::openapitools::server::model::Instrument_metadata &instrumentMetadata, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Load binary image for internal FPGA generator
/// </summary>
/// <remarks>
@@ -150,20 +242,19 @@ private:
/// </remarks>
virtual void config_internal_generator_image_put(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get radial integration configuration
/// Load TIFF image for internal FPGA generator
/// </summary>
/// <remarks>
/// Can be done anytime
/// Load image for internal FPGA generator. This can only happen in Idle state of the detector. Requires TIFF with 16-bit integer numbers of size of detector in raw/converted coordinates (depending on detector settings).
/// </remarks>
virtual void config_rad_int_get(Pistache::Http::ResponseWriter &response) = 0;
virtual void config_internal_generator_image_tiff_put(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Configure radial integration
/// Get mask of the detector
/// </summary>
/// <remarks>
/// Can be done when detector is Inactive or Idle
/// Get full pixel mask of the detector See NXmx standard for meaning of pixel values
/// </remarks>
/// <param name="radIntSettings"> (optional)</param>
virtual void config_rad_int_put(const org::openapitools::server::model::Rad_int_settings &radIntSettings, Pistache::Http::ResponseWriter &response) = 0;
virtual void config_mask_tiff_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// List available detectors
/// </summary>
@@ -195,6 +286,35 @@ private:
/// <param name="spotFindingSettings"> (optional)</param>
virtual void config_spot_finding_put(const org::openapitools::server::model::Spot_finding_settings &spotFindingSettings, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get user mask of the detector
/// </summary>
/// <remarks>
/// Get user pixel mask of the detector in the actual detector coordinates: 0 - good pixel, 1 - masked
/// </remarks>
virtual void config_user_mask_tiff_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Upload user mask of the detector
/// </summary>
/// <remarks>
/// Should be in &#x60;Idle&#x60; state. Upload user mask of the detector - this is for example to account for beam stop shadow or misbehaving regions. If detector is conversion mode the mask can be both in raw (1024x512; stacked modules) or converted coordinates. In the latter case - module gaps are ignored and don&#39;t need to be assigned value. Mask is expected as TIFF (4-byte; unsigned). 0 - good pixel, other value - masked User mask is stored in NXmx pixel mask (bit 8), as well as used in spot finding and azimuthal integration. User mask is not automatically applied - i.e. pixels with user mask will have a valid pixel value in the images.
/// </remarks>
virtual void config_user_mask_tiff_put(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get ZeroMQ preview settings
/// </summary>
/// <remarks>
///
/// </remarks>
virtual void config_zeromq_preview_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Set ZeroMQ preview settings
/// </summary>
/// <remarks>
/// Jungfraujoch can generate preview message stream on ZeroMQ SUB socket. Here settings of the socket can be adjusted. While the data structure contains also socket_address, this cannot be changed via HTTP and is ignore in PUT request. Options set with this PUT request have no effect on HTTP based preview.
/// </remarks>
/// <param name="zeromqPreviewSettings"> (optional)</param>
virtual void config_zeromq_preview_put(const org::openapitools::server::model::Zeromq_preview_settings &zeromqPreviewSettings, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Prepare detector to turn off
/// </summary>
/// <remarks>
@@ -209,6 +329,13 @@ private:
/// </remarks>
virtual void detector_status_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get status of FPGA devices
/// </summary>
/// <remarks>
///
/// </remarks>
virtual void fpga_status_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Initialize detector and data acquisition
/// </summary>
/// <remarks>
@@ -223,13 +350,22 @@ private:
/// </remarks>
virtual void pedestal_post(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate radial integration profile
/// </summary>
/// <remarks>
/// Generate average radial integration profile
/// </remarks>
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_azim_int_get(const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate background estimate plot
/// </summary>
/// <remarks>
/// Mean intensity for d &#x3D; 3 - 5 A per image; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_bkg_estimate_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_bkg_estimate_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate error pixels plot
/// </summary>
@@ -237,7 +373,8 @@ private:
/// Count of error (mean) and saturated (mean/max) pixels per image; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_error_pixel_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_error_pixel_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate image collection efficiency plot
/// </summary>
@@ -245,7 +382,8 @@ private:
/// Ratio of collected and expected packets per image; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_image_collection_efficiency_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_image_collection_efficiency_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate indexing rate plot
/// </summary>
@@ -253,28 +391,8 @@ private:
/// Image indexing rate; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_indexing_rate_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate indexing rate per file
/// </summary>
/// <remarks>
/// Indexing rate per each of data files; useful for example for time resolved data
/// </remarks>
virtual void plot_indexing_rate_per_file_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate radial integration profile
/// </summary>
/// <remarks>
/// Generate average radial integration profile
/// </remarks>
virtual void plot_rad_int_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate radial integration profiles per file
/// </summary>
/// <remarks>
/// Radial integration plots for both the whole dataset and per file; useful for time-resolved measurements
/// </remarks>
virtual void plot_rad_int_per_file_get(Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_indexing_rate_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate receiver delay plot
/// </summary>
@@ -282,7 +400,8 @@ private:
/// Amount of frames the receiver is behind the FPGA for each image - used for internal debugging; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_receiver_delay_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_receiver_delay_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate receiver free send buffer plot
/// </summary>
@@ -290,7 +409,8 @@ private:
/// Amount of send buffers available during frame processing - used for internal debugging; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate plot of ROI max count
/// </summary>
@@ -298,7 +418,8 @@ private:
/// Max count of ROI per image; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_roi_max_count_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_roi_max_count_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate ROI sum plot
/// </summary>
@@ -306,7 +427,8 @@ private:
/// Sum of ROI rectangle per image; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_roi_sum_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_roi_sum_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate plot of ROI valid pixels
/// </summary>
@@ -314,7 +436,8 @@ private:
/// Number of pixels within a ROI area; pixels with special values (overload, bad pixel) are excluded; multipixels are counted just once; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_roi_valid_pixels_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_roi_valid_pixels_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate spot count plot
/// </summary>
@@ -322,7 +445,8 @@ private:
/// Number of spots per image; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_spot_count_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_spot_count_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate strong pixels plot
/// </summary>
@@ -330,7 +454,8 @@ private:
/// Count of strong pixels per image (from spot finding); binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_strong_pixel_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void plot_strong_pixel_get(const std::optional<int32_t> &binning, const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get last preview image in TIFF format for calibration with PyFAI/Dioptas
/// </summary>
@@ -403,7 +528,7 @@ private:
/// Start detector
/// </summary>
/// <remarks>
/// Start data acquisition. Detector must be in &#x60;Idle&#x60; state. Doesn&#39;t run calibration procedure. This is async function - one needs to use &#x60;POST /wait_till_done&#x60; to ensure operation is done.
/// Start data acquisition. Detector must be in &#x60;Idle&#x60; state. Doesn&#39;t run calibration procedure. When the function returns, detector is ready to accept soft/TTL triggers.
/// </remarks>
/// <param name="datasetSettings"> (optional)</param>
virtual void start_post(const org::openapitools::server::model::Dataset_settings &datasetSettings, Pistache::Http::ResponseWriter &response) = 0;
@@ -422,6 +547,14 @@ private:
/// </remarks>
virtual void statistics_data_collection_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get general statistics
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="compression">Enable DEFLATE compression of output data. (optional, default to true)</param>
virtual void statistics_get(const std::optional<bool> &compression, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get Jungfraujoch status
/// </summary>
/// <remarks>
@@ -436,12 +569,20 @@ private:
/// </remarks>
virtual void trigger_post(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
virtual void version_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Wait for acquisition done
/// </summary>
/// <remarks>
/// Block execution of external script till initialization, data collection or pedestal is finished. Running this command does not affect (cancel) running data collection, it is only to ensure synchronous execution of other software. To not block web server for a long period of time, the procedure is provided with a timeout of 5 seconds.
/// Block execution of external script till initialization, data collection or pedestal is finished. Running this command does not affect (cancel) running data collection, it is only to ensure synchronous execution of other software. To not block web server for a indefinite period of time, the procedure is provided with a timeout. Extending timeout is possible, but requires to ensure safety that client will not close the connection and retry the connection.
/// </remarks>
virtual void wait_till_done_post(Pistache::Http::ResponseWriter &response) = 0;
/// <param name="timeout">Timeout in seconds (0 &#x3D;&#x3D; immediate response) (optional, default to 60)</param>
virtual void wait_till_done_post(const std::optional<int32_t> &timeout, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Return XFEL event codes for the current data acquisition
/// </summary>

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -11,7 +11,7 @@
*/
#include "Rad_int_settings.h"
#include "Azim_int_settings.h"
#include "Helpers.h"
#include <sstream>
@@ -19,7 +19,7 @@
namespace org::openapitools::server::model
{
Rad_int_settings::Rad_int_settings()
Azim_int_settings::Azim_int_settings()
{
m_Polarization_factor = 0.0f;
m_Polarization_factorIsSet = false;
@@ -30,7 +30,7 @@ Rad_int_settings::Rad_int_settings()
}
void Rad_int_settings::validate() const
void Azim_int_settings::validate() const
{
std::stringstream msg;
if (!validate(msg))
@@ -39,15 +39,15 @@ void Rad_int_settings::validate() const
}
}
bool Rad_int_settings::validate(std::stringstream& msg) const
bool Azim_int_settings::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Rad_int_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
bool Azim_int_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Rad_int_settings" : pathPrefix;
const std::string _pathPrefix = pathPrefix.empty() ? "Azim_int_settings" : pathPrefix;
if (polarizationFactorIsSet())
@@ -72,7 +72,7 @@ bool Rad_int_settings::validate(std::stringstream& msg, const std::string& pathP
return success;
}
bool Rad_int_settings::operator==(const Rad_int_settings& rhs) const
bool Azim_int_settings::operator==(const Azim_int_settings& rhs) const
{
return
@@ -95,14 +95,14 @@ bool Rad_int_settings::operator==(const Rad_int_settings& rhs) const
;
}
bool Rad_int_settings::operator!=(const Rad_int_settings& rhs) const
bool Azim_int_settings::operator!=(const Azim_int_settings& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Rad_int_settings& o)
void to_json(nlohmann::json& j, const Azim_int_settings& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
if(o.polarizationFactorIsSet())
j["polarization_factor"] = o.m_Polarization_factor;
j["solid_angle_corr"] = o.m_Solid_angle_corr;
@@ -112,7 +112,7 @@ void to_json(nlohmann::json& j, const Rad_int_settings& o)
}
void from_json(const nlohmann::json& j, Rad_int_settings& o)
void from_json(const nlohmann::json& j, Azim_int_settings& o)
{
if(j.find("polarization_factor") != j.end())
{
@@ -126,52 +126,52 @@ void from_json(const nlohmann::json& j, Rad_int_settings& o)
}
float Rad_int_settings::getPolarizationFactor() const
float Azim_int_settings::getPolarizationFactor() const
{
return m_Polarization_factor;
}
void Rad_int_settings::setPolarizationFactor(float const value)
void Azim_int_settings::setPolarizationFactor(float const value)
{
m_Polarization_factor = value;
m_Polarization_factorIsSet = true;
}
bool Rad_int_settings::polarizationFactorIsSet() const
bool Azim_int_settings::polarizationFactorIsSet() const
{
return m_Polarization_factorIsSet;
}
void Rad_int_settings::unsetPolarization_factor()
void Azim_int_settings::unsetPolarization_factor()
{
m_Polarization_factorIsSet = false;
}
bool Rad_int_settings::isSolidAngleCorr() const
bool Azim_int_settings::isSolidAngleCorr() const
{
return m_Solid_angle_corr;
}
void Rad_int_settings::setSolidAngleCorr(bool const value)
void Azim_int_settings::setSolidAngleCorr(bool const value)
{
m_Solid_angle_corr = value;
}
float Rad_int_settings::getHighQRecipA() const
float Azim_int_settings::getHighQRecipA() const
{
return m_High_q_recipA;
}
void Rad_int_settings::setHighQRecipA(float const value)
void Azim_int_settings::setHighQRecipA(float const value)
{
m_High_q_recipA = value;
}
float Rad_int_settings::getLowQRecipA() const
float Azim_int_settings::getLowQRecipA() const
{
return m_Low_q_recipA;
}
void Rad_int_settings::setLowQRecipA(float const value)
void Azim_int_settings::setLowQRecipA(float const value)
{
m_Low_q_recipA = value;
}
float Rad_int_settings::getQSpacing() const
float Azim_int_settings::getQSpacing() const
{
return m_Q_spacing;
}
void Rad_int_settings::setQSpacing(float const value)
void Azim_int_settings::setQSpacing(float const value)
{
m_Q_spacing = value;
}

View File

@@ -1,22 +1,22 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Rad_int_settings.h
* Azim_int_settings.h
*
*
*/
#ifndef Rad_int_settings_H_
#define Rad_int_settings_H_
#ifndef Azim_int_settings_H_
#define Azim_int_settings_H_
#include <nlohmann/json.hpp>
@@ -27,11 +27,11 @@ namespace org::openapitools::server::model
/// <summary>
///
/// </summary>
class Rad_int_settings
class Azim_int_settings
{
public:
Rad_int_settings();
virtual ~Rad_int_settings() = default;
Azim_int_settings();
virtual ~Azim_int_settings() = default;
/// <summary>
@@ -51,11 +51,11 @@ public:
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Rad_int_settings& rhs) const;
bool operator!=(const Rad_int_settings& rhs) const;
bool operator==(const Azim_int_settings& rhs) const;
bool operator!=(const Azim_int_settings& rhs) const;
/////////////////////////////////////////////
/// Rad_int_settings members
/// Azim_int_settings members
/// <summary>
/// If polarization factor is provided, than polarization correction is enabled.
@@ -85,8 +85,8 @@ public:
float getQSpacing() const;
void setQSpacing(float const value);
friend void to_json(nlohmann::json& j, const Rad_int_settings& o);
friend void from_json(const nlohmann::json& j, Rad_int_settings& o);
friend void to_json(nlohmann::json& j, const Azim_int_settings& o);
friend void from_json(const nlohmann::json& j, Azim_int_settings& o);
protected:
float m_Polarization_factor;
bool m_Polarization_factorIsSet;
@@ -103,4 +103,4 @@ protected:
} // namespace org::openapitools::server::model
#endif /* Rad_int_settings_H_ */
#endif /* Azim_int_settings_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -24,8 +24,6 @@ Broker_status::Broker_status()
m_State = "";
m_Progress = 0.0f;
m_ProgressIsSet = false;
m_Indexing_rate = 0.0f;
m_Indexing_rateIsSet = false;
}
@@ -55,25 +53,6 @@ bool Broker_status::validate(std::stringstream& msg, const std::string& pathPref
const std::string currentValuePath = _pathPrefix + ".progress";
if (value < static_cast<float>(0.0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0.0;";
}
if (value > static_cast<float>(1.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 1.0;";
}
}
if (indexingRateIsSet())
{
const float& value = m_Indexing_rate;
const std::string currentValuePath = _pathPrefix + ".indexingRate";
if (value < static_cast<float>(0.0))
{
success = false;
@@ -99,10 +78,7 @@ bool Broker_status::operator==(const Broker_status& rhs) const
&&
((!progressIsSet() && !rhs.progressIsSet()) || (progressIsSet() && rhs.progressIsSet() && getProgress() == rhs.getProgress())) &&
((!indexingRateIsSet() && !rhs.indexingRateIsSet()) || (indexingRateIsSet() && rhs.indexingRateIsSet() && getIndexingRate() == rhs.getIndexingRate()))
((!progressIsSet() && !rhs.progressIsSet()) || (progressIsSet() && rhs.progressIsSet() && getProgress() == rhs.getProgress()))
;
}
@@ -114,12 +90,10 @@ bool Broker_status::operator!=(const Broker_status& rhs) const
void to_json(nlohmann::json& j, const Broker_status& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["state"] = o.m_State;
if(o.progressIsSet())
j["progress"] = o.m_Progress;
if(o.indexingRateIsSet())
j["indexing_rate"] = o.m_Indexing_rate;
}
@@ -131,11 +105,6 @@ void from_json(const nlohmann::json& j, Broker_status& o)
j.at("progress").get_to(o.m_Progress);
o.m_ProgressIsSet = true;
}
if(j.find("indexing_rate") != j.end())
{
j.at("indexing_rate").get_to(o.m_Indexing_rate);
o.m_Indexing_rateIsSet = true;
}
}
@@ -164,23 +133,6 @@ void Broker_status::unsetProgress()
{
m_ProgressIsSet = false;
}
float Broker_status::getIndexingRate() const
{
return m_Indexing_rate;
}
void Broker_status::setIndexingRate(float const value)
{
m_Indexing_rate = value;
m_Indexing_rateIsSet = true;
}
bool Broker_status::indexingRateIsSet() const
{
return m_Indexing_rateIsSet;
}
void Broker_status::unsetIndexing_rate()
{
m_Indexing_rateIsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -64,29 +64,20 @@ public:
std::string getState() const;
void setState(std::string const& value);
/// <summary>
///
/// Progress of data collection (only available if receiving is running)
/// </summary>
float getProgress() const;
void setProgress(float const value);
bool progressIsSet() const;
void unsetProgress();
/// <summary>
///
/// </summary>
float getIndexingRate() const;
void setIndexingRate(float const value);
bool indexingRateIsSet() const;
void unsetIndexing_rate();
friend void to_json(nlohmann::json& j, const Broker_status& o);
friend void from_json(const nlohmann::json& j, Broker_status& o);
friend void to_json(nlohmann::json& j, const Broker_status& o);
friend void from_json(const nlohmann::json& j, Broker_status& o);
protected:
std::string m_State;
float m_Progress;
bool m_ProgressIsSet;
float m_Indexing_rate;
bool m_Indexing_rateIsSet;
};

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -98,7 +98,7 @@ bool Calibration_statistics_inner::operator!=(const Calibration_statistics_inner
void to_json(nlohmann::json& j, const Calibration_statistics_inner& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["module_number"] = o.m_Module_number;
j["storage_cell_number"] = o.m_Storage_cell_number;
j["pedestal_g0_mean"] = o.m_Pedestal_g0_mean;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -103,8 +103,8 @@ public:
int64_t getMaskedPixels() const;
void setMaskedPixels(int64_t const value);
friend void to_json(nlohmann::json& j, const Calibration_statistics_inner& o);
friend void from_json(const nlohmann::json& j, Calibration_statistics_inner& o);
friend void to_json(nlohmann::json& j, const Calibration_statistics_inner& o);
friend void from_json(const nlohmann::json& j, Calibration_statistics_inner& o);
protected:
int64_t m_Module_number;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -25,12 +25,12 @@ Dataset_settings::Dataset_settings()
m_Images_per_triggerIsSet = false;
m_Ntrigger = 1L;
m_NtriggerIsSet = false;
m_Summation = 1L;
m_SummationIsSet = false;
m_Image_time_us = 0L;
m_Image_time_usIsSet = false;
m_Beam_x_pxl = 0.0f;
m_Beam_y_pxl = 0.0f;
m_Detector_distance_mm = 0.0f;
m_Photon_energy_keV = 0.0f;
m_Incident_energy_keV = 0.0f;
m_File_prefix = "";
m_File_prefixIsSet = false;
m_Images_per_file = 1000L;
@@ -38,23 +38,32 @@ Dataset_settings::Dataset_settings()
m_Space_group_number = 0L;
m_Space_group_numberIsSet = false;
m_Sample_name = "";
m_Fpga_output = "auto";
m_Fpga_outputIsSet = false;
m_Sample_nameIsSet = false;
m_Compression = "bslz4";
m_CompressionIsSet = false;
m_Total_flux = 0.0f;
m_Total_fluxIsSet = false;
m_Transmission = 0.0f;
m_TransmissionIsSet = false;
m_OmegaIsSet = false;
m_Header_appendix = "";
m_GoniometerIsSet = false;
m_Header_appendixIsSet = false;
m_Image_appendix = "";
m_Image_appendixIsSet = false;
m_Photon_energy_multiplier = 1.0f;
m_Photon_energy_multiplierIsSet = false;
m_Data_reduction_factor_serialmx = 1.0f;
m_Data_reduction_factor_serialmxIsSet = false;
m_Pixel_value_low_threshold = 0L;
m_Pixel_value_low_thresholdIsSet = false;
m_Run_number = 0L;
m_Run_numberIsSet = false;
m_Run_name = "";
m_Run_nameIsSet = false;
m_Experiment_group = "";
m_Experiment_groupIsSet = false;
m_Poisson_compression = 0L;
m_Poisson_compressionIsSet = false;
m_Write_nxmx_hdf5_master = true;
m_Write_nxmx_hdf5_masterIsSet = false;
m_Save_calibration = false;
m_Save_calibrationIsSet = false;
m_Unit_cellIsSet = false;
}
@@ -107,21 +116,16 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP
}
if (summationIsSet())
if (imageTimeUsIsSet())
{
const int64_t& value = m_Summation;
const std::string currentValuePath = _pathPrefix + ".summation";
const int64_t& value = m_Image_time_us;
const std::string currentValuePath = _pathPrefix + ".imageTimeUs";
if (value < 1ll)
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
if (value > 256ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 256;";
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
@@ -141,15 +145,20 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP
}
/* Photon_energy_keV */ {
const float& value = m_Photon_energy_keV;
const std::string currentValuePath = _pathPrefix + ".photonEnergyKeV";
/* Incident_energy_keV */ {
const float& value = m_Incident_energy_keV;
const std::string currentValuePath = _pathPrefix + ".incidentEnergyKeV";
if (value < static_cast<float>(0))
if (value < static_cast<float>(0.001))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
msg << currentValuePath << ": must be greater than or equal to 0.001;";
}
if (value > static_cast<float>(500.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 500.0;";
}
}
@@ -186,7 +195,7 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP
}
}
if (transmissionIsSet())
{
const float& value = m_Transmission;
@@ -206,25 +215,6 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP
}
if (photonEnergyMultiplierIsSet())
{
const float& value = m_Photon_energy_multiplier;
const std::string currentValuePath = _pathPrefix + ".photonEnergyMultiplier";
if (value < static_cast<float>(0.015625))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0.015625;";
}
if (value > static_cast<float>(4.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 4.0;";
}
}
if (dataReductionFactorSerialmxIsSet())
{
const float& value = m_Data_reduction_factor_serialmx;
@@ -243,7 +233,54 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP
}
}
if (pixelValueLowThresholdIsSet())
{
const int64_t& value = m_Pixel_value_low_threshold;
const std::string currentValuePath = _pathPrefix + ".pixelValueLowThreshold";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (runNumberIsSet())
{
const int64_t& value = m_Run_number;
const std::string currentValuePath = _pathPrefix + ".runNumber";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (poissonCompressionIsSet())
{
const int64_t& value = m_Poisson_compression;
const std::string currentValuePath = _pathPrefix + ".poissonCompression";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > 16ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 16;";
}
}
return success;
}
@@ -259,7 +296,7 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const
((!ntriggerIsSet() && !rhs.ntriggerIsSet()) || (ntriggerIsSet() && rhs.ntriggerIsSet() && getNtrigger() == rhs.getNtrigger())) &&
((!summationIsSet() && !rhs.summationIsSet()) || (summationIsSet() && rhs.summationIsSet() && getSummation() == rhs.getSummation())) &&
((!imageTimeUsIsSet() && !rhs.imageTimeUsIsSet()) || (imageTimeUsIsSet() && rhs.imageTimeUsIsSet() && getImageTimeUs() == rhs.getImageTimeUs())) &&
(getBeamXPxl() == rhs.getBeamXPxl())
&&
@@ -270,7 +307,7 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const
(getDetectorDistanceMm() == rhs.getDetectorDistanceMm())
&&
(getPhotonEnergyKeV() == rhs.getPhotonEnergyKeV())
(getIncidentEnergyKeV() == rhs.getIncidentEnergyKeV())
&&
@@ -282,11 +319,8 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const
((!spaceGroupNumberIsSet() && !rhs.spaceGroupNumberIsSet()) || (spaceGroupNumberIsSet() && rhs.spaceGroupNumberIsSet() && getSpaceGroupNumber() == rhs.getSpaceGroupNumber())) &&
(getSampleName() == rhs.getSampleName())
&&
((!fpgaOutputIsSet() && !rhs.fpgaOutputIsSet()) || (fpgaOutputIsSet() && rhs.fpgaOutputIsSet() && getFpgaOutput() == rhs.getFpgaOutput())) &&
((!sampleNameIsSet() && !rhs.sampleNameIsSet()) || (sampleNameIsSet() && rhs.sampleNameIsSet() && getSampleName() == rhs.getSampleName())) &&
((!compressionIsSet() && !rhs.compressionIsSet()) || (compressionIsSet() && rhs.compressionIsSet() && getCompression() == rhs.getCompression())) &&
@@ -298,7 +332,7 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const
((!transmissionIsSet() && !rhs.transmissionIsSet()) || (transmissionIsSet() && rhs.transmissionIsSet() && getTransmission() == rhs.getTransmission())) &&
((!omegaIsSet() && !rhs.omegaIsSet()) || (omegaIsSet() && rhs.omegaIsSet() && getOmega() == rhs.getOmega())) &&
((!goniometerIsSet() && !rhs.goniometerIsSet()) || (goniometerIsSet() && rhs.goniometerIsSet() && getGoniometer() == rhs.getGoniometer())) &&
((!headerAppendixIsSet() && !rhs.headerAppendixIsSet()) || (headerAppendixIsSet() && rhs.headerAppendixIsSet() && getHeaderAppendix() == rhs.getHeaderAppendix())) &&
@@ -307,12 +341,30 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const
((!imageAppendixIsSet() && !rhs.imageAppendixIsSet()) || (imageAppendixIsSet() && rhs.imageAppendixIsSet() && getImageAppendix() == rhs.getImageAppendix())) &&
((!photonEnergyMultiplierIsSet() && !rhs.photonEnergyMultiplierIsSet()) || (photonEnergyMultiplierIsSet() && rhs.photonEnergyMultiplierIsSet() && getPhotonEnergyMultiplier() == rhs.getPhotonEnergyMultiplier())) &&
((!dataReductionFactorSerialmxIsSet() && !rhs.dataReductionFactorSerialmxIsSet()) || (dataReductionFactorSerialmxIsSet() && rhs.dataReductionFactorSerialmxIsSet() && getDataReductionFactorSerialmx() == rhs.getDataReductionFactorSerialmx())) &&
((!pixelValueLowThresholdIsSet() && !rhs.pixelValueLowThresholdIsSet()) || (pixelValueLowThresholdIsSet() && rhs.pixelValueLowThresholdIsSet() && getPixelValueLowThreshold() == rhs.getPixelValueLowThreshold())) &&
((!runNumberIsSet() && !rhs.runNumberIsSet()) || (runNumberIsSet() && rhs.runNumberIsSet() && getRunNumber() == rhs.getRunNumber())) &&
((!runNameIsSet() && !rhs.runNameIsSet()) || (runNameIsSet() && rhs.runNameIsSet() && getRunName() == rhs.getRunName())) &&
((!experimentGroupIsSet() && !rhs.experimentGroupIsSet()) || (experimentGroupIsSet() && rhs.experimentGroupIsSet() && getExperimentGroup() == rhs.getExperimentGroup())) &&
((!poissonCompressionIsSet() && !rhs.poissonCompressionIsSet()) || (poissonCompressionIsSet() && rhs.poissonCompressionIsSet() && getPoissonCompression() == rhs.getPoissonCompression())) &&
((!writeNxmxHdf5MasterIsSet() && !rhs.writeNxmxHdf5MasterIsSet()) || (writeNxmxHdf5MasterIsSet() && rhs.writeNxmxHdf5MasterIsSet() && isWriteNxmxHdf5Master() == rhs.isWriteNxmxHdf5Master())) &&
((!saveCalibrationIsSet() && !rhs.saveCalibrationIsSet()) || (saveCalibrationIsSet() && rhs.saveCalibrationIsSet() && isSaveCalibration() == rhs.isSaveCalibration())) &&
((!unitCellIsSet() && !rhs.unitCellIsSet()) || (unitCellIsSet() && rhs.unitCellIsSet() && getUnitCell() == rhs.getUnitCell()))
;
@@ -325,42 +377,53 @@ bool Dataset_settings::operator!=(const Dataset_settings& rhs) const
void to_json(nlohmann::json& j, const Dataset_settings& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
if(o.imagesPerTriggerIsSet())
j["images_per_trigger"] = o.m_Images_per_trigger;
if(o.ntriggerIsSet())
j["ntrigger"] = o.m_Ntrigger;
if(o.summationIsSet())
j["summation"] = o.m_Summation;
if(o.imageTimeUsIsSet())
j["image_time_us"] = o.m_Image_time_us;
j["beam_x_pxl"] = o.m_Beam_x_pxl;
j["beam_y_pxl"] = o.m_Beam_y_pxl;
j["detector_distance_mm"] = o.m_Detector_distance_mm;
j["photon_energy_keV"] = o.m_Photon_energy_keV;
j["incident_energy_keV"] = o.m_Incident_energy_keV;
if(o.filePrefixIsSet())
j["file_prefix"] = o.m_File_prefix;
if(o.imagesPerFileIsSet())
j["images_per_file"] = o.m_Images_per_file;
if(o.spaceGroupNumberIsSet())
j["space_group_number"] = o.m_Space_group_number;
j["sample_name"] = o.m_Sample_name;
if(o.fpgaOutputIsSet())
j["fpga_output"] = o.m_Fpga_output;
if(o.sampleNameIsSet())
j["sample_name"] = o.m_Sample_name;
if(o.compressionIsSet())
j["compression"] = o.m_Compression;
if(o.totalFluxIsSet())
j["total_flux"] = o.m_Total_flux;
if(o.transmissionIsSet())
j["transmission"] = o.m_Transmission;
if(o.omegaIsSet())
j["omega"] = o.m_Omega;
if(o.goniometerIsSet())
j["goniometer"] = o.m_Goniometer;
if(o.headerAppendixIsSet())
j["header_appendix"] = o.m_Header_appendix;
if(o.imageAppendixIsSet())
j["image_appendix"] = o.m_Image_appendix;
if(o.photonEnergyMultiplierIsSet())
j["photon_energy_multiplier"] = o.m_Photon_energy_multiplier;
if(o.dataReductionFactorSerialmxIsSet())
j["data_reduction_factor_serialmx"] = o.m_Data_reduction_factor_serialmx;
if(o.pixelValueLowThresholdIsSet())
j["pixel_value_low_threshold"] = o.m_Pixel_value_low_threshold;
if(o.runNumberIsSet())
j["run_number"] = o.m_Run_number;
if(o.runNameIsSet())
j["run_name"] = o.m_Run_name;
if(o.experimentGroupIsSet())
j["experiment_group"] = o.m_Experiment_group;
if(o.poissonCompressionIsSet())
j["poisson_compression"] = o.m_Poisson_compression;
if(o.writeNxmxHdf5MasterIsSet())
j["write_nxmx_hdf5_master"] = o.m_Write_nxmx_hdf5_master;
if(o.saveCalibrationIsSet())
j["save_calibration"] = o.m_Save_calibration;
if(o.unitCellIsSet())
j["unit_cell"] = o.m_Unit_cell;
@@ -378,15 +441,15 @@ void from_json(const nlohmann::json& j, Dataset_settings& o)
j.at("ntrigger").get_to(o.m_Ntrigger);
o.m_NtriggerIsSet = true;
}
if(j.find("summation") != j.end())
if(j.find("image_time_us") != j.end())
{
j.at("summation").get_to(o.m_Summation);
o.m_SummationIsSet = true;
j.at("image_time_us").get_to(o.m_Image_time_us);
o.m_Image_time_usIsSet = true;
}
j.at("beam_x_pxl").get_to(o.m_Beam_x_pxl);
j.at("beam_y_pxl").get_to(o.m_Beam_y_pxl);
j.at("detector_distance_mm").get_to(o.m_Detector_distance_mm);
j.at("photon_energy_keV").get_to(o.m_Photon_energy_keV);
j.at("incident_energy_keV").get_to(o.m_Incident_energy_keV);
if(j.find("file_prefix") != j.end())
{
j.at("file_prefix").get_to(o.m_File_prefix);
@@ -402,11 +465,10 @@ void from_json(const nlohmann::json& j, Dataset_settings& o)
j.at("space_group_number").get_to(o.m_Space_group_number);
o.m_Space_group_numberIsSet = true;
}
j.at("sample_name").get_to(o.m_Sample_name);
if(j.find("fpga_output") != j.end())
if(j.find("sample_name") != j.end())
{
j.at("fpga_output").get_to(o.m_Fpga_output);
o.m_Fpga_outputIsSet = true;
j.at("sample_name").get_to(o.m_Sample_name);
o.m_Sample_nameIsSet = true;
}
if(j.find("compression") != j.end())
{
@@ -423,10 +485,10 @@ void from_json(const nlohmann::json& j, Dataset_settings& o)
j.at("transmission").get_to(o.m_Transmission);
o.m_TransmissionIsSet = true;
}
if(j.find("omega") != j.end())
if(j.find("goniometer") != j.end())
{
j.at("omega").get_to(o.m_Omega);
o.m_OmegaIsSet = true;
j.at("goniometer").get_to(o.m_Goniometer);
o.m_GoniometerIsSet = true;
}
if(j.find("header_appendix") != j.end())
{
@@ -438,16 +500,46 @@ void from_json(const nlohmann::json& j, Dataset_settings& o)
j.at("image_appendix").get_to(o.m_Image_appendix);
o.m_Image_appendixIsSet = true;
}
if(j.find("photon_energy_multiplier") != j.end())
{
j.at("photon_energy_multiplier").get_to(o.m_Photon_energy_multiplier);
o.m_Photon_energy_multiplierIsSet = true;
}
if(j.find("data_reduction_factor_serialmx") != j.end())
{
j.at("data_reduction_factor_serialmx").get_to(o.m_Data_reduction_factor_serialmx);
o.m_Data_reduction_factor_serialmxIsSet = true;
}
if(j.find("pixel_value_low_threshold") != j.end())
{
j.at("pixel_value_low_threshold").get_to(o.m_Pixel_value_low_threshold);
o.m_Pixel_value_low_thresholdIsSet = true;
}
if(j.find("run_number") != j.end())
{
j.at("run_number").get_to(o.m_Run_number);
o.m_Run_numberIsSet = true;
}
if(j.find("run_name") != j.end())
{
j.at("run_name").get_to(o.m_Run_name);
o.m_Run_nameIsSet = true;
}
if(j.find("experiment_group") != j.end())
{
j.at("experiment_group").get_to(o.m_Experiment_group);
o.m_Experiment_groupIsSet = true;
}
if(j.find("poisson_compression") != j.end())
{
j.at("poisson_compression").get_to(o.m_Poisson_compression);
o.m_Poisson_compressionIsSet = true;
}
if(j.find("write_nxmx_hdf5_master") != j.end())
{
j.at("write_nxmx_hdf5_master").get_to(o.m_Write_nxmx_hdf5_master);
o.m_Write_nxmx_hdf5_masterIsSet = true;
}
if(j.find("save_calibration") != j.end())
{
j.at("save_calibration").get_to(o.m_Save_calibration);
o.m_Save_calibrationIsSet = true;
}
if(j.find("unit_cell") != j.end())
{
j.at("unit_cell").get_to(o.m_Unit_cell);
@@ -490,22 +582,22 @@ void Dataset_settings::unsetNtrigger()
{
m_NtriggerIsSet = false;
}
int64_t Dataset_settings::getSummation() const
int64_t Dataset_settings::getImageTimeUs() const
{
return m_Summation;
return m_Image_time_us;
}
void Dataset_settings::setSummation(int64_t const value)
void Dataset_settings::setImageTimeUs(int64_t const value)
{
m_Summation = value;
m_SummationIsSet = true;
m_Image_time_us = value;
m_Image_time_usIsSet = true;
}
bool Dataset_settings::summationIsSet() const
bool Dataset_settings::imageTimeUsIsSet() const
{
return m_SummationIsSet;
return m_Image_time_usIsSet;
}
void Dataset_settings::unsetSummation()
void Dataset_settings::unsetImage_time_us()
{
m_SummationIsSet = false;
m_Image_time_usIsSet = false;
}
float Dataset_settings::getBeamXPxl() const
{
@@ -531,13 +623,13 @@ void Dataset_settings::setDetectorDistanceMm(float const value)
{
m_Detector_distance_mm = value;
}
float Dataset_settings::getPhotonEnergyKeV() const
float Dataset_settings::getIncidentEnergyKeV() const
{
return m_Photon_energy_keV;
return m_Incident_energy_keV;
}
void Dataset_settings::setPhotonEnergyKeV(float const value)
void Dataset_settings::setIncidentEnergyKeV(float const value)
{
m_Photon_energy_keV = value;
m_Incident_energy_keV = value;
}
std::string Dataset_settings::getFilePrefix() const
{
@@ -597,23 +689,15 @@ std::string Dataset_settings::getSampleName() const
void Dataset_settings::setSampleName(std::string const& value)
{
m_Sample_name = value;
m_Sample_nameIsSet = true;
}
std::string Dataset_settings::getFpgaOutput() const
bool Dataset_settings::sampleNameIsSet() const
{
return m_Fpga_output;
return m_Sample_nameIsSet;
}
void Dataset_settings::setFpgaOutput(std::string const& value)
void Dataset_settings::unsetSample_name()
{
m_Fpga_output = value;
m_Fpga_outputIsSet = true;
}
bool Dataset_settings::fpgaOutputIsSet() const
{
return m_Fpga_outputIsSet;
}
void Dataset_settings::unsetFpga_output()
{
m_Fpga_outputIsSet = false;
m_Sample_nameIsSet = false;
}
std::string Dataset_settings::getCompression() const
{
@@ -666,28 +750,28 @@ void Dataset_settings::unsetTransmission()
{
m_TransmissionIsSet = false;
}
org::openapitools::server::model::Rotation_axis Dataset_settings::getOmega() const
org::openapitools::server::model::Rotation_axis Dataset_settings::getGoniometer() const
{
return m_Omega;
return m_Goniometer;
}
void Dataset_settings::setOmega(org::openapitools::server::model::Rotation_axis const& value)
void Dataset_settings::setGoniometer(org::openapitools::server::model::Rotation_axis const& value)
{
m_Omega = value;
m_OmegaIsSet = true;
m_Goniometer = value;
m_GoniometerIsSet = true;
}
bool Dataset_settings::omegaIsSet() const
bool Dataset_settings::goniometerIsSet() const
{
return m_OmegaIsSet;
return m_GoniometerIsSet;
}
void Dataset_settings::unsetOmega()
void Dataset_settings::unsetGoniometer()
{
m_OmegaIsSet = false;
m_GoniometerIsSet = false;
}
std::string Dataset_settings::getHeaderAppendix() const
nlohmann::json Dataset_settings::getHeaderAppendix() const
{
return m_Header_appendix;
}
void Dataset_settings::setHeaderAppendix(std::string const& value)
void Dataset_settings::setHeaderAppendix(nlohmann::json const& value)
{
m_Header_appendix = value;
m_Header_appendixIsSet = true;
@@ -700,11 +784,11 @@ void Dataset_settings::unsetHeader_appendix()
{
m_Header_appendixIsSet = false;
}
std::string Dataset_settings::getImageAppendix() const
nlohmann::json Dataset_settings::getImageAppendix() const
{
return m_Image_appendix;
}
void Dataset_settings::setImageAppendix(std::string const& value)
void Dataset_settings::setImageAppendix(nlohmann::json const& value)
{
m_Image_appendix = value;
m_Image_appendixIsSet = true;
@@ -717,23 +801,6 @@ void Dataset_settings::unsetImage_appendix()
{
m_Image_appendixIsSet = false;
}
float Dataset_settings::getPhotonEnergyMultiplier() const
{
return m_Photon_energy_multiplier;
}
void Dataset_settings::setPhotonEnergyMultiplier(float const value)
{
m_Photon_energy_multiplier = value;
m_Photon_energy_multiplierIsSet = true;
}
bool Dataset_settings::photonEnergyMultiplierIsSet() const
{
return m_Photon_energy_multiplierIsSet;
}
void Dataset_settings::unsetPhoton_energy_multiplier()
{
m_Photon_energy_multiplierIsSet = false;
}
float Dataset_settings::getDataReductionFactorSerialmx() const
{
return m_Data_reduction_factor_serialmx;
@@ -751,6 +818,125 @@ void Dataset_settings::unsetData_reduction_factor_serialmx()
{
m_Data_reduction_factor_serialmxIsSet = false;
}
int64_t Dataset_settings::getPixelValueLowThreshold() const
{
return m_Pixel_value_low_threshold;
}
void Dataset_settings::setPixelValueLowThreshold(int64_t const value)
{
m_Pixel_value_low_threshold = value;
m_Pixel_value_low_thresholdIsSet = true;
}
bool Dataset_settings::pixelValueLowThresholdIsSet() const
{
return m_Pixel_value_low_thresholdIsSet;
}
void Dataset_settings::unsetPixel_value_low_threshold()
{
m_Pixel_value_low_thresholdIsSet = false;
}
int64_t Dataset_settings::getRunNumber() const
{
return m_Run_number;
}
void Dataset_settings::setRunNumber(int64_t const value)
{
m_Run_number = value;
m_Run_numberIsSet = true;
}
bool Dataset_settings::runNumberIsSet() const
{
return m_Run_numberIsSet;
}
void Dataset_settings::unsetRun_number()
{
m_Run_numberIsSet = false;
}
std::string Dataset_settings::getRunName() const
{
return m_Run_name;
}
void Dataset_settings::setRunName(std::string const& value)
{
m_Run_name = value;
m_Run_nameIsSet = true;
}
bool Dataset_settings::runNameIsSet() const
{
return m_Run_nameIsSet;
}
void Dataset_settings::unsetRun_name()
{
m_Run_nameIsSet = false;
}
std::string Dataset_settings::getExperimentGroup() const
{
return m_Experiment_group;
}
void Dataset_settings::setExperimentGroup(std::string const& value)
{
m_Experiment_group = value;
m_Experiment_groupIsSet = true;
}
bool Dataset_settings::experimentGroupIsSet() const
{
return m_Experiment_groupIsSet;
}
void Dataset_settings::unsetExperiment_group()
{
m_Experiment_groupIsSet = false;
}
int64_t Dataset_settings::getPoissonCompression() const
{
return m_Poisson_compression;
}
void Dataset_settings::setPoissonCompression(int64_t const value)
{
m_Poisson_compression = value;
m_Poisson_compressionIsSet = true;
}
bool Dataset_settings::poissonCompressionIsSet() const
{
return m_Poisson_compressionIsSet;
}
void Dataset_settings::unsetPoisson_compression()
{
m_Poisson_compressionIsSet = false;
}
bool Dataset_settings::isWriteNxmxHdf5Master() const
{
return m_Write_nxmx_hdf5_master;
}
void Dataset_settings::setWriteNxmxHdf5Master(bool const value)
{
m_Write_nxmx_hdf5_master = value;
m_Write_nxmx_hdf5_masterIsSet = true;
}
bool Dataset_settings::writeNxmxHdf5MasterIsSet() const
{
return m_Write_nxmx_hdf5_masterIsSet;
}
void Dataset_settings::unsetWrite_nxmx_hdf5_master()
{
m_Write_nxmx_hdf5_masterIsSet = false;
}
bool Dataset_settings::isSaveCalibration() const
{
return m_Save_calibration;
}
void Dataset_settings::setSaveCalibration(bool const value)
{
m_Save_calibration = value;
m_Save_calibrationIsSet = true;
}
bool Dataset_settings::saveCalibrationIsSet() const
{
return m_Save_calibrationIsSet;
}
void Dataset_settings::unsetSave_calibration()
{
m_Save_calibrationIsSet = false;
}
org::openapitools::server::model::Dataset_settings_unit_cell Dataset_settings::getUnitCell() const
{
return m_Unit_cell;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -19,6 +19,7 @@
#define Dataset_settings_H_
#include <nlohmann/json.hpp>
#include "Rotation_axis.h"
#include <string>
#include "Dataset_settings_unit_cell.h"
@@ -75,12 +76,12 @@ public:
bool ntriggerIsSet() const;
void unsetNtrigger();
/// <summary>
/// FPGA frame summation. For summation above two 32-bit pixel format will be used, unless explicitly specified. Frame summation factor applies only to conversion mode (assumed as 1 for raw data). In XFEL mode: summation happens for frames collected with multiple triggers. Ignored for storage cells (assumed as 1).
/// Image time. If not provided (or zero value) the frame time is assumed as default. Image time must be multiple of frame time; max value is 256 * frame_time. In XFEL mode: summation happens for frames collected with multiple triggers. Ignored for storage cells and if raw data are saved.
/// </summary>
int64_t getSummation() const;
void setSummation(int64_t const value);
bool summationIsSet() const;
void unsetSummation();
int64_t getImageTimeUs() const;
void setImageTimeUs(int64_t const value);
bool imageTimeUsIsSet() const;
void unsetImage_time_us();
/// <summary>
/// /entry/detector/beam_center_x in NXmx Beam center in X direction [pixels]
/// </summary>
@@ -97,10 +98,10 @@ public:
float getDetectorDistanceMm() const;
void setDetectorDistanceMm(float const value);
/// <summary>
/// Used to calculate /entry/beam/incident_wavelength in NXmx Incident photon energy in keV
/// Used to calculate /entry/beam/incident_wavelength in NXmx Incident particle (photon, electron) energy in keV
/// </summary>
float getPhotonEnergyKeV() const;
void setPhotonEnergyKeV(float const value);
float getIncidentEnergyKeV() const;
void setIncidentEnergyKeV(float const value);
/// <summary>
/// Prefix for filenames. If left empty, no file will be saved.
/// </summary>
@@ -127,13 +128,8 @@ public:
/// </summary>
std::string getSampleName() const;
void setSampleName(std::string const& value);
/// <summary>
/// FPGA output data type
/// </summary>
std::string getFpgaOutput() const;
void setFpgaOutput(std::string const& value);
bool fpgaOutputIsSet() const;
void unsetFpga_output();
bool sampleNameIsSet() const;
void unsetSample_name();
/// <summary>
///
/// </summary>
@@ -158,32 +154,25 @@ public:
/// <summary>
///
/// </summary>
org::openapitools::server::model::Rotation_axis getOmega() const;
void setOmega(org::openapitools::server::model::Rotation_axis const& value);
bool omegaIsSet() const;
void unsetOmega();
org::openapitools::server::model::Rotation_axis getGoniometer() const;
void setGoniometer(org::openapitools::server::model::Rotation_axis const& value);
bool goniometerIsSet() const;
void unsetGoniometer();
/// <summary>
/// Header appendix, added as user_data to start message
/// Header appendix, added as user_data/user to start message (can be any valid JSON)
/// </summary>
std::string getHeaderAppendix() const;
void setHeaderAppendix(std::string const& value);
nlohmann::json getHeaderAppendix() const;
void setHeaderAppendix(nlohmann::json const& value);
bool headerAppendixIsSet() const;
void unsetHeader_appendix();
/// <summary>
/// Image appendix, added as user_data to image message
/// Image appendix, added as user_data to image message (can be any valid JSON)
/// </summary>
std::string getImageAppendix() const;
void setImageAppendix(std::string const& value);
nlohmann::json getImageAppendix() const;
void setImageAppendix(nlohmann::json const& value);
bool imageAppendixIsSet() const;
void unsetImage_appendix();
/// <summary>
/// For JUNGFRAU conversion it is possible to multiply energy by a given factor to get fractional/multiplied photon counts
/// </summary>
float getPhotonEnergyMultiplier() const;
void setPhotonEnergyMultiplier(float const value);
bool photonEnergyMultiplierIsSet() const;
void unsetPhoton_energy_multiplier();
/// <summary>
/// Rate at which non-indexed images are accepted to be forwarded to writer. Value of 1.0 (default) means that all images are written. Values below zero mean that non-indexed images will be accepted with a given probability.
/// </summary>
float getDataReductionFactorSerialmx() const;
@@ -191,6 +180,55 @@ public:
bool dataReductionFactorSerialmxIsSet() const;
void unsetData_reduction_factor_serialmx();
/// <summary>
/// Set all counts lower than the value to zero. When the value is set, negative numbers other than error pixel value are always set to zero. Setting to zero is equivalent to turning the option off.
/// </summary>
int64_t getPixelValueLowThreshold() const;
void setPixelValueLowThreshold(int64_t const value);
bool pixelValueLowThresholdIsSet() const;
void unsetPixel_value_low_threshold();
/// <summary>
/// Number of run within an experimental session. Transferred over CBOR stream as \&quot;series ID\&quot;, though not saved in HDF5 file. It is highly recommended to keep this number unique for each data collection during experimental series. If not provided, the number will be automatically incremented.
/// </summary>
int64_t getRunNumber() const;
void setRunNumber(int64_t const value);
bool runNumberIsSet() const;
void unsetRun_number();
/// <summary>
/// Unique ID of run. Transferred over CBOR stream as \&quot;unique series ID\&quot;, though not saved in HDF5 file. It is highly recommended to keep this name unique for each data collection during experimental series. If not provided, the name will be automatically generated as number + colon + file_prefix.
/// </summary>
std::string getRunName() const;
void setRunName(std::string const& value);
bool runNameIsSet() const;
void unsetRun_name();
/// <summary>
/// Name of group owning the data (e.g. p-group or proposal number). Transferred over CBOR stream, though not saved in HDF5 file.
/// </summary>
std::string getExperimentGroup() const;
void setExperimentGroup(std::string const& value);
bool experimentGroupIsSet() const;
void unsetExperiment_group();
/// <summary>
/// Enable lossy compression of pixel values that preserves Poisson statistics. Requires to provide a numerical factor SQ. Pixel value P will be transformed to round(sqrt(P) * SQ), with rounding to the closest integer. Compression is turned off if the value is missing or it is set to zero.
/// </summary>
int64_t getPoissonCompression() const;
void setPoissonCompression(int64_t const value);
bool poissonCompressionIsSet() const;
void unsetPoisson_compression();
/// <summary>
/// Write NXmx formatted HDF5 master file. Recommended to use for macromolecular crystallography experiments and to turn off for other experiments.
/// </summary>
bool isWriteNxmxHdf5Master() const;
void setWriteNxmxHdf5Master(bool const value);
bool writeNxmxHdf5MasterIsSet() const;
void unsetWrite_nxmx_hdf5_master();
/// <summary>
/// Forward image calibration (at the moment pedestal and pedestal RMS for JUNGFRAU) using the ZeroMQ stream to writer. If parameter is not provided calibration will be saved only if more than 4 images are recorded.
/// </summary>
bool isSaveCalibration() const;
void setSaveCalibration(bool const value);
bool saveCalibrationIsSet() const;
void unsetSave_calibration();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Dataset_settings_unit_cell getUnitCell() const;
@@ -198,22 +236,22 @@ public:
bool unitCellIsSet() const;
void unsetUnit_cell();
friend void to_json(nlohmann::json& j, const Dataset_settings& o);
friend void from_json(const nlohmann::json& j, Dataset_settings& o);
friend void to_json(nlohmann::json& j, const Dataset_settings& o);
friend void from_json(const nlohmann::json& j, Dataset_settings& o);
protected:
int64_t m_Images_per_trigger;
bool m_Images_per_triggerIsSet;
int64_t m_Ntrigger;
bool m_NtriggerIsSet;
int64_t m_Summation;
bool m_SummationIsSet;
int64_t m_Image_time_us;
bool m_Image_time_usIsSet;
float m_Beam_x_pxl;
float m_Beam_y_pxl;
float m_Detector_distance_mm;
float m_Photon_energy_keV;
float m_Incident_energy_keV;
std::string m_File_prefix;
bool m_File_prefixIsSet;
@@ -222,25 +260,35 @@ protected:
int64_t m_Space_group_number;
bool m_Space_group_numberIsSet;
std::string m_Sample_name;
std::string m_Fpga_output;
bool m_Fpga_outputIsSet;
bool m_Sample_nameIsSet;
std::string m_Compression;
bool m_CompressionIsSet;
float m_Total_flux;
bool m_Total_fluxIsSet;
float m_Transmission;
bool m_TransmissionIsSet;
org::openapitools::server::model::Rotation_axis m_Omega;
bool m_OmegaIsSet;
std::string m_Header_appendix;
org::openapitools::server::model::Rotation_axis m_Goniometer;
bool m_GoniometerIsSet;
nlohmann::json m_Header_appendix;
bool m_Header_appendixIsSet;
std::string m_Image_appendix;
nlohmann::json m_Image_appendix;
bool m_Image_appendixIsSet;
float m_Photon_energy_multiplier;
bool m_Photon_energy_multiplierIsSet;
float m_Data_reduction_factor_serialmx;
bool m_Data_reduction_factor_serialmxIsSet;
int64_t m_Pixel_value_low_threshold;
bool m_Pixel_value_low_thresholdIsSet;
int64_t m_Run_number;
bool m_Run_numberIsSet;
std::string m_Run_name;
bool m_Run_nameIsSet;
std::string m_Experiment_group;
bool m_Experiment_groupIsSet;
int64_t m_Poisson_compression;
bool m_Poisson_compressionIsSet;
bool m_Write_nxmx_hdf5_master;
bool m_Write_nxmx_hdf5_masterIsSet;
bool m_Save_calibration;
bool m_Save_calibrationIsSet;
org::openapitools::server::model::Dataset_settings_unit_cell m_Unit_cell;
bool m_Unit_cellIsSet;

View File

@@ -1,133 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Dataset_settings_roi_sum_area.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Dataset_settings_roi_sum_area::Dataset_settings_roi_sum_area()
{
m_X_min = 0L;
m_X_max = 0L;
m_Y_min = 0L;
m_Y_max = 0L;
}
void Dataset_settings_roi_sum_area::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Dataset_settings_roi_sum_area::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Dataset_settings_roi_sum_area::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Dataset_settings_roi_sum_area" : pathPrefix;
return success;
}
bool Dataset_settings_roi_sum_area::operator==(const Dataset_settings_roi_sum_area& rhs) const
{
return
(getXMin() == rhs.getXMin())
&&
(getXMax() == rhs.getXMax())
&&
(getYMin() == rhs.getYMin())
&&
(getYMax() == rhs.getYMax())
;
}
bool Dataset_settings_roi_sum_area::operator!=(const Dataset_settings_roi_sum_area& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Dataset_settings_roi_sum_area& o)
{
j = nlohmann::json();
j["x_min"] = o.m_X_min;
j["x_max"] = o.m_X_max;
j["y_min"] = o.m_Y_min;
j["y_max"] = o.m_Y_max;
}
void from_json(const nlohmann::json& j, Dataset_settings_roi_sum_area& o)
{
j.at("x_min").get_to(o.m_X_min);
j.at("x_max").get_to(o.m_X_max);
j.at("y_min").get_to(o.m_Y_min);
j.at("y_max").get_to(o.m_Y_max);
}
int64_t Dataset_settings_roi_sum_area::getXMin() const
{
return m_X_min;
}
void Dataset_settings_roi_sum_area::setXMin(int64_t const value)
{
m_X_min = value;
}
int64_t Dataset_settings_roi_sum_area::getXMax() const
{
return m_X_max;
}
void Dataset_settings_roi_sum_area::setXMax(int64_t const value)
{
m_X_max = value;
}
int64_t Dataset_settings_roi_sum_area::getYMin() const
{
return m_Y_min;
}
void Dataset_settings_roi_sum_area::setYMin(int64_t const value)
{
m_Y_min = value;
}
int64_t Dataset_settings_roi_sum_area::getYMax() const
{
return m_Y_max;
}
void Dataset_settings_roi_sum_area::setYMax(int64_t const value)
{
m_Y_max = value;
}
} // namespace org::openapitools::server::model

View File

@@ -1,97 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Dataset_settings_roi_sum_area.h
*
* Rectangle for ROI summation
*/
#ifndef Dataset_settings_roi_sum_area_H_
#define Dataset_settings_roi_sum_area_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
/// Rectangle for ROI summation
/// </summary>
class Dataset_settings_roi_sum_area
{
public:
Dataset_settings_roi_sum_area();
virtual ~Dataset_settings_roi_sum_area() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Dataset_settings_roi_sum_area& rhs) const;
bool operator!=(const Dataset_settings_roi_sum_area& rhs) const;
/////////////////////////////////////////////
/// Dataset_settings_roi_sum_area members
/// <summary>
///
/// </summary>
int64_t getXMin() const;
void setXMin(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getXMax() const;
void setXMax(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getYMin() const;
void setYMin(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getYMax() const;
void setYMax(int64_t const value);
friend void to_json(nlohmann::json& j, const Dataset_settings_roi_sum_area& o);
friend void from_json(const nlohmann::json& j, Dataset_settings_roi_sum_area& o);
protected:
int64_t m_X_min;
int64_t m_X_max;
int64_t m_Y_min;
int64_t m_Y_max;
};
} // namespace org::openapitools::server::model
#endif /* Dataset_settings_roi_sum_area_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -185,7 +185,7 @@ bool Dataset_settings_unit_cell::operator!=(const Dataset_settings_unit_cell& rh
void to_json(nlohmann::json& j, const Dataset_settings_unit_cell& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["a"] = o.m_a;
j["b"] = o.m_b;
j["c"] = o.m_c;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -88,8 +88,8 @@ public:
float getGamma() const;
void setGamma(float const value);
friend void to_json(nlohmann::json& j, const Dataset_settings_unit_cell& o);
friend void from_json(const nlohmann::json& j, Dataset_settings_unit_cell& o);
friend void to_json(nlohmann::json& j, const Dataset_settings_unit_cell& o);
friend void from_json(const nlohmann::json& j, Dataset_settings_unit_cell& o);
protected:
float m_a;

View File

@@ -0,0 +1,640 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Detector.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Detector::Detector()
{
m_Description = "";
m_Serial_number = "";
m_TypeIsSet = false;
m_High_voltage_V = 0L;
m_High_voltage_VIsSet = false;
m_Udp_interface_count = 1L;
m_Udp_interface_countIsSet = false;
m_Module_sync = true;
m_Module_syncIsSet = false;
m_Sensor_thickness_um = 320.0f;
m_Sensor_thickness_umIsSet = false;
m_Calibration_fileIsSet = false;
m_HostnameIsSet = false;
m_Sensor_material = "Si";
m_Sensor_materialIsSet = false;
m_Tx_delayIsSet = false;
m_Base_data_ipv4_address = "";
m_Base_data_ipv4_addressIsSet = false;
m_Standard_geometryIsSet = false;
m_Custom_geometryIsSet = false;
m_Mirror_y = true;
m_Mirror_yIsSet = false;
}
void Detector::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector" : pathPrefix;
/* Description */ {
const std::string& value = m_Description;
const std::string currentValuePath = _pathPrefix + ".description";
if (value.length() < 1)
{
success = false;
msg << currentValuePath << ": must be at least 1 characters long;";
}
}
/* Serial_number */ {
const std::string& value = m_Serial_number;
const std::string currentValuePath = _pathPrefix + ".serialNumber";
if (value.length() < 1)
{
success = false;
msg << currentValuePath << ": must be at least 1 characters long;";
}
}
if (highVoltageVIsSet())
{
const int64_t& value = m_High_voltage_V;
const std::string currentValuePath = _pathPrefix + ".highVoltageV";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > 200ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 200;";
}
}
if (udpInterfaceCountIsSet())
{
const int64_t& value = m_Udp_interface_count;
const std::string currentValuePath = _pathPrefix + ".udpInterfaceCount";
if (value < 1ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
if (value > 2ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 2;";
}
}
if (sensorThicknessUmIsSet())
{
const float& value = m_Sensor_thickness_um;
const std::string currentValuePath = _pathPrefix + ".sensorThicknessUm";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (calibrationFileIsSet())
{
const std::vector<std::string>& value = m_Calibration_file;
const std::string currentValuePath = _pathPrefix + ".calibrationFile";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const std::string& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
i++;
}
}
}
if (hostnameIsSet())
{
const std::vector<std::string>& value = m_Hostname;
const std::string currentValuePath = _pathPrefix + ".hostname";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const std::string& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
i++;
}
}
}
if (txDelayIsSet())
{
const std::vector<int64_t>& value = m_Tx_delay;
const std::string currentValuePath = _pathPrefix + ".txDelay";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const int64_t& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
i++;
}
}
}
if (customGeometryIsSet())
{
const std::vector<org::openapitools::server::model::Detector_module>& value = m_Custom_geometry;
const std::string currentValuePath = _pathPrefix + ".customGeometry";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const org::openapitools::server::model::Detector_module& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
success = value.validate(msg, currentValuePath + ".customGeometry") && success;
i++;
}
}
}
return success;
}
bool Detector::operator==(const Detector& rhs) const
{
return
(getDescription() == rhs.getDescription())
&&
(getSerialNumber() == rhs.getSerialNumber())
&&
((!typeIsSet() && !rhs.typeIsSet()) || (typeIsSet() && rhs.typeIsSet() && getType() == rhs.getType())) &&
((!highVoltageVIsSet() && !rhs.highVoltageVIsSet()) || (highVoltageVIsSet() && rhs.highVoltageVIsSet() && getHighVoltageV() == rhs.getHighVoltageV())) &&
((!udpInterfaceCountIsSet() && !rhs.udpInterfaceCountIsSet()) || (udpInterfaceCountIsSet() && rhs.udpInterfaceCountIsSet() && getUdpInterfaceCount() == rhs.getUdpInterfaceCount())) &&
((!moduleSyncIsSet() && !rhs.moduleSyncIsSet()) || (moduleSyncIsSet() && rhs.moduleSyncIsSet() && isModuleSync() == rhs.isModuleSync())) &&
((!sensorThicknessUmIsSet() && !rhs.sensorThicknessUmIsSet()) || (sensorThicknessUmIsSet() && rhs.sensorThicknessUmIsSet() && getSensorThicknessUm() == rhs.getSensorThicknessUm())) &&
((!calibrationFileIsSet() && !rhs.calibrationFileIsSet()) || (calibrationFileIsSet() && rhs.calibrationFileIsSet() && getCalibrationFile() == rhs.getCalibrationFile())) &&
((!hostnameIsSet() && !rhs.hostnameIsSet()) || (hostnameIsSet() && rhs.hostnameIsSet() && getHostname() == rhs.getHostname())) &&
((!sensorMaterialIsSet() && !rhs.sensorMaterialIsSet()) || (sensorMaterialIsSet() && rhs.sensorMaterialIsSet() && getSensorMaterial() == rhs.getSensorMaterial())) &&
((!txDelayIsSet() && !rhs.txDelayIsSet()) || (txDelayIsSet() && rhs.txDelayIsSet() && getTxDelay() == rhs.getTxDelay())) &&
((!baseDataIpv4AddressIsSet() && !rhs.baseDataIpv4AddressIsSet()) || (baseDataIpv4AddressIsSet() && rhs.baseDataIpv4AddressIsSet() && getBaseDataIpv4Address() == rhs.getBaseDataIpv4Address())) &&
((!standardGeometryIsSet() && !rhs.standardGeometryIsSet()) || (standardGeometryIsSet() && rhs.standardGeometryIsSet() && getStandardGeometry() == rhs.getStandardGeometry())) &&
((!customGeometryIsSet() && !rhs.customGeometryIsSet()) || (customGeometryIsSet() && rhs.customGeometryIsSet() && getCustomGeometry() == rhs.getCustomGeometry())) &&
((!mirrorYIsSet() && !rhs.mirrorYIsSet()) || (mirrorYIsSet() && rhs.mirrorYIsSet() && isMirrorY() == rhs.isMirrorY()))
;
}
bool Detector::operator!=(const Detector& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector& o)
{
j = nlohmann::json::object();
j["description"] = o.m_Description;
j["serial_number"] = o.m_Serial_number;
if(o.typeIsSet())
j["type"] = o.m_Type;
if(o.highVoltageVIsSet())
j["high_voltage_V"] = o.m_High_voltage_V;
if(o.udpInterfaceCountIsSet())
j["udp_interface_count"] = o.m_Udp_interface_count;
if(o.moduleSyncIsSet())
j["module_sync"] = o.m_Module_sync;
if(o.sensorThicknessUmIsSet())
j["sensor_thickness_um"] = o.m_Sensor_thickness_um;
if(o.calibrationFileIsSet() || !o.m_Calibration_file.empty())
j["calibration_file"] = o.m_Calibration_file;
if(o.hostnameIsSet() || !o.m_Hostname.empty())
j["hostname"] = o.m_Hostname;
if(o.sensorMaterialIsSet())
j["sensor_material"] = o.m_Sensor_material;
if(o.txDelayIsSet() || !o.m_Tx_delay.empty())
j["tx_delay"] = o.m_Tx_delay;
if(o.baseDataIpv4AddressIsSet())
j["base_data_ipv4_address"] = o.m_Base_data_ipv4_address;
if(o.standardGeometryIsSet())
j["standard_geometry"] = o.m_Standard_geometry;
if(o.customGeometryIsSet() || !o.m_Custom_geometry.empty())
j["custom_geometry"] = o.m_Custom_geometry;
if(o.mirrorYIsSet())
j["mirror_y"] = o.m_Mirror_y;
}
void from_json(const nlohmann::json& j, Detector& o)
{
j.at("description").get_to(o.m_Description);
j.at("serial_number").get_to(o.m_Serial_number);
if(j.find("type") != j.end())
{
j.at("type").get_to(o.m_Type);
o.m_TypeIsSet = true;
}
if(j.find("high_voltage_V") != j.end())
{
j.at("high_voltage_V").get_to(o.m_High_voltage_V);
o.m_High_voltage_VIsSet = true;
}
if(j.find("udp_interface_count") != j.end())
{
j.at("udp_interface_count").get_to(o.m_Udp_interface_count);
o.m_Udp_interface_countIsSet = true;
}
if(j.find("module_sync") != j.end())
{
j.at("module_sync").get_to(o.m_Module_sync);
o.m_Module_syncIsSet = true;
}
if(j.find("sensor_thickness_um") != j.end())
{
j.at("sensor_thickness_um").get_to(o.m_Sensor_thickness_um);
o.m_Sensor_thickness_umIsSet = true;
}
if(j.find("calibration_file") != j.end())
{
j.at("calibration_file").get_to(o.m_Calibration_file);
o.m_Calibration_fileIsSet = true;
}
if(j.find("hostname") != j.end())
{
j.at("hostname").get_to(o.m_Hostname);
o.m_HostnameIsSet = true;
}
if(j.find("sensor_material") != j.end())
{
j.at("sensor_material").get_to(o.m_Sensor_material);
o.m_Sensor_materialIsSet = true;
}
if(j.find("tx_delay") != j.end())
{
j.at("tx_delay").get_to(o.m_Tx_delay);
o.m_Tx_delayIsSet = true;
}
if(j.find("base_data_ipv4_address") != j.end())
{
j.at("base_data_ipv4_address").get_to(o.m_Base_data_ipv4_address);
o.m_Base_data_ipv4_addressIsSet = true;
}
if(j.find("standard_geometry") != j.end())
{
j.at("standard_geometry").get_to(o.m_Standard_geometry);
o.m_Standard_geometryIsSet = true;
}
if(j.find("custom_geometry") != j.end())
{
j.at("custom_geometry").get_to(o.m_Custom_geometry);
o.m_Custom_geometryIsSet = true;
}
if(j.find("mirror_y") != j.end())
{
j.at("mirror_y").get_to(o.m_Mirror_y);
o.m_Mirror_yIsSet = true;
}
}
std::string Detector::getDescription() const
{
return m_Description;
}
void Detector::setDescription(std::string const& value)
{
m_Description = value;
}
std::string Detector::getSerialNumber() const
{
return m_Serial_number;
}
void Detector::setSerialNumber(std::string const& value)
{
m_Serial_number = value;
}
org::openapitools::server::model::Detector_type Detector::getType() const
{
return m_Type;
}
void Detector::setType(org::openapitools::server::model::Detector_type const& value)
{
m_Type = value;
m_TypeIsSet = true;
}
bool Detector::typeIsSet() const
{
return m_TypeIsSet;
}
void Detector::unsetType()
{
m_TypeIsSet = false;
}
int64_t Detector::getHighVoltageV() const
{
return m_High_voltage_V;
}
void Detector::setHighVoltageV(int64_t const value)
{
m_High_voltage_V = value;
m_High_voltage_VIsSet = true;
}
bool Detector::highVoltageVIsSet() const
{
return m_High_voltage_VIsSet;
}
void Detector::unsetHigh_voltage_V()
{
m_High_voltage_VIsSet = false;
}
int64_t Detector::getUdpInterfaceCount() const
{
return m_Udp_interface_count;
}
void Detector::setUdpInterfaceCount(int64_t const value)
{
m_Udp_interface_count = value;
m_Udp_interface_countIsSet = true;
}
bool Detector::udpInterfaceCountIsSet() const
{
return m_Udp_interface_countIsSet;
}
void Detector::unsetUdp_interface_count()
{
m_Udp_interface_countIsSet = false;
}
bool Detector::isModuleSync() const
{
return m_Module_sync;
}
void Detector::setModuleSync(bool const value)
{
m_Module_sync = value;
m_Module_syncIsSet = true;
}
bool Detector::moduleSyncIsSet() const
{
return m_Module_syncIsSet;
}
void Detector::unsetModule_sync()
{
m_Module_syncIsSet = false;
}
float Detector::getSensorThicknessUm() const
{
return m_Sensor_thickness_um;
}
void Detector::setSensorThicknessUm(float const value)
{
m_Sensor_thickness_um = value;
m_Sensor_thickness_umIsSet = true;
}
bool Detector::sensorThicknessUmIsSet() const
{
return m_Sensor_thickness_umIsSet;
}
void Detector::unsetSensor_thickness_um()
{
m_Sensor_thickness_umIsSet = false;
}
std::vector<std::string> Detector::getCalibrationFile() const
{
return m_Calibration_file;
}
void Detector::setCalibrationFile(std::vector<std::string> const& value)
{
m_Calibration_file = value;
m_Calibration_fileIsSet = true;
}
bool Detector::calibrationFileIsSet() const
{
return m_Calibration_fileIsSet;
}
void Detector::unsetCalibration_file()
{
m_Calibration_fileIsSet = false;
}
std::vector<std::string> Detector::getHostname() const
{
return m_Hostname;
}
void Detector::setHostname(std::vector<std::string> const& value)
{
m_Hostname = value;
m_HostnameIsSet = true;
}
bool Detector::hostnameIsSet() const
{
return m_HostnameIsSet;
}
void Detector::unsetHostname()
{
m_HostnameIsSet = false;
}
std::string Detector::getSensorMaterial() const
{
return m_Sensor_material;
}
void Detector::setSensorMaterial(std::string const& value)
{
m_Sensor_material = value;
m_Sensor_materialIsSet = true;
}
bool Detector::sensorMaterialIsSet() const
{
return m_Sensor_materialIsSet;
}
void Detector::unsetSensor_material()
{
m_Sensor_materialIsSet = false;
}
std::vector<int64_t> Detector::getTxDelay() const
{
return m_Tx_delay;
}
void Detector::setTxDelay(std::vector<int64_t> const value)
{
m_Tx_delay = value;
m_Tx_delayIsSet = true;
}
bool Detector::txDelayIsSet() const
{
return m_Tx_delayIsSet;
}
void Detector::unsetTx_delay()
{
m_Tx_delayIsSet = false;
}
std::string Detector::getBaseDataIpv4Address() const
{
return m_Base_data_ipv4_address;
}
void Detector::setBaseDataIpv4Address(std::string const& value)
{
m_Base_data_ipv4_address = value;
m_Base_data_ipv4_addressIsSet = true;
}
bool Detector::baseDataIpv4AddressIsSet() const
{
return m_Base_data_ipv4_addressIsSet;
}
void Detector::unsetBase_data_ipv4_address()
{
m_Base_data_ipv4_addressIsSet = false;
}
org::openapitools::server::model::Standard_detector_geometry Detector::getStandardGeometry() const
{
return m_Standard_geometry;
}
void Detector::setStandardGeometry(org::openapitools::server::model::Standard_detector_geometry const& value)
{
m_Standard_geometry = value;
m_Standard_geometryIsSet = true;
}
bool Detector::standardGeometryIsSet() const
{
return m_Standard_geometryIsSet;
}
void Detector::unsetStandard_geometry()
{
m_Standard_geometryIsSet = false;
}
std::vector<org::openapitools::server::model::Detector_module> Detector::getCustomGeometry() const
{
return m_Custom_geometry;
}
void Detector::setCustomGeometry(std::vector<org::openapitools::server::model::Detector_module> const& value)
{
m_Custom_geometry = value;
m_Custom_geometryIsSet = true;
}
bool Detector::customGeometryIsSet() const
{
return m_Custom_geometryIsSet;
}
void Detector::unsetCustom_geometry()
{
m_Custom_geometryIsSet = false;
}
bool Detector::isMirrorY() const
{
return m_Mirror_y;
}
void Detector::setMirrorY(bool const value)
{
m_Mirror_y = value;
m_Mirror_yIsSet = true;
}
bool Detector::mirrorYIsSet() const
{
return m_Mirror_yIsSet;
}
void Detector::unsetMirror_y()
{
m_Mirror_yIsSet = false;
}
} // namespace org::openapitools::server::model

205
broker/gen/model/Detector.h Normal file
View File

@@ -0,0 +1,205 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Detector.h
*
*
*/
#ifndef Detector_H_
#define Detector_H_
#include "Detector_type.h"
#include <string>
#include <vector>
#include "Standard_detector_geometry.h"
#include "Detector_module.h"
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Detector
{
public:
Detector();
virtual ~Detector() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Detector& rhs) const;
bool operator!=(const Detector& rhs) const;
/////////////////////////////////////////////
/// Detector members
/// <summary>
///
/// </summary>
std::string getDescription() const;
void setDescription(std::string const& value);
/// <summary>
///
/// </summary>
std::string getSerialNumber() const;
void setSerialNumber(std::string const& value);
/// <summary>
///
/// </summary>
org::openapitools::server::model::Detector_type getType() const;
void setType(org::openapitools::server::model::Detector_type const& value);
bool typeIsSet() const;
void unsetType();
/// <summary>
///
/// </summary>
int64_t getHighVoltageV() const;
void setHighVoltageV(int64_t const value);
bool highVoltageVIsSet() const;
void unsetHigh_voltage_V();
/// <summary>
///
/// </summary>
int64_t getUdpInterfaceCount() const;
void setUdpInterfaceCount(int64_t const value);
bool udpInterfaceCountIsSet() const;
void unsetUdp_interface_count();
/// <summary>
/// Use module 0 as master for timing. Only applies to JUNGFRAU detector (this cannot be turned off for EIGER).
/// </summary>
bool isModuleSync() const;
void setModuleSync(bool const value);
bool moduleSyncIsSet() const;
void unsetModule_sync();
/// <summary>
///
/// </summary>
float getSensorThicknessUm() const;
void setSensorThicknessUm(float const value);
bool sensorThicknessUmIsSet() const;
void unsetSensor_thickness_um();
/// <summary>
/// Gain file (JUNGFRAU) or trimbit file (EIGER). One entry per module. Either empty or number of module entries.
/// </summary>
std::vector<std::string> getCalibrationFile() const;
void setCalibrationFile(std::vector<std::string> const& value);
bool calibrationFileIsSet() const;
void unsetCalibration_file();
/// <summary>
/// Hostname for detector module. One entry per module One entry per module. Either empty or number of module entries.
/// </summary>
std::vector<std::string> getHostname() const;
void setHostname(std::vector<std::string> const& value);
bool hostnameIsSet() const;
void unsetHostname();
/// <summary>
///
/// </summary>
std::string getSensorMaterial() const;
void setSensorMaterial(std::string const& value);
bool sensorMaterialIsSet() const;
void unsetSensor_material();
/// <summary>
///
/// </summary>
std::vector<int64_t> getTxDelay() const;
void setTxDelay(std::vector<int64_t> const value);
bool txDelayIsSet() const;
void unsetTx_delay();
/// <summary>
///
/// </summary>
std::string getBaseDataIpv4Address() const;
void setBaseDataIpv4Address(std::string const& value);
bool baseDataIpv4AddressIsSet() const;
void unsetBase_data_ipv4_address();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Standard_detector_geometry getStandardGeometry() const;
void setStandardGeometry(org::openapitools::server::model::Standard_detector_geometry const& value);
bool standardGeometryIsSet() const;
void unsetStandard_geometry();
/// <summary>
///
/// </summary>
std::vector<org::openapitools::server::model::Detector_module> getCustomGeometry() const;
void setCustomGeometry(std::vector<org::openapitools::server::model::Detector_module> const& value);
bool customGeometryIsSet() const;
void unsetCustom_geometry();
/// <summary>
/// Mirror detector in Y direction to account for MX convention of (0,0) point in top left corner
/// </summary>
bool isMirrorY() const;
void setMirrorY(bool const value);
bool mirrorYIsSet() const;
void unsetMirror_y();
friend void to_json(nlohmann::json& j, const Detector& o);
friend void from_json(const nlohmann::json& j, Detector& o);
protected:
std::string m_Description;
std::string m_Serial_number;
org::openapitools::server::model::Detector_type m_Type;
bool m_TypeIsSet;
int64_t m_High_voltage_V;
bool m_High_voltage_VIsSet;
int64_t m_Udp_interface_count;
bool m_Udp_interface_countIsSet;
bool m_Module_sync;
bool m_Module_syncIsSet;
float m_Sensor_thickness_um;
bool m_Sensor_thickness_umIsSet;
std::vector<std::string> m_Calibration_file;
bool m_Calibration_fileIsSet;
std::vector<std::string> m_Hostname;
bool m_HostnameIsSet;
std::string m_Sensor_material;
bool m_Sensor_materialIsSet;
std::vector<int64_t> m_Tx_delay;
bool m_Tx_delayIsSet;
std::string m_Base_data_ipv4_address;
bool m_Base_data_ipv4_addressIsSet;
org::openapitools::server::model::Standard_detector_geometry m_Standard_geometry;
bool m_Standard_geometryIsSet;
std::vector<org::openapitools::server::model::Detector_module> m_Custom_geometry;
bool m_Custom_geometryIsSet;
bool m_Mirror_y;
bool m_Mirror_yIsSet;
};
} // namespace org::openapitools::server::model
#endif /* Detector_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -90,7 +90,7 @@ bool Detector_list::operator!=(const Detector_list& rhs) const
void to_json(nlohmann::json& j, const Detector_list& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["detectors"] = o.m_Detectors;
j["current_id"] = o.m_Current_id;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -70,8 +70,8 @@ public:
int64_t getCurrentId() const;
void setCurrentId(int64_t const value);
friend void to_json(nlohmann::json& j, const Detector_list& o);
friend void from_json(const nlohmann::json& j, Detector_list& o);
friend void to_json(nlohmann::json& j, const Detector_list& o);
friend void from_json(const nlohmann::json& j, Detector_list& o);
protected:
std::vector<org::openapitools::server::model::Detector_list_detectors_inner> m_Detectors;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -23,6 +23,9 @@ Detector_list_detectors_inner::Detector_list_detectors_inner()
{
m_Id = 0L;
m_Description = "";
m_Serial_number = "";
m_Base_ipv4_addr = "";
m_Udp_interface_count = 0L;
m_Nmodules = 0L;
m_Width = 0L;
m_Height = 0L;
@@ -62,7 +65,7 @@ bool Detector_list_detectors_inner::validate(std::stringstream& msg, const std::
}
}
return success;
}
@@ -77,6 +80,15 @@ bool Detector_list_detectors_inner::operator==(const Detector_list_detectors_inn
(getDescription() == rhs.getDescription())
&&
(getSerialNumber() == rhs.getSerialNumber())
&&
(getBaseIpv4Addr() == rhs.getBaseIpv4Addr())
&&
(getUdpInterfaceCount() == rhs.getUdpInterfaceCount())
&&
(getNmodules() == rhs.getNmodules())
&&
@@ -96,9 +108,12 @@ bool Detector_list_detectors_inner::operator!=(const Detector_list_detectors_inn
void to_json(nlohmann::json& j, const Detector_list_detectors_inner& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["id"] = o.m_Id;
j["description"] = o.m_Description;
j["serial_number"] = o.m_Serial_number;
j["base_ipv4_addr"] = o.m_Base_ipv4_addr;
j["udp_interface_count"] = o.m_Udp_interface_count;
j["nmodules"] = o.m_Nmodules;
j["width"] = o.m_Width;
j["height"] = o.m_Height;
@@ -109,6 +124,9 @@ void from_json(const nlohmann::json& j, Detector_list_detectors_inner& o)
{
j.at("id").get_to(o.m_Id);
j.at("description").get_to(o.m_Description);
j.at("serial_number").get_to(o.m_Serial_number);
j.at("base_ipv4_addr").get_to(o.m_Base_ipv4_addr);
j.at("udp_interface_count").get_to(o.m_Udp_interface_count);
j.at("nmodules").get_to(o.m_Nmodules);
j.at("width").get_to(o.m_Width);
j.at("height").get_to(o.m_Height);
@@ -131,6 +149,30 @@ void Detector_list_detectors_inner::setDescription(std::string const& value)
{
m_Description = value;
}
std::string Detector_list_detectors_inner::getSerialNumber() const
{
return m_Serial_number;
}
void Detector_list_detectors_inner::setSerialNumber(std::string const& value)
{
m_Serial_number = value;
}
std::string Detector_list_detectors_inner::getBaseIpv4Addr() const
{
return m_Base_ipv4_addr;
}
void Detector_list_detectors_inner::setBaseIpv4Addr(std::string const& value)
{
m_Base_ipv4_addr = value;
}
int64_t Detector_list_detectors_inner::getUdpInterfaceCount() const
{
return m_Udp_interface_count;
}
void Detector_list_detectors_inner::setUdpInterfaceCount(int64_t const value)
{
m_Udp_interface_count = value;
}
int64_t Detector_list_detectors_inner::getNmodules() const
{
return m_Nmodules;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -71,6 +71,21 @@ public:
/// <summary>
///
/// </summary>
std::string getSerialNumber() const;
void setSerialNumber(std::string const& value);
/// <summary>
///
/// </summary>
std::string getBaseIpv4Addr() const;
void setBaseIpv4Addr(std::string const& value);
/// <summary>
/// Number of UDP interfaces per detector module
/// </summary>
int64_t getUdpInterfaceCount() const;
void setUdpInterfaceCount(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getNmodules() const;
void setNmodules(int64_t const value);
/// <summary>
@@ -84,13 +99,19 @@ public:
int64_t getHeight() const;
void setHeight(int64_t const value);
friend void to_json(nlohmann::json& j, const Detector_list_detectors_inner& o);
friend void from_json(const nlohmann::json& j, Detector_list_detectors_inner& o);
friend void to_json(nlohmann::json& j, const Detector_list_detectors_inner& o);
friend void from_json(const nlohmann::json& j, Detector_list_detectors_inner& o);
protected:
int64_t m_Id;
std::string m_Description;
std::string m_Serial_number;
std::string m_Base_ipv4_addr;
int64_t m_Udp_interface_count;
int64_t m_Nmodules;
int64_t m_Width;

View File

@@ -0,0 +1,131 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Detector_module.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Detector_module::Detector_module()
{
m_X0 = 0.0;
m_Y0 = 0.0;
}
void Detector_module::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_module::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_module::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_module" : pathPrefix;
return success;
}
bool Detector_module::operator==(const Detector_module& rhs) const
{
return
(getX0() == rhs.getX0())
&&
(getY0() == rhs.getY0())
&&
(getFastAxis() == rhs.getFastAxis())
&&
(getSlowAxis() == rhs.getSlowAxis())
;
}
bool Detector_module::operator!=(const Detector_module& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_module& o)
{
j = nlohmann::json::object();
j["x0"] = o.m_X0;
j["y0"] = o.m_Y0;
j["fast_axis"] = o.m_Fast_axis;
j["slow_axis"] = o.m_Slow_axis;
}
void from_json(const nlohmann::json& j, Detector_module& o)
{
j.at("x0").get_to(o.m_X0);
j.at("y0").get_to(o.m_Y0);
j.at("fast_axis").get_to(o.m_Fast_axis);
j.at("slow_axis").get_to(o.m_Slow_axis);
}
double Detector_module::getX0() const
{
return m_X0;
}
void Detector_module::setX0(double const value)
{
m_X0 = value;
}
double Detector_module::getY0() const
{
return m_Y0;
}
void Detector_module::setY0(double const value)
{
m_Y0 = value;
}
org::openapitools::server::model::Detector_module_direction Detector_module::getFastAxis() const
{
return m_Fast_axis;
}
void Detector_module::setFastAxis(org::openapitools::server::model::Detector_module_direction const& value)
{
m_Fast_axis = value;
}
org::openapitools::server::model::Detector_module_direction Detector_module::getSlowAxis() const
{
return m_Slow_axis;
}
void Detector_module::setSlowAxis(org::openapitools::server::model::Detector_module_direction const& value)
{
m_Slow_axis = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,98 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Detector_module.h
*
*
*/
#ifndef Detector_module_H_
#define Detector_module_H_
#include "Detector_module_direction.h"
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Detector_module
{
public:
Detector_module();
virtual ~Detector_module() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Detector_module& rhs) const;
bool operator!=(const Detector_module& rhs) const;
/////////////////////////////////////////////
/// Detector_module members
/// <summary>
///
/// </summary>
double getX0() const;
void setX0(double const value);
/// <summary>
///
/// </summary>
double getY0() const;
void setY0(double const value);
/// <summary>
///
/// </summary>
org::openapitools::server::model::Detector_module_direction getFastAxis() const;
void setFastAxis(org::openapitools::server::model::Detector_module_direction const& value);
/// <summary>
///
/// </summary>
org::openapitools::server::model::Detector_module_direction getSlowAxis() const;
void setSlowAxis(org::openapitools::server::model::Detector_module_direction const& value);
friend void to_json(nlohmann::json& j, const Detector_module& o);
friend void from_json(const nlohmann::json& j, Detector_module& o);
protected:
double m_X0;
double m_Y0;
org::openapitools::server::model::Detector_module_direction m_Fast_axis;
org::openapitools::server::model::Detector_module_direction m_Slow_axis;
};
} // namespace org::openapitools::server::model
#endif /* Detector_module_H_ */

View File

@@ -0,0 +1,128 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Detector_module_direction.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
Detector_module_direction::Detector_module_direction()
{
}
void Detector_module_direction::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_module_direction::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_module_direction::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_module_direction" : pathPrefix;
if (m_value == Detector_module_direction::eDetector_module_direction::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool Detector_module_direction::operator==(const Detector_module_direction& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool Detector_module_direction::operator!=(const Detector_module_direction& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_module_direction& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case Detector_module_direction::eDetector_module_direction::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case Detector_module_direction::eDetector_module_direction::XP:
j = "Xp";
break;
case Detector_module_direction::eDetector_module_direction::XN:
j = "Xn";
break;
case Detector_module_direction::eDetector_module_direction::YP:
j = "Yp";
break;
case Detector_module_direction::eDetector_module_direction::YN:
j = "Yn";
break;
}
}
void from_json(const nlohmann::json& j, Detector_module_direction& o)
{
auto s = j.get<std::string>();
if (s == "Xp") {
o.setValue(Detector_module_direction::eDetector_module_direction::XP);
}
else if (s == "Xn") {
o.setValue(Detector_module_direction::eDetector_module_direction::XN);
}
else if (s == "Yp") {
o.setValue(Detector_module_direction::eDetector_module_direction::YP);
}
else if (s == "Yn") {
o.setValue(Detector_module_direction::eDetector_module_direction::YN);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " Detector_module_direction::eDetector_module_direction";
throw std::invalid_argument(ss.str());
}
}
Detector_module_direction::eDetector_module_direction Detector_module_direction::getValue() const
{
return m_value;
}
void Detector_module_direction::setValue(Detector_module_direction::eDetector_module_direction value)
{
m_value = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,81 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Detector_module_direction.h
*
*
*/
#ifndef Detector_module_direction_H_
#define Detector_module_direction_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Detector_module_direction
{
public:
Detector_module_direction();
virtual ~Detector_module_direction() = default;
enum class eDetector_module_direction {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
XP,
XN,
YP,
YN
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Detector_module_direction& rhs) const;
bool operator!=(const Detector_module_direction& rhs) const;
/////////////////////////////////////////////
/// Detector_module_direction members
Detector_module_direction::eDetector_module_direction getValue() const;
void setValue(Detector_module_direction::eDetector_module_direction value);
friend void to_json(nlohmann::json& j, const Detector_module_direction& o);
friend void from_json(const nlohmann::json& j, Detector_module_direction& o);
protected:
Detector_module_direction::eDetector_module_direction m_value = Detector_module_direction::eDetector_module_direction::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace org::openapitools::server::model
#endif /* Detector_module_direction_H_ */

View File

@@ -0,0 +1,122 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Detector_power_state.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
Detector_power_state::Detector_power_state()
{
}
void Detector_power_state::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_power_state::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_power_state::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_power_state" : pathPrefix;
if (m_value == Detector_power_state::eDetector_power_state::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool Detector_power_state::operator==(const Detector_power_state& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool Detector_power_state::operator!=(const Detector_power_state& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_power_state& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case Detector_power_state::eDetector_power_state::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case Detector_power_state::eDetector_power_state::POWERON:
j = "PowerOn";
break;
case Detector_power_state::eDetector_power_state::POWEROFF:
j = "PowerOff";
break;
case Detector_power_state::eDetector_power_state::PARTIAL:
j = "Partial";
break;
}
}
void from_json(const nlohmann::json& j, Detector_power_state& o)
{
auto s = j.get<std::string>();
if (s == "PowerOn") {
o.setValue(Detector_power_state::eDetector_power_state::POWERON);
}
else if (s == "PowerOff") {
o.setValue(Detector_power_state::eDetector_power_state::POWEROFF);
}
else if (s == "Partial") {
o.setValue(Detector_power_state::eDetector_power_state::PARTIAL);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " Detector_power_state::eDetector_power_state";
throw std::invalid_argument(ss.str());
}
}
Detector_power_state::eDetector_power_state Detector_power_state::getValue() const
{
return m_value;
}
void Detector_power_state::setValue(Detector_power_state::eDetector_power_state value)
{
m_value = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,80 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Detector_power_state.h
*
* Power on of ASICs
*/
#ifndef Detector_power_state_H_
#define Detector_power_state_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
/// Power on of ASICs
/// </summary>
class Detector_power_state
{
public:
Detector_power_state();
virtual ~Detector_power_state() = default;
enum class eDetector_power_state {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
POWERON,
POWEROFF,
PARTIAL
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Detector_power_state& rhs) const;
bool operator!=(const Detector_power_state& rhs) const;
/////////////////////////////////////////////
/// Detector_power_state members
Detector_power_state::eDetector_power_state getValue() const;
void setValue(Detector_power_state::eDetector_power_state value);
friend void to_json(nlohmann::json& j, const Detector_power_state& o);
friend void from_json(const nlohmann::json& j, Detector_power_state& o);
protected:
Detector_power_state::eDetector_power_state m_value = Detector_power_state::eDetector_power_state::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace org::openapitools::server::model
#endif /* Detector_power_state_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -66,7 +66,7 @@ bool Detector_selection::operator!=(const Detector_selection& rhs) const
void to_json(nlohmann::json& j, const Detector_selection& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["id"] = o.m_Id;
}

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -63,8 +63,8 @@ public:
int64_t getId() const;
void setId(int64_t const value);
friend void to_json(nlohmann::json& j, const Detector_selection& o);
friend void from_json(const nlohmann::json& j, Detector_selection& o);
friend void to_json(nlohmann::json& j, const Detector_selection& o);
friend void from_json(const nlohmann::json& j, Detector_selection& o);
protected:
int64_t m_Id;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -24,28 +24,33 @@ Detector_settings::Detector_settings()
m_Frame_time_us = 0L;
m_Count_time_us = 0L;
m_Count_time_usIsSet = false;
m_Storage_cell_count = 1L;
m_Storage_cell_countIsSet = false;
m_Internal_frame_generator = false;
m_Internal_frame_generatorIsSet = false;
m_Internal_frame_generator_images = 1L;
m_Internal_frame_generator_imagesIsSet = false;
m_Collect_raw_data = false;
m_Collect_raw_dataIsSet = false;
m_Pedestal_g0_frames = 0L;
m_Pedestal_g0_framesIsSet = false;
m_Pedestal_g1_frames = 0L;
m_Pedestal_g1_framesIsSet = false;
m_Pedestal_g2_frames = 0L;
m_Pedestal_g2_framesIsSet = false;
m_Storage_cell_delay_us = 0.0f;
m_Storage_cell_delay_usIsSet = false;
m_Detector_trigger_delay_us = 0.0f;
m_Detector_trigger_delay_usIsSet = false;
m_Fixed_gain_g1 = false;
m_Fixed_gain_g1IsSet = false;
m_Use_gain_hg0 = false;
m_Use_gain_hg0IsSet = false;
m_Detector_trigger_delay_ns = 0L;
m_Detector_trigger_delay_nsIsSet = false;
m_TimingIsSet = false;
m_Eiger_threshold_keV = 0.0f;
m_Eiger_threshold_keVIsSet = false;
m_Jungfrau_pedestal_g0_frames = 2000L;
m_Jungfrau_pedestal_g0_framesIsSet = false;
m_Jungfrau_pedestal_g1_frames = 300L;
m_Jungfrau_pedestal_g1_framesIsSet = false;
m_Jungfrau_pedestal_g2_frames = 300L;
m_Jungfrau_pedestal_g2_framesIsSet = false;
m_Jungfrau_pedestal_g0_rms_limit = 100L;
m_Jungfrau_pedestal_g0_rms_limitIsSet = false;
m_Jungfrau_pedestal_min_image_count = 128L;
m_Jungfrau_pedestal_min_image_countIsSet = false;
m_Jungfrau_storage_cell_count = 1L;
m_Jungfrau_storage_cell_countIsSet = false;
m_Jungfrau_storage_cell_delay_ns = 5000L;
m_Jungfrau_storage_cell_delay_nsIsSet = false;
m_Jungfrau_fixed_gain_g1 = false;
m_Jungfrau_fixed_gain_g1IsSet = false;
m_Jungfrau_use_gain_hg0 = false;
m_Jungfrau_use_gain_hg0IsSet = false;
}
@@ -82,26 +87,7 @@ bool Detector_settings::validate(std::stringstream& msg, const std::string& path
}
}
if (storageCellCountIsSet())
{
const int64_t& value = m_Storage_cell_count;
const std::string currentValuePath = _pathPrefix + ".storageCellCount";
if (value < 1ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
if (value > 16ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 16;";
}
}
if (internalFrameGeneratorImagesIsSet())
{
const int64_t& value = m_Internal_frame_generator_images;
@@ -120,11 +106,44 @@ bool Detector_settings::validate(std::stringstream& msg, const std::string& path
}
}
if (detectorTriggerDelayNsIsSet())
{
const int64_t& value = m_Detector_trigger_delay_ns;
const std::string currentValuePath = _pathPrefix + ".detectorTriggerDelayNs";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (pedestalG0FramesIsSet())
if (eigerThresholdKeVIsSet())
{
const int64_t& value = m_Pedestal_g0_frames;
const std::string currentValuePath = _pathPrefix + ".pedestalG0Frames";
const float& value = m_Eiger_threshold_keV;
const std::string currentValuePath = _pathPrefix + ".eigerThresholdKeV";
if (value < static_cast<float>(1.0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1.0;";
}
if (value > static_cast<float>(100.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 100.0;";
}
}
if (jungfrauPedestalG0FramesIsSet())
{
const int64_t& value = m_Jungfrau_pedestal_g0_frames;
const std::string currentValuePath = _pathPrefix + ".jungfrauPedestalG0Frames";
if (value < 0ll)
@@ -135,10 +154,10 @@ bool Detector_settings::validate(std::stringstream& msg, const std::string& path
}
if (pedestalG1FramesIsSet())
if (jungfrauPedestalG1FramesIsSet())
{
const int64_t& value = m_Pedestal_g1_frames;
const std::string currentValuePath = _pathPrefix + ".pedestalG1Frames";
const int64_t& value = m_Jungfrau_pedestal_g1_frames;
const std::string currentValuePath = _pathPrefix + ".jungfrauPedestalG1Frames";
if (value < 0ll)
@@ -149,10 +168,10 @@ bool Detector_settings::validate(std::stringstream& msg, const std::string& path
}
if (pedestalG2FramesIsSet())
if (jungfrauPedestalG2FramesIsSet())
{
const int64_t& value = m_Pedestal_g2_frames;
const std::string currentValuePath = _pathPrefix + ".pedestalG2Frames";
const int64_t& value = m_Jungfrau_pedestal_g2_frames;
const std::string currentValuePath = _pathPrefix + ".jungfrauPedestalG2Frames";
if (value < 0ll)
@@ -162,7 +181,68 @@ bool Detector_settings::validate(std::stringstream& msg, const std::string& path
}
}
if (jungfrauPedestalG0RmsLimitIsSet())
{
const int64_t& value = m_Jungfrau_pedestal_g0_rms_limit;
const std::string currentValuePath = _pathPrefix + ".jungfrauPedestalG0RmsLimit";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (jungfrauPedestalMinImageCountIsSet())
{
const int64_t& value = m_Jungfrau_pedestal_min_image_count;
const std::string currentValuePath = _pathPrefix + ".jungfrauPedestalMinImageCount";
if (value < 32ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 32;";
}
}
if (jungfrauStorageCellCountIsSet())
{
const int64_t& value = m_Jungfrau_storage_cell_count;
const std::string currentValuePath = _pathPrefix + ".jungfrauStorageCellCount";
if (value < 1ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
if (value > 16ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 16;";
}
}
if (jungfrauStorageCellDelayNsIsSet())
{
const int64_t& value = m_Jungfrau_storage_cell_delay_ns;
const std::string currentValuePath = _pathPrefix + ".jungfrauStorageCellDelayNs";
if (value < 2100ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 2100;";
}
}
return success;
}
@@ -178,37 +258,46 @@ bool Detector_settings::operator==(const Detector_settings& rhs) const
((!countTimeUsIsSet() && !rhs.countTimeUsIsSet()) || (countTimeUsIsSet() && rhs.countTimeUsIsSet() && getCountTimeUs() == rhs.getCountTimeUs())) &&
((!storageCellCountIsSet() && !rhs.storageCellCountIsSet()) || (storageCellCountIsSet() && rhs.storageCellCountIsSet() && getStorageCellCount() == rhs.getStorageCellCount())) &&
((!internalFrameGeneratorIsSet() && !rhs.internalFrameGeneratorIsSet()) || (internalFrameGeneratorIsSet() && rhs.internalFrameGeneratorIsSet() && isInternalFrameGenerator() == rhs.isInternalFrameGenerator())) &&
((!internalFrameGeneratorImagesIsSet() && !rhs.internalFrameGeneratorImagesIsSet()) || (internalFrameGeneratorImagesIsSet() && rhs.internalFrameGeneratorImagesIsSet() && getInternalFrameGeneratorImages() == rhs.getInternalFrameGeneratorImages())) &&
((!collectRawDataIsSet() && !rhs.collectRawDataIsSet()) || (collectRawDataIsSet() && rhs.collectRawDataIsSet() && isCollectRawData() == rhs.isCollectRawData())) &&
((!detectorTriggerDelayNsIsSet() && !rhs.detectorTriggerDelayNsIsSet()) || (detectorTriggerDelayNsIsSet() && rhs.detectorTriggerDelayNsIsSet() && getDetectorTriggerDelayNs() == rhs.getDetectorTriggerDelayNs())) &&
((!pedestalG0FramesIsSet() && !rhs.pedestalG0FramesIsSet()) || (pedestalG0FramesIsSet() && rhs.pedestalG0FramesIsSet() && getPedestalG0Frames() == rhs.getPedestalG0Frames())) &&
((!timingIsSet() && !rhs.timingIsSet()) || (timingIsSet() && rhs.timingIsSet() && getTiming() == rhs.getTiming())) &&
((!pedestalG1FramesIsSet() && !rhs.pedestalG1FramesIsSet()) || (pedestalG1FramesIsSet() && rhs.pedestalG1FramesIsSet() && getPedestalG1Frames() == rhs.getPedestalG1Frames())) &&
((!eigerThresholdKeVIsSet() && !rhs.eigerThresholdKeVIsSet()) || (eigerThresholdKeVIsSet() && rhs.eigerThresholdKeVIsSet() && getEigerThresholdKeV() == rhs.getEigerThresholdKeV())) &&
((!pedestalG2FramesIsSet() && !rhs.pedestalG2FramesIsSet()) || (pedestalG2FramesIsSet() && rhs.pedestalG2FramesIsSet() && getPedestalG2Frames() == rhs.getPedestalG2Frames())) &&
((!jungfrauPedestalG0FramesIsSet() && !rhs.jungfrauPedestalG0FramesIsSet()) || (jungfrauPedestalG0FramesIsSet() && rhs.jungfrauPedestalG0FramesIsSet() && getJungfrauPedestalG0Frames() == rhs.getJungfrauPedestalG0Frames())) &&
((!storageCellDelayUsIsSet() && !rhs.storageCellDelayUsIsSet()) || (storageCellDelayUsIsSet() && rhs.storageCellDelayUsIsSet() && getStorageCellDelayUs() == rhs.getStorageCellDelayUs())) &&
((!jungfrauPedestalG1FramesIsSet() && !rhs.jungfrauPedestalG1FramesIsSet()) || (jungfrauPedestalG1FramesIsSet() && rhs.jungfrauPedestalG1FramesIsSet() && getJungfrauPedestalG1Frames() == rhs.getJungfrauPedestalG1Frames())) &&
((!detectorTriggerDelayUsIsSet() && !rhs.detectorTriggerDelayUsIsSet()) || (detectorTriggerDelayUsIsSet() && rhs.detectorTriggerDelayUsIsSet() && getDetectorTriggerDelayUs() == rhs.getDetectorTriggerDelayUs())) &&
((!jungfrauPedestalG2FramesIsSet() && !rhs.jungfrauPedestalG2FramesIsSet()) || (jungfrauPedestalG2FramesIsSet() && rhs.jungfrauPedestalG2FramesIsSet() && getJungfrauPedestalG2Frames() == rhs.getJungfrauPedestalG2Frames())) &&
((!fixedGainG1IsSet() && !rhs.fixedGainG1IsSet()) || (fixedGainG1IsSet() && rhs.fixedGainG1IsSet() && isFixedGainG1() == rhs.isFixedGainG1())) &&
((!jungfrauPedestalG0RmsLimitIsSet() && !rhs.jungfrauPedestalG0RmsLimitIsSet()) || (jungfrauPedestalG0RmsLimitIsSet() && rhs.jungfrauPedestalG0RmsLimitIsSet() && getJungfrauPedestalG0RmsLimit() == rhs.getJungfrauPedestalG0RmsLimit())) &&
((!useGainHg0IsSet() && !rhs.useGainHg0IsSet()) || (useGainHg0IsSet() && rhs.useGainHg0IsSet() && isUseGainHg0() == rhs.isUseGainHg0()))
((!jungfrauPedestalMinImageCountIsSet() && !rhs.jungfrauPedestalMinImageCountIsSet()) || (jungfrauPedestalMinImageCountIsSet() && rhs.jungfrauPedestalMinImageCountIsSet() && getJungfrauPedestalMinImageCount() == rhs.getJungfrauPedestalMinImageCount())) &&
((!jungfrauStorageCellCountIsSet() && !rhs.jungfrauStorageCellCountIsSet()) || (jungfrauStorageCellCountIsSet() && rhs.jungfrauStorageCellCountIsSet() && getJungfrauStorageCellCount() == rhs.getJungfrauStorageCellCount())) &&
((!jungfrauStorageCellDelayNsIsSet() && !rhs.jungfrauStorageCellDelayNsIsSet()) || (jungfrauStorageCellDelayNsIsSet() && rhs.jungfrauStorageCellDelayNsIsSet() && getJungfrauStorageCellDelayNs() == rhs.getJungfrauStorageCellDelayNs())) &&
((!jungfrauFixedGainG1IsSet() && !rhs.jungfrauFixedGainG1IsSet()) || (jungfrauFixedGainG1IsSet() && rhs.jungfrauFixedGainG1IsSet() && isJungfrauFixedGainG1() == rhs.isJungfrauFixedGainG1())) &&
((!jungfrauUseGainHg0IsSet() && !rhs.jungfrauUseGainHg0IsSet()) || (jungfrauUseGainHg0IsSet() && rhs.jungfrauUseGainHg0IsSet() && isJungfrauUseGainHg0() == rhs.isJungfrauUseGainHg0()))
;
}
@@ -220,32 +309,38 @@ bool Detector_settings::operator!=(const Detector_settings& rhs) const
void to_json(nlohmann::json& j, const Detector_settings& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["frame_time_us"] = o.m_Frame_time_us;
if(o.countTimeUsIsSet())
j["count_time_us"] = o.m_Count_time_us;
if(o.storageCellCountIsSet())
j["storage_cell_count"] = o.m_Storage_cell_count;
if(o.internalFrameGeneratorIsSet())
j["internal_frame_generator"] = o.m_Internal_frame_generator;
if(o.internalFrameGeneratorImagesIsSet())
j["internal_frame_generator_images"] = o.m_Internal_frame_generator_images;
if(o.collectRawDataIsSet())
j["collect_raw_data"] = o.m_Collect_raw_data;
if(o.pedestalG0FramesIsSet())
j["pedestal_g0_frames"] = o.m_Pedestal_g0_frames;
if(o.pedestalG1FramesIsSet())
j["pedestal_g1_frames"] = o.m_Pedestal_g1_frames;
if(o.pedestalG2FramesIsSet())
j["pedestal_g2_frames"] = o.m_Pedestal_g2_frames;
if(o.storageCellDelayUsIsSet())
j["storage_cell_delay_us"] = o.m_Storage_cell_delay_us;
if(o.detectorTriggerDelayUsIsSet())
j["detector_trigger_delay_us"] = o.m_Detector_trigger_delay_us;
if(o.fixedGainG1IsSet())
j["fixed_gain_g1"] = o.m_Fixed_gain_g1;
if(o.useGainHg0IsSet())
j["use_gain_hg0"] = o.m_Use_gain_hg0;
if(o.detectorTriggerDelayNsIsSet())
j["detector_trigger_delay_ns"] = o.m_Detector_trigger_delay_ns;
if(o.timingIsSet())
j["timing"] = o.m_Timing;
if(o.eigerThresholdKeVIsSet())
j["eiger_threshold_keV"] = o.m_Eiger_threshold_keV;
if(o.jungfrauPedestalG0FramesIsSet())
j["jungfrau_pedestal_g0_frames"] = o.m_Jungfrau_pedestal_g0_frames;
if(o.jungfrauPedestalG1FramesIsSet())
j["jungfrau_pedestal_g1_frames"] = o.m_Jungfrau_pedestal_g1_frames;
if(o.jungfrauPedestalG2FramesIsSet())
j["jungfrau_pedestal_g2_frames"] = o.m_Jungfrau_pedestal_g2_frames;
if(o.jungfrauPedestalG0RmsLimitIsSet())
j["jungfrau_pedestal_g0_rms_limit"] = o.m_Jungfrau_pedestal_g0_rms_limit;
if(o.jungfrauPedestalMinImageCountIsSet())
j["jungfrau_pedestal_min_image_count"] = o.m_Jungfrau_pedestal_min_image_count;
if(o.jungfrauStorageCellCountIsSet())
j["jungfrau_storage_cell_count"] = o.m_Jungfrau_storage_cell_count;
if(o.jungfrauStorageCellDelayNsIsSet())
j["jungfrau_storage_cell_delay_ns"] = o.m_Jungfrau_storage_cell_delay_ns;
if(o.jungfrauFixedGainG1IsSet())
j["jungfrau_fixed_gain_g1"] = o.m_Jungfrau_fixed_gain_g1;
if(o.jungfrauUseGainHg0IsSet())
j["jungfrau_use_gain_hg0"] = o.m_Jungfrau_use_gain_hg0;
}
@@ -257,11 +352,6 @@ void from_json(const nlohmann::json& j, Detector_settings& o)
j.at("count_time_us").get_to(o.m_Count_time_us);
o.m_Count_time_usIsSet = true;
}
if(j.find("storage_cell_count") != j.end())
{
j.at("storage_cell_count").get_to(o.m_Storage_cell_count);
o.m_Storage_cell_countIsSet = true;
}
if(j.find("internal_frame_generator") != j.end())
{
j.at("internal_frame_generator").get_to(o.m_Internal_frame_generator);
@@ -272,45 +362,65 @@ void from_json(const nlohmann::json& j, Detector_settings& o)
j.at("internal_frame_generator_images").get_to(o.m_Internal_frame_generator_images);
o.m_Internal_frame_generator_imagesIsSet = true;
}
if(j.find("collect_raw_data") != j.end())
if(j.find("detector_trigger_delay_ns") != j.end())
{
j.at("collect_raw_data").get_to(o.m_Collect_raw_data);
o.m_Collect_raw_dataIsSet = true;
j.at("detector_trigger_delay_ns").get_to(o.m_Detector_trigger_delay_ns);
o.m_Detector_trigger_delay_nsIsSet = true;
}
if(j.find("pedestal_g0_frames") != j.end())
if(j.find("timing") != j.end())
{
j.at("pedestal_g0_frames").get_to(o.m_Pedestal_g0_frames);
o.m_Pedestal_g0_framesIsSet = true;
j.at("timing").get_to(o.m_Timing);
o.m_TimingIsSet = true;
}
if(j.find("pedestal_g1_frames") != j.end())
if(j.find("eiger_threshold_keV") != j.end())
{
j.at("pedestal_g1_frames").get_to(o.m_Pedestal_g1_frames);
o.m_Pedestal_g1_framesIsSet = true;
j.at("eiger_threshold_keV").get_to(o.m_Eiger_threshold_keV);
o.m_Eiger_threshold_keVIsSet = true;
}
if(j.find("pedestal_g2_frames") != j.end())
if(j.find("jungfrau_pedestal_g0_frames") != j.end())
{
j.at("pedestal_g2_frames").get_to(o.m_Pedestal_g2_frames);
o.m_Pedestal_g2_framesIsSet = true;
j.at("jungfrau_pedestal_g0_frames").get_to(o.m_Jungfrau_pedestal_g0_frames);
o.m_Jungfrau_pedestal_g0_framesIsSet = true;
}
if(j.find("storage_cell_delay_us") != j.end())
if(j.find("jungfrau_pedestal_g1_frames") != j.end())
{
j.at("storage_cell_delay_us").get_to(o.m_Storage_cell_delay_us);
o.m_Storage_cell_delay_usIsSet = true;
j.at("jungfrau_pedestal_g1_frames").get_to(o.m_Jungfrau_pedestal_g1_frames);
o.m_Jungfrau_pedestal_g1_framesIsSet = true;
}
if(j.find("detector_trigger_delay_us") != j.end())
if(j.find("jungfrau_pedestal_g2_frames") != j.end())
{
j.at("detector_trigger_delay_us").get_to(o.m_Detector_trigger_delay_us);
o.m_Detector_trigger_delay_usIsSet = true;
j.at("jungfrau_pedestal_g2_frames").get_to(o.m_Jungfrau_pedestal_g2_frames);
o.m_Jungfrau_pedestal_g2_framesIsSet = true;
}
if(j.find("fixed_gain_g1") != j.end())
if(j.find("jungfrau_pedestal_g0_rms_limit") != j.end())
{
j.at("fixed_gain_g1").get_to(o.m_Fixed_gain_g1);
o.m_Fixed_gain_g1IsSet = true;
j.at("jungfrau_pedestal_g0_rms_limit").get_to(o.m_Jungfrau_pedestal_g0_rms_limit);
o.m_Jungfrau_pedestal_g0_rms_limitIsSet = true;
}
if(j.find("use_gain_hg0") != j.end())
if(j.find("jungfrau_pedestal_min_image_count") != j.end())
{
j.at("use_gain_hg0").get_to(o.m_Use_gain_hg0);
o.m_Use_gain_hg0IsSet = true;
j.at("jungfrau_pedestal_min_image_count").get_to(o.m_Jungfrau_pedestal_min_image_count);
o.m_Jungfrau_pedestal_min_image_countIsSet = true;
}
if(j.find("jungfrau_storage_cell_count") != j.end())
{
j.at("jungfrau_storage_cell_count").get_to(o.m_Jungfrau_storage_cell_count);
o.m_Jungfrau_storage_cell_countIsSet = true;
}
if(j.find("jungfrau_storage_cell_delay_ns") != j.end())
{
j.at("jungfrau_storage_cell_delay_ns").get_to(o.m_Jungfrau_storage_cell_delay_ns);
o.m_Jungfrau_storage_cell_delay_nsIsSet = true;
}
if(j.find("jungfrau_fixed_gain_g1") != j.end())
{
j.at("jungfrau_fixed_gain_g1").get_to(o.m_Jungfrau_fixed_gain_g1);
o.m_Jungfrau_fixed_gain_g1IsSet = true;
}
if(j.find("jungfrau_use_gain_hg0") != j.end())
{
j.at("jungfrau_use_gain_hg0").get_to(o.m_Jungfrau_use_gain_hg0);
o.m_Jungfrau_use_gain_hg0IsSet = true;
}
}
@@ -340,23 +450,6 @@ void Detector_settings::unsetCount_time_us()
{
m_Count_time_usIsSet = false;
}
int64_t Detector_settings::getStorageCellCount() const
{
return m_Storage_cell_count;
}
void Detector_settings::setStorageCellCount(int64_t const value)
{
m_Storage_cell_count = value;
m_Storage_cell_countIsSet = true;
}
bool Detector_settings::storageCellCountIsSet() const
{
return m_Storage_cell_countIsSet;
}
void Detector_settings::unsetStorage_cell_count()
{
m_Storage_cell_countIsSet = false;
}
bool Detector_settings::isInternalFrameGenerator() const
{
return m_Internal_frame_generator;
@@ -391,141 +484,209 @@ void Detector_settings::unsetInternal_frame_generator_images()
{
m_Internal_frame_generator_imagesIsSet = false;
}
bool Detector_settings::isCollectRawData() const
int64_t Detector_settings::getDetectorTriggerDelayNs() const
{
return m_Collect_raw_data;
return m_Detector_trigger_delay_ns;
}
void Detector_settings::setCollectRawData(bool const value)
void Detector_settings::setDetectorTriggerDelayNs(int64_t const value)
{
m_Collect_raw_data = value;
m_Collect_raw_dataIsSet = true;
m_Detector_trigger_delay_ns = value;
m_Detector_trigger_delay_nsIsSet = true;
}
bool Detector_settings::collectRawDataIsSet() const
bool Detector_settings::detectorTriggerDelayNsIsSet() const
{
return m_Collect_raw_dataIsSet;
return m_Detector_trigger_delay_nsIsSet;
}
void Detector_settings::unsetCollect_raw_data()
void Detector_settings::unsetDetector_trigger_delay_ns()
{
m_Collect_raw_dataIsSet = false;
m_Detector_trigger_delay_nsIsSet = false;
}
int64_t Detector_settings::getPedestalG0Frames() const
org::openapitools::server::model::Detector_timing Detector_settings::getTiming() const
{
return m_Pedestal_g0_frames;
return m_Timing;
}
void Detector_settings::setPedestalG0Frames(int64_t const value)
void Detector_settings::setTiming(org::openapitools::server::model::Detector_timing const& value)
{
m_Pedestal_g0_frames = value;
m_Pedestal_g0_framesIsSet = true;
m_Timing = value;
m_TimingIsSet = true;
}
bool Detector_settings::pedestalG0FramesIsSet() const
bool Detector_settings::timingIsSet() const
{
return m_Pedestal_g0_framesIsSet;
return m_TimingIsSet;
}
void Detector_settings::unsetPedestal_g0_frames()
void Detector_settings::unsetTiming()
{
m_Pedestal_g0_framesIsSet = false;
m_TimingIsSet = false;
}
int64_t Detector_settings::getPedestalG1Frames() const
float Detector_settings::getEigerThresholdKeV() const
{
return m_Pedestal_g1_frames;
return m_Eiger_threshold_keV;
}
void Detector_settings::setPedestalG1Frames(int64_t const value)
void Detector_settings::setEigerThresholdKeV(float const value)
{
m_Pedestal_g1_frames = value;
m_Pedestal_g1_framesIsSet = true;
m_Eiger_threshold_keV = value;
m_Eiger_threshold_keVIsSet = true;
}
bool Detector_settings::pedestalG1FramesIsSet() const
bool Detector_settings::eigerThresholdKeVIsSet() const
{
return m_Pedestal_g1_framesIsSet;
return m_Eiger_threshold_keVIsSet;
}
void Detector_settings::unsetPedestal_g1_frames()
void Detector_settings::unsetEiger_threshold_keV()
{
m_Pedestal_g1_framesIsSet = false;
m_Eiger_threshold_keVIsSet = false;
}
int64_t Detector_settings::getPedestalG2Frames() const
int64_t Detector_settings::getJungfrauPedestalG0Frames() const
{
return m_Pedestal_g2_frames;
return m_Jungfrau_pedestal_g0_frames;
}
void Detector_settings::setPedestalG2Frames(int64_t const value)
void Detector_settings::setJungfrauPedestalG0Frames(int64_t const value)
{
m_Pedestal_g2_frames = value;
m_Pedestal_g2_framesIsSet = true;
m_Jungfrau_pedestal_g0_frames = value;
m_Jungfrau_pedestal_g0_framesIsSet = true;
}
bool Detector_settings::pedestalG2FramesIsSet() const
bool Detector_settings::jungfrauPedestalG0FramesIsSet() const
{
return m_Pedestal_g2_framesIsSet;
return m_Jungfrau_pedestal_g0_framesIsSet;
}
void Detector_settings::unsetPedestal_g2_frames()
void Detector_settings::unsetJungfrau_pedestal_g0_frames()
{
m_Pedestal_g2_framesIsSet = false;
m_Jungfrau_pedestal_g0_framesIsSet = false;
}
float Detector_settings::getStorageCellDelayUs() const
int64_t Detector_settings::getJungfrauPedestalG1Frames() const
{
return m_Storage_cell_delay_us;
return m_Jungfrau_pedestal_g1_frames;
}
void Detector_settings::setStorageCellDelayUs(float const value)
void Detector_settings::setJungfrauPedestalG1Frames(int64_t const value)
{
m_Storage_cell_delay_us = value;
m_Storage_cell_delay_usIsSet = true;
m_Jungfrau_pedestal_g1_frames = value;
m_Jungfrau_pedestal_g1_framesIsSet = true;
}
bool Detector_settings::storageCellDelayUsIsSet() const
bool Detector_settings::jungfrauPedestalG1FramesIsSet() const
{
return m_Storage_cell_delay_usIsSet;
return m_Jungfrau_pedestal_g1_framesIsSet;
}
void Detector_settings::unsetStorage_cell_delay_us()
void Detector_settings::unsetJungfrau_pedestal_g1_frames()
{
m_Storage_cell_delay_usIsSet = false;
m_Jungfrau_pedestal_g1_framesIsSet = false;
}
float Detector_settings::getDetectorTriggerDelayUs() const
int64_t Detector_settings::getJungfrauPedestalG2Frames() const
{
return m_Detector_trigger_delay_us;
return m_Jungfrau_pedestal_g2_frames;
}
void Detector_settings::setDetectorTriggerDelayUs(float const value)
void Detector_settings::setJungfrauPedestalG2Frames(int64_t const value)
{
m_Detector_trigger_delay_us = value;
m_Detector_trigger_delay_usIsSet = true;
m_Jungfrau_pedestal_g2_frames = value;
m_Jungfrau_pedestal_g2_framesIsSet = true;
}
bool Detector_settings::detectorTriggerDelayUsIsSet() const
bool Detector_settings::jungfrauPedestalG2FramesIsSet() const
{
return m_Detector_trigger_delay_usIsSet;
return m_Jungfrau_pedestal_g2_framesIsSet;
}
void Detector_settings::unsetDetector_trigger_delay_us()
void Detector_settings::unsetJungfrau_pedestal_g2_frames()
{
m_Detector_trigger_delay_usIsSet = false;
m_Jungfrau_pedestal_g2_framesIsSet = false;
}
bool Detector_settings::isFixedGainG1() const
int64_t Detector_settings::getJungfrauPedestalG0RmsLimit() const
{
return m_Fixed_gain_g1;
return m_Jungfrau_pedestal_g0_rms_limit;
}
void Detector_settings::setFixedGainG1(bool const value)
void Detector_settings::setJungfrauPedestalG0RmsLimit(int64_t const value)
{
m_Fixed_gain_g1 = value;
m_Fixed_gain_g1IsSet = true;
m_Jungfrau_pedestal_g0_rms_limit = value;
m_Jungfrau_pedestal_g0_rms_limitIsSet = true;
}
bool Detector_settings::fixedGainG1IsSet() const
bool Detector_settings::jungfrauPedestalG0RmsLimitIsSet() const
{
return m_Fixed_gain_g1IsSet;
return m_Jungfrau_pedestal_g0_rms_limitIsSet;
}
void Detector_settings::unsetFixed_gain_g1()
void Detector_settings::unsetJungfrau_pedestal_g0_rms_limit()
{
m_Fixed_gain_g1IsSet = false;
m_Jungfrau_pedestal_g0_rms_limitIsSet = false;
}
bool Detector_settings::isUseGainHg0() const
int64_t Detector_settings::getJungfrauPedestalMinImageCount() const
{
return m_Use_gain_hg0;
return m_Jungfrau_pedestal_min_image_count;
}
void Detector_settings::setUseGainHg0(bool const value)
void Detector_settings::setJungfrauPedestalMinImageCount(int64_t const value)
{
m_Use_gain_hg0 = value;
m_Use_gain_hg0IsSet = true;
m_Jungfrau_pedestal_min_image_count = value;
m_Jungfrau_pedestal_min_image_countIsSet = true;
}
bool Detector_settings::useGainHg0IsSet() const
bool Detector_settings::jungfrauPedestalMinImageCountIsSet() const
{
return m_Use_gain_hg0IsSet;
return m_Jungfrau_pedestal_min_image_countIsSet;
}
void Detector_settings::unsetUse_gain_hg0()
void Detector_settings::unsetJungfrau_pedestal_min_image_count()
{
m_Use_gain_hg0IsSet = false;
m_Jungfrau_pedestal_min_image_countIsSet = false;
}
int64_t Detector_settings::getJungfrauStorageCellCount() const
{
return m_Jungfrau_storage_cell_count;
}
void Detector_settings::setJungfrauStorageCellCount(int64_t const value)
{
m_Jungfrau_storage_cell_count = value;
m_Jungfrau_storage_cell_countIsSet = true;
}
bool Detector_settings::jungfrauStorageCellCountIsSet() const
{
return m_Jungfrau_storage_cell_countIsSet;
}
void Detector_settings::unsetJungfrau_storage_cell_count()
{
m_Jungfrau_storage_cell_countIsSet = false;
}
int64_t Detector_settings::getJungfrauStorageCellDelayNs() const
{
return m_Jungfrau_storage_cell_delay_ns;
}
void Detector_settings::setJungfrauStorageCellDelayNs(int64_t const value)
{
m_Jungfrau_storage_cell_delay_ns = value;
m_Jungfrau_storage_cell_delay_nsIsSet = true;
}
bool Detector_settings::jungfrauStorageCellDelayNsIsSet() const
{
return m_Jungfrau_storage_cell_delay_nsIsSet;
}
void Detector_settings::unsetJungfrau_storage_cell_delay_ns()
{
m_Jungfrau_storage_cell_delay_nsIsSet = false;
}
bool Detector_settings::isJungfrauFixedGainG1() const
{
return m_Jungfrau_fixed_gain_g1;
}
void Detector_settings::setJungfrauFixedGainG1(bool const value)
{
m_Jungfrau_fixed_gain_g1 = value;
m_Jungfrau_fixed_gain_g1IsSet = true;
}
bool Detector_settings::jungfrauFixedGainG1IsSet() const
{
return m_Jungfrau_fixed_gain_g1IsSet;
}
void Detector_settings::unsetJungfrau_fixed_gain_g1()
{
m_Jungfrau_fixed_gain_g1IsSet = false;
}
bool Detector_settings::isJungfrauUseGainHg0() const
{
return m_Jungfrau_use_gain_hg0;
}
void Detector_settings::setJungfrauUseGainHg0(bool const value)
{
m_Jungfrau_use_gain_hg0 = value;
m_Jungfrau_use_gain_hg0IsSet = true;
}
bool Detector_settings::jungfrauUseGainHg0IsSet() const
{
return m_Jungfrau_use_gain_hg0IsSet;
}
void Detector_settings::unsetJungfrau_use_gain_hg0()
{
m_Jungfrau_use_gain_hg0IsSet = false;
}

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -19,6 +19,7 @@
#define Detector_settings_H_
#include "Detector_timing.h"
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
@@ -70,13 +71,6 @@ public:
bool countTimeUsIsSet() const;
void unsetCount_time_us();
/// <summary>
///
/// </summary>
int64_t getStorageCellCount() const;
void setStorageCellCount(int64_t const value);
bool storageCellCountIsSet() const;
void unsetStorage_cell_count();
/// <summary>
/// Use internal frame generator in FPGA instead of getting data from a real detector
/// </summary>
bool isInternalFrameGenerator() const;
@@ -91,91 +85,125 @@ public:
bool internalFrameGeneratorImagesIsSet() const;
void unsetInternal_frame_generator_images();
/// <summary>
/// Turn off conversion of pixel read-out to photon count
/// Delay between TTL trigger and acquisition start [ns]
/// </summary>
bool isCollectRawData() const;
void setCollectRawData(bool const value);
bool collectRawDataIsSet() const;
void unsetCollect_raw_data();
int64_t getDetectorTriggerDelayNs() const;
void setDetectorTriggerDelayNs(int64_t const value);
bool detectorTriggerDelayNsIsSet() const;
void unsetDetector_trigger_delay_ns();
/// <summary>
///
/// </summary>
int64_t getPedestalG0Frames() const;
void setPedestalG0Frames(int64_t const value);
bool pedestalG0FramesIsSet() const;
void unsetPedestal_g0_frames();
org::openapitools::server::model::Detector_timing getTiming() const;
void setTiming(org::openapitools::server::model::Detector_timing const& value);
bool timingIsSet() const;
void unsetTiming();
/// <summary>
///
/// </summary>
int64_t getPedestalG1Frames() const;
void setPedestalG1Frames(int64_t const value);
bool pedestalG1FramesIsSet() const;
void unsetPedestal_g1_frames();
float getEigerThresholdKeV() const;
void setEigerThresholdKeV(float const value);
bool eigerThresholdKeVIsSet() const;
void unsetEiger_threshold_keV();
/// <summary>
///
/// </summary>
int64_t getPedestalG2Frames() const;
void setPedestalG2Frames(int64_t const value);
bool pedestalG2FramesIsSet() const;
void unsetPedestal_g2_frames();
int64_t getJungfrauPedestalG0Frames() const;
void setJungfrauPedestalG0Frames(int64_t const value);
bool jungfrauPedestalG0FramesIsSet() const;
void unsetJungfrau_pedestal_g0_frames();
/// <summary>
/// Delay between two storage cells [us]
///
/// </summary>
float getStorageCellDelayUs() const;
void setStorageCellDelayUs(float const value);
bool storageCellDelayUsIsSet() const;
void unsetStorage_cell_delay_us();
int64_t getJungfrauPedestalG1Frames() const;
void setJungfrauPedestalG1Frames(int64_t const value);
bool jungfrauPedestalG1FramesIsSet() const;
void unsetJungfrau_pedestal_g1_frames();
/// <summary>
/// Delay between TTL trigger and acquisition start [us]
///
/// </summary>
float getDetectorTriggerDelayUs() const;
void setDetectorTriggerDelayUs(float const value);
bool detectorTriggerDelayUsIsSet() const;
void unsetDetector_trigger_delay_us();
int64_t getJungfrauPedestalG2Frames() const;
void setJungfrauPedestalG2Frames(int64_t const value);
bool jungfrauPedestalG2FramesIsSet() const;
void unsetJungfrau_pedestal_g2_frames();
/// <summary>
/// Pixels with pedestal G0 RMS above the threshold are marked as masked pixels
/// </summary>
int64_t getJungfrauPedestalG0RmsLimit() const;
void setJungfrauPedestalG0RmsLimit(int64_t const value);
bool jungfrauPedestalG0RmsLimitIsSet() const;
void unsetJungfrau_pedestal_g0_rms_limit();
/// <summary>
/// Minimum number of collected images for pedestal to consider it viable
/// </summary>
int64_t getJungfrauPedestalMinImageCount() const;
void setJungfrauPedestalMinImageCount(int64_t const value);
bool jungfrauPedestalMinImageCountIsSet() const;
void unsetJungfrau_pedestal_min_image_count();
/// <summary>
///
/// </summary>
int64_t getJungfrauStorageCellCount() const;
void setJungfrauStorageCellCount(int64_t const value);
bool jungfrauStorageCellCountIsSet() const;
void unsetJungfrau_storage_cell_count();
/// <summary>
/// Delay between two storage cells [ns]
/// </summary>
int64_t getJungfrauStorageCellDelayNs() const;
void setJungfrauStorageCellDelayNs(int64_t const value);
bool jungfrauStorageCellDelayNsIsSet() const;
void unsetJungfrau_storage_cell_delay_ns();
/// <summary>
/// Fix gain to G1 (can be useful for storage cells)
/// </summary>
bool isFixedGainG1() const;
void setFixedGainG1(bool const value);
bool fixedGainG1IsSet() const;
void unsetFixed_gain_g1();
bool isJungfrauFixedGainG1() const;
void setJungfrauFixedGainG1(bool const value);
bool jungfrauFixedGainG1IsSet() const;
void unsetJungfrau_fixed_gain_g1();
/// <summary>
/// Use high G0 (for low energy applications)
/// </summary>
bool isUseGainHg0() const;
void setUseGainHg0(bool const value);
bool useGainHg0IsSet() const;
void unsetUse_gain_hg0();
bool isJungfrauUseGainHg0() const;
void setJungfrauUseGainHg0(bool const value);
bool jungfrauUseGainHg0IsSet() const;
void unsetJungfrau_use_gain_hg0();
friend void to_json(nlohmann::json& j, const Detector_settings& o);
friend void from_json(const nlohmann::json& j, Detector_settings& o);
friend void to_json(nlohmann::json& j, const Detector_settings& o);
friend void from_json(const nlohmann::json& j, Detector_settings& o);
protected:
int64_t m_Frame_time_us;
int64_t m_Count_time_us;
bool m_Count_time_usIsSet;
int64_t m_Storage_cell_count;
bool m_Storage_cell_countIsSet;
bool m_Internal_frame_generator;
bool m_Internal_frame_generatorIsSet;
int64_t m_Internal_frame_generator_images;
bool m_Internal_frame_generator_imagesIsSet;
bool m_Collect_raw_data;
bool m_Collect_raw_dataIsSet;
int64_t m_Pedestal_g0_frames;
bool m_Pedestal_g0_framesIsSet;
int64_t m_Pedestal_g1_frames;
bool m_Pedestal_g1_framesIsSet;
int64_t m_Pedestal_g2_frames;
bool m_Pedestal_g2_framesIsSet;
float m_Storage_cell_delay_us;
bool m_Storage_cell_delay_usIsSet;
float m_Detector_trigger_delay_us;
bool m_Detector_trigger_delay_usIsSet;
bool m_Fixed_gain_g1;
bool m_Fixed_gain_g1IsSet;
bool m_Use_gain_hg0;
bool m_Use_gain_hg0IsSet;
int64_t m_Detector_trigger_delay_ns;
bool m_Detector_trigger_delay_nsIsSet;
org::openapitools::server::model::Detector_timing m_Timing;
bool m_TimingIsSet;
float m_Eiger_threshold_keV;
bool m_Eiger_threshold_keVIsSet;
int64_t m_Jungfrau_pedestal_g0_frames;
bool m_Jungfrau_pedestal_g0_framesIsSet;
int64_t m_Jungfrau_pedestal_g1_frames;
bool m_Jungfrau_pedestal_g1_framesIsSet;
int64_t m_Jungfrau_pedestal_g2_frames;
bool m_Jungfrau_pedestal_g2_framesIsSet;
int64_t m_Jungfrau_pedestal_g0_rms_limit;
bool m_Jungfrau_pedestal_g0_rms_limitIsSet;
int64_t m_Jungfrau_pedestal_min_image_count;
bool m_Jungfrau_pedestal_min_image_countIsSet;
int64_t m_Jungfrau_storage_cell_count;
bool m_Jungfrau_storage_cell_countIsSet;
int64_t m_Jungfrau_storage_cell_delay_ns;
bool m_Jungfrau_storage_cell_delay_nsIsSet;
bool m_Jungfrau_fixed_gain_g1;
bool m_Jungfrau_fixed_gain_g1IsSet;
bool m_Jungfrau_use_gain_hg0;
bool m_Jungfrau_use_gain_hg0IsSet;
};

View File

@@ -0,0 +1,134 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Detector_state.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
Detector_state::Detector_state()
{
}
void Detector_state::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_state::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_state::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_state" : pathPrefix;
if (m_value == Detector_state::eDetector_state::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool Detector_state::operator==(const Detector_state& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool Detector_state::operator!=(const Detector_state& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_state& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case Detector_state::eDetector_state::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case Detector_state::eDetector_state::IDLE:
j = "Idle";
break;
case Detector_state::eDetector_state::WAITING:
j = "Waiting";
break;
case Detector_state::eDetector_state::BUSY:
j = "Busy";
break;
case Detector_state::eDetector_state::ERROR:
j = "Error";
break;
case Detector_state::eDetector_state::NOT_CONNECTED:
j = "Not connected";
break;
}
}
void from_json(const nlohmann::json& j, Detector_state& o)
{
auto s = j.get<std::string>();
if (s == "Idle") {
o.setValue(Detector_state::eDetector_state::IDLE);
}
else if (s == "Waiting") {
o.setValue(Detector_state::eDetector_state::WAITING);
}
else if (s == "Busy") {
o.setValue(Detector_state::eDetector_state::BUSY);
}
else if (s == "Error") {
o.setValue(Detector_state::eDetector_state::ERROR);
}
else if (s == "Not connected") {
o.setValue(Detector_state::eDetector_state::NOT_CONNECTED);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " Detector_state::eDetector_state";
throw std::invalid_argument(ss.str());
}
}
Detector_state::eDetector_state Detector_state::getValue() const
{
return m_value;
}
void Detector_state::setValue(Detector_state::eDetector_state value)
{
m_value = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,82 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Detector_state.h
*
* Current state of the detector
*/
#ifndef Detector_state_H_
#define Detector_state_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
/// Current state of the detector
/// </summary>
class Detector_state
{
public:
Detector_state();
virtual ~Detector_state() = default;
enum class eDetector_state {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
IDLE,
WAITING,
BUSY,
ERROR,
NOT_CONNECTED
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Detector_state& rhs) const;
bool operator!=(const Detector_state& rhs) const;
/////////////////////////////////////////////
/// Detector_state members
Detector_state::eDetector_state getValue() const;
void setValue(Detector_state::eDetector_state value);
friend void to_json(nlohmann::json& j, const Detector_state& o);
friend void from_json(const nlohmann::json& j, Detector_state& o);
protected:
Detector_state::eDetector_state m_value = Detector_state::eDetector_state::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace org::openapitools::server::model
#endif /* Detector_state_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -21,8 +21,6 @@ namespace org::openapitools::server::model
Detector_status::Detector_status()
{
m_State = "";
m_Powerchip = "";
m_Server_version = "";
m_Number_of_triggers_left = 0L;
@@ -126,7 +124,7 @@ bool Detector_status::operator!=(const Detector_status& rhs) const
void to_json(nlohmann::json& j, const Detector_status& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["state"] = o.m_State;
j["powerchip"] = o.m_Powerchip;
j["server_version"] = o.m_Server_version;
@@ -147,19 +145,19 @@ void from_json(const nlohmann::json& j, Detector_status& o)
}
std::string Detector_status::getState() const
org::openapitools::server::model::Detector_state Detector_status::getState() const
{
return m_State;
}
void Detector_status::setState(std::string const& value)
void Detector_status::setState(org::openapitools::server::model::Detector_state const& value)
{
m_State = value;
}
std::string Detector_status::getPowerchip() const
org::openapitools::server::model::Detector_power_state Detector_status::getPowerchip() const
{
return m_Powerchip;
}
void Detector_status::setPowerchip(std::string const& value)
void Detector_status::setPowerchip(org::openapitools::server::model::Detector_power_state const& value)
{
m_Powerchip = value;
}

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -19,7 +19,9 @@
#define Detector_status_H_
#include "Detector_state.h"
#include <string>
#include "Detector_power_state.h"
#include <vector>
#include <nlohmann/json.hpp>
@@ -60,15 +62,15 @@ public:
/// Detector_status members
/// <summary>
/// Current state of the detector
///
/// </summary>
std::string getState() const;
void setState(std::string const& value);
org::openapitools::server::model::Detector_state getState() const;
void setState(org::openapitools::server::model::Detector_state const& value);
/// <summary>
/// Power on of ASICs
///
/// </summary>
std::string getPowerchip() const;
void setPowerchip(std::string const& value);
org::openapitools::server::model::Detector_power_state getPowerchip() const;
void setPowerchip(org::openapitools::server::model::Detector_power_state const& value);
/// <summary>
/// Detector server (on read-out boards) version
/// </summary>
@@ -90,12 +92,12 @@ public:
std::vector<int64_t> getHighVoltageV() const;
void setHighVoltageV(std::vector<int64_t> const value);
friend void to_json(nlohmann::json& j, const Detector_status& o);
friend void from_json(const nlohmann::json& j, Detector_status& o);
friend void to_json(nlohmann::json& j, const Detector_status& o);
friend void from_json(const nlohmann::json& j, Detector_status& o);
protected:
std::string m_State;
org::openapitools::server::model::Detector_state m_State;
std::string m_Powerchip;
org::openapitools::server::model::Detector_power_state m_Powerchip;
std::string m_Server_version;

View File

@@ -0,0 +1,128 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Detector_timing.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
Detector_timing::Detector_timing()
{
}
void Detector_timing::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_timing::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_timing::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_timing" : pathPrefix;
if (m_value == Detector_timing::eDetector_timing::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool Detector_timing::operator==(const Detector_timing& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool Detector_timing::operator!=(const Detector_timing& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_timing& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case Detector_timing::eDetector_timing::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case Detector_timing::eDetector_timing::AUTO:
j = "auto";
break;
case Detector_timing::eDetector_timing::TRIGGER:
j = "trigger";
break;
case Detector_timing::eDetector_timing::BURST:
j = "burst";
break;
case Detector_timing::eDetector_timing::GATED:
j = "gated";
break;
}
}
void from_json(const nlohmann::json& j, Detector_timing& o)
{
auto s = j.get<std::string>();
if (s == "auto") {
o.setValue(Detector_timing::eDetector_timing::AUTO);
}
else if (s == "trigger") {
o.setValue(Detector_timing::eDetector_timing::TRIGGER);
}
else if (s == "burst") {
o.setValue(Detector_timing::eDetector_timing::BURST);
}
else if (s == "gated") {
o.setValue(Detector_timing::eDetector_timing::GATED);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " Detector_timing::eDetector_timing";
throw std::invalid_argument(ss.str());
}
}
Detector_timing::eDetector_timing Detector_timing::getValue() const
{
return m_value;
}
void Detector_timing::setValue(Detector_timing::eDetector_timing value)
{
m_value = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,81 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Detector_timing.h
*
*
*/
#ifndef Detector_timing_H_
#define Detector_timing_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Detector_timing
{
public:
Detector_timing();
virtual ~Detector_timing() = default;
enum class eDetector_timing {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
AUTO,
TRIGGER,
BURST,
GATED
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Detector_timing& rhs) const;
bool operator!=(const Detector_timing& rhs) const;
/////////////////////////////////////////////
/// Detector_timing members
Detector_timing::eDetector_timing getValue() const;
void setValue(Detector_timing::eDetector_timing value);
friend void to_json(nlohmann::json& j, const Detector_timing& o);
friend void from_json(const nlohmann::json& j, Detector_timing& o);
protected:
Detector_timing::eDetector_timing m_value = Detector_timing::eDetector_timing::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace org::openapitools::server::model
#endif /* Detector_timing_H_ */

View File

@@ -0,0 +1,116 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Detector_type.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
Detector_type::Detector_type()
{
}
void Detector_type::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_type::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_type::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_type" : pathPrefix;
if (m_value == Detector_type::eDetector_type::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool Detector_type::operator==(const Detector_type& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool Detector_type::operator!=(const Detector_type& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_type& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case Detector_type::eDetector_type::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case Detector_type::eDetector_type::EIGER:
j = "EIGER";
break;
case Detector_type::eDetector_type::JUNGFRAU:
j = "JUNGFRAU";
break;
}
}
void from_json(const nlohmann::json& j, Detector_type& o)
{
auto s = j.get<std::string>();
if (s == "EIGER") {
o.setValue(Detector_type::eDetector_type::EIGER);
}
else if (s == "JUNGFRAU") {
o.setValue(Detector_type::eDetector_type::JUNGFRAU);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " Detector_type::eDetector_type";
throw std::invalid_argument(ss.str());
}
}
Detector_type::eDetector_type Detector_type::getValue() const
{
return m_value;
}
void Detector_type::setValue(Detector_type::eDetector_type value)
{
m_value = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,79 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Detector_type.h
*
*
*/
#ifndef Detector_type_H_
#define Detector_type_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Detector_type
{
public:
Detector_type();
virtual ~Detector_type() = default;
enum class eDetector_type {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
EIGER,
JUNGFRAU
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Detector_type& rhs) const;
bool operator!=(const Detector_type& rhs) const;
/////////////////////////////////////////////
/// Detector_type members
Detector_type::eDetector_type getValue() const;
void setValue(Detector_type::eDetector_type value);
friend void to_json(nlohmann::json& j, const Detector_type& o);
friend void from_json(const nlohmann::json& j, Detector_type& o);
protected:
Detector_type::eDetector_type m_value = Detector_type::eDetector_type::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace org::openapitools::server::model
#endif /* Detector_type_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -70,7 +70,7 @@ bool Error_message::operator!=(const Error_message& rhs) const
void to_json(nlohmann::json& j, const Error_message& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["msg"] = o.m_Msg;
j["reason"] = o.m_Reason;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -69,8 +69,8 @@ public:
std::string getReason() const;
void setReason(std::string const& value);
friend void to_json(nlohmann::json& j, const Error_message& o);
friend void from_json(const nlohmann::json& j, Error_message& o);
friend void to_json(nlohmann::json& j, const Error_message& o);
friend void from_json(const nlohmann::json& j, Error_message& o);
protected:
std::string m_Msg;

View File

@@ -0,0 +1,231 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Fpga_status_inner.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Fpga_status_inner::Fpga_status_inner()
{
m_Pci_dev_id = "";
m_Serial_number = "";
m_Base_mac_addr = "";
m_Eth_link_count = 0L;
m_Eth_link_status = 0L;
m_Power_usage_W = 0.0f;
m_Fpga_temp_C = 0.0f;
m_Hbm_temp_C = 0.0f;
m_Packets_udp = 0L;
m_Packets_sls = 0L;
m_Idle = false;
}
void Fpga_status_inner::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Fpga_status_inner::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Fpga_status_inner::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Fpga_status_inner" : pathPrefix;
return success;
}
bool Fpga_status_inner::operator==(const Fpga_status_inner& rhs) const
{
return
(getPciDevId() == rhs.getPciDevId())
&&
(getSerialNumber() == rhs.getSerialNumber())
&&
(getBaseMacAddr() == rhs.getBaseMacAddr())
&&
(getEthLinkCount() == rhs.getEthLinkCount())
&&
(getEthLinkStatus() == rhs.getEthLinkStatus())
&&
(getPowerUsageW() == rhs.getPowerUsageW())
&&
(getFpgaTempC() == rhs.getFpgaTempC())
&&
(getHbmTempC() == rhs.getHbmTempC())
&&
(getPacketsUdp() == rhs.getPacketsUdp())
&&
(getPacketsSls() == rhs.getPacketsSls())
&&
(isIdle() == rhs.isIdle())
;
}
bool Fpga_status_inner::operator!=(const Fpga_status_inner& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Fpga_status_inner& o)
{
j = nlohmann::json::object();
j["pci_dev_id"] = o.m_Pci_dev_id;
j["serial_number"] = o.m_Serial_number;
j["base_mac_addr"] = o.m_Base_mac_addr;
j["eth_link_count"] = o.m_Eth_link_count;
j["eth_link_status"] = o.m_Eth_link_status;
j["power_usage_W"] = o.m_Power_usage_W;
j["fpga_temp_C"] = o.m_Fpga_temp_C;
j["hbm_temp_C"] = o.m_Hbm_temp_C;
j["packets_udp"] = o.m_Packets_udp;
j["packets_sls"] = o.m_Packets_sls;
j["idle"] = o.m_Idle;
}
void from_json(const nlohmann::json& j, Fpga_status_inner& o)
{
j.at("pci_dev_id").get_to(o.m_Pci_dev_id);
j.at("serial_number").get_to(o.m_Serial_number);
j.at("base_mac_addr").get_to(o.m_Base_mac_addr);
j.at("eth_link_count").get_to(o.m_Eth_link_count);
j.at("eth_link_status").get_to(o.m_Eth_link_status);
j.at("power_usage_W").get_to(o.m_Power_usage_W);
j.at("fpga_temp_C").get_to(o.m_Fpga_temp_C);
j.at("hbm_temp_C").get_to(o.m_Hbm_temp_C);
j.at("packets_udp").get_to(o.m_Packets_udp);
j.at("packets_sls").get_to(o.m_Packets_sls);
j.at("idle").get_to(o.m_Idle);
}
std::string Fpga_status_inner::getPciDevId() const
{
return m_Pci_dev_id;
}
void Fpga_status_inner::setPciDevId(std::string const& value)
{
m_Pci_dev_id = value;
}
std::string Fpga_status_inner::getSerialNumber() const
{
return m_Serial_number;
}
void Fpga_status_inner::setSerialNumber(std::string const& value)
{
m_Serial_number = value;
}
std::string Fpga_status_inner::getBaseMacAddr() const
{
return m_Base_mac_addr;
}
void Fpga_status_inner::setBaseMacAddr(std::string const& value)
{
m_Base_mac_addr = value;
}
int64_t Fpga_status_inner::getEthLinkCount() const
{
return m_Eth_link_count;
}
void Fpga_status_inner::setEthLinkCount(int64_t const value)
{
m_Eth_link_count = value;
}
int64_t Fpga_status_inner::getEthLinkStatus() const
{
return m_Eth_link_status;
}
void Fpga_status_inner::setEthLinkStatus(int64_t const value)
{
m_Eth_link_status = value;
}
float Fpga_status_inner::getPowerUsageW() const
{
return m_Power_usage_W;
}
void Fpga_status_inner::setPowerUsageW(float const value)
{
m_Power_usage_W = value;
}
float Fpga_status_inner::getFpgaTempC() const
{
return m_Fpga_temp_C;
}
void Fpga_status_inner::setFpgaTempC(float const value)
{
m_Fpga_temp_C = value;
}
float Fpga_status_inner::getHbmTempC() const
{
return m_Hbm_temp_C;
}
void Fpga_status_inner::setHbmTempC(float const value)
{
m_Hbm_temp_C = value;
}
int64_t Fpga_status_inner::getPacketsUdp() const
{
return m_Packets_udp;
}
void Fpga_status_inner::setPacketsUdp(int64_t const value)
{
m_Packets_udp = value;
}
int64_t Fpga_status_inner::getPacketsSls() const
{
return m_Packets_sls;
}
void Fpga_status_inner::setPacketsSls(int64_t const value)
{
m_Packets_sls = value;
}
bool Fpga_status_inner::isIdle() const
{
return m_Idle;
}
void Fpga_status_inner::setIdle(bool const value)
{
m_Idle = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,147 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Fpga_status_inner.h
*
*
*/
#ifndef Fpga_status_inner_H_
#define Fpga_status_inner_H_
#include <string>
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Fpga_status_inner
{
public:
Fpga_status_inner();
virtual ~Fpga_status_inner() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Fpga_status_inner& rhs) const;
bool operator!=(const Fpga_status_inner& rhs) const;
/////////////////////////////////////////////
/// Fpga_status_inner members
/// <summary>
///
/// </summary>
std::string getPciDevId() const;
void setPciDevId(std::string const& value);
/// <summary>
///
/// </summary>
std::string getSerialNumber() const;
void setSerialNumber(std::string const& value);
/// <summary>
///
/// </summary>
std::string getBaseMacAddr() const;
void setBaseMacAddr(std::string const& value);
/// <summary>
///
/// </summary>
int64_t getEthLinkCount() const;
void setEthLinkCount(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getEthLinkStatus() const;
void setEthLinkStatus(int64_t const value);
/// <summary>
///
/// </summary>
float getPowerUsageW() const;
void setPowerUsageW(float const value);
/// <summary>
///
/// </summary>
float getFpgaTempC() const;
void setFpgaTempC(float const value);
/// <summary>
///
/// </summary>
float getHbmTempC() const;
void setHbmTempC(float const value);
/// <summary>
///
/// </summary>
int64_t getPacketsUdp() const;
void setPacketsUdp(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getPacketsSls() const;
void setPacketsSls(int64_t const value);
/// <summary>
///
/// </summary>
bool isIdle() const;
void setIdle(bool const value);
friend void to_json(nlohmann::json& j, const Fpga_status_inner& o);
friend void from_json(const nlohmann::json& j, Fpga_status_inner& o);
protected:
std::string m_Pci_dev_id;
std::string m_Serial_number;
std::string m_Base_mac_addr;
int64_t m_Eth_link_count;
int64_t m_Eth_link_status;
float m_Power_usage_W;
float m_Fpga_temp_C;
float m_Hbm_temp_C;
int64_t m_Packets_udp;
int64_t m_Packets_sls;
bool m_Idle;
};
} // namespace org::openapitools::server::model
#endif /* Fpga_status_inner_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -23,6 +23,7 @@
#include <sstream>
#include <vector>
#include <map>
#include <set>
namespace org::openapitools::server::helpers
{
@@ -92,6 +93,15 @@ namespace org::openapitools::server::helpers
return true;
}
/// <summary>
/// Determine if the given set<T> only has unique elements.
/// </summary>
template <typename T>
bool hasOnlyUniqueItems(const std::set<T>&)
{
return true;
}
std::string toStringValue(const std::string &value);
std::string toStringValue(const int32_t value);
std::string toStringValue(const int64_t value);

View File

@@ -0,0 +1,253 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Image_format_settings.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Image_format_settings::Image_format_settings()
{
m_Summation = false;
m_Geometry_transform = false;
m_Jungfrau_conversion = false;
m_Jungfrau_conversion_factor_keV = 0.0f;
m_Jungfrau_conversion_factor_keVIsSet = false;
m_Bit_depth_image = 0L;
m_Bit_depth_imageIsSet = false;
m_Signed_output = false;
m_Signed_outputIsSet = false;
m_Mask_module_edges = true;
m_Mask_chip_edges = true;
}
void Image_format_settings::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Image_format_settings::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Image_format_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Image_format_settings" : pathPrefix;
if (jungfrauConversionFactorKeVIsSet())
{
const float& value = m_Jungfrau_conversion_factor_keV;
const std::string currentValuePath = _pathPrefix + ".jungfrauConversionFactorKeV";
if (value < static_cast<float>(0.001))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0.001;";
}
if (value > static_cast<float>(500.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 500.0;";
}
}
return success;
}
bool Image_format_settings::operator==(const Image_format_settings& rhs) const
{
return
(isSummation() == rhs.isSummation())
&&
(isGeometryTransform() == rhs.isGeometryTransform())
&&
(isJungfrauConversion() == rhs.isJungfrauConversion())
&&
((!jungfrauConversionFactorKeVIsSet() && !rhs.jungfrauConversionFactorKeVIsSet()) || (jungfrauConversionFactorKeVIsSet() && rhs.jungfrauConversionFactorKeVIsSet() && getJungfrauConversionFactorKeV() == rhs.getJungfrauConversionFactorKeV())) &&
((!bitDepthImageIsSet() && !rhs.bitDepthImageIsSet()) || (bitDepthImageIsSet() && rhs.bitDepthImageIsSet() && getBitDepthImage() == rhs.getBitDepthImage())) &&
((!signedOutputIsSet() && !rhs.signedOutputIsSet()) || (signedOutputIsSet() && rhs.signedOutputIsSet() && isSignedOutput() == rhs.isSignedOutput())) &&
(isMaskModuleEdges() == rhs.isMaskModuleEdges())
&&
(isMaskChipEdges() == rhs.isMaskChipEdges())
;
}
bool Image_format_settings::operator!=(const Image_format_settings& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Image_format_settings& o)
{
j = nlohmann::json::object();
j["summation"] = o.m_Summation;
j["geometry_transform"] = o.m_Geometry_transform;
j["jungfrau_conversion"] = o.m_Jungfrau_conversion;
if(o.jungfrauConversionFactorKeVIsSet())
j["jungfrau_conversion_factor_keV"] = o.m_Jungfrau_conversion_factor_keV;
if(o.bitDepthImageIsSet())
j["bit_depth_image"] = o.m_Bit_depth_image;
if(o.signedOutputIsSet())
j["signed_output"] = o.m_Signed_output;
j["mask_module_edges"] = o.m_Mask_module_edges;
j["mask_chip_edges"] = o.m_Mask_chip_edges;
}
void from_json(const nlohmann::json& j, Image_format_settings& o)
{
j.at("summation").get_to(o.m_Summation);
j.at("geometry_transform").get_to(o.m_Geometry_transform);
j.at("jungfrau_conversion").get_to(o.m_Jungfrau_conversion);
if(j.find("jungfrau_conversion_factor_keV") != j.end())
{
j.at("jungfrau_conversion_factor_keV").get_to(o.m_Jungfrau_conversion_factor_keV);
o.m_Jungfrau_conversion_factor_keVIsSet = true;
}
if(j.find("bit_depth_image") != j.end())
{
j.at("bit_depth_image").get_to(o.m_Bit_depth_image);
o.m_Bit_depth_imageIsSet = true;
}
if(j.find("signed_output") != j.end())
{
j.at("signed_output").get_to(o.m_Signed_output);
o.m_Signed_outputIsSet = true;
}
j.at("mask_module_edges").get_to(o.m_Mask_module_edges);
j.at("mask_chip_edges").get_to(o.m_Mask_chip_edges);
}
bool Image_format_settings::isSummation() const
{
return m_Summation;
}
void Image_format_settings::setSummation(bool const value)
{
m_Summation = value;
}
bool Image_format_settings::isGeometryTransform() const
{
return m_Geometry_transform;
}
void Image_format_settings::setGeometryTransform(bool const value)
{
m_Geometry_transform = value;
}
bool Image_format_settings::isJungfrauConversion() const
{
return m_Jungfrau_conversion;
}
void Image_format_settings::setJungfrauConversion(bool const value)
{
m_Jungfrau_conversion = value;
}
float Image_format_settings::getJungfrauConversionFactorKeV() const
{
return m_Jungfrau_conversion_factor_keV;
}
void Image_format_settings::setJungfrauConversionFactorKeV(float const value)
{
m_Jungfrau_conversion_factor_keV = value;
m_Jungfrau_conversion_factor_keVIsSet = true;
}
bool Image_format_settings::jungfrauConversionFactorKeVIsSet() const
{
return m_Jungfrau_conversion_factor_keVIsSet;
}
void Image_format_settings::unsetJungfrau_conversion_factor_keV()
{
m_Jungfrau_conversion_factor_keVIsSet = false;
}
int64_t Image_format_settings::getBitDepthImage() const
{
return m_Bit_depth_image;
}
void Image_format_settings::setBitDepthImage(int64_t const value)
{
m_Bit_depth_image = value;
m_Bit_depth_imageIsSet = true;
}
bool Image_format_settings::bitDepthImageIsSet() const
{
return m_Bit_depth_imageIsSet;
}
void Image_format_settings::unsetBit_depth_image()
{
m_Bit_depth_imageIsSet = false;
}
bool Image_format_settings::isSignedOutput() const
{
return m_Signed_output;
}
void Image_format_settings::setSignedOutput(bool const value)
{
m_Signed_output = value;
m_Signed_outputIsSet = true;
}
bool Image_format_settings::signedOutputIsSet() const
{
return m_Signed_outputIsSet;
}
void Image_format_settings::unsetSigned_output()
{
m_Signed_outputIsSet = false;
}
bool Image_format_settings::isMaskModuleEdges() const
{
return m_Mask_module_edges;
}
void Image_format_settings::setMaskModuleEdges(bool const value)
{
m_Mask_module_edges = value;
}
bool Image_format_settings::isMaskChipEdges() const
{
return m_Mask_chip_edges;
}
void Image_format_settings::setMaskChipEdges(bool const value)
{
m_Mask_chip_edges = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,131 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Image_format_settings.h
*
*
*/
#ifndef Image_format_settings_H_
#define Image_format_settings_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Image_format_settings
{
public:
Image_format_settings();
virtual ~Image_format_settings() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Image_format_settings& rhs) const;
bool operator!=(const Image_format_settings& rhs) const;
/////////////////////////////////////////////
/// Image_format_settings members
/// <summary>
/// Enable summation of images to a given image_time If disabled images are saved according to original detector speed, but image count is adjusted
/// </summary>
bool isSummation() const;
void setSummation(bool const value);
/// <summary>
/// Place module read-out into their location on composed detector and extend multipixels
/// </summary>
bool isGeometryTransform() const;
void setGeometryTransform(bool const value);
/// <summary>
/// Convert pixel value in ADU to photon counts/energy Only affects JUNGFRAU detector
/// </summary>
bool isJungfrauConversion() const;
void setJungfrauConversion(bool const value);
/// <summary>
/// Used to convert energy deposited into pixel to counts If not provided incident_energy_keV is used
/// </summary>
float getJungfrauConversionFactorKeV() const;
void setJungfrauConversionFactorKeV(float const value);
bool jungfrauConversionFactorKeVIsSet() const;
void unsetJungfrau_conversion_factor_keV();
/// <summary>
/// Bit depth of resulting image (it doesn&#39;t affect the original detector value) If not provided value is adjusted automatically
/// </summary>
int64_t getBitDepthImage() const;
void setBitDepthImage(int64_t const value);
bool bitDepthImageIsSet() const;
void unsetBit_depth_image();
/// <summary>
/// Controls if pixels have signed output If not provided value is adjusted automatically
/// </summary>
bool isSignedOutput() const;
void setSignedOutput(bool const value);
bool signedOutputIsSet() const;
void unsetSigned_output();
/// <summary>
/// Mask 1 pixel on the module boundary
/// </summary>
bool isMaskModuleEdges() const;
void setMaskModuleEdges(bool const value);
/// <summary>
/// Mask multipixels on chip boundary
/// </summary>
bool isMaskChipEdges() const;
void setMaskChipEdges(bool const value);
friend void to_json(nlohmann::json& j, const Image_format_settings& o);
friend void from_json(const nlohmann::json& j, Image_format_settings& o);
protected:
bool m_Summation;
bool m_Geometry_transform;
bool m_Jungfrau_conversion;
float m_Jungfrau_conversion_factor_keV;
bool m_Jungfrau_conversion_factor_keVIsSet;
int64_t m_Bit_depth_image;
bool m_Bit_depth_imageIsSet;
bool m_Signed_output;
bool m_Signed_outputIsSet;
bool m_Mask_module_edges;
bool m_Mask_chip_edges;
};
} // namespace org::openapitools::server::model
#endif /* Image_format_settings_H_ */

View File

@@ -0,0 +1,128 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Image_pusher_type.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
Image_pusher_type::Image_pusher_type()
{
}
void Image_pusher_type::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Image_pusher_type::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Image_pusher_type::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Image_pusher_type" : pathPrefix;
if (m_value == Image_pusher_type::eImage_pusher_type::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool Image_pusher_type::operator==(const Image_pusher_type& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool Image_pusher_type::operator!=(const Image_pusher_type& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Image_pusher_type& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case Image_pusher_type::eImage_pusher_type::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case Image_pusher_type::eImage_pusher_type::ZEROMQ:
j = "ZeroMQ";
break;
case Image_pusher_type::eImage_pusher_type::HDF5:
j = "HDF5";
break;
case Image_pusher_type::eImage_pusher_type::CBOR:
j = "CBOR";
break;
case Image_pusher_type::eImage_pusher_type::NONE:
j = "None";
break;
}
}
void from_json(const nlohmann::json& j, Image_pusher_type& o)
{
auto s = j.get<std::string>();
if (s == "ZeroMQ") {
o.setValue(Image_pusher_type::eImage_pusher_type::ZEROMQ);
}
else if (s == "HDF5") {
o.setValue(Image_pusher_type::eImage_pusher_type::HDF5);
}
else if (s == "CBOR") {
o.setValue(Image_pusher_type::eImage_pusher_type::CBOR);
}
else if (s == "None") {
o.setValue(Image_pusher_type::eImage_pusher_type::NONE);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " Image_pusher_type::eImage_pusher_type";
throw std::invalid_argument(ss.str());
}
}
Image_pusher_type::eImage_pusher_type Image_pusher_type::getValue() const
{
return m_value;
}
void Image_pusher_type::setValue(Image_pusher_type::eImage_pusher_type value)
{
m_value = value;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,81 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Image_pusher_type.h
*
*
*/
#ifndef Image_pusher_type_H_
#define Image_pusher_type_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Image_pusher_type
{
public:
Image_pusher_type();
virtual ~Image_pusher_type() = default;
enum class eImage_pusher_type {
// To have a valid default value.
// Avoiding name clashes with user defined
// enum values
INVALID_VALUE_OPENAPI_GENERATED = 0,
ZEROMQ,
HDF5,
CBOR,
NONE
};
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Image_pusher_type& rhs) const;
bool operator!=(const Image_pusher_type& rhs) const;
/////////////////////////////////////////////
/// Image_pusher_type members
Image_pusher_type::eImage_pusher_type getValue() const;
void setValue(Image_pusher_type::eImage_pusher_type value);
friend void to_json(nlohmann::json& j, const Image_pusher_type& o);
friend void from_json(const nlohmann::json& j, Image_pusher_type& o);
protected:
Image_pusher_type::eImage_pusher_type m_value = Image_pusher_type::eImage_pusher_type::INVALID_VALUE_OPENAPI_GENERATED;
};
} // namespace org::openapitools::server::model
#endif /* Image_pusher_type_H_ */

View File

@@ -0,0 +1,163 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Instrument_metadata.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Instrument_metadata::Instrument_metadata()
{
m_Source_name = "";
m_Source_type = "";
m_Source_typeIsSet = false;
m_Instrument_name = "";
m_Pulsed_source = false;
m_Pulsed_sourceIsSet = false;
}
void Instrument_metadata::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Instrument_metadata::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Instrument_metadata::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Instrument_metadata" : pathPrefix;
return success;
}
bool Instrument_metadata::operator==(const Instrument_metadata& rhs) const
{
return
(getSourceName() == rhs.getSourceName())
&&
((!sourceTypeIsSet() && !rhs.sourceTypeIsSet()) || (sourceTypeIsSet() && rhs.sourceTypeIsSet() && getSourceType() == rhs.getSourceType())) &&
(getInstrumentName() == rhs.getInstrumentName())
&&
((!pulsedSourceIsSet() && !rhs.pulsedSourceIsSet()) || (pulsedSourceIsSet() && rhs.pulsedSourceIsSet() && isPulsedSource() == rhs.isPulsedSource()))
;
}
bool Instrument_metadata::operator!=(const Instrument_metadata& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Instrument_metadata& o)
{
j = nlohmann::json::object();
j["source_name"] = o.m_Source_name;
if(o.sourceTypeIsSet())
j["source_type"] = o.m_Source_type;
j["instrument_name"] = o.m_Instrument_name;
if(o.pulsedSourceIsSet())
j["pulsed_source"] = o.m_Pulsed_source;
}
void from_json(const nlohmann::json& j, Instrument_metadata& o)
{
j.at("source_name").get_to(o.m_Source_name);
if(j.find("source_type") != j.end())
{
j.at("source_type").get_to(o.m_Source_type);
o.m_Source_typeIsSet = true;
}
j.at("instrument_name").get_to(o.m_Instrument_name);
if(j.find("pulsed_source") != j.end())
{
j.at("pulsed_source").get_to(o.m_Pulsed_source);
o.m_Pulsed_sourceIsSet = true;
}
}
std::string Instrument_metadata::getSourceName() const
{
return m_Source_name;
}
void Instrument_metadata::setSourceName(std::string const& value)
{
m_Source_name = value;
}
std::string Instrument_metadata::getSourceType() const
{
return m_Source_type;
}
void Instrument_metadata::setSourceType(std::string const& value)
{
m_Source_type = value;
m_Source_typeIsSet = true;
}
bool Instrument_metadata::sourceTypeIsSet() const
{
return m_Source_typeIsSet;
}
void Instrument_metadata::unsetSource_type()
{
m_Source_typeIsSet = false;
}
std::string Instrument_metadata::getInstrumentName() const
{
return m_Instrument_name;
}
void Instrument_metadata::setInstrumentName(std::string const& value)
{
m_Instrument_name = value;
}
bool Instrument_metadata::isPulsedSource() const
{
return m_Pulsed_source;
}
void Instrument_metadata::setPulsedSource(bool const value)
{
m_Pulsed_source = value;
m_Pulsed_sourceIsSet = true;
}
bool Instrument_metadata::pulsedSourceIsSet() const
{
return m_Pulsed_sourceIsSet;
}
void Instrument_metadata::unsetPulsed_source()
{
m_Pulsed_sourceIsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,102 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Instrument_metadata.h
*
* Metadata for a measurement instrument
*/
#ifndef Instrument_metadata_H_
#define Instrument_metadata_H_
#include <string>
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
/// Metadata for a measurement instrument
/// </summary>
class Instrument_metadata
{
public:
Instrument_metadata();
virtual ~Instrument_metadata() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Instrument_metadata& rhs) const;
bool operator!=(const Instrument_metadata& rhs) const;
/////////////////////////////////////////////
/// Instrument_metadata members
/// <summary>
///
/// </summary>
std::string getSourceName() const;
void setSourceName(std::string const& value);
/// <summary>
/// Type of radiation source. NXmx gives a fixed dictionary, though Jungfraujoch is not enforcing compliance. https://manual.nexusformat.org/classes/base_classes/NXsource.html#nxsource NXsource allows the following: Spallation Neutron Source Pulsed Reactor Neutron Source Reactor Neutron Source Synchrotron X-ray Source Pulsed Muon Source Rotating Anode X-ray Fixed Tube X-ray UV Laser Free-Electron Laser Optical Laser Ion Source UV Plasma Source Metal Jet X-ray
/// </summary>
std::string getSourceType() const;
void setSourceType(std::string const& value);
bool sourceTypeIsSet() const;
void unsetSource_type();
/// <summary>
///
/// </summary>
std::string getInstrumentName() const;
void setInstrumentName(std::string const& value);
/// <summary>
/// Settings specific to XFEL (e.g., every image has to come from TTL trigger, save pulse ID and event code)
/// </summary>
bool isPulsedSource() const;
void setPulsedSource(bool const value);
bool pulsedSourceIsSet() const;
void unsetPulsed_source();
friend void to_json(nlohmann::json& j, const Instrument_metadata& o);
friend void from_json(const nlohmann::json& j, Instrument_metadata& o);
protected:
std::string m_Source_name;
std::string m_Source_type;
bool m_Source_typeIsSet;
std::string m_Instrument_name;
bool m_Pulsed_source;
bool m_Pulsed_sourceIsSet;
};
} // namespace org::openapitools::server::model
#endif /* Instrument_metadata_H_ */

View File

@@ -0,0 +1,475 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Jfjoch_settings.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Jfjoch_settings::Jfjoch_settings()
{
m_PcieIsSet = false;
m_ZeromqIsSet = false;
m_InstrumentIsSet = false;
m_Detector_settingsIsSet = false;
m_Azim_intIsSet = false;
m_Image_formatIsSet = false;
m_Image_buffer_MiB = 2048;
m_Image_buffer_MiBIsSet = false;
m_Receiver_threads = 64;
m_Receiver_threadsIsSet = false;
m_Numa_policy = "";
m_Numa_policyIsSet = false;
m_Frontend_directory = "";
m_Zeromq_previewIsSet = false;
}
void Jfjoch_settings::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Jfjoch_settings::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Jfjoch_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Jfjoch_settings" : pathPrefix;
if (pcieIsSet())
{
const std::vector<org::openapitools::server::model::Pcie_devices_inner>& value = m_Pcie;
const std::string currentValuePath = _pathPrefix + ".pcie";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const org::openapitools::server::model::Pcie_devices_inner& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
success = value.validate(msg, currentValuePath + ".pcie") && success;
i++;
}
}
}
/* Detector */ {
const std::vector<org::openapitools::server::model::Detector>& value = m_Detector;
const std::string currentValuePath = _pathPrefix + ".detector";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const org::openapitools::server::model::Detector& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
success = value.validate(msg, currentValuePath + ".detector") && success;
i++;
}
}
}
if (imageBufferMiBIsSet())
{
const int32_t& value = m_Image_buffer_MiB;
const std::string currentValuePath = _pathPrefix + ".imageBufferMiB";
if (value < 128)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 128;";
}
}
if (receiverThreadsIsSet())
{
const int32_t& value = m_Receiver_threads;
const std::string currentValuePath = _pathPrefix + ".receiverThreads";
if (value < 1)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
if (value > 512)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 512;";
}
}
return success;
}
bool Jfjoch_settings::operator==(const Jfjoch_settings& rhs) const
{
return
((!pcieIsSet() && !rhs.pcieIsSet()) || (pcieIsSet() && rhs.pcieIsSet() && getPcie() == rhs.getPcie())) &&
((!zeromqIsSet() && !rhs.zeromqIsSet()) || (zeromqIsSet() && rhs.zeromqIsSet() && getZeromq() == rhs.getZeromq())) &&
((!instrumentIsSet() && !rhs.instrumentIsSet()) || (instrumentIsSet() && rhs.instrumentIsSet() && getInstrument() == rhs.getInstrument())) &&
(getDetector() == rhs.getDetector())
&&
((!detectorSettingsIsSet() && !rhs.detectorSettingsIsSet()) || (detectorSettingsIsSet() && rhs.detectorSettingsIsSet() && getDetectorSettings() == rhs.getDetectorSettings())) &&
((!azimIntIsSet() && !rhs.azimIntIsSet()) || (azimIntIsSet() && rhs.azimIntIsSet() && getAzimInt() == rhs.getAzimInt())) &&
((!imageFormatIsSet() && !rhs.imageFormatIsSet()) || (imageFormatIsSet() && rhs.imageFormatIsSet() && getImageFormat() == rhs.getImageFormat())) &&
((!imageBufferMiBIsSet() && !rhs.imageBufferMiBIsSet()) || (imageBufferMiBIsSet() && rhs.imageBufferMiBIsSet() && getImageBufferMiB() == rhs.getImageBufferMiB())) &&
((!receiverThreadsIsSet() && !rhs.receiverThreadsIsSet()) || (receiverThreadsIsSet() && rhs.receiverThreadsIsSet() && getReceiverThreads() == rhs.getReceiverThreads())) &&
((!numaPolicyIsSet() && !rhs.numaPolicyIsSet()) || (numaPolicyIsSet() && rhs.numaPolicyIsSet() && getNumaPolicy() == rhs.getNumaPolicy())) &&
(getFrontendDirectory() == rhs.getFrontendDirectory())
&&
(getImagePusher() == rhs.getImagePusher())
&&
((!zeromqPreviewIsSet() && !rhs.zeromqPreviewIsSet()) || (zeromqPreviewIsSet() && rhs.zeromqPreviewIsSet() && getZeromqPreview() == rhs.getZeromqPreview()))
;
}
bool Jfjoch_settings::operator!=(const Jfjoch_settings& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Jfjoch_settings& o)
{
j = nlohmann::json::object();
if(o.pcieIsSet() || !o.m_Pcie.empty())
j["pcie"] = o.m_Pcie;
if(o.zeromqIsSet())
j["zeromq"] = o.m_Zeromq;
if(o.instrumentIsSet())
j["instrument"] = o.m_Instrument;
j["detector"] = o.m_Detector;
if(o.detectorSettingsIsSet())
j["detector_settings"] = o.m_Detector_settings;
if(o.azimIntIsSet())
j["azim_int"] = o.m_Azim_int;
if(o.imageFormatIsSet())
j["image_format"] = o.m_Image_format;
if(o.imageBufferMiBIsSet())
j["image_buffer_MiB"] = o.m_Image_buffer_MiB;
if(o.receiverThreadsIsSet())
j["receiver_threads"] = o.m_Receiver_threads;
if(o.numaPolicyIsSet())
j["numa_policy"] = o.m_Numa_policy;
j["frontend_directory"] = o.m_Frontend_directory;
j["image_pusher"] = o.m_Image_pusher;
if(o.zeromqPreviewIsSet())
j["zeromq_preview"] = o.m_Zeromq_preview;
}
void from_json(const nlohmann::json& j, Jfjoch_settings& o)
{
if(j.find("pcie") != j.end())
{
j.at("pcie").get_to(o.m_Pcie);
o.m_PcieIsSet = true;
}
if(j.find("zeromq") != j.end())
{
j.at("zeromq").get_to(o.m_Zeromq);
o.m_ZeromqIsSet = true;
}
if(j.find("instrument") != j.end())
{
j.at("instrument").get_to(o.m_Instrument);
o.m_InstrumentIsSet = true;
}
j.at("detector").get_to(o.m_Detector);
if(j.find("detector_settings") != j.end())
{
j.at("detector_settings").get_to(o.m_Detector_settings);
o.m_Detector_settingsIsSet = true;
}
if(j.find("azim_int") != j.end())
{
j.at("azim_int").get_to(o.m_Azim_int);
o.m_Azim_intIsSet = true;
}
if(j.find("image_format") != j.end())
{
j.at("image_format").get_to(o.m_Image_format);
o.m_Image_formatIsSet = true;
}
if(j.find("image_buffer_MiB") != j.end())
{
j.at("image_buffer_MiB").get_to(o.m_Image_buffer_MiB);
o.m_Image_buffer_MiBIsSet = true;
}
if(j.find("receiver_threads") != j.end())
{
j.at("receiver_threads").get_to(o.m_Receiver_threads);
o.m_Receiver_threadsIsSet = true;
}
if(j.find("numa_policy") != j.end())
{
j.at("numa_policy").get_to(o.m_Numa_policy);
o.m_Numa_policyIsSet = true;
}
j.at("frontend_directory").get_to(o.m_Frontend_directory);
j.at("image_pusher").get_to(o.m_Image_pusher);
if(j.find("zeromq_preview") != j.end())
{
j.at("zeromq_preview").get_to(o.m_Zeromq_preview);
o.m_Zeromq_previewIsSet = true;
}
}
std::vector<org::openapitools::server::model::Pcie_devices_inner> Jfjoch_settings::getPcie() const
{
return m_Pcie;
}
void Jfjoch_settings::setPcie(std::vector<org::openapitools::server::model::Pcie_devices_inner> const& value)
{
m_Pcie = value;
m_PcieIsSet = true;
}
bool Jfjoch_settings::pcieIsSet() const
{
return m_PcieIsSet;
}
void Jfjoch_settings::unsetPcie()
{
m_PcieIsSet = false;
}
org::openapitools::server::model::Zeromq_settings Jfjoch_settings::getZeromq() const
{
return m_Zeromq;
}
void Jfjoch_settings::setZeromq(org::openapitools::server::model::Zeromq_settings const& value)
{
m_Zeromq = value;
m_ZeromqIsSet = true;
}
bool Jfjoch_settings::zeromqIsSet() const
{
return m_ZeromqIsSet;
}
void Jfjoch_settings::unsetZeromq()
{
m_ZeromqIsSet = false;
}
org::openapitools::server::model::Instrument_metadata Jfjoch_settings::getInstrument() const
{
return m_Instrument;
}
void Jfjoch_settings::setInstrument(org::openapitools::server::model::Instrument_metadata const& value)
{
m_Instrument = value;
m_InstrumentIsSet = true;
}
bool Jfjoch_settings::instrumentIsSet() const
{
return m_InstrumentIsSet;
}
void Jfjoch_settings::unsetInstrument()
{
m_InstrumentIsSet = false;
}
std::vector<org::openapitools::server::model::Detector> Jfjoch_settings::getDetector() const
{
return m_Detector;
}
void Jfjoch_settings::setDetector(std::vector<org::openapitools::server::model::Detector> const& value)
{
m_Detector = value;
}
org::openapitools::server::model::Detector_settings Jfjoch_settings::getDetectorSettings() const
{
return m_Detector_settings;
}
void Jfjoch_settings::setDetectorSettings(org::openapitools::server::model::Detector_settings const& value)
{
m_Detector_settings = value;
m_Detector_settingsIsSet = true;
}
bool Jfjoch_settings::detectorSettingsIsSet() const
{
return m_Detector_settingsIsSet;
}
void Jfjoch_settings::unsetDetector_settings()
{
m_Detector_settingsIsSet = false;
}
org::openapitools::server::model::Azim_int_settings Jfjoch_settings::getAzimInt() const
{
return m_Azim_int;
}
void Jfjoch_settings::setAzimInt(org::openapitools::server::model::Azim_int_settings const& value)
{
m_Azim_int = value;
m_Azim_intIsSet = true;
}
bool Jfjoch_settings::azimIntIsSet() const
{
return m_Azim_intIsSet;
}
void Jfjoch_settings::unsetAzim_int()
{
m_Azim_intIsSet = false;
}
org::openapitools::server::model::Image_format_settings Jfjoch_settings::getImageFormat() const
{
return m_Image_format;
}
void Jfjoch_settings::setImageFormat(org::openapitools::server::model::Image_format_settings const& value)
{
m_Image_format = value;
m_Image_formatIsSet = true;
}
bool Jfjoch_settings::imageFormatIsSet() const
{
return m_Image_formatIsSet;
}
void Jfjoch_settings::unsetImage_format()
{
m_Image_formatIsSet = false;
}
int32_t Jfjoch_settings::getImageBufferMiB() const
{
return m_Image_buffer_MiB;
}
void Jfjoch_settings::setImageBufferMiB(int32_t const value)
{
m_Image_buffer_MiB = value;
m_Image_buffer_MiBIsSet = true;
}
bool Jfjoch_settings::imageBufferMiBIsSet() const
{
return m_Image_buffer_MiBIsSet;
}
void Jfjoch_settings::unsetImage_buffer_MiB()
{
m_Image_buffer_MiBIsSet = false;
}
int32_t Jfjoch_settings::getReceiverThreads() const
{
return m_Receiver_threads;
}
void Jfjoch_settings::setReceiverThreads(int32_t const value)
{
m_Receiver_threads = value;
m_Receiver_threadsIsSet = true;
}
bool Jfjoch_settings::receiverThreadsIsSet() const
{
return m_Receiver_threadsIsSet;
}
void Jfjoch_settings::unsetReceiver_threads()
{
m_Receiver_threadsIsSet = false;
}
std::string Jfjoch_settings::getNumaPolicy() const
{
return m_Numa_policy;
}
void Jfjoch_settings::setNumaPolicy(std::string const& value)
{
m_Numa_policy = value;
m_Numa_policyIsSet = true;
}
bool Jfjoch_settings::numaPolicyIsSet() const
{
return m_Numa_policyIsSet;
}
void Jfjoch_settings::unsetNuma_policy()
{
m_Numa_policyIsSet = false;
}
std::string Jfjoch_settings::getFrontendDirectory() const
{
return m_Frontend_directory;
}
void Jfjoch_settings::setFrontendDirectory(std::string const& value)
{
m_Frontend_directory = value;
}
org::openapitools::server::model::Image_pusher_type Jfjoch_settings::getImagePusher() const
{
return m_Image_pusher;
}
void Jfjoch_settings::setImagePusher(org::openapitools::server::model::Image_pusher_type const& value)
{
m_Image_pusher = value;
}
org::openapitools::server::model::Zeromq_preview_settings Jfjoch_settings::getZeromqPreview() const
{
return m_Zeromq_preview;
}
void Jfjoch_settings::setZeromqPreview(org::openapitools::server::model::Zeromq_preview_settings const& value)
{
m_Zeromq_preview = value;
m_Zeromq_previewIsSet = true;
}
bool Jfjoch_settings::zeromqPreviewIsSet() const
{
return m_Zeromq_previewIsSet;
}
void Jfjoch_settings::unsetZeromq_preview()
{
m_Zeromq_previewIsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,191 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Jfjoch_settings.h
*
* Default settings for Jungfraujoch software. This structure is used to provide default settings using configuration JSON file and is not used in HTTP.
*/
#ifndef Jfjoch_settings_H_
#define Jfjoch_settings_H_
#include "Detector.h"
#include "Zeromq_preview_settings.h"
#include "Image_pusher_type.h"
#include "Pcie_devices_inner.h"
#include <string>
#include "Zeromq_settings.h"
#include "Azim_int_settings.h"
#include "Image_format_settings.h"
#include "Detector_settings.h"
#include "Instrument_metadata.h"
#include <vector>
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
/// Default settings for Jungfraujoch software. This structure is used to provide default settings using configuration JSON file and is not used in HTTP.
/// </summary>
class Jfjoch_settings
{
public:
Jfjoch_settings();
virtual ~Jfjoch_settings() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Jfjoch_settings& rhs) const;
bool operator!=(const Jfjoch_settings& rhs) const;
/////////////////////////////////////////////
/// Jfjoch_settings members
/// <summary>
///
/// </summary>
std::vector<org::openapitools::server::model::Pcie_devices_inner> getPcie() const;
void setPcie(std::vector<org::openapitools::server::model::Pcie_devices_inner> const& value);
bool pcieIsSet() const;
void unsetPcie();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Zeromq_settings getZeromq() const;
void setZeromq(org::openapitools::server::model::Zeromq_settings const& value);
bool zeromqIsSet() const;
void unsetZeromq();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Instrument_metadata getInstrument() const;
void setInstrument(org::openapitools::server::model::Instrument_metadata const& value);
bool instrumentIsSet() const;
void unsetInstrument();
/// <summary>
///
/// </summary>
std::vector<org::openapitools::server::model::Detector> getDetector() const;
void setDetector(std::vector<org::openapitools::server::model::Detector> const& value);
/// <summary>
///
/// </summary>
org::openapitools::server::model::Detector_settings getDetectorSettings() const;
void setDetectorSettings(org::openapitools::server::model::Detector_settings const& value);
bool detectorSettingsIsSet() const;
void unsetDetector_settings();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Azim_int_settings getAzimInt() const;
void setAzimInt(org::openapitools::server::model::Azim_int_settings const& value);
bool azimIntIsSet() const;
void unsetAzim_int();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Image_format_settings getImageFormat() const;
void setImageFormat(org::openapitools::server::model::Image_format_settings const& value);
bool imageFormatIsSet() const;
void unsetImage_format();
/// <summary>
/// Size of internal buffer in MiB for images before they are sent to a stream
/// </summary>
int32_t getImageBufferMiB() const;
void setImageBufferMiB(int32_t const value);
bool imageBufferMiBIsSet() const;
void unsetImage_buffer_MiB();
/// <summary>
/// Number of threads used by the receiver
/// </summary>
int32_t getReceiverThreads() const;
void setReceiverThreads(int32_t const value);
bool receiverThreadsIsSet() const;
void unsetReceiver_threads();
/// <summary>
/// NUMA policy to bind CPUs
/// </summary>
std::string getNumaPolicy() const;
void setNumaPolicy(std::string const& value);
bool numaPolicyIsSet() const;
void unsetNuma_policy();
/// <summary>
/// Location of built JavaScript web frontend
/// </summary>
std::string getFrontendDirectory() const;
void setFrontendDirectory(std::string const& value);
/// <summary>
///
/// </summary>
org::openapitools::server::model::Image_pusher_type getImagePusher() const;
void setImagePusher(org::openapitools::server::model::Image_pusher_type const& value);
/// <summary>
///
/// </summary>
org::openapitools::server::model::Zeromq_preview_settings getZeromqPreview() const;
void setZeromqPreview(org::openapitools::server::model::Zeromq_preview_settings const& value);
bool zeromqPreviewIsSet() const;
void unsetZeromq_preview();
friend void to_json(nlohmann::json& j, const Jfjoch_settings& o);
friend void from_json(const nlohmann::json& j, Jfjoch_settings& o);
protected:
std::vector<org::openapitools::server::model::Pcie_devices_inner> m_Pcie;
bool m_PcieIsSet;
org::openapitools::server::model::Zeromq_settings m_Zeromq;
bool m_ZeromqIsSet;
org::openapitools::server::model::Instrument_metadata m_Instrument;
bool m_InstrumentIsSet;
std::vector<org::openapitools::server::model::Detector> m_Detector;
org::openapitools::server::model::Detector_settings m_Detector_settings;
bool m_Detector_settingsIsSet;
org::openapitools::server::model::Azim_int_settings m_Azim_int;
bool m_Azim_intIsSet;
org::openapitools::server::model::Image_format_settings m_Image_format;
bool m_Image_formatIsSet;
int32_t m_Image_buffer_MiB;
bool m_Image_buffer_MiBIsSet;
int32_t m_Receiver_threads;
bool m_Receiver_threadsIsSet;
std::string m_Numa_policy;
bool m_Numa_policyIsSet;
std::string m_Frontend_directory;
org::openapitools::server::model::Image_pusher_type m_Image_pusher;
org::openapitools::server::model::Zeromq_preview_settings m_Zeromq_preview;
bool m_Zeromq_previewIsSet;
};
} // namespace org::openapitools::server::model
#endif /* Jfjoch_settings_H_ */

View File

@@ -0,0 +1,427 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Jfjoch_statistics.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Jfjoch_statistics::Jfjoch_statistics()
{
m_DetectorIsSet = false;
m_Detector_listIsSet = false;
m_Detector_settingsIsSet = false;
m_Image_format_settingsIsSet = false;
m_Instrument_metadataIsSet = false;
m_Data_processing_settingsIsSet = false;
m_MeasurementIsSet = false;
m_BrokerIsSet = false;
m_FpgaIsSet = false;
m_CalibrationIsSet = false;
m_Zeromq_previewIsSet = false;
}
void Jfjoch_statistics::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Jfjoch_statistics::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Jfjoch_statistics::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Jfjoch_statistics" : pathPrefix;
if (fpgaIsSet())
{
const std::vector<org::openapitools::server::model::Fpga_status_inner>& value = m_Fpga;
const std::string currentValuePath = _pathPrefix + ".fpga";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const org::openapitools::server::model::Fpga_status_inner& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
success = value.validate(msg, currentValuePath + ".fpga") && success;
i++;
}
}
}
if (calibrationIsSet())
{
const std::vector<org::openapitools::server::model::Calibration_statistics_inner>& value = m_Calibration;
const std::string currentValuePath = _pathPrefix + ".calibration";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const org::openapitools::server::model::Calibration_statistics_inner& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
success = value.validate(msg, currentValuePath + ".calibration") && success;
i++;
}
}
}
return success;
}
bool Jfjoch_statistics::operator==(const Jfjoch_statistics& rhs) const
{
return
((!detectorIsSet() && !rhs.detectorIsSet()) || (detectorIsSet() && rhs.detectorIsSet() && getDetector() == rhs.getDetector())) &&
((!detectorListIsSet() && !rhs.detectorListIsSet()) || (detectorListIsSet() && rhs.detectorListIsSet() && getDetectorList() == rhs.getDetectorList())) &&
((!detectorSettingsIsSet() && !rhs.detectorSettingsIsSet()) || (detectorSettingsIsSet() && rhs.detectorSettingsIsSet() && getDetectorSettings() == rhs.getDetectorSettings())) &&
((!imageFormatSettingsIsSet() && !rhs.imageFormatSettingsIsSet()) || (imageFormatSettingsIsSet() && rhs.imageFormatSettingsIsSet() && getImageFormatSettings() == rhs.getImageFormatSettings())) &&
((!instrumentMetadataIsSet() && !rhs.instrumentMetadataIsSet()) || (instrumentMetadataIsSet() && rhs.instrumentMetadataIsSet() && getInstrumentMetadata() == rhs.getInstrumentMetadata())) &&
((!dataProcessingSettingsIsSet() && !rhs.dataProcessingSettingsIsSet()) || (dataProcessingSettingsIsSet() && rhs.dataProcessingSettingsIsSet() && getDataProcessingSettings() == rhs.getDataProcessingSettings())) &&
((!measurementIsSet() && !rhs.measurementIsSet()) || (measurementIsSet() && rhs.measurementIsSet() && getMeasurement() == rhs.getMeasurement())) &&
((!brokerIsSet() && !rhs.brokerIsSet()) || (brokerIsSet() && rhs.brokerIsSet() && getBroker() == rhs.getBroker())) &&
((!fpgaIsSet() && !rhs.fpgaIsSet()) || (fpgaIsSet() && rhs.fpgaIsSet() && getFpga() == rhs.getFpga())) &&
((!calibrationIsSet() && !rhs.calibrationIsSet()) || (calibrationIsSet() && rhs.calibrationIsSet() && getCalibration() == rhs.getCalibration())) &&
((!zeromqPreviewIsSet() && !rhs.zeromqPreviewIsSet()) || (zeromqPreviewIsSet() && rhs.zeromqPreviewIsSet() && getZeromqPreview() == rhs.getZeromqPreview()))
;
}
bool Jfjoch_statistics::operator!=(const Jfjoch_statistics& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Jfjoch_statistics& o)
{
j = nlohmann::json::object();
if(o.detectorIsSet())
j["detector"] = o.m_Detector;
if(o.detectorListIsSet())
j["detector_list"] = o.m_Detector_list;
if(o.detectorSettingsIsSet())
j["detector_settings"] = o.m_Detector_settings;
if(o.imageFormatSettingsIsSet())
j["image_format_settings"] = o.m_Image_format_settings;
if(o.instrumentMetadataIsSet())
j["instrument_metadata"] = o.m_Instrument_metadata;
if(o.dataProcessingSettingsIsSet())
j["data_processing_settings"] = o.m_Data_processing_settings;
if(o.measurementIsSet())
j["measurement"] = o.m_Measurement;
if(o.brokerIsSet())
j["broker"] = o.m_Broker;
if(o.fpgaIsSet() || !o.m_Fpga.empty())
j["fpga"] = o.m_Fpga;
if(o.calibrationIsSet() || !o.m_Calibration.empty())
j["calibration"] = o.m_Calibration;
if(o.zeromqPreviewIsSet())
j["zeromq_preview"] = o.m_Zeromq_preview;
}
void from_json(const nlohmann::json& j, Jfjoch_statistics& o)
{
if(j.find("detector") != j.end())
{
j.at("detector").get_to(o.m_Detector);
o.m_DetectorIsSet = true;
}
if(j.find("detector_list") != j.end())
{
j.at("detector_list").get_to(o.m_Detector_list);
o.m_Detector_listIsSet = true;
}
if(j.find("detector_settings") != j.end())
{
j.at("detector_settings").get_to(o.m_Detector_settings);
o.m_Detector_settingsIsSet = true;
}
if(j.find("image_format_settings") != j.end())
{
j.at("image_format_settings").get_to(o.m_Image_format_settings);
o.m_Image_format_settingsIsSet = true;
}
if(j.find("instrument_metadata") != j.end())
{
j.at("instrument_metadata").get_to(o.m_Instrument_metadata);
o.m_Instrument_metadataIsSet = true;
}
if(j.find("data_processing_settings") != j.end())
{
j.at("data_processing_settings").get_to(o.m_Data_processing_settings);
o.m_Data_processing_settingsIsSet = true;
}
if(j.find("measurement") != j.end())
{
j.at("measurement").get_to(o.m_Measurement);
o.m_MeasurementIsSet = true;
}
if(j.find("broker") != j.end())
{
j.at("broker").get_to(o.m_Broker);
o.m_BrokerIsSet = true;
}
if(j.find("fpga") != j.end())
{
j.at("fpga").get_to(o.m_Fpga);
o.m_FpgaIsSet = true;
}
if(j.find("calibration") != j.end())
{
j.at("calibration").get_to(o.m_Calibration);
o.m_CalibrationIsSet = true;
}
if(j.find("zeromq_preview") != j.end())
{
j.at("zeromq_preview").get_to(o.m_Zeromq_preview);
o.m_Zeromq_previewIsSet = true;
}
}
org::openapitools::server::model::Detector_status Jfjoch_statistics::getDetector() const
{
return m_Detector;
}
void Jfjoch_statistics::setDetector(org::openapitools::server::model::Detector_status const& value)
{
m_Detector = value;
m_DetectorIsSet = true;
}
bool Jfjoch_statistics::detectorIsSet() const
{
return m_DetectorIsSet;
}
void Jfjoch_statistics::unsetDetector()
{
m_DetectorIsSet = false;
}
org::openapitools::server::model::Detector_list Jfjoch_statistics::getDetectorList() const
{
return m_Detector_list;
}
void Jfjoch_statistics::setDetectorList(org::openapitools::server::model::Detector_list const& value)
{
m_Detector_list = value;
m_Detector_listIsSet = true;
}
bool Jfjoch_statistics::detectorListIsSet() const
{
return m_Detector_listIsSet;
}
void Jfjoch_statistics::unsetDetector_list()
{
m_Detector_listIsSet = false;
}
org::openapitools::server::model::Detector_settings Jfjoch_statistics::getDetectorSettings() const
{
return m_Detector_settings;
}
void Jfjoch_statistics::setDetectorSettings(org::openapitools::server::model::Detector_settings const& value)
{
m_Detector_settings = value;
m_Detector_settingsIsSet = true;
}
bool Jfjoch_statistics::detectorSettingsIsSet() const
{
return m_Detector_settingsIsSet;
}
void Jfjoch_statistics::unsetDetector_settings()
{
m_Detector_settingsIsSet = false;
}
org::openapitools::server::model::Image_format_settings Jfjoch_statistics::getImageFormatSettings() const
{
return m_Image_format_settings;
}
void Jfjoch_statistics::setImageFormatSettings(org::openapitools::server::model::Image_format_settings const& value)
{
m_Image_format_settings = value;
m_Image_format_settingsIsSet = true;
}
bool Jfjoch_statistics::imageFormatSettingsIsSet() const
{
return m_Image_format_settingsIsSet;
}
void Jfjoch_statistics::unsetImage_format_settings()
{
m_Image_format_settingsIsSet = false;
}
org::openapitools::server::model::Instrument_metadata Jfjoch_statistics::getInstrumentMetadata() const
{
return m_Instrument_metadata;
}
void Jfjoch_statistics::setInstrumentMetadata(org::openapitools::server::model::Instrument_metadata const& value)
{
m_Instrument_metadata = value;
m_Instrument_metadataIsSet = true;
}
bool Jfjoch_statistics::instrumentMetadataIsSet() const
{
return m_Instrument_metadataIsSet;
}
void Jfjoch_statistics::unsetInstrument_metadata()
{
m_Instrument_metadataIsSet = false;
}
org::openapitools::server::model::Spot_finding_settings Jfjoch_statistics::getDataProcessingSettings() const
{
return m_Data_processing_settings;
}
void Jfjoch_statistics::setDataProcessingSettings(org::openapitools::server::model::Spot_finding_settings const& value)
{
m_Data_processing_settings = value;
m_Data_processing_settingsIsSet = true;
}
bool Jfjoch_statistics::dataProcessingSettingsIsSet() const
{
return m_Data_processing_settingsIsSet;
}
void Jfjoch_statistics::unsetData_processing_settings()
{
m_Data_processing_settingsIsSet = false;
}
org::openapitools::server::model::Measurement_statistics Jfjoch_statistics::getMeasurement() const
{
return m_Measurement;
}
void Jfjoch_statistics::setMeasurement(org::openapitools::server::model::Measurement_statistics const& value)
{
m_Measurement = value;
m_MeasurementIsSet = true;
}
bool Jfjoch_statistics::measurementIsSet() const
{
return m_MeasurementIsSet;
}
void Jfjoch_statistics::unsetMeasurement()
{
m_MeasurementIsSet = false;
}
org::openapitools::server::model::Broker_status Jfjoch_statistics::getBroker() const
{
return m_Broker;
}
void Jfjoch_statistics::setBroker(org::openapitools::server::model::Broker_status const& value)
{
m_Broker = value;
m_BrokerIsSet = true;
}
bool Jfjoch_statistics::brokerIsSet() const
{
return m_BrokerIsSet;
}
void Jfjoch_statistics::unsetBroker()
{
m_BrokerIsSet = false;
}
std::vector<org::openapitools::server::model::Fpga_status_inner> Jfjoch_statistics::getFpga() const
{
return m_Fpga;
}
void Jfjoch_statistics::setFpga(std::vector<org::openapitools::server::model::Fpga_status_inner> const& value)
{
m_Fpga = value;
m_FpgaIsSet = true;
}
bool Jfjoch_statistics::fpgaIsSet() const
{
return m_FpgaIsSet;
}
void Jfjoch_statistics::unsetFpga()
{
m_FpgaIsSet = false;
}
std::vector<org::openapitools::server::model::Calibration_statistics_inner> Jfjoch_statistics::getCalibration() const
{
return m_Calibration;
}
void Jfjoch_statistics::setCalibration(std::vector<org::openapitools::server::model::Calibration_statistics_inner> const& value)
{
m_Calibration = value;
m_CalibrationIsSet = true;
}
bool Jfjoch_statistics::calibrationIsSet() const
{
return m_CalibrationIsSet;
}
void Jfjoch_statistics::unsetCalibration()
{
m_CalibrationIsSet = false;
}
org::openapitools::server::model::Zeromq_preview_settings Jfjoch_statistics::getZeromqPreview() const
{
return m_Zeromq_preview;
}
void Jfjoch_statistics::setZeromqPreview(org::openapitools::server::model::Zeromq_preview_settings const& value)
{
m_Zeromq_preview = value;
m_Zeromq_previewIsSet = true;
}
bool Jfjoch_statistics::zeromqPreviewIsSet() const
{
return m_Zeromq_previewIsSet;
}
void Jfjoch_statistics::unsetZeromq_preview()
{
m_Zeromq_previewIsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,180 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Jfjoch_statistics.h
*
* Pool statistics for Jungfraujoch to reduce transfers between frontend and jfjoch_broker
*/
#ifndef Jfjoch_statistics_H_
#define Jfjoch_statistics_H_
#include "Calibration_statistics_inner.h"
#include "Detector_status.h"
#include "Broker_status.h"
#include "Measurement_statistics.h"
#include "Spot_finding_settings.h"
#include "Zeromq_preview_settings.h"
#include "Detector_list.h"
#include "Fpga_status_inner.h"
#include "Image_format_settings.h"
#include "Detector_settings.h"
#include "Instrument_metadata.h"
#include <vector>
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
/// Pool statistics for Jungfraujoch to reduce transfers between frontend and jfjoch_broker
/// </summary>
class Jfjoch_statistics
{
public:
Jfjoch_statistics();
virtual ~Jfjoch_statistics() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Jfjoch_statistics& rhs) const;
bool operator!=(const Jfjoch_statistics& rhs) const;
/////////////////////////////////////////////
/// Jfjoch_statistics members
/// <summary>
///
/// </summary>
org::openapitools::server::model::Detector_status getDetector() const;
void setDetector(org::openapitools::server::model::Detector_status const& value);
bool detectorIsSet() const;
void unsetDetector();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Detector_list getDetectorList() const;
void setDetectorList(org::openapitools::server::model::Detector_list const& value);
bool detectorListIsSet() const;
void unsetDetector_list();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Detector_settings getDetectorSettings() const;
void setDetectorSettings(org::openapitools::server::model::Detector_settings const& value);
bool detectorSettingsIsSet() const;
void unsetDetector_settings();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Image_format_settings getImageFormatSettings() const;
void setImageFormatSettings(org::openapitools::server::model::Image_format_settings const& value);
bool imageFormatSettingsIsSet() const;
void unsetImage_format_settings();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Instrument_metadata getInstrumentMetadata() const;
void setInstrumentMetadata(org::openapitools::server::model::Instrument_metadata const& value);
bool instrumentMetadataIsSet() const;
void unsetInstrument_metadata();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Spot_finding_settings getDataProcessingSettings() const;
void setDataProcessingSettings(org::openapitools::server::model::Spot_finding_settings const& value);
bool dataProcessingSettingsIsSet() const;
void unsetData_processing_settings();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Measurement_statistics getMeasurement() const;
void setMeasurement(org::openapitools::server::model::Measurement_statistics const& value);
bool measurementIsSet() const;
void unsetMeasurement();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Broker_status getBroker() const;
void setBroker(org::openapitools::server::model::Broker_status const& value);
bool brokerIsSet() const;
void unsetBroker();
/// <summary>
///
/// </summary>
std::vector<org::openapitools::server::model::Fpga_status_inner> getFpga() const;
void setFpga(std::vector<org::openapitools::server::model::Fpga_status_inner> const& value);
bool fpgaIsSet() const;
void unsetFpga();
/// <summary>
///
/// </summary>
std::vector<org::openapitools::server::model::Calibration_statistics_inner> getCalibration() const;
void setCalibration(std::vector<org::openapitools::server::model::Calibration_statistics_inner> const& value);
bool calibrationIsSet() const;
void unsetCalibration();
/// <summary>
///
/// </summary>
org::openapitools::server::model::Zeromq_preview_settings getZeromqPreview() const;
void setZeromqPreview(org::openapitools::server::model::Zeromq_preview_settings const& value);
bool zeromqPreviewIsSet() const;
void unsetZeromq_preview();
friend void to_json(nlohmann::json& j, const Jfjoch_statistics& o);
friend void from_json(const nlohmann::json& j, Jfjoch_statistics& o);
protected:
org::openapitools::server::model::Detector_status m_Detector;
bool m_DetectorIsSet;
org::openapitools::server::model::Detector_list m_Detector_list;
bool m_Detector_listIsSet;
org::openapitools::server::model::Detector_settings m_Detector_settings;
bool m_Detector_settingsIsSet;
org::openapitools::server::model::Image_format_settings m_Image_format_settings;
bool m_Image_format_settingsIsSet;
org::openapitools::server::model::Instrument_metadata m_Instrument_metadata;
bool m_Instrument_metadataIsSet;
org::openapitools::server::model::Spot_finding_settings m_Data_processing_settings;
bool m_Data_processing_settingsIsSet;
org::openapitools::server::model::Measurement_statistics m_Measurement;
bool m_MeasurementIsSet;
org::openapitools::server::model::Broker_status m_Broker;
bool m_BrokerIsSet;
std::vector<org::openapitools::server::model::Fpga_status_inner> m_Fpga;
bool m_FpgaIsSet;
std::vector<org::openapitools::server::model::Calibration_statistics_inner> m_Calibration;
bool m_CalibrationIsSet;
org::openapitools::server::model::Zeromq_preview_settings m_Zeromq_preview;
bool m_Zeromq_previewIsSet;
};
} // namespace org::openapitools::server::model
#endif /* Jfjoch_statistics_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -23,6 +23,10 @@ Measurement_statistics::Measurement_statistics()
{
m_File_prefix = "";
m_File_prefixIsSet = false;
m_Run_number = 0L;
m_Run_numberIsSet = false;
m_Experiment_group = "";
m_Experiment_groupIsSet = false;
m_Images_expected = 0L;
m_Images_expectedIsSet = false;
m_Images_collected = 0L;
@@ -51,6 +55,8 @@ Measurement_statistics::Measurement_statistics()
m_Detector_pixel_depthIsSet = false;
m_Bkg_estimate = 0.0f;
m_Bkg_estimateIsSet = false;
m_Unit_cell = "";
m_Unit_cellIsSet = false;
}
@@ -73,7 +79,7 @@ bool Measurement_statistics::validate(std::stringstream& msg, const std::string&
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Measurement_statistics" : pathPrefix;
if (collectionEfficiencyIsSet())
{
const float& value = m_Collection_efficiency;
@@ -106,7 +112,7 @@ bool Measurement_statistics::validate(std::stringstream& msg, const std::string&
}
}
return success;
}
@@ -119,6 +125,12 @@ bool Measurement_statistics::operator==(const Measurement_statistics& rhs) const
((!filePrefixIsSet() && !rhs.filePrefixIsSet()) || (filePrefixIsSet() && rhs.filePrefixIsSet() && getFilePrefix() == rhs.getFilePrefix())) &&
((!runNumberIsSet() && !rhs.runNumberIsSet()) || (runNumberIsSet() && rhs.runNumberIsSet() && getRunNumber() == rhs.getRunNumber())) &&
((!experimentGroupIsSet() && !rhs.experimentGroupIsSet()) || (experimentGroupIsSet() && rhs.experimentGroupIsSet() && getExperimentGroup() == rhs.getExperimentGroup())) &&
((!imagesExpectedIsSet() && !rhs.imagesExpectedIsSet()) || (imagesExpectedIsSet() && rhs.imagesExpectedIsSet() && getImagesExpected() == rhs.getImagesExpected())) &&
@@ -158,7 +170,10 @@ bool Measurement_statistics::operator==(const Measurement_statistics& rhs) const
((!detectorPixelDepthIsSet() && !rhs.detectorPixelDepthIsSet()) || (detectorPixelDepthIsSet() && rhs.detectorPixelDepthIsSet() && getDetectorPixelDepth() == rhs.getDetectorPixelDepth())) &&
((!bkgEstimateIsSet() && !rhs.bkgEstimateIsSet()) || (bkgEstimateIsSet() && rhs.bkgEstimateIsSet() && getBkgEstimate() == rhs.getBkgEstimate()))
((!bkgEstimateIsSet() && !rhs.bkgEstimateIsSet()) || (bkgEstimateIsSet() && rhs.bkgEstimateIsSet() && getBkgEstimate() == rhs.getBkgEstimate())) &&
((!unitCellIsSet() && !rhs.unitCellIsSet()) || (unitCellIsSet() && rhs.unitCellIsSet() && getUnitCell() == rhs.getUnitCell()))
;
}
@@ -170,9 +185,13 @@ bool Measurement_statistics::operator!=(const Measurement_statistics& rhs) const
void to_json(nlohmann::json& j, const Measurement_statistics& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
if(o.filePrefixIsSet())
j["file_prefix"] = o.m_File_prefix;
if(o.runNumberIsSet())
j["run_number"] = o.m_Run_number;
if(o.experimentGroupIsSet())
j["experiment_group"] = o.m_Experiment_group;
if(o.imagesExpectedIsSet())
j["images_expected"] = o.m_Images_expected;
if(o.imagesCollectedIsSet())
@@ -201,6 +220,8 @@ void to_json(nlohmann::json& j, const Measurement_statistics& o)
j["detector_pixel_depth"] = o.m_Detector_pixel_depth;
if(o.bkgEstimateIsSet())
j["bkg_estimate"] = o.m_Bkg_estimate;
if(o.unitCellIsSet())
j["unit_cell"] = o.m_Unit_cell;
}
@@ -211,6 +232,16 @@ void from_json(const nlohmann::json& j, Measurement_statistics& o)
j.at("file_prefix").get_to(o.m_File_prefix);
o.m_File_prefixIsSet = true;
}
if(j.find("run_number") != j.end())
{
j.at("run_number").get_to(o.m_Run_number);
o.m_Run_numberIsSet = true;
}
if(j.find("experiment_group") != j.end())
{
j.at("experiment_group").get_to(o.m_Experiment_group);
o.m_Experiment_groupIsSet = true;
}
if(j.find("images_expected") != j.end())
{
j.at("images_expected").get_to(o.m_Images_expected);
@@ -281,6 +312,11 @@ void from_json(const nlohmann::json& j, Measurement_statistics& o)
j.at("bkg_estimate").get_to(o.m_Bkg_estimate);
o.m_Bkg_estimateIsSet = true;
}
if(j.find("unit_cell") != j.end())
{
j.at("unit_cell").get_to(o.m_Unit_cell);
o.m_Unit_cellIsSet = true;
}
}
@@ -301,6 +337,40 @@ void Measurement_statistics::unsetFile_prefix()
{
m_File_prefixIsSet = false;
}
int64_t Measurement_statistics::getRunNumber() const
{
return m_Run_number;
}
void Measurement_statistics::setRunNumber(int64_t const value)
{
m_Run_number = value;
m_Run_numberIsSet = true;
}
bool Measurement_statistics::runNumberIsSet() const
{
return m_Run_numberIsSet;
}
void Measurement_statistics::unsetRun_number()
{
m_Run_numberIsSet = false;
}
std::string Measurement_statistics::getExperimentGroup() const
{
return m_Experiment_group;
}
void Measurement_statistics::setExperimentGroup(std::string const& value)
{
m_Experiment_group = value;
m_Experiment_groupIsSet = true;
}
bool Measurement_statistics::experimentGroupIsSet() const
{
return m_Experiment_groupIsSet;
}
void Measurement_statistics::unsetExperiment_group()
{
m_Experiment_groupIsSet = false;
}
int64_t Measurement_statistics::getImagesExpected() const
{
return m_Images_expected;
@@ -539,6 +609,23 @@ void Measurement_statistics::unsetBkg_estimate()
{
m_Bkg_estimateIsSet = false;
}
std::string Measurement_statistics::getUnitCell() const
{
return m_Unit_cell;
}
void Measurement_statistics::setUnitCell(std::string const& value)
{
m_Unit_cell = value;
m_Unit_cellIsSet = true;
}
bool Measurement_statistics::unitCellIsSet() const
{
return m_Unit_cellIsSet;
}
void Measurement_statistics::unsetUnit_cell()
{
m_Unit_cellIsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -66,6 +66,20 @@ public:
bool filePrefixIsSet() const;
void unsetFile_prefix();
/// <summary>
/// Number of data collection run. This can be either automatically incremented or provided externally for each data collection.
/// </summary>
int64_t getRunNumber() const;
void setRunNumber(int64_t const value);
bool runNumberIsSet() const;
void unsetRun_number();
/// <summary>
/// Name of group owning the data (e.g. p-group or proposal number).
/// </summary>
std::string getExperimentGroup() const;
void setExperimentGroup(std::string const& value);
bool experimentGroupIsSet() const;
void unsetExperiment_group();
/// <summary>
///
/// </summary>
int64_t getImagesExpected() const;
@@ -163,12 +177,23 @@ public:
void setBkgEstimate(float const value);
bool bkgEstimateIsSet() const;
void unsetBkg_estimate();
/// <summary>
///
/// </summary>
std::string getUnitCell() const;
void setUnitCell(std::string const& value);
bool unitCellIsSet() const;
void unsetUnit_cell();
friend void to_json(nlohmann::json& j, const Measurement_statistics& o);
friend void from_json(const nlohmann::json& j, Measurement_statistics& o);
friend void to_json(nlohmann::json& j, const Measurement_statistics& o);
friend void from_json(const nlohmann::json& j, Measurement_statistics& o);
protected:
std::string m_File_prefix;
bool m_File_prefixIsSet;
int64_t m_Run_number;
bool m_Run_numberIsSet;
std::string m_Experiment_group;
bool m_Experiment_groupIsSet;
int64_t m_Images_expected;
bool m_Images_expectedIsSet;
int64_t m_Images_collected;
@@ -197,6 +222,8 @@ protected:
bool m_Detector_pixel_depthIsSet;
float m_Bkg_estimate;
bool m_Bkg_estimateIsSet;
std::string m_Unit_cell;
bool m_Unit_cellIsSet;
};

View File

@@ -0,0 +1,135 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Pcie_devices_inner.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Pcie_devices_inner::Pcie_devices_inner()
{
m_Blk = "";
m_BlkIsSet = false;
m_Ipv4 = "";
m_Ipv4IsSet = false;
}
void Pcie_devices_inner::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Pcie_devices_inner::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Pcie_devices_inner::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Pcie_devices_inner" : pathPrefix;
return success;
}
bool Pcie_devices_inner::operator==(const Pcie_devices_inner& rhs) const
{
return
((!blkIsSet() && !rhs.blkIsSet()) || (blkIsSet() && rhs.blkIsSet() && getBlk() == rhs.getBlk())) &&
((!ipv4IsSet() && !rhs.ipv4IsSet()) || (ipv4IsSet() && rhs.ipv4IsSet() && getIpv4() == rhs.getIpv4()))
;
}
bool Pcie_devices_inner::operator!=(const Pcie_devices_inner& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Pcie_devices_inner& o)
{
j = nlohmann::json::object();
if(o.blkIsSet())
j["blk"] = o.m_Blk;
if(o.ipv4IsSet())
j["ipv4"] = o.m_Ipv4;
}
void from_json(const nlohmann::json& j, Pcie_devices_inner& o)
{
if(j.find("blk") != j.end())
{
j.at("blk").get_to(o.m_Blk);
o.m_BlkIsSet = true;
}
if(j.find("ipv4") != j.end())
{
j.at("ipv4").get_to(o.m_Ipv4);
o.m_Ipv4IsSet = true;
}
}
std::string Pcie_devices_inner::getBlk() const
{
return m_Blk;
}
void Pcie_devices_inner::setBlk(std::string const& value)
{
m_Blk = value;
m_BlkIsSet = true;
}
bool Pcie_devices_inner::blkIsSet() const
{
return m_BlkIsSet;
}
void Pcie_devices_inner::unsetBlk()
{
m_BlkIsSet = false;
}
std::string Pcie_devices_inner::getIpv4() const
{
return m_Ipv4;
}
void Pcie_devices_inner::setIpv4(std::string const& value)
{
m_Ipv4 = value;
m_Ipv4IsSet = true;
}
bool Pcie_devices_inner::ipv4IsSet() const
{
return m_Ipv4IsSet;
}
void Pcie_devices_inner::unsetIpv4()
{
m_Ipv4IsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -0,0 +1,88 @@
/**
* Jungfraujoch
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Pcie_devices_inner.h
*
*
*/
#ifndef Pcie_devices_inner_H_
#define Pcie_devices_inner_H_
#include <string>
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Pcie_devices_inner
{
public:
Pcie_devices_inner();
virtual ~Pcie_devices_inner() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Pcie_devices_inner& rhs) const;
bool operator!=(const Pcie_devices_inner& rhs) const;
/////////////////////////////////////////////
/// Pcie_devices_inner members
/// <summary>
/// Block device name
/// </summary>
std::string getBlk() const;
void setBlk(std::string const& value);
bool blkIsSet() const;
void unsetBlk();
/// <summary>
/// IPv4 address of the block device
/// </summary>
std::string getIpv4() const;
void setIpv4(std::string const& value);
bool ipv4IsSet() const;
void unsetIpv4();
friend void to_json(nlohmann::json& j, const Pcie_devices_inner& o);
friend void from_json(const nlohmann::json& j, Pcie_devices_inner& o);
protected:
std::string m_Blk;
bool m_BlkIsSet;
std::string m_Ipv4;
bool m_Ipv4IsSet;
};
} // namespace org::openapitools::server::model
#endif /* Pcie_devices_inner_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -114,7 +114,7 @@ bool Plot::operator!=(const Plot& rhs) const
void to_json(nlohmann::json& j, const Plot& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["title"] = o.m_Title;
j["x"] = o.m_x;
j["y"] = o.m_y;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -75,8 +75,8 @@ public:
std::vector<float> getY() const;
void setY(std::vector<float> const value);
friend void to_json(nlohmann::json& j, const Plot& o);
friend void from_json(const nlohmann::json& j, Plot& o);
friend void to_json(nlohmann::json& j, const Plot& o);
friend void from_json(const nlohmann::json& j, Plot& o);
protected:
std::string m_Title;

View File

@@ -1,106 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Plot_request.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Plot_request::Plot_request()
{
m_Binning = 0L;
m_BinningIsSet = false;
}
void Plot_request::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Plot_request::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Plot_request::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Plot_request" : pathPrefix;
return success;
}
bool Plot_request::operator==(const Plot_request& rhs) const
{
return
((!binningIsSet() && !rhs.binningIsSet()) || (binningIsSet() && rhs.binningIsSet() && getBinning() == rhs.getBinning()))
;
}
bool Plot_request::operator!=(const Plot_request& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Plot_request& o)
{
j = nlohmann::json();
if(o.binningIsSet())
j["binning"] = o.m_Binning;
}
void from_json(const nlohmann::json& j, Plot_request& o)
{
if(j.find("binning") != j.end())
{
j.at("binning").get_to(o.m_Binning);
o.m_BinningIsSet = true;
}
}
int64_t Plot_request::getBinning() const
{
return m_Binning;
}
void Plot_request::setBinning(int64_t const value)
{
m_Binning = value;
m_BinningIsSet = true;
}
bool Plot_request::binningIsSet() const
{
return m_BinningIsSet;
}
void Plot_request::unsetBinning()
{
m_BinningIsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -1,78 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Plot_request.h
*
*
*/
#ifndef Plot_request_H_
#define Plot_request_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Plot_request
{
public:
Plot_request();
virtual ~Plot_request() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Plot_request& rhs) const;
bool operator!=(const Plot_request& rhs) const;
/////////////////////////////////////////////
/// Plot_request members
/// <summary>
///
/// </summary>
int64_t getBinning() const;
void setBinning(int64_t const value);
bool binningIsSet() const;
void unsetBinning();
friend void to_json(nlohmann::json& j, const Plot_request& o);
friend void from_json(const nlohmann::json& j, Plot_request& o);
protected:
int64_t m_Binning;
bool m_BinningIsSet;
};
} // namespace org::openapitools::server::model
#endif /* Plot_request_H_ */

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -91,7 +91,7 @@ bool Plots::operator!=(const Plots& rhs) const
void to_json(nlohmann::json& j, const Plots& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
if(o.titleIsSet())
j["title"] = o.m_Title;
j["plot"] = o.m_Plot;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -73,8 +73,8 @@ public:
std::vector<org::openapitools::server::model::Plot> getPlot() const;
void setPlot(std::vector<org::openapitools::server::model::Plot> const& value);
friend void to_json(nlohmann::json& j, const Plots& o);
friend void from_json(const nlohmann::json& j, Plots& o);
friend void to_json(nlohmann::json& j, const Plots& o);
friend void from_json(const nlohmann::json& j, Plots& o);
protected:
std::string m_Title;
bool m_TitleIsSet;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -26,11 +26,13 @@ Preview_settings::Preview_settings()
m_Show_spotsIsSet = false;
m_Show_roi = false;
m_Show_roiIsSet = false;
m_Jpeg_quality = 0L;
m_Jpeg_quality = 100L;
m_Jpeg_qualityIsSet = false;
m_Show_indexed = false;
m_Show_indexedIsSet = false;
m_Resolution_ring = 0.0f;
m_Show_user_mask = false;
m_Show_user_maskIsSet = false;
m_Resolution_ring = 0.1f;
m_Resolution_ringIsSet = false;
}
@@ -92,7 +94,7 @@ bool Preview_settings::validate(std::stringstream& msg, const std::string& pathP
}
}
if (resolutionRingIsSet())
{
const float& value = m_Resolution_ring;
@@ -136,6 +138,9 @@ bool Preview_settings::operator==(const Preview_settings& rhs) const
((!showIndexedIsSet() && !rhs.showIndexedIsSet()) || (showIndexedIsSet() && rhs.showIndexedIsSet() && isShowIndexed() == rhs.isShowIndexed())) &&
((!showUserMaskIsSet() && !rhs.showUserMaskIsSet()) || (showUserMaskIsSet() && rhs.showUserMaskIsSet() && isShowUserMask() == rhs.isShowUserMask())) &&
((!resolutionRingIsSet() && !rhs.resolutionRingIsSet()) || (resolutionRingIsSet() && rhs.resolutionRingIsSet() && getResolutionRing() == rhs.getResolutionRing()))
;
@@ -148,7 +153,7 @@ bool Preview_settings::operator!=(const Preview_settings& rhs) const
void to_json(nlohmann::json& j, const Preview_settings& o)
{
j = nlohmann::json();
j = nlohmann::json::object();
j["saturation"] = o.m_Saturation;
if(o.showSpotsIsSet())
j["show_spots"] = o.m_Show_spots;
@@ -158,6 +163,8 @@ void to_json(nlohmann::json& j, const Preview_settings& o)
j["jpeg_quality"] = o.m_Jpeg_quality;
if(o.showIndexedIsSet())
j["show_indexed"] = o.m_Show_indexed;
if(o.showUserMaskIsSet())
j["show_user_mask"] = o.m_Show_user_mask;
if(o.resolutionRingIsSet())
j["resolution_ring"] = o.m_Resolution_ring;
@@ -186,6 +193,11 @@ void from_json(const nlohmann::json& j, Preview_settings& o)
j.at("show_indexed").get_to(o.m_Show_indexed);
o.m_Show_indexedIsSet = true;
}
if(j.find("show_user_mask") != j.end())
{
j.at("show_user_mask").get_to(o.m_Show_user_mask);
o.m_Show_user_maskIsSet = true;
}
if(j.find("resolution_ring") != j.end())
{
j.at("resolution_ring").get_to(o.m_Resolution_ring);
@@ -270,6 +282,23 @@ void Preview_settings::unsetShow_indexed()
{
m_Show_indexedIsSet = false;
}
bool Preview_settings::isShowUserMask() const
{
return m_Show_user_mask;
}
void Preview_settings::setShowUserMask(bool const value)
{
m_Show_user_mask = value;
m_Show_user_maskIsSet = true;
}
bool Preview_settings::showUserMaskIsSet() const
{
return m_Show_user_maskIsSet;
}
void Preview_settings::unsetShow_user_mask()
{
m_Show_user_maskIsSet = false;
}
float Preview_settings::getResolutionRing() const
{
return m_Resolution_ring;

View File

@@ -1,9 +1,9 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates.
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0-rc.18
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -91,6 +91,13 @@ public:
bool showIndexedIsSet() const;
void unsetShow_indexed();
/// <summary>
/// Show user mask
/// </summary>
bool isShowUserMask() const;
void setShowUserMask(bool const value);
bool showUserMaskIsSet() const;
void unsetShow_user_mask();
/// <summary>
///
/// </summary>
float getResolutionRing() const;
@@ -98,8 +105,8 @@ public:
bool resolutionRingIsSet() const;
void unsetResolution_ring();
friend void to_json(nlohmann::json& j, const Preview_settings& o);
friend void from_json(const nlohmann::json& j, Preview_settings& o);
friend void to_json(nlohmann::json& j, const Preview_settings& o);
friend void from_json(const nlohmann::json& j, Preview_settings& o);
protected:
int64_t m_Saturation;
@@ -111,6 +118,8 @@ protected:
bool m_Jpeg_qualityIsSet;
bool m_Show_indexed;
bool m_Show_indexedIsSet;
bool m_Show_user_mask;
bool m_Show_user_maskIsSet;
float m_Resolution_ring;
bool m_Resolution_ringIsSet;

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