From babb1a5c8d1dba0654a2d066e36e36161c250f5a Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Mon, 5 Feb 2024 17:18:16 +0100 Subject: [PATCH] Fixes after MAX IV experiment --- .gitmodules | 4 +- CMakeLists.txt | 7 +- README.md | 6 +- acquisition_device/AcquisitionDevice.cpp | 16 +- acquisition_device/AcquisitionDevice.h | 4 +- acquisition_device/FPGAAcquisitionDevice.cpp | 64 +- acquisition_device/FPGAAcquisitionDevice.h | 6 +- acquisition_device/HLSSimulatedDevice.cpp | 60 +- acquisition_device/HLSSimulatedDevice.h | 5 +- broker/JFJochBrokerHttp.cpp | 100 +- broker/JFJochBrokerHttp.h | 14 + broker/JFJochBrokerParser.cpp | 19 +- broker/JFJochServices.cpp | 21 + broker/JFJochServices.h | 5 + broker/JFJochStateMachine.cpp | 29 +- broker/JFJochStateMachine.h | 16 +- broker/gen/api/DefaultApi.cpp | 141 ++- broker/gen/api/DefaultApi.h | 55 +- broker/gen/model/Broker_status.cpp | 2 +- broker/gen/model/Broker_status.h | 2 +- .../model/Calibration_statistics_inner.cpp | 2 +- .../gen/model/Calibration_statistics_inner.h | 2 +- broker/gen/model/Data_processing_settings.cpp | 246 ---- broker/gen/model/Data_processing_settings.h | 120 -- broker/gen/model/Dataset_settings.cpp | 2 +- broker/gen/model/Dataset_settings.h | 2 +- .../model/Dataset_settings_roi_sum_area.cpp | 2 +- .../gen/model/Dataset_settings_roi_sum_area.h | 2 +- .../gen/model/Dataset_settings_unit_cell.cpp | 2 +- broker/gen/model/Dataset_settings_unit_cell.h | 2 +- broker/gen/model/Detector_list.cpp | 2 +- broker/gen/model/Detector_list.h | 2 +- .../model/Detector_list_detectors_inner.cpp | 2 +- .../gen/model/Detector_list_detectors_inner.h | 2 +- broker/gen/model/Detector_selection.cpp | 2 +- broker/gen/model/Detector_selection.h | 2 +- broker/gen/model/Detector_settings.cpp | 33 +- broker/gen/model/Detector_settings.h | 11 +- broker/gen/model/Detector_status.cpp | 242 ++++ broker/gen/model/Detector_status.h | 116 ++ broker/gen/model/Error_message.cpp | 2 +- broker/gen/model/Error_message.h | 2 +- broker/gen/model/Helpers.cpp | 2 +- broker/gen/model/Helpers.h | 2 +- broker/gen/model/Measurement_statistics.cpp | 2 +- broker/gen/model/Measurement_statistics.h | 2 +- broker/gen/model/Plot.cpp | 2 +- broker/gen/model/Plot.h | 2 +- broker/gen/model/Plot_request.cpp | 2 +- broker/gen/model/Plot_request.h | 2 +- broker/gen/model/Preview_settings.cpp | 187 +++ broker/gen/model/Preview_settings.h | 94 ++ broker/gen/model/Rad_int_settings.cpp | 2 +- broker/gen/model/Rad_int_settings.h | 2 +- .../model/Radial_integration_plots_inner.cpp | 2 +- .../model/Radial_integration_plots_inner.h | 2 +- broker/gen/model/Rotation_axis.cpp | 2 +- broker/gen/model/Rotation_axis.h | 2 +- broker/gen/model/Spot_finding_settings.cpp | 2 +- broker/gen/model/Spot_finding_settings.h | 2 +- broker/jfjoch_api.yaml | 164 ++- broker/redoc-static.html | 1106 +++++++++-------- common/CMakeLists.txt | 2 +- common/DetectorSetup.cpp | 20 +- common/DetectorSetup.h | 3 + common/DiffractionExperiment.cpp | 28 + common/DiffractionExperiment.h | 10 + common/DiffractionGeometry.h | 14 + detector_control/DetectorWrapper.cpp | 68 +- detector_control/DetectorWrapper.h | 23 +- detector_control/slsDetectorPackage | 2 +- export_images/CMakeLists.txt | 25 +- export_images/PreviewImage.cpp | 217 ++++ export_images/PreviewImage.h | 40 + export_images/WriteJPEG.cpp | 30 +- export_images/WriteJPEG.h | 4 + export_images/WriteTIFF.cpp | 24 +- fpga/hdl/action_config.v | 39 +- fpga/hls/CMakeLists.txt | 9 +- fpga/hls/axis_helpers.cpp | 20 - fpga/hls/hls_jfjoch.h | 53 +- fpga/hls/host_writer.cpp | 8 +- fpga/hls/jf_conversion.cpp | 6 +- fpga/hls/load_calibration.cpp | 15 +- fpga/hls/pedestal.cpp | 12 +- fpga/hls/spot_finder.cpp | 66 +- fpga/hls/spot_finder_connectivity.cpp | 84 ++ fpga/hls/spot_finder_mask.cpp | 89 ++ fpga/hls/spot_finder_merge.cpp | 92 ++ fpga/hls/spot_finder_tb.cpp | 9 +- fpga/host_library/JungfraujochDevice.cpp | 6 - fpga/host_library/JungfraujochDevice.h | 5 +- fpga/include/jfjoch_fpga.h | 13 +- fpga/pcie_driver/README.md | 13 + fpga/pcie_driver/jfjoch_function.c | 4 - fpga/pcie_driver/jfjoch_ioctl.c | 8 - fpga/pcie_driver/jfjoch_ioctl.h | 2 +- fpga/scripts/bd_pcie.tcl | 12 +- fpga/scripts/hbm_u55c.tcl | 5 +- fpga/scripts/image_processing.tcl | 110 +- fpga/scripts/jfjoch.tcl | 15 +- frame_serialize/JFJochMessages.h | 6 +- frame_serialize/README.md | 4 +- frontend_ui/src/App.tsx | 145 ++- .../src/components/BkgEstimatePlot.tsx | 12 +- frontend_ui/src/components/Calibration.tsx | 7 - .../src/components/DataProcessingPlot.tsx | 18 - .../src/components/DataProcessingPlots.tsx | 12 +- .../src/components/DataProcessingSettings.tsx | 11 +- .../src/components/DetectorSelection.tsx | 14 +- .../src/components/DetectorSettings.tsx | 24 +- frontend_ui/src/components/DetectorStatus.tsx | 98 ++ .../src/components/MeasurementStatistics.tsx | 11 +- frontend_ui/src/components/PreviewImage.tsx | 58 + .../src/components/PreviewImageSettings.tsx | 91 ++ .../RadialIntegrationProfilePlots.tsx | 10 +- frontend_ui/src/components/StatusBar.tsx | 11 +- frontend_ui/src/components/handleErrors.ts | 7 + frontend_ui/src/openapi/core/OpenAPI.ts | 2 +- frontend_ui/src/openapi/index.ts | 2 + .../src/openapi/models/detector_settings.ts | 4 + .../src/openapi/models/detector_status.ts | 52 + .../src/openapi/models/preview_settings.ts | 23 + .../src/openapi/services/DefaultService.ts | 102 +- image_analysis/CrystalLattice.cpp | 1 + image_analysis/StrongPixelSet.cpp | 110 +- image_analysis/StrongPixelSet.h | 15 +- receiver/CMakeLists.txt | 2 +- receiver/JFJochReceiver.cpp | 63 +- receiver/JFJochReceiver.h | 10 +- receiver/JFJochReceiverPlots.cpp | 4 +- receiver/JFJochReceiverService.cpp | 42 +- receiver/JFJochReceiverService.h | 7 +- tests/CMakeLists.txt | 4 +- tests/DiffractionExperimentTest.cpp | 24 + tests/FPGAIntegrationTest.cpp | 233 +++- tests/FPGASpotFindingUnitTest.cpp | 3 + tests/JFJochReceiverProcessingTest.cpp | 175 +++ tests/JPEGTest.cpp | 70 ++ tests/StrongPixelSetTest.cpp | 5 +- tests/TIFFTest.cpp | 76 +- tools/CMakeLists.txt | 4 +- tools/SpotFindingPerformanceTest.cpp | 35 +- writer/CMakeLists.txt | 4 +- writer/HDF5DataFile.cpp | 4 + writer/HDF5DataFile.h | 1 + writer/HDF5ImagePusher.cpp | 46 + writer/HDF5ImagePusher.h | 21 + writer/MakeDirectory.h | 12 + writer/StreamWriter.cpp | 12 - writer/StreamWriter.h | 1 - 151 files changed, 4395 insertions(+), 1477 deletions(-) delete mode 100644 broker/gen/model/Data_processing_settings.cpp delete mode 100644 broker/gen/model/Data_processing_settings.h create mode 100644 broker/gen/model/Detector_status.cpp create mode 100644 broker/gen/model/Detector_status.h create mode 100644 broker/gen/model/Preview_settings.cpp create mode 100644 broker/gen/model/Preview_settings.h create mode 100644 export_images/PreviewImage.cpp create mode 100644 export_images/PreviewImage.h create mode 100644 fpga/hls/spot_finder_connectivity.cpp create mode 100644 fpga/hls/spot_finder_mask.cpp create mode 100644 fpga/hls/spot_finder_merge.cpp create mode 100644 frontend_ui/src/components/DetectorStatus.tsx create mode 100644 frontend_ui/src/components/PreviewImage.tsx create mode 100644 frontend_ui/src/components/PreviewImageSettings.tsx create mode 100644 frontend_ui/src/components/handleErrors.ts create mode 100644 frontend_ui/src/openapi/models/detector_status.ts create mode 100644 frontend_ui/src/openapi/models/preview_settings.ts create mode 100644 tests/JFJochReceiverProcessingTest.cpp create mode 100644 tests/JPEGTest.cpp create mode 100644 writer/HDF5ImagePusher.cpp create mode 100644 writer/HDF5ImagePusher.h diff --git a/.gitmodules b/.gitmodules index 67c7f0e8..28d8adb2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,8 +9,8 @@ url = https://github.com/facebook/zstd [submodule "detector_control/slsDetectorPackage"] path = detector_control/slsDetectorPackage - url = https://github.com/slsdetectorgroup/slsDetectorPackage - branch = "developer" + url = https://github.com/fleon-psi/slsDetectorPackage + branch = "jfjoch-shmem" [submodule "compression/bitshuffle_hperf"] path = compression/bitshuffle_hperf url = https://github.com/kalcutter/bitshuffle diff --git a/CMakeLists.txt b/CMakeLists.txt index da465437..414b64cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ CHECK_INCLUDE_FILE(numaif.h HAS_NUMAIF) CHECK_INCLUDE_FILE(numa.h HAS_NUMA_H) LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -FIND_PACKAGE(ZeroMQ 4 REQUIRED) +#FIND_PACKAGE(ZeroMQ 4 REQUIRED) ADD_SUBDIRECTORY(jungfrau) ADD_SUBDIRECTORY(compression) @@ -41,7 +41,7 @@ ADD_SUBDIRECTORY(writer) ADD_SUBDIRECTORY(frame_serialize) ADD_SUBDIRECTORY(broker/pistache) - +ADD_SUBDIRECTORY(detector_control) IF (JFJOCH_WRITER_ONLY) MESSAGE(STATUS "Compiling HDF5 writer only") SET(jfjoch_executables jfjoch_writer) @@ -51,10 +51,9 @@ ELSE() ADD_SUBDIRECTORY(acquisition_device) ADD_SUBDIRECTORY(receiver) ADD_SUBDIRECTORY(image_analysis) - ADD_SUBDIRECTORY(detector_control) ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tools) -# ADD_SUBDIRECTORY(export_images) + ADD_SUBDIRECTORY(export_images) SET(jfjoch_executables jfjoch_broker jfjoch_writer CatchTest CompressionBenchmark HDF5DatasetWriteTest jfjoch_udp_simulator sls_detector_put sls_detector_get) ENDIF() diff --git a/README.md b/README.md index 0bd17b1b..4e3e55b9 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,9 @@ 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 -* ZeroMQ library * OpenSSL library -* TIFF library + C++ binding (optional) -* JPEG library (optional) +* TIFF library (with C++ headers) +* JPEG library (turbo-jpeg is also OK) Optional: * CUDA compiler version 11 or newer - image analysis features won't work without it @@ -49,6 +48,7 @@ Directly included in the repository: * Bitshuffle filter from K. Masui - see [github.com/kiyo-masui/bitshuffle](https://github.com/kiyo-masui/bitshuffle) * LZ4 compression by Y.Collet - see [github.com/lz4/lz4](https://github.com/lz4/lz4) * Spdlog logging library - see [github.com/gabime/spdlog](https://github.com/gabime/spdlog) +* ZeroMQ library (through slsDetectorPackage) For license check LICENSE file in respective directory ### Software components diff --git a/acquisition_device/AcquisitionDevice.cpp b/acquisition_device/AcquisitionDevice.cpp index 13640f15..e8b15ee7 100644 --- a/acquisition_device/AcquisitionDevice.cpp +++ b/acquisition_device/AcquisitionDevice.cpp @@ -183,6 +183,9 @@ void AcquisitionDevice::InitializeIntegrationMap(const DiffractionExperiment &ex const std::vector &v, const std::vector &weights) {} +void AcquisitionDevice::InitializeSpotFinderResolutionMap(const DiffractionExperiment &experiment, + const std::vector &v) {} + void AcquisitionDevice::MapBuffersStandard(size_t c2h_buffer_count, int16_t numa_node) { try { for (int i = 0; i < c2h_buffer_count; i++) @@ -289,4 +292,15 @@ void AcquisitionDevice::RunInternalGenerator(const DiffractionExperiment &experi config.dest_mac_addr = MacAddressFromStr(GetMACAddress()); config.dest_ipv4_addr = IPv4AddressFromStr(GetIPv4Address()); HW_RunInternalGenerator(config); -} \ No newline at end of file +} + +void AcquisitionDevice::SetSpotFinderParameters(const SpotFindingSettings &settings) { + SpotFinderParameters fpga_parameters{}; + + fpga_parameters.snr_threshold = settings.signal_to_noise_threshold; + fpga_parameters.count_threshold = settings.photon_count_threshold; + fpga_parameters.max_d = settings.low_resolution_limit; + fpga_parameters.min_d = settings.high_resolution_limit; + fpga_parameters.min_pix_per_spot = settings.min_pix_per_spot; + HW_SetSpotFinderParameters(fpga_parameters); +} diff --git a/acquisition_device/AcquisitionDevice.h b/acquisition_device/AcquisitionDevice.h index fc8177d7..bdab2ad3 100644 --- a/acquisition_device/AcquisitionDevice.h +++ b/acquisition_device/AcquisitionDevice.h @@ -63,6 +63,7 @@ protected: const DeviceOutput *GetDeviceOutput(size_t handle) const; DeviceOutput *GetDeviceOutput(size_t handle); virtual void HW_RunInternalGenerator(const FrameGeneratorConfig& config) = 0; + virtual void HW_SetSpotFinderParameters(const SpotFinderParameters ¶ms) = 0; public: AcquisitionDevice(const AcquisitionDevice &other) = delete; AcquisitionDevice &operator=(const AcquisitionDevice &other) = delete; @@ -94,9 +95,10 @@ public: virtual void InitializeIntegrationMap(const DiffractionExperiment &experiment, const std::vector &v); virtual void InitializeIntegrationMap(const DiffractionExperiment &experiment, const std::vector &v, const std::vector &weights); + virtual void InitializeSpotFinderResolutionMap(const DiffractionExperiment &experiment, const std::vector& v); const AcquisitionCounters& Counters() const; - virtual void SetSpotFinderParameters(int32_t count_threshold, float snr_threshold) {}; + 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); diff --git a/acquisition_device/FPGAAcquisitionDevice.cpp b/acquisition_device/FPGAAcquisitionDevice.cpp index 59a7dace..8cf8c918 100644 --- a/acquisition_device/FPGAAcquisitionDevice.cpp +++ b/acquisition_device/FPGAAcquisitionDevice.cpp @@ -82,6 +82,23 @@ void FPGAAcquisitionDevice::SendWorkRequestThread() { } } +void FPGAAcquisitionDevice::InitializeSpotFinderResolutionMap(const DiffractionExperiment &experiment, const std::vector &v) { + auto offset = experiment.GetFirstModuleOfDataStream(data_stream); + size_t modules = experiment.GetModulesNum(data_stream); + + if (v.size() != experiment.GetModulesNum() * RAW_MODULE_SIZE) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, + "Mismatch regarding integration map array"); + for (uint32_t m = 0; m < modules; m++) { + memcpy(buffer_device[0]->pixels, v.data() + (offset + m) * RAW_MODULE_SIZE, RAW_MODULE_SIZE * sizeof(float)); + buffer_device[0]->module_statistics.module_number = m; + buffer_device[0]->module_statistics.load_calibration_destination + = LOAD_CALIBRATION_DEST_SPOT_FINDER_RESOLUTION_MAP; + LoadCalibration(0); + } + +} + void FPGAAcquisitionDevice::InitializeIntegrationMap(const DiffractionExperiment &experiment, const std::vector &v) { std::vector weights(experiment.GetModulesNum() * RAW_MODULE_SIZE, 1.0); @@ -139,7 +156,6 @@ void FPGAAcquisitionDevice::SetInternalGeneratorFrameForAllModules(const std::ve } } - void FPGAAcquisitionDevice::SetInternalGeneratorFrame(const std::vector &v) { if (v.empty() || (v.size() % RAW_MODULE_SIZE != 0)) { throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, @@ -167,6 +183,32 @@ void FPGAAcquisitionDevice::SetInternalGeneratorFrame(const std::vector &v) { + if (v.empty() || (v.size() % RAW_MODULE_SIZE != 0)) { + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, + "Error in size of custom internal generator frame"); + } + + size_t nmodules = v.size() / RAW_MODULE_SIZE; + if (nmodules > max_modules) { + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, + "Max number of modules exceeded"); + } + + memcpy(internal_pkt_gen_frame.data(), v.data(), nmodules * RAW_MODULE_SIZE * sizeof(int16_t)); + + if (nmodules > buffer_device.size()) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, + "Not enough host/FPGA buffers to load all integration map values"); + + for (uint32_t m = 0; m < nmodules; m++) { + memcpy(buffer_device[0], internal_pkt_gen_frame.data() + m * RAW_MODULE_SIZE, RAW_MODULE_SIZE * sizeof(int16_t)); + buffer_device[0]->module_statistics.module_number = m; + buffer_device[0]->module_statistics.load_calibration_destination = LOAD_CALIBRATION_DEST_FRAME_GEN; + LoadCalibration(0); + } +} + void FPGAAcquisitionDevice::InitializeCalibration(const DiffractionExperiment &experiment, const JFCalibration &calib) { auto offset = experiment.GetFirstModuleOfDataStream(data_stream); @@ -270,8 +312,6 @@ void FPGAAcquisitionDevice::FillActionRegister(const DiffractionExperiment& x, D switch (x.GetDetectorMode()) { case DetectorMode::Conversion: - job.mode |= MODE_CONV; - break; case DetectorMode::Raw: break; case DetectorMode::PedestalG0: @@ -285,11 +325,15 @@ void FPGAAcquisitionDevice::FillActionRegister(const DiffractionExperiment& x, D break; } + if (x.IsConversionOnFPGA()) + job.mode |= MODE_CONV; + if (x.IsFixedGainG1()) job.mode |= MODE_FIXG1; if (!x.IsPixelSigned()) job.mode |= MODE_UNSIGNED; + if (x.GetPixelDepth() == 4) job.mode |= MODE_32BIT; } @@ -343,20 +387,6 @@ FPGAAcquisitionDevice::FPGAAcquisitionDevice(uint16_t data_stream) internal_pkt_gen_frame(RAW_MODULE_SIZE * MAX_MODULES_FPGA) { } -void FPGAAcquisitionDevice::SetSpotFinderParameters(int32_t count_threshold, float snr_threshold) { - if (snr_threshold < 0) { - if (logger) - logger->Warning("Trying to set SNR threshold below zero: {}", snr_threshold ); - snr_threshold = 0; - } else if (snr_threshold > 16) { - if (logger) - logger->Warning("Trying to set SNR threshold too high: {}", snr_threshold ); - snr_threshold = 16; - } - SpotFinderParameters params{.count_threshold = count_threshold, .snr_threshold = snr_threshold}; - HW_SetSpotFinderParameters(params); -} - AcquisitionDeviceSource FPGAAcquisitionDevice::GetDataSource() { switch (HW_GetDataSource()) { case STREAM_MERGE_SRC_100G: diff --git a/acquisition_device/FPGAAcquisitionDevice.h b/acquisition_device/FPGAAcquisitionDevice.h index 84c79ec6..f8cd29d9 100644 --- a/acquisition_device/FPGAAcquisitionDevice.h +++ b/acquisition_device/FPGAAcquisitionDevice.h @@ -33,7 +33,6 @@ class FPGAAcquisitionDevice : public AcquisitionDevice { void LoadCalibration(uint32_t handle); virtual bool HW_ReadMailbox(uint32_t *values) = 0; virtual bool HW_SendWorkRequest(uint32_t handle) = 0; - virtual void HW_SetSpotFinderParameters(const SpotFinderParameters ¶ms) = 0; virtual void HW_SetDataSource(uint32_t val) = 0; virtual uint32_t HW_GetDataSource() = 0; void StartSendingWorkRequests() override; @@ -51,12 +50,13 @@ public: void InitializeIntegrationMap(const DiffractionExperiment &experiment, const std::vector &v) override; void InitializeIntegrationMap(const DiffractionExperiment &experiment, const std::vector &v, const std::vector &weights) override; - + void InitializeSpotFinderResolutionMap(const DiffractionExperiment &experiment, const std::vector& v); void SetInternalGeneratorFrame(const std::vector &v); + void SetInternalGeneratorFrame(const std::vector &v); + void SetInternalGeneratorFrameForAllModules(const std::vector &v); void SetInternalGeneratorFrame(); std::vector GetInternalGeneratorFrame() const override; - void SetSpotFinderParameters(int32_t count_threshold, float snr_threshold) override; AcquisitionDeviceSource GetDataSource() override; void SetDefaultDataSource(AcquisitionDeviceSource id) override; uint32_t GetExpectedDescriptorsPerModule() const override; diff --git a/acquisition_device/HLSSimulatedDevice.cpp b/acquisition_device/HLSSimulatedDevice.cpp index e1a6b71e..5787125a 100644 --- a/acquisition_device/HLSSimulatedDevice.cpp +++ b/acquisition_device/HLSSimulatedDevice.cpp @@ -254,6 +254,7 @@ void HLSSimulatedDevice::HLSMainThread() { STREAM_768 stream_768_0; STREAM_768 stream_768_1; STREAM_768 stream_768_2; + STREAM_768 stream_768_3; STREAM_512 converted_0; STREAM_512 converted_1; @@ -272,7 +273,7 @@ void HLSSimulatedDevice::HLSMainThread() { hls::stream addr2; hls::stream addr3; - hls::stream compl0, compl1, compl2, compl2a, compl3, compl4, compl5, compl6, compl7; + hls::stream compl0, compl1, compl2, compl2a, compl3, compl4, compl5, compl6, compl7, compl8; hls::stream> hbm_handles; hls::stream> adu_histo_result; @@ -281,7 +282,10 @@ void HLSSimulatedDevice::HLSMainThread() { hls::stream> integration_result_1; hls::stream> spot_finder_result_0; - hls::stream> spot_finder_result_1; + hls::stream> spot_finder_result_1; + hls::stream> spot_finder_conn_0; + hls::stream> spot_finder_result_2; + hls::stream> spot_finder_mask_0; hls::stream > udp_metadata; volatile ap_uint<1> idle_data_collection = 1; @@ -462,19 +466,54 @@ void HLSSimulatedDevice::HLSMainThread() { hls_cores.emplace_back([&] { axis_64_to_512(integration_result_0, integration_result_1);}); // 8. Spot finding - ap_uint<32> tmp_snr_threshold = float2uint(snr_threshold); - hls_cores.emplace_back([&] { spot_finder(stream_768_1, stream_768_2, spot_finder_result_0, - count_threshold,tmp_snr_threshold);}); - hls_cores.emplace_back([&] { axis_32_to_512(spot_finder_result_0, spot_finder_result_1);}); + 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_1, + stream_768_2, + spot_finder_mask_0, + compl7, + compl8, + 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_2, spot_finder_mask_0, stream_768_3, 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"); + }); // 9. Reduce/extend 24-bit stream - hls_cores.emplace_back([&] { stream_24bit_conv(stream_768_2, converted_7, stream_conv_idle);}); + hls_cores.emplace_back([&] { stream_24bit_conv(stream_768_3, converted_7, stream_conv_idle);}); // 10. Prepare data to write to host memory hls_cores.emplace_back([&] { ap_uint<3> state; - host_writer(converted_7, adu_histo_result, integration_result_1, spot_finder_result_1, - compl7, datamover_out.GetDataStream(), + host_writer(converted_7, adu_histo_result, integration_result_1, spot_finder_result_2, + compl8, datamover_out.GetDataStream(), datamover_out.GetCtrlStream(), work_request_stream, completion_stream, dma_address_table.data(), packets_processed, host_writer_idle, cancel_data_collection, state);}); @@ -618,8 +657,7 @@ void HLSSimulatedDevice::HW_LoadCalibration(const LoadCalibrationConfig &config) } void HLSSimulatedDevice::HW_SetSpotFinderParameters(const SpotFinderParameters ¶ms) { - count_threshold = params.count_threshold; - snr_threshold = params.snr_threshold; + spot_finder_parameters = params; } void HLSSimulatedDevice::HW_SetDataSource(uint32_t val) { diff --git a/acquisition_device/HLSSimulatedDevice.h b/acquisition_device/HLSSimulatedDevice.h index 02ebd3ec..0fa140a6 100644 --- a/acquisition_device/HLSSimulatedDevice.h +++ b/acquisition_device/HLSSimulatedDevice.h @@ -22,14 +22,13 @@ class HLSSimulatedDevice : public FPGAAcquisitionDevice { uint32_t run_counter = 0; ap_uint<2> data_source = STREAM_MERGE_SRC_100G; - ap_int<32> count_threshold = -1; - float snr_threshold = 0; + SpotFinderParameters spot_finder_parameters; DataCollectionConfig cfg; volatile bool idle; - constexpr static const size_t hbm_if_count = 28; + constexpr static const size_t hbm_if_count = 30; constexpr static const size_t hbm_if_size = 32*1024*1024LU; std::vector> hbm; diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index 1b4c248b..87b81c8c 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -87,6 +87,8 @@ inline DetectorSettings Convert(const org::openapitools::server::model::Detector ret.pedestal_g2_frames = input.getPedestalG2Frames(); if (input.storageCellDelayNsIsSet()) ret.storage_cell_delay_ns = input.getStorageCellDelayNs(); + if (input.detectorTriggerDelayNsIsSet()) + ret.detector_delay_ns = input.getDetectorTriggerDelayNs(); return ret; } @@ -107,6 +109,8 @@ inline org::openapitools::server::model::Detector_settings Convert(const Detecto ret.setPedestalG2Frames(input.pedestal_g2_frames.value()); ret.setStorageCellDelayNs(input.storage_cell_delay_ns.value()); + ret.setDetectorTriggerDelayNs(input.detector_delay_ns.value()); + return ret; } @@ -156,6 +160,40 @@ inline org::openapitools::server::model::Calibration_statistics_inner Convert(co 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); + 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 dets; @@ -218,6 +256,22 @@ inline org::openapitools::server::model::Rad_int_settings Convert(const RadialIn 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(); + return ret; +} + +inline org::openapitools::server::model::Preview_settings Convert(const PreviewJPEGSettings& settings) { + org::openapitools::server::model::Preview_settings ret{}; + ret.setJpegQuality(settings.jpeg_quality); + ret.setSaturation(settings.saturation_value); + ret.setShowSpots(settings.show_spots); + return ret; +} + inline DatasetSettings Convert(const org::openapitools::server::model::Dataset_settings& input) { DatasetSettings ret; @@ -401,7 +455,7 @@ void JFJochBrokerHttp::config_rad_int_get(Pistache::Http::ResponseWriter &respon void JFJochBrokerHttp::config_rad_int_put(const org::openapitools::server::model::Rad_int_settings &radIntSettings, Pistache::Http::ResponseWriter &response) { - state_machine.LoadRadialIntegrationSettings(Convert(radIntSettings)); + state_machine.SetRadialIntegrationSettings(Convert(radIntSettings)); response.send(Pistache::Http::Code::Ok); } @@ -606,4 +660,46 @@ void JFJochBrokerHttp::plot_roi_sum_post(const org::openapitools::server::model: req.binning = plotRequest.getBinning(); auto plot = state_machine.GetPlots(req); ProcessOutput(Convert(plot), response); -} \ No newline at end of file +} + +void JFJochBrokerHttp::detector_status_get(Pistache::Http::ResponseWriter &response) { + auto out = state_machine.GetDetectorStatus(); + if (out) + ProcessOutput(Convert(out.value()), response); + else + response.send(Pistache::Http::Code::Not_Found); +} + +void JFJochBrokerHttp::preview_calibration_tiff_get(Pistache::Http::ResponseWriter &response) { + std::string s = state_machine.GetPreviewTIFF(true); + if (!s.empty()) + response.send(Pistache::Http::Code::Ok, s, Pistache::Http::Mime::MediaType::fromString("image/tiff")); + else + response.send(Pistache::Http::Code::Not_Found); +} + +void JFJochBrokerHttp::preview_image_jpeg_get(Pistache::Http::ResponseWriter &response) { + std::string s = state_machine.GetPreviewJPEG(); + if (!s.empty()) + response.send(Pistache::Http::Code::Ok, s, Pistache::Http::Mime::MediaType::fromString("image/jpeg")); + else + response.send(Pistache::Http::Code::Not_Found); +} + +void JFJochBrokerHttp::preview_image_tiff_get(Pistache::Http::ResponseWriter &response) { + std::string s = state_machine.GetPreviewTIFF(false); + if (!s.empty()) + response.send(Pistache::Http::Code::Ok, s, Pistache::Http::Mime::MediaType::fromString("image/tiff")); + else + response.send(Pistache::Http::Code::Not_Found); +} + +void JFJochBrokerHttp::preview_jpeg_settings_get(Pistache::Http::ResponseWriter &response) { + ProcessOutput(Convert(state_machine.GetPreviewJPEGSettings()), response); +} + +void JFJochBrokerHttp::preview_jpeg_settings_put(const org::openapitools::server::model::Preview_settings &previewSettings, + Pistache::Http::ResponseWriter &response) { + state_machine.SetPreviewJPEGSettings(Convert(previewSettings)); + response.send(Pistache::Http::Code::Ok); +} diff --git a/broker/JFJochBrokerHttp.h b/broker/JFJochBrokerHttp.h index f830d5c2..70105b49 100644 --- a/broker/JFJochBrokerHttp.h +++ b/broker/JFJochBrokerHttp.h @@ -33,6 +33,8 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { void config_select_detector_put(const org::openapitools::server::model::Detector_selection &detectorSelection, Pistache::Http::ResponseWriter &response) override; + void detector_status_get(Pistache::Http::ResponseWriter &response) override; + void config_spot_finding_get(Pistache::Http::ResponseWriter &response) override; void config_spot_finding_put(const org::openapitools::server::model::Spot_finding_settings &spotFindingSettings, @@ -88,6 +90,18 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { void trigger_post(Pistache::Http::ResponseWriter &response) override; void pedestal_post(Pistache::Http::ResponseWriter &response) override; + + void preview_calibration_tiff_get(Pistache::Http::ResponseWriter &response) override; + + void preview_image_jpeg_get(Pistache::Http::ResponseWriter &response) override; + + void preview_image_tiff_get(Pistache::Http::ResponseWriter &response) override; + + void preview_jpeg_settings_get(Pistache::Http::ResponseWriter &response) override; + + void preview_jpeg_settings_put(const org::openapitools::server::model::Preview_settings &previewSettings, + Pistache::Http::ResponseWriter &response) override; + void GetStaticFile(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); std::pair handleOperationException(const std::exception &ex) const noexcept override; diff --git a/broker/JFJochBrokerParser.cpp b/broker/JFJochBrokerParser.cpp index 63f4d6d9..49d14dcc 100644 --- a/broker/JFJochBrokerParser.cpp +++ b/broker/JFJochBrokerParser.cpp @@ -113,6 +113,20 @@ inline std::vector GET_STR_ARR(const nlohmann::json &j, const std:: return ret; } +inline std::vector GET_I64_ARR(const nlohmann::json &j, const std::string& tag) { + std::vector ret; + + if (CHECK_ARRAY(j, tag)) { + try { + for (const auto &iter: j[tag]) + ret.push_back(iter.get()); + } 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()) @@ -218,6 +232,7 @@ DetectorSetup ParseDetectorSetup(const nlohmann::json &j) { std::string description = GET_STR(j, "description"); auto module_hostname = GET_STR_ARR(j, "module_hostname"); auto gain_files = GET_STR_ARR(j, "gain_files"); + auto tx_delay = GET_I64_ARR(j, "tx_delay"); DetectorSetup setup(geom, description, module_hostname); if (!gain_files.empty()) @@ -226,7 +241,9 @@ DetectorSetup ParseDetectorSetup(const nlohmann::json &j) { 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")); + .SensorMaterial(GET_STR(j, "sensor_material", "Si")) + .TxDelay(tx_delay); + return setup; } diff --git a/broker/JFJochServices.cpp b/broker/JFJochServices.cpp index 07293fe5..8ae44d31 100644 --- a/broker/JFJochServices.cpp +++ b/broker/JFJochServices.cpp @@ -145,3 +145,24 @@ void JFJochServices::Trigger() { if (detector && (receiver != nullptr)) detector->Trigger(); } + +std::optional JFJochServices::GetDetectorStatus() const { + if (detector) + return detector->GetStatus(); + else + return {}; +} + +std::string JFJochServices::GetPreviewJPEG(const PreviewJPEGSettings &settings) const { + if (receiver != nullptr) + return receiver->GetJPEG(settings); + else + return PreviewImage::GenerateTestJPEG(settings); +} + +std::string JFJochServices::GetPreviewTIFF(bool calibration) const { + if (receiver != nullptr) + return receiver->GetTIFF(calibration); + else + return ""; +} diff --git a/broker/JFJochServices.h b/broker/JFJochServices.h index f9f12cc6..c86b4c58 100644 --- a/broker/JFJochServices.h +++ b/broker/JFJochServices.h @@ -34,6 +34,11 @@ public: void SetSpotFindingSettings(const SpotFindingSettings &settings); JFJochServices& Receiver(JFJochReceiverService *input); JFJochServices& Detector(); + + std::optional GetDetectorStatus() const; + + std::string GetPreviewJPEG(const PreviewJPEGSettings &settings) const; + std::string GetPreviewTIFF(bool calibration) const; }; diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index 55f5edee..9dc09249 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -72,6 +72,8 @@ void ApplyDetectorSettings(DiffractionExperiment& experiment, const DetectorSett 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())); } catch (...) { experiment = tmp; throw; @@ -514,6 +516,7 @@ DetectorSettings JFJochStateMachine::GetDetectorSettings() const { 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(); return ret; @@ -591,7 +594,7 @@ void JFJochStateMachine::AddDetectorSetup(const DetectorSetup &setup) { detector_setup.emplace_back(setup); } -DetectorList JFJochStateMachine::GetDetectorsList() { +DetectorList JFJochStateMachine::GetDetectorsList() const { std::unique_lock ul(m); DetectorList ret; @@ -608,6 +611,10 @@ DetectorList JFJochStateMachine::GetDetectorsList() { return ret; } +std::optional JFJochStateMachine::GetDetectorStatus() const { + return services.GetDetectorStatus(); +} + void JFJochStateMachine::SelectDetector(int64_t id) { std::unique_lock ul(m); @@ -628,7 +635,7 @@ void JFJochStateMachine::SelectDetector(int64_t id) { } } -void JFJochStateMachine::LoadRadialIntegrationSettings(const RadialIntegrationSettings &settings) { +void JFJochStateMachine::SetRadialIntegrationSettings(const RadialIntegrationSettings &settings) { std::unique_lock ul(m); if (IsRunning()) @@ -682,4 +689,20 @@ std::optional JFJochStateMachine::CheckError() { return e.what(); } return {}; -} \ No newline at end of file +} + +void JFJochStateMachine::SetPreviewJPEGSettings(const PreviewJPEGSettings &settings) { + preview_jpeg_settings = settings; +} + +PreviewJPEGSettings JFJochStateMachine::GetPreviewJPEGSettings() const { + return preview_jpeg_settings; +} + +std::string JFJochStateMachine::GetPreviewJPEG() const { + return services.GetPreviewJPEG(preview_jpeg_settings); +} + +std::string JFJochStateMachine::GetPreviewTIFF(bool calibration) const { + return services.GetPreviewTIFF(calibration); +} diff --git a/broker/JFJochStateMachine.h b/broker/JFJochStateMachine.h index fb0a8286..54cabd7f 100644 --- a/broker/JFJochStateMachine.h +++ b/broker/JFJochStateMachine.h @@ -104,6 +104,7 @@ struct DetectorSettings { std::optional pedestal_g2_frames; std::optional storage_cell_delay_ns; + std::optional detector_delay_ns; }; @@ -147,6 +148,11 @@ class JFJochStateMachine { mutable std::mutex data_processing_settings_mutex; SpotFindingSettings data_processing_settings; + // Not protected with mutex: + // little harm of having preview image out-of-sync, given these images are regularly recalculated + // while there is risk of deadlock with too many mutexes + PreviewJPEGSettings preview_jpeg_settings; + // Private functions assume that lock m is acquired void SetDatasetDefaults(DatasetSettings& settings); void MeasurementThread(); @@ -194,12 +200,18 @@ public: JFJochState GetState() const; void AddDetectorSetup(const DetectorSetup& setup); - DetectorList GetDetectorsList(); + DetectorList GetDetectorsList() const; void SelectDetector(int64_t id); + std::optional GetDetectorStatus() const; - void LoadRadialIntegrationSettings(const RadialIntegrationSettings& settings); + void SetRadialIntegrationSettings(const RadialIntegrationSettings& settings); RadialIntegrationSettings GetRadialIntegrationSettings() const; + void SetPreviewJPEGSettings(const PreviewJPEGSettings& settings); + PreviewJPEGSettings GetPreviewJPEGSettings() const; + std::string GetPreviewJPEG() const; + std::string GetPreviewTIFF(bool calibration) const; + // Not thread safe - only for configuration in serial context DiffractionExperiment& NotThreadSafe_Experiment(); diff --git a/broker/gen/api/DefaultApi.cpp b/broker/gen/api/DefaultApi.cpp index 90e2f895..b365f23c 100644 --- a/broker/gen/api/DefaultApi.cpp +++ b/broker/gen/api/DefaultApi.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -43,6 +43,7 @@ void DefaultApi::setupRoutes() { Routes::Get(*router, base + "/config/spot_finding", Routes::bind(&DefaultApi::config_spot_finding_get_handler, this)); Routes::Put(*router, base + "/config/spot_finding", Routes::bind(&DefaultApi::config_spot_finding_put_handler, this)); Routes::Post(*router, base + "/deactivate", Routes::bind(&DefaultApi::deactivate_post_handler, this)); + Routes::Get(*router, base + "/detector/status", Routes::bind(&DefaultApi::detector_status_get_handler, this)); Routes::Post(*router, base + "/initialize", Routes::bind(&DefaultApi::initialize_post_handler, this)); Routes::Post(*router, base + "/pedestal", Routes::bind(&DefaultApi::pedestal_post_handler, this)); Routes::Post(*router, base + "/plot/bkg_estimate", Routes::bind(&DefaultApi::plot_bkg_estimate_post_handler, this)); @@ -57,6 +58,11 @@ void DefaultApi::setupRoutes() { Routes::Post(*router, base + "/plot/saturated_pixel", Routes::bind(&DefaultApi::plot_saturated_pixel_post_handler, this)); Routes::Post(*router, base + "/plot/spot_count", Routes::bind(&DefaultApi::plot_spot_count_post_handler, this)); Routes::Post(*router, base + "/plot/strong_pixel", Routes::bind(&DefaultApi::plot_strong_pixel_post_handler, this)); + Routes::Get(*router, base + "/preview/calibration.tiff", Routes::bind(&DefaultApi::preview_calibration_tiff_get_handler, this)); + Routes::Get(*router, base + "/preview/image.jpeg", Routes::bind(&DefaultApi::preview_image_jpeg_get_handler, this)); + Routes::Get(*router, base + "/preview/image.tiff", Routes::bind(&DefaultApi::preview_image_tiff_get_handler, this)); + Routes::Get(*router, base + "/preview/jpeg_settings", Routes::bind(&DefaultApi::preview_jpeg_settings_get_handler, this)); + Routes::Put(*router, base + "/preview/jpeg_settings", Routes::bind(&DefaultApi::preview_jpeg_settings_put_handler, this)); Routes::Post(*router, base + "/start", Routes::bind(&DefaultApi::start_post_handler, this)); Routes::Get(*router, base + "/statistics/calibration", Routes::bind(&DefaultApi::statistics_calibration_get_handler, this)); Routes::Get(*router, base + "/statistics/data_collection", Routes::bind(&DefaultApi::statistics_data_collection_get_handler, this)); @@ -337,6 +343,26 @@ void DefaultApi::deactivate_post_handler(const Pistache::Rest::Request &, Pistac response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } +} +void DefaultApi::detector_status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->detector_status_get(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + } void DefaultApi::initialize_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { @@ -734,6 +760,119 @@ void DefaultApi::plot_strong_pixel_post_handler(const Pistache::Rest::Request &r response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } +} +void DefaultApi::preview_calibration_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->preview_calibration_tiff_get(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void DefaultApi::preview_image_jpeg_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->preview_image_jpeg_get(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void DefaultApi::preview_image_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->preview_image_tiff_get(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void DefaultApi::preview_jpeg_settings_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { + try { + + + try { + this->preview_jpeg_settings_get(response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + +} +void DefaultApi::preview_jpeg_settings_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + + Preview_settings previewSettings; + + try { + nlohmann::json::parse(request.body()).get_to(previewSettings); + previewSettings.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->preview_jpeg_settings_put(previewSettings, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + } void DefaultApi::start_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { diff --git a/broker/gen/api/DefaultApi.h b/broker/gen/api/DefaultApi.h index 10689b46..da868364 100644 --- a/broker/gen/api/DefaultApi.h +++ b/broker/gen/api/DefaultApi.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -32,10 +32,12 @@ #include "Detector_list.h" #include "Detector_selection.h" #include "Detector_settings.h" +#include "Detector_status.h" #include "Error_message.h" #include "Measurement_statistics.h" #include "Plot.h" #include "Plot_request.h" +#include "Preview_settings.h" #include "Rad_int_settings.h" #include "Radial_integration_plots_inner.h" #include "Spot_finding_settings.h" @@ -65,6 +67,7 @@ private: 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 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 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_bkg_estimate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); @@ -79,6 +82,11 @@ private: void plot_saturated_pixel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void plot_spot_count_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void plot_strong_pixel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void preview_calibration_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void preview_image_jpeg_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void preview_image_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void preview_jpeg_settings_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void preview_jpeg_settings_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); 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); @@ -126,7 +134,7 @@ private: /// (optional) virtual void config_detector_put(const org::openapitools::server::model::Detector_settings &detectorSettings, Pistache::Http::ResponseWriter &response) = 0; /// - /// Get data processing configuration + /// Get radial integration configuration /// /// /// Can be done anytime @@ -178,6 +186,13 @@ private: /// virtual void deactivate_post(Pistache::Http::ResponseWriter &response) = 0; /// + /// Get detector status + /// + /// + /// Status of the JUNGFRAU detector + /// + virtual void detector_status_get(Pistache::Http::ResponseWriter &response) = 0; + /// /// Initialize detector and data acquisition /// /// @@ -285,6 +300,42 @@ private: /// (optional) virtual void plot_strong_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; /// + /// Get last preview image in TIFF format for calibration with PyFAI/Dioptas + /// + /// + /// Image is reduced to unsigned 16-bit images, all bad pixels are set to 65535 and image is mirrored in vertical direction + /// + virtual void preview_calibration_tiff_get(Pistache::Http::ResponseWriter &response) = 0; + /// + /// Get last preview image in JPEG format + /// + /// + /// + /// + virtual void preview_image_jpeg_get(Pistache::Http::ResponseWriter &response) = 0; + /// + /// Get last preview image in TIFF format + /// + /// + /// + /// + virtual void preview_image_tiff_get(Pistache::Http::ResponseWriter &response) = 0; + /// + /// Get JPEG rendering configuration + /// + /// + /// Can be done anytime + /// + virtual void preview_jpeg_settings_get(Pistache::Http::ResponseWriter &response) = 0; + /// + /// Configure JPEG rendering of preview images + /// + /// + /// Can be done at any state of the detector + /// + /// (optional) + virtual void preview_jpeg_settings_put(const org::openapitools::server::model::Preview_settings &previewSettings, Pistache::Http::ResponseWriter &response) = 0; + /// /// Start detector /// /// diff --git a/broker/gen/model/Broker_status.cpp b/broker/gen/model/Broker_status.cpp index 9aab6e4a..732395e8 100644 --- a/broker/gen/model/Broker_status.cpp +++ b/broker/gen/model/Broker_status.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Broker_status.h b/broker/gen/model/Broker_status.h index 1f32a14a..944a6fc8 100644 --- a/broker/gen/model/Broker_status.h +++ b/broker/gen/model/Broker_status.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Calibration_statistics_inner.cpp b/broker/gen/model/Calibration_statistics_inner.cpp index 1e250376..099660fb 100644 --- a/broker/gen/model/Calibration_statistics_inner.cpp +++ b/broker/gen/model/Calibration_statistics_inner.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Calibration_statistics_inner.h b/broker/gen/model/Calibration_statistics_inner.h index 0b9dfa96..6c7e3a28 100644 --- a/broker/gen/model/Calibration_statistics_inner.h +++ b/broker/gen/model/Calibration_statistics_inner.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Data_processing_settings.cpp b/broker/gen/model/Data_processing_settings.cpp deleted file mode 100644 index 60c5ae3c..00000000 --- a/broker/gen/model/Data_processing_settings.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/** -* Jungfraujoch -* Jungfraujoch Broker Web API -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ - - -#include "Data_processing_settings.h" -#include "Helpers.h" - -#include - -namespace org::openapitools::server::model -{ - -Data_processing_settings::Data_processing_settings() -{ - m_Signal_to_noise_threshold = 0.0f; - m_Photon_count_threshold = 0L; - m_Min_pix_per_spot = 0L; - m_Max_pix_per_spot = 0L; - m_High_resolution_limit = 0.0f; - m_Low_resolution_limit = 0.0f; - m_Preview_indexed_only = false; - m_Preview_indexed_onlyIsSet = false; - -} - -void Data_processing_settings::validate() const -{ - std::stringstream msg; - if (!validate(msg)) - { - throw org::openapitools::server::helpers::ValidationException(msg.str()); - } -} - -bool Data_processing_settings::validate(std::stringstream& msg) const -{ - return validate(msg, ""); -} - -bool Data_processing_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const -{ - bool success = true; - const std::string _pathPrefix = pathPrefix.empty() ? "Data_processing_settings" : pathPrefix; - - - - /* Signal_to_noise_threshold */ { - const float& value = m_Signal_to_noise_threshold; - const std::string currentValuePath = _pathPrefix + ".signalToNoiseThreshold"; - - - if (value < static_cast(0)) - { - success = false; - msg << currentValuePath << ": must be greater than or equal to 0;"; - } - - } - - - /* Photon_count_threshold */ { - const int64_t& value = m_Photon_count_threshold; - const std::string currentValuePath = _pathPrefix + ".photonCountThreshold"; - - - if (value < 0ll) - { - success = false; - msg << currentValuePath << ": must be greater than or equal to 0;"; - } - - } - - - /* Min_pix_per_spot */ { - const int64_t& value = m_Min_pix_per_spot; - const std::string currentValuePath = _pathPrefix + ".minPixPerSpot"; - - - if (value < 1ll) - { - success = false; - msg << currentValuePath << ": must be greater than or equal to 1;"; - } - - } - - - /* Max_pix_per_spot */ { - const int64_t& value = m_Max_pix_per_spot; - const std::string currentValuePath = _pathPrefix + ".maxPixPerSpot"; - - - if (value < 1ll) - { - success = false; - msg << currentValuePath << ": must be greater than or equal to 1;"; - } - - } - - return success; -} - -bool Data_processing_settings::operator==(const Data_processing_settings& rhs) const -{ - return - - - (getSignalToNoiseThreshold() == rhs.getSignalToNoiseThreshold()) - && - - (getPhotonCountThreshold() == rhs.getPhotonCountThreshold()) - && - - (getMinPixPerSpot() == rhs.getMinPixPerSpot()) - && - - (getMaxPixPerSpot() == rhs.getMaxPixPerSpot()) - && - - (getHighResolutionLimit() == rhs.getHighResolutionLimit()) - && - - (getLowResolutionLimit() == rhs.getLowResolutionLimit()) - && - - - ((!previewIndexedOnlyIsSet() && !rhs.previewIndexedOnlyIsSet()) || (previewIndexedOnlyIsSet() && rhs.previewIndexedOnlyIsSet() && isPreviewIndexedOnly() == rhs.isPreviewIndexedOnly())) - - ; -} - -bool Data_processing_settings::operator!=(const Data_processing_settings& rhs) const -{ - return !(*this == rhs); -} - -void to_json(nlohmann::json& j, const Data_processing_settings& o) -{ - j = nlohmann::json(); - j["signal_to_noise_threshold"] = o.m_Signal_to_noise_threshold; - j["photon_count_threshold"] = o.m_Photon_count_threshold; - j["min_pix_per_spot"] = o.m_Min_pix_per_spot; - j["max_pix_per_spot"] = o.m_Max_pix_per_spot; - j["high_resolution_limit"] = o.m_High_resolution_limit; - j["low_resolution_limit"] = o.m_Low_resolution_limit; - if(o.previewIndexedOnlyIsSet()) - j["preview_indexed_only"] = o.m_Preview_indexed_only; - -} - -void from_json(const nlohmann::json& j, Data_processing_settings& o) -{ - j.at("signal_to_noise_threshold").get_to(o.m_Signal_to_noise_threshold); - j.at("photon_count_threshold").get_to(o.m_Photon_count_threshold); - j.at("min_pix_per_spot").get_to(o.m_Min_pix_per_spot); - j.at("max_pix_per_spot").get_to(o.m_Max_pix_per_spot); - j.at("high_resolution_limit").get_to(o.m_High_resolution_limit); - j.at("low_resolution_limit").get_to(o.m_Low_resolution_limit); - if(j.find("preview_indexed_only") != j.end()) - { - j.at("preview_indexed_only").get_to(o.m_Preview_indexed_only); - o.m_Preview_indexed_onlyIsSet = true; - } - -} - -float Data_processing_settings::getSignalToNoiseThreshold() const -{ - return m_Signal_to_noise_threshold; -} -void Data_processing_settings::setSignalToNoiseThreshold(float const value) -{ - m_Signal_to_noise_threshold = value; -} -int64_t Data_processing_settings::getPhotonCountThreshold() const -{ - return m_Photon_count_threshold; -} -void Data_processing_settings::setPhotonCountThreshold(int64_t const value) -{ - m_Photon_count_threshold = value; -} -int64_t Data_processing_settings::getMinPixPerSpot() const -{ - return m_Min_pix_per_spot; -} -void Data_processing_settings::setMinPixPerSpot(int64_t const value) -{ - m_Min_pix_per_spot = value; -} -int64_t Data_processing_settings::getMaxPixPerSpot() const -{ - return m_Max_pix_per_spot; -} -void Data_processing_settings::setMaxPixPerSpot(int64_t const value) -{ - m_Max_pix_per_spot = value; -} -float Data_processing_settings::getHighResolutionLimit() const -{ - return m_High_resolution_limit; -} -void Data_processing_settings::setHighResolutionLimit(float const value) -{ - m_High_resolution_limit = value; -} -float Data_processing_settings::getLowResolutionLimit() const -{ - return m_Low_resolution_limit; -} -void Data_processing_settings::setLowResolutionLimit(float const value) -{ - m_Low_resolution_limit = value; -} -bool Data_processing_settings::isPreviewIndexedOnly() const -{ - return m_Preview_indexed_only; -} -void Data_processing_settings::setPreviewIndexedOnly(bool const value) -{ - m_Preview_indexed_only = value; - m_Preview_indexed_onlyIsSet = true; -} -bool Data_processing_settings::previewIndexedOnlyIsSet() const -{ - return m_Preview_indexed_onlyIsSet; -} -void Data_processing_settings::unsetPreview_indexed_only() -{ - m_Preview_indexed_onlyIsSet = false; -} - - -} // namespace org::openapitools::server::model - diff --git a/broker/gen/model/Data_processing_settings.h b/broker/gen/model/Data_processing_settings.h deleted file mode 100644 index 0e4a847c..00000000 --- a/broker/gen/model/Data_processing_settings.h +++ /dev/null @@ -1,120 +0,0 @@ -/** -* Jungfraujoch -* Jungfraujoch Broker Web API -* -* The version of the OpenAPI document: 1.0.0 -* -* -* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). -* https://openapi-generator.tech -* Do not edit the class manually. -*/ -/* - * Data_processing_settings.h - * - * - */ - -#ifndef Data_processing_settings_H_ -#define Data_processing_settings_H_ - - -#include - -namespace org::openapitools::server::model -{ - -/// -/// -/// -class Data_processing_settings -{ -public: - Data_processing_settings(); - virtual ~Data_processing_settings() = default; - - - /// - /// Validate the current data in the model. Throws a ValidationException on failure. - /// - void validate() const; - - /// - /// Validate the current data in the model. Returns false on error and writes an error - /// message into the given stringstream. - /// - bool validate(std::stringstream& msg) const; - - /// - /// Helper overload for validate. Used when one model stores another model and calls it's validate. - /// Not meant to be called outside that case. - /// - bool validate(std::stringstream& msg, const std::string& pathPrefix) const; - - bool operator==(const Data_processing_settings& rhs) const; - bool operator!=(const Data_processing_settings& rhs) const; - - ///////////////////////////////////////////// - /// Data_processing_settings members - - /// - /// - /// - float getSignalToNoiseThreshold() const; - void setSignalToNoiseThreshold(float const value); - /// - /// - /// - int64_t getPhotonCountThreshold() const; - void setPhotonCountThreshold(int64_t const value); - /// - /// - /// - int64_t getMinPixPerSpot() const; - void setMinPixPerSpot(int64_t const value); - /// - /// - /// - int64_t getMaxPixPerSpot() const; - void setMaxPixPerSpot(int64_t const value); - /// - /// - /// - float getHighResolutionLimit() const; - void setHighResolutionLimit(float const value); - /// - /// - /// - float getLowResolutionLimit() const; - void setLowResolutionLimit(float const value); - /// - /// - /// - bool isPreviewIndexedOnly() const; - void setPreviewIndexedOnly(bool const value); - bool previewIndexedOnlyIsSet() const; - void unsetPreview_indexed_only(); - - friend void to_json(nlohmann::json& j, const Data_processing_settings& o); - friend void from_json(const nlohmann::json& j, Data_processing_settings& o); -protected: - float m_Signal_to_noise_threshold; - - int64_t m_Photon_count_threshold; - - int64_t m_Min_pix_per_spot; - - int64_t m_Max_pix_per_spot; - - float m_High_resolution_limit; - - float m_Low_resolution_limit; - - bool m_Preview_indexed_only; - bool m_Preview_indexed_onlyIsSet; - -}; - -} // namespace org::openapitools::server::model - -#endif /* Data_processing_settings_H_ */ diff --git a/broker/gen/model/Dataset_settings.cpp b/broker/gen/model/Dataset_settings.cpp index 57f8c2f7..50461e1a 100644 --- a/broker/gen/model/Dataset_settings.cpp +++ b/broker/gen/model/Dataset_settings.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Dataset_settings.h b/broker/gen/model/Dataset_settings.h index b977c6e6..389fc686 100644 --- a/broker/gen/model/Dataset_settings.h +++ b/broker/gen/model/Dataset_settings.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Dataset_settings_roi_sum_area.cpp b/broker/gen/model/Dataset_settings_roi_sum_area.cpp index 5f4256e7..a0e81811 100644 --- a/broker/gen/model/Dataset_settings_roi_sum_area.cpp +++ b/broker/gen/model/Dataset_settings_roi_sum_area.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Dataset_settings_roi_sum_area.h b/broker/gen/model/Dataset_settings_roi_sum_area.h index 79041795..c7fda428 100644 --- a/broker/gen/model/Dataset_settings_roi_sum_area.h +++ b/broker/gen/model/Dataset_settings_roi_sum_area.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Dataset_settings_unit_cell.cpp b/broker/gen/model/Dataset_settings_unit_cell.cpp index 14633d8d..b051bb7c 100644 --- a/broker/gen/model/Dataset_settings_unit_cell.cpp +++ b/broker/gen/model/Dataset_settings_unit_cell.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Dataset_settings_unit_cell.h b/broker/gen/model/Dataset_settings_unit_cell.h index 47c3db25..c98f75f9 100644 --- a/broker/gen/model/Dataset_settings_unit_cell.h +++ b/broker/gen/model/Dataset_settings_unit_cell.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Detector_list.cpp b/broker/gen/model/Detector_list.cpp index 1ba6a3b8..0309926e 100644 --- a/broker/gen/model/Detector_list.cpp +++ b/broker/gen/model/Detector_list.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Detector_list.h b/broker/gen/model/Detector_list.h index cb1b7a39..bfbff8d7 100644 --- a/broker/gen/model/Detector_list.h +++ b/broker/gen/model/Detector_list.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Detector_list_detectors_inner.cpp b/broker/gen/model/Detector_list_detectors_inner.cpp index 99e184c3..8010177e 100644 --- a/broker/gen/model/Detector_list_detectors_inner.cpp +++ b/broker/gen/model/Detector_list_detectors_inner.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Detector_list_detectors_inner.h b/broker/gen/model/Detector_list_detectors_inner.h index f9278166..859f4736 100644 --- a/broker/gen/model/Detector_list_detectors_inner.h +++ b/broker/gen/model/Detector_list_detectors_inner.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Detector_selection.cpp b/broker/gen/model/Detector_selection.cpp index 048d72a7..d0b53cd8 100644 --- a/broker/gen/model/Detector_selection.cpp +++ b/broker/gen/model/Detector_selection.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Detector_selection.h b/broker/gen/model/Detector_selection.h index 93b71da6..198b39ed 100644 --- a/broker/gen/model/Detector_selection.h +++ b/broker/gen/model/Detector_selection.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Detector_settings.cpp b/broker/gen/model/Detector_settings.cpp index 2c4190f9..7d5f43b0 100644 --- a/broker/gen/model/Detector_settings.cpp +++ b/broker/gen/model/Detector_settings.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -38,6 +38,8 @@ Detector_settings::Detector_settings() m_Pedestal_g2_framesIsSet = false; m_Storage_cell_delay_ns = 0L; m_Storage_cell_delay_nsIsSet = false; + m_Detector_trigger_delay_ns = 0L; + m_Detector_trigger_delay_nsIsSet = false; m_Fixed_gain_g1 = false; m_Fixed_gain_g1IsSet = false; m_Use_gain_hg0 = false; @@ -139,7 +141,7 @@ bool Detector_settings::validate(std::stringstream& msg, const std::string& path } } - + return success; } @@ -176,6 +178,9 @@ bool Detector_settings::operator==(const Detector_settings& rhs) const ((!storageCellDelayNsIsSet() && !rhs.storageCellDelayNsIsSet()) || (storageCellDelayNsIsSet() && rhs.storageCellDelayNsIsSet() && getStorageCellDelayNs() == rhs.getStorageCellDelayNs())) && + ((!detectorTriggerDelayNsIsSet() && !rhs.detectorTriggerDelayNsIsSet()) || (detectorTriggerDelayNsIsSet() && rhs.detectorTriggerDelayNsIsSet() && getDetectorTriggerDelayNs() == rhs.getDetectorTriggerDelayNs())) && + + ((!fixedGainG1IsSet() && !rhs.fixedGainG1IsSet()) || (fixedGainG1IsSet() && rhs.fixedGainG1IsSet() && isFixedGainG1() == rhs.isFixedGainG1())) && @@ -209,6 +214,8 @@ void to_json(nlohmann::json& j, const Detector_settings& o) j["pedestal_g2_frames"] = o.m_Pedestal_g2_frames; if(o.storageCellDelayNsIsSet()) j["storage_cell_delay_ns"] = o.m_Storage_cell_delay_ns; + if(o.detectorTriggerDelayNsIsSet()) + j["detector_trigger_delay_ns"] = o.m_Detector_trigger_delay_ns; if(o.fixedGainG1IsSet()) j["fixed_gain_g1"] = o.m_Fixed_gain_g1; if(o.useGainHg0IsSet()) @@ -259,6 +266,11 @@ void from_json(const nlohmann::json& j, Detector_settings& o) j.at("storage_cell_delay_ns").get_to(o.m_Storage_cell_delay_ns); o.m_Storage_cell_delay_nsIsSet = true; } + if(j.find("detector_trigger_delay_ns") != j.end()) + { + j.at("detector_trigger_delay_ns").get_to(o.m_Detector_trigger_delay_ns); + o.m_Detector_trigger_delay_nsIsSet = true; + } if(j.find("fixed_gain_g1") != j.end()) { j.at("fixed_gain_g1").get_to(o.m_Fixed_gain_g1); @@ -416,6 +428,23 @@ void Detector_settings::unsetStorage_cell_delay_ns() { m_Storage_cell_delay_nsIsSet = false; } +int64_t Detector_settings::getDetectorTriggerDelayNs() const +{ + return m_Detector_trigger_delay_ns; +} +void Detector_settings::setDetectorTriggerDelayNs(int64_t const value) +{ + m_Detector_trigger_delay_ns = value; + m_Detector_trigger_delay_nsIsSet = true; +} +bool Detector_settings::detectorTriggerDelayNsIsSet() const +{ + return m_Detector_trigger_delay_nsIsSet; +} +void Detector_settings::unsetDetector_trigger_delay_ns() +{ + m_Detector_trigger_delay_nsIsSet = false; +} bool Detector_settings::isFixedGainG1() const { return m_Fixed_gain_g1; diff --git a/broker/gen/model/Detector_settings.h b/broker/gen/model/Detector_settings.h index 59bc6fe9..d8daf9fd 100644 --- a/broker/gen/model/Detector_settings.h +++ b/broker/gen/model/Detector_settings.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -119,6 +119,13 @@ public: bool storageCellDelayNsIsSet() const; void unsetStorage_cell_delay_ns(); /// + /// Delay between TTL trigger and acquisition start + /// + int64_t getDetectorTriggerDelayNs() const; + void setDetectorTriggerDelayNs(int64_t const value); + bool detectorTriggerDelayNsIsSet() const; + void unsetDetector_trigger_delay_ns(); + /// /// Fix gain to G1 (can be useful for storage cells) /// bool isFixedGainG1() const; @@ -154,6 +161,8 @@ protected: bool m_Pedestal_g2_framesIsSet; int64_t m_Storage_cell_delay_ns; bool m_Storage_cell_delay_nsIsSet; + int64_t m_Detector_trigger_delay_ns; + bool m_Detector_trigger_delay_nsIsSet; bool m_Fixed_gain_g1; bool m_Fixed_gain_g1IsSet; bool m_Use_gain_hg0; diff --git a/broker/gen/model/Detector_status.cpp b/broker/gen/model/Detector_status.cpp new file mode 100644 index 00000000..7a851d81 --- /dev/null +++ b/broker/gen/model/Detector_status.cpp @@ -0,0 +1,242 @@ +/** +* 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 "Detector_status.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Detector_status::Detector_status() +{ + m_State = ""; + m_StateIsSet = false; + m_Powerchip = ""; + m_PowerchipIsSet = false; + m_Server_version = ""; + m_Server_versionIsSet = false; + m_Number_of_triggers_left = 0L; + m_Number_of_triggers_leftIsSet = false; + m_Fpga_temp_degCIsSet = false; + +} + +void Detector_status::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Detector_status::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Detector_status::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Detector_status" : pathPrefix; + + + if (fpgaTempDegCIsSet()) + { + const std::vector& value = m_Fpga_temp_degC; + const std::string currentValuePath = _pathPrefix + ".fpgaTempDegC"; + + + { // 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++; + } + } + + } + + return success; +} + +bool Detector_status::operator==(const Detector_status& rhs) const +{ + return + + + + ((!stateIsSet() && !rhs.stateIsSet()) || (stateIsSet() && rhs.stateIsSet() && getState() == rhs.getState())) && + + + ((!powerchipIsSet() && !rhs.powerchipIsSet()) || (powerchipIsSet() && rhs.powerchipIsSet() && getPowerchip() == rhs.getPowerchip())) && + + + ((!serverVersionIsSet() && !rhs.serverVersionIsSet()) || (serverVersionIsSet() && rhs.serverVersionIsSet() && getServerVersion() == rhs.getServerVersion())) && + + + ((!numberOfTriggersLeftIsSet() && !rhs.numberOfTriggersLeftIsSet()) || (numberOfTriggersLeftIsSet() && rhs.numberOfTriggersLeftIsSet() && getNumberOfTriggersLeft() == rhs.getNumberOfTriggersLeft())) && + + + ((!fpgaTempDegCIsSet() && !rhs.fpgaTempDegCIsSet()) || (fpgaTempDegCIsSet() && rhs.fpgaTempDegCIsSet() && getFpgaTempDegC() == rhs.getFpgaTempDegC())) + + ; +} + +bool Detector_status::operator!=(const Detector_status& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Detector_status& o) +{ + j = nlohmann::json(); + if(o.stateIsSet()) + j["state"] = o.m_State; + if(o.powerchipIsSet()) + j["powerchip"] = o.m_Powerchip; + if(o.serverVersionIsSet()) + j["server_version"] = o.m_Server_version; + if(o.numberOfTriggersLeftIsSet()) + j["number_of_triggers_left"] = o.m_Number_of_triggers_left; + if(o.fpgaTempDegCIsSet() || !o.m_Fpga_temp_degC.empty()) + j["fpga_temp_degC"] = o.m_Fpga_temp_degC; + +} + +void from_json(const nlohmann::json& j, Detector_status& o) +{ + if(j.find("state") != j.end()) + { + j.at("state").get_to(o.m_State); + o.m_StateIsSet = true; + } + if(j.find("powerchip") != j.end()) + { + j.at("powerchip").get_to(o.m_Powerchip); + o.m_PowerchipIsSet = true; + } + if(j.find("server_version") != j.end()) + { + j.at("server_version").get_to(o.m_Server_version); + o.m_Server_versionIsSet = true; + } + if(j.find("number_of_triggers_left") != j.end()) + { + j.at("number_of_triggers_left").get_to(o.m_Number_of_triggers_left); + o.m_Number_of_triggers_leftIsSet = true; + } + if(j.find("fpga_temp_degC") != j.end()) + { + j.at("fpga_temp_degC").get_to(o.m_Fpga_temp_degC); + o.m_Fpga_temp_degCIsSet = true; + } + +} + +std::string Detector_status::getState() const +{ + return m_State; +} +void Detector_status::setState(std::string const& value) +{ + m_State = value; + m_StateIsSet = true; +} +bool Detector_status::stateIsSet() const +{ + return m_StateIsSet; +} +void Detector_status::unsetState() +{ + m_StateIsSet = false; +} +std::string Detector_status::getPowerchip() const +{ + return m_Powerchip; +} +void Detector_status::setPowerchip(std::string const& value) +{ + m_Powerchip = value; + m_PowerchipIsSet = true; +} +bool Detector_status::powerchipIsSet() const +{ + return m_PowerchipIsSet; +} +void Detector_status::unsetPowerchip() +{ + m_PowerchipIsSet = false; +} +std::string Detector_status::getServerVersion() const +{ + return m_Server_version; +} +void Detector_status::setServerVersion(std::string const& value) +{ + m_Server_version = value; + m_Server_versionIsSet = true; +} +bool Detector_status::serverVersionIsSet() const +{ + return m_Server_versionIsSet; +} +void Detector_status::unsetServer_version() +{ + m_Server_versionIsSet = false; +} +int64_t Detector_status::getNumberOfTriggersLeft() const +{ + return m_Number_of_triggers_left; +} +void Detector_status::setNumberOfTriggersLeft(int64_t const value) +{ + m_Number_of_triggers_left = value; + m_Number_of_triggers_leftIsSet = true; +} +bool Detector_status::numberOfTriggersLeftIsSet() const +{ + return m_Number_of_triggers_leftIsSet; +} +void Detector_status::unsetNumber_of_triggers_left() +{ + m_Number_of_triggers_leftIsSet = false; +} +std::vector Detector_status::getFpgaTempDegC() const +{ + return m_Fpga_temp_degC; +} +void Detector_status::setFpgaTempDegC(std::vector const value) +{ + m_Fpga_temp_degC = value; + m_Fpga_temp_degCIsSet = true; +} +bool Detector_status::fpgaTempDegCIsSet() const +{ + return m_Fpga_temp_degCIsSet; +} +void Detector_status::unsetFpga_temp_degC() +{ + m_Fpga_temp_degCIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/broker/gen/model/Detector_status.h b/broker/gen/model/Detector_status.h new file mode 100644 index 00000000..abb9e2e8 --- /dev/null +++ b/broker/gen/model/Detector_status.h @@ -0,0 +1,116 @@ +/** +* 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. +*/ +/* + * Detector_status.h + * + * + */ + +#ifndef Detector_status_H_ +#define Detector_status_H_ + + +#include +#include +#include + +namespace org::openapitools::server::model +{ + +/// +/// +/// +class Detector_status +{ +public: + Detector_status(); + virtual ~Detector_status() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Detector_status& rhs) const; + bool operator!=(const Detector_status& rhs) const; + + ///////////////////////////////////////////// + /// Detector_status members + + /// + /// Current state of the detector + /// + std::string getState() const; + void setState(std::string const& value); + bool stateIsSet() const; + void unsetState(); + /// + /// Power on of ASICs + /// + std::string getPowerchip() const; + void setPowerchip(std::string const& value); + bool powerchipIsSet() const; + void unsetPowerchip(); + /// + /// Detector server (on read-out boards) version + /// + std::string getServerVersion() const; + void setServerVersion(std::string const& value); + bool serverVersionIsSet() const; + void unsetServer_version(); + /// + /// Remaining triggers to the detector (max of all modules) + /// + int64_t getNumberOfTriggersLeft() const; + void setNumberOfTriggersLeft(int64_t const value); + bool numberOfTriggersLeftIsSet() const; + void unsetNumber_of_triggers_left(); + /// + /// Temperature of detector FPGAs + /// + std::vector getFpgaTempDegC() const; + void setFpgaTempDegC(std::vector const value); + bool fpgaTempDegCIsSet() const; + void unsetFpga_temp_degC(); + + 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; + bool m_StateIsSet; + std::string m_Powerchip; + bool m_PowerchipIsSet; + std::string m_Server_version; + bool m_Server_versionIsSet; + int64_t m_Number_of_triggers_left; + bool m_Number_of_triggers_leftIsSet; + std::vector m_Fpga_temp_degC; + bool m_Fpga_temp_degCIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Detector_status_H_ */ diff --git a/broker/gen/model/Error_message.cpp b/broker/gen/model/Error_message.cpp index 116f35d1..41c0cdac 100644 --- a/broker/gen/model/Error_message.cpp +++ b/broker/gen/model/Error_message.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Error_message.h b/broker/gen/model/Error_message.h index cf5d29f7..05f3fbc1 100644 --- a/broker/gen/model/Error_message.h +++ b/broker/gen/model/Error_message.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Helpers.cpp b/broker/gen/model/Helpers.cpp index a6b7658e..506d5fa4 100644 --- a/broker/gen/model/Helpers.cpp +++ b/broker/gen/model/Helpers.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Helpers.h b/broker/gen/model/Helpers.h index 7d3e98db..6ef73eee 100644 --- a/broker/gen/model/Helpers.h +++ b/broker/gen/model/Helpers.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Measurement_statistics.cpp b/broker/gen/model/Measurement_statistics.cpp index 9eb47844..faf5c55a 100644 --- a/broker/gen/model/Measurement_statistics.cpp +++ b/broker/gen/model/Measurement_statistics.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Measurement_statistics.h b/broker/gen/model/Measurement_statistics.h index 70a1fb99..fb6597c1 100644 --- a/broker/gen/model/Measurement_statistics.h +++ b/broker/gen/model/Measurement_statistics.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Plot.cpp b/broker/gen/model/Plot.cpp index a7681a8c..67a241b8 100644 --- a/broker/gen/model/Plot.cpp +++ b/broker/gen/model/Plot.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Plot.h b/broker/gen/model/Plot.h index fb55d6db..67d2a77d 100644 --- a/broker/gen/model/Plot.h +++ b/broker/gen/model/Plot.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Plot_request.cpp b/broker/gen/model/Plot_request.cpp index 689be18d..b347371b 100644 --- a/broker/gen/model/Plot_request.cpp +++ b/broker/gen/model/Plot_request.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Plot_request.h b/broker/gen/model/Plot_request.h index d6cce77d..006ce4fb 100644 --- a/broker/gen/model/Plot_request.h +++ b/broker/gen/model/Plot_request.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Preview_settings.cpp b/broker/gen/model/Preview_settings.cpp new file mode 100644 index 00000000..226bb4b1 --- /dev/null +++ b/broker/gen/model/Preview_settings.cpp @@ -0,0 +1,187 @@ +/** +* 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 "Preview_settings.h" +#include "Helpers.h" + +#include + +namespace org::openapitools::server::model +{ + +Preview_settings::Preview_settings() +{ + m_Saturation = 0L; + m_Show_spots = true; + m_Show_spotsIsSet = false; + m_Jpeg_quality = 0L; + m_Jpeg_qualityIsSet = false; + +} + +void Preview_settings::validate() const +{ + std::stringstream msg; + if (!validate(msg)) + { + throw org::openapitools::server::helpers::ValidationException(msg.str()); + } +} + +bool Preview_settings::validate(std::stringstream& msg) const +{ + return validate(msg, ""); +} + +bool Preview_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const +{ + bool success = true; + const std::string _pathPrefix = pathPrefix.empty() ? "Preview_settings" : pathPrefix; + + + + /* Saturation */ { + const int64_t& value = m_Saturation; + const std::string currentValuePath = _pathPrefix + ".saturation"; + + + if (value < 0ll) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 0;"; + } + if (value > 65535ll) + { + success = false; + msg << currentValuePath << ": must be less than or equal to 65535;"; + } + + } + + if (jpegQualityIsSet()) + { + const int64_t& value = m_Jpeg_quality; + const std::string currentValuePath = _pathPrefix + ".jpegQuality"; + + + if (value < 0ll) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 0;"; + } + if (value > 100ll) + { + success = false; + msg << currentValuePath << ": must be less than or equal to 100;"; + } + + } + + return success; +} + +bool Preview_settings::operator==(const Preview_settings& rhs) const +{ + return + + + (getSaturation() == rhs.getSaturation()) + && + + + ((!showSpotsIsSet() && !rhs.showSpotsIsSet()) || (showSpotsIsSet() && rhs.showSpotsIsSet() && isShowSpots() == rhs.isShowSpots())) && + + + ((!jpegQualityIsSet() && !rhs.jpegQualityIsSet()) || (jpegQualityIsSet() && rhs.jpegQualityIsSet() && getJpegQuality() == rhs.getJpegQuality())) + + ; +} + +bool Preview_settings::operator!=(const Preview_settings& rhs) const +{ + return !(*this == rhs); +} + +void to_json(nlohmann::json& j, const Preview_settings& o) +{ + j = nlohmann::json(); + j["saturation"] = o.m_Saturation; + if(o.showSpotsIsSet()) + j["show_spots"] = o.m_Show_spots; + if(o.jpegQualityIsSet()) + j["jpeg_quality"] = o.m_Jpeg_quality; + +} + +void from_json(const nlohmann::json& j, Preview_settings& o) +{ + j.at("saturation").get_to(o.m_Saturation); + if(j.find("show_spots") != j.end()) + { + j.at("show_spots").get_to(o.m_Show_spots); + o.m_Show_spotsIsSet = true; + } + if(j.find("jpeg_quality") != j.end()) + { + j.at("jpeg_quality").get_to(o.m_Jpeg_quality); + o.m_Jpeg_qualityIsSet = true; + } + +} + +int64_t Preview_settings::getSaturation() const +{ + return m_Saturation; +} +void Preview_settings::setSaturation(int64_t const value) +{ + m_Saturation = value; +} +bool Preview_settings::isShowSpots() const +{ + return m_Show_spots; +} +void Preview_settings::setShowSpots(bool const value) +{ + m_Show_spots = value; + m_Show_spotsIsSet = true; +} +bool Preview_settings::showSpotsIsSet() const +{ + return m_Show_spotsIsSet; +} +void Preview_settings::unsetShow_spots() +{ + m_Show_spotsIsSet = false; +} +int64_t Preview_settings::getJpegQuality() const +{ + return m_Jpeg_quality; +} +void Preview_settings::setJpegQuality(int64_t const value) +{ + m_Jpeg_quality = value; + m_Jpeg_qualityIsSet = true; +} +bool Preview_settings::jpegQualityIsSet() const +{ + return m_Jpeg_qualityIsSet; +} +void Preview_settings::unsetJpeg_quality() +{ + m_Jpeg_qualityIsSet = false; +} + + +} // namespace org::openapitools::server::model + diff --git a/broker/gen/model/Preview_settings.h b/broker/gen/model/Preview_settings.h new file mode 100644 index 00000000..de443621 --- /dev/null +++ b/broker/gen/model/Preview_settings.h @@ -0,0 +1,94 @@ +/** +* 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. +*/ +/* + * Preview_settings.h + * + * Settings for JPEG rendering of preview images + */ + +#ifndef Preview_settings_H_ +#define Preview_settings_H_ + + +#include + +namespace org::openapitools::server::model +{ + +/// +/// Settings for JPEG rendering of preview images +/// +class Preview_settings +{ +public: + Preview_settings(); + virtual ~Preview_settings() = default; + + + /// + /// Validate the current data in the model. Throws a ValidationException on failure. + /// + void validate() const; + + /// + /// Validate the current data in the model. Returns false on error and writes an error + /// message into the given stringstream. + /// + bool validate(std::stringstream& msg) const; + + /// + /// Helper overload for validate. Used when one model stores another model and calls it's validate. + /// Not meant to be called outside that case. + /// + bool validate(std::stringstream& msg, const std::string& pathPrefix) const; + + bool operator==(const Preview_settings& rhs) const; + bool operator!=(const Preview_settings& rhs) const; + + ///////////////////////////////////////////// + /// Preview_settings members + + /// + /// Saturation value to set contrast in the preview image + /// + int64_t getSaturation() const; + void setSaturation(int64_t const value); + /// + /// Show spot finding results on the image + /// + bool isShowSpots() const; + void setShowSpots(bool const value); + bool showSpotsIsSet() const; + void unsetShow_spots(); + /// + /// Quality of JPEG image (100 - highest; 0 - lowest) + /// + int64_t getJpegQuality() const; + void setJpegQuality(int64_t const value); + bool jpegQualityIsSet() const; + void unsetJpeg_quality(); + + 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; + + bool m_Show_spots; + bool m_Show_spotsIsSet; + int64_t m_Jpeg_quality; + bool m_Jpeg_qualityIsSet; + +}; + +} // namespace org::openapitools::server::model + +#endif /* Preview_settings_H_ */ diff --git a/broker/gen/model/Rad_int_settings.cpp b/broker/gen/model/Rad_int_settings.cpp index 3e963a7e..67f80064 100644 --- a/broker/gen/model/Rad_int_settings.cpp +++ b/broker/gen/model/Rad_int_settings.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Rad_int_settings.h b/broker/gen/model/Rad_int_settings.h index 6f70ab75..adc365cf 100644 --- a/broker/gen/model/Rad_int_settings.h +++ b/broker/gen/model/Rad_int_settings.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Radial_integration_plots_inner.cpp b/broker/gen/model/Radial_integration_plots_inner.cpp index 28151e1d..860aae1c 100644 --- a/broker/gen/model/Radial_integration_plots_inner.cpp +++ b/broker/gen/model/Radial_integration_plots_inner.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Radial_integration_plots_inner.h b/broker/gen/model/Radial_integration_plots_inner.h index edbc7705..546cce4d 100644 --- a/broker/gen/model/Radial_integration_plots_inner.h +++ b/broker/gen/model/Radial_integration_plots_inner.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Rotation_axis.cpp b/broker/gen/model/Rotation_axis.cpp index e180df07..b7e4feb6 100644 --- a/broker/gen/model/Rotation_axis.cpp +++ b/broker/gen/model/Rotation_axis.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Rotation_axis.h b/broker/gen/model/Rotation_axis.h index 9de7ba0a..0abca528 100644 --- a/broker/gen/model/Rotation_axis.h +++ b/broker/gen/model/Rotation_axis.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Spot_finding_settings.cpp b/broker/gen/model/Spot_finding_settings.cpp index ac23cb80..b0f4501e 100644 --- a/broker/gen/model/Spot_finding_settings.cpp +++ b/broker/gen/model/Spot_finding_settings.cpp @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/gen/model/Spot_finding_settings.h b/broker/gen/model/Spot_finding_settings.h index 9e1e3519..70f47538 100644 --- a/broker/gen/model/Spot_finding_settings.h +++ b/broker/gen/model/Spot_finding_settings.h @@ -2,7 +2,7 @@ * Jungfraujoch * Jungfraujoch Broker Web API * -* The version of the OpenAPI document: 1.0.0 +* The version of the OpenAPI document: 1.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index eaed6961..234cc2a0 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -2,7 +2,7 @@ openapi: 3.0.3 info: title: Jungfraujoch description: Jungfraujoch Broker Web API - version: 1.0.0 + version: 1.0.1 components: schemas: rotation_axis: @@ -209,6 +209,43 @@ components: type: number format: float example: 90 + detector_status: + type: object + required: + - state + - powerchip + - server_version + - number_of_triggers_left + - fpga_temp_degC + properties: + state: + type: string + description: Current state of the detector + enum: + - Idle + - Waiting + - Busy + - Error + powerchip: + type: string + description: Power on of ASICs + enum: + - On + - Off + - Partial + server_version: + type: string + description: Detector server (on read-out boards) version + number_of_triggers_left: + type: integer + format: int64 + description: Remaining triggers to the detector (max of all modules) + fpga_temp_degC: + type: array + description: Temperature of detector FPGAs + items: + type: integer + format: int64 detector_settings: type: object required: @@ -253,6 +290,10 @@ components: type: integer format: int64 description: Delay between two storage cells + detector_trigger_delay_ns: + type: integer + format: int64 + description: Delay between TTL trigger and acquisition start fixed_gain_g1: type: boolean default: false @@ -526,6 +567,29 @@ components: masked_pixels: type: integer format: int64 + preview_settings: + type: object + description: "Settings for JPEG rendering of preview images" + required: + - saturation + properties: + saturation: + type: integer + format: int64 + minimum: 0 + maximum: 65535 + description: "Saturation value to set contrast in the preview image" + show_spots: + type: boolean + default: true + description: "Show spot finding results on the image" + jpeg_quality: + type: integer + description: "Quality of JPEG image (100 - highest; 0 - lowest)" + format: int64 + minimum: 0 + maximum: 100 + error_message: type: object required: @@ -769,7 +833,7 @@ paths: schema: $ref: '#/components/schemas/error_message' get: - summary: Get data processing configuration + summary: Get radial integration configuration description: Can be done anytime responses: "200": @@ -828,6 +892,27 @@ paths: application/json: schema: $ref: '#/components/schemas/broker_status' + /detector/status: + get: + summary: Get detector status + description: Status of the JUNGFRAU detector + responses: + "200": + description: Everything OK + content: + application/json: + schema: + $ref: '#/components/schemas/detector_status' + "404": + description: Running in "simulator" mode - no detector present + "500": + description: Error encountered when trying to read status + content: + text/plain: + schema: + type: string + description: Exception error + /plot/bkg_estimate: post: summary: Generate background estimate plot @@ -1093,3 +1178,78 @@ paths: application/json: schema: $ref: '#/components/schemas/calibration_statistics' + /preview/image.jpeg: + get: + summary: Get last preview image in JPEG format + responses: + "200": + description: Preview image + content: + image/jpeg: + schema: + type: string + format: binary + "404": + description: No preview image recorded so far + /preview/jpeg_settings: + put: + summary: Configure JPEG rendering of preview images + description: Can be done at any state of the detector + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/preview_settings' + responses: + "200": + description: Everything OK + "400": + description: Input parsing or validation error + content: + text/plain: + schema: + type: string + description: Exception error + "500": + description: Error within Jungfraujoch code - see output message. + content: + application/json: + schema: + $ref: '#/components/schemas/error_message' + get: + summary: Get JPEG rendering configuration + description: Can be done anytime + responses: + "200": + description: Everything OK + content: + application/json: + schema: + $ref: '#/components/schemas/preview_settings' + /preview/image.tiff: + get: + summary: Get last preview image in TIFF format + responses: + "200": + description: Preview image + content: + image/tiff: + schema: + type: string + format: binary + "404": + description: No preview image recorded so far + /preview/calibration.tiff: + get: + summary: Get last preview image in TIFF format for calibration with PyFAI/Dioptas + description: Image is reduced to unsigned 16-bit images, all bad pixels are set to 65535 and image is mirrored in vertical direction + responses: + "200": + description: Preview image + content: + image/tiff: + schema: + type: string + format: binary + "404": + description: No preview image recorded so far \ No newline at end of file diff --git a/broker/redoc-static.html b/broker/redoc-static.html index c0c7cb39..802b3a84 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -12,336 +12,336 @@ margin: 0; } - -

Jungfraujoch (1.0.0)

Download OpenAPI specification:Download

Jungfraujoch Broker Web API

-

Initialize detector and data acquisition

Jungfraujoch (1.0.1)

Download OpenAPI specification:Download

Jungfraujoch Broker Web API

+

Initialize detector and data acquisition

Should be used in two cases:

+" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

Should be used in two cases:

  • Detector is in Inactive state
  • Detector is in Error state @@ -381,271 +381,313 @@ During operation of the detector it is recommended to use the POST /pedest If storage cells are used, the execution time might be few minutes.

This is async function - one needs to use POST /wait_till_done to ensure operation is done.

-

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Collect dark current for the detector

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Collect dark current for the detector

Updates calibration of the JUNGFRAU detector. Must be in Idle state.

+" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

Updates calibration of the JUNGFRAU detector. Must be in Idle state.

X-ray shutter must be closed. Recommended to run once per hour for long integration times (> 100 us).

This is async function - one needs to use POST /wait_till_done to ensure operation is done.

-

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Start detector

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Start detector

Start data acquisition. +" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

Start data acquisition. Detector must be in Idle state. Doesn't run calibration procedure. This is async function - one needs to use POST /wait_till_done to ensure operation is done.

-
Request Body schema: application/json
images_per_trigger
required
integer <int64> >= 0
ntrigger
integer <int64> >= 1
Default: 1
summation
integer <int64> [ 1 .. 256 ]
Default: 1
beam_x_pxl
required
number <float>
Request Body schema: application/json
images_per_trigger
required
integer <int64> >= 0
ntrigger
integer <int64> >= 1
Default: 1
summation
integer <int64> [ 1 .. 256 ]
Default: 1
beam_x_pxl
required
number <float>

/entry/detector/beam_center_x in NXmx +" class="sc-iKOmoZ sc-cCzLxZ WVNwY jaVotg">

/entry/detector/beam_center_x in NXmx Beam center in X direction [pixels]

-
beam_y_pxl
required
number <float>
beam_y_pxl
required
number <float>

/entry/detector/beam_center_y in NXmx +" class="sc-iKOmoZ sc-cCzLxZ WVNwY jaVotg">

/entry/detector/beam_center_y in NXmx Beam center in X direction [pixels]

-
detector_distance_mm
required
number <float> >= 0

/entry/detector/distance in NXmx Detector distance [mm]

-
photon_energy_keV
required
number <float> >= 0
detector_distance_mm
required
number <float> >= 0

/entry/detector/distance in NXmx Detector distance [mm]

+
photon_energy_keV
required
number <float> >= 0

Used to calculate /entry/beam/incident_wavelength in NXmx +" class="sc-iKOmoZ sc-cCzLxZ WVNwY jaVotg">

Used to calculate /entry/beam/incident_wavelength in NXmx Incident photon energy in keV

-
file_prefix
string
Default: ""

Prefix for filenames. If left empty, no file will be saved.

-
data_file_count
integer <int64> >= 1
Default: 1

Number of round-robin data files

-
space_group_number
integer <int64> [ 0 .. 194 ]
Default: 0
sample_name
required
string
file_prefix
string
Default: ""

Prefix for filenames. If left empty, no file will be saved.

+
data_file_count
integer <int64> >= 1
Default: 1

Number of round-robin data files

+
space_group_number
integer <int64> [ 0 .. 194 ]
Default: 0
sample_name
required
string

/entry/sample/name in NXmx +" class="sc-iKOmoZ sc-cCzLxZ WVNwY jaVotg">

/entry/sample/name in NXmx Sample name

-
save_calibration
boolean
Default: false

Save pedestal together with the dataset

-
fpga_output
string
Default: "auto"
Enum: "auto" "int32" "int16" "uint32" "uint16"

FPGA output data type

-
compression
string
Default: "bslz4"
Enum: "bslz4" "bszstd" "bszstd_rle" "none"
total_flux
number <float>
save_calibration
boolean
Default: false

Save pedestal together with the dataset

+
fpga_output
string
Default: "auto"
Enum: "auto" "int32" "int16" "uint32" "uint16"

FPGA output data type

+
compression
string
Default: "bslz4"
Enum: "bslz4" "bszstd" "bszstd_rle" "none"
total_flux
number <float>

/entry/beam/total_flux in NXmx +" class="sc-iKOmoZ sc-cCzLxZ WVNwY jaVotg">

/entry/beam/total_flux in NXmx Flux incident on beam plane in photons per second. In other words this is the flux integrated over area. [photons/s]

-
transmission
number <float> [ 0 .. 1 ]
transmission
number <float> [ 0 .. 1 ]

/entry/instrument/attenuator/attenuator_transmission +" class="sc-iKOmoZ sc-cCzLxZ WVNwY jaVotg">

/entry/instrument/attenuator/attenuator_transmission Transmission of attenuator (filter) [no units]

-
object (rotation_axis)

Definition of a crystal rotation axis

-
header_appendix
string

Header appendix, added as user_data to start message

-
image_appendix
string

Image appendix, added as user_data to image message

-
object

Rectangle for ROI summation

-
object

Units of angstrom and degree

-

Responses

Request samples

Content type
application/json
{
  • "images_per_trigger": 0,
  • "ntrigger": 1,
  • "summation": 1,
  • "beam_x_pxl": 0,
  • "beam_y_pxl": 0,
  • "detector_distance_mm": 0,
  • "photon_energy_keV": 0,
  • "file_prefix": "",
  • "data_file_count": 1,
  • "space_group_number": 0,
  • "sample_name": "string",
  • "save_calibration": false,
  • "fpga_output": "auto",
  • "compression": "bslz4",
  • "total_flux": 0,
  • "transmission": 1,
  • "omega": {
    },
  • "header_appendix": "string",
  • "image_appendix": "string",
  • "roi_sum_area": {
    },
  • "unit_cell": {
    }
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Wait for acquisition done

object (rotation_axis)

Definition of a crystal rotation axis

+
header_appendix
string

Header appendix, added as user_data to start message

+
image_appendix
string

Image appendix, added as user_data to image message

+
object

Rectangle for ROI summation

+
object

Units of angstrom and degree

+

Responses

Request samples

Content type
application/json
{
  • "images_per_trigger": 0,
  • "ntrigger": 1,
  • "summation": 1,
  • "beam_x_pxl": 0.1,
  • "beam_y_pxl": 0.1,
  • "detector_distance_mm": 0.1,
  • "photon_energy_keV": 0.1,
  • "file_prefix": "",
  • "data_file_count": 1,
  • "space_group_number": 0,
  • "sample_name": "string",
  • "save_calibration": false,
  • "fpga_output": "auto",
  • "compression": "bslz4",
  • "total_flux": 0.1,
  • "transmission": 1,
  • "omega": {
    },
  • "header_appendix": "string",
  • "image_appendix": "string",
  • "roi_sum_area": {
    },
  • "unit_cell": {
    }
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Wait for acquisition done

Block execution of external script till initialization, data collection or pedestal is finished. +" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

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.

-

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Send soft trigger to the detector

Generate soft trigger

-

Responses

Cancel running data collection

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Send soft trigger to the detector

Generate soft trigger

+

Responses

Cancel running data collection

Command will inform FPGA network card to stop pedestal or data collection at the current stage. +" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

Command will inform FPGA network card to stop pedestal or data collection at the current stage. Any frame that is currently being processed by CPU will be finished and sent to writer. Given the command is making sure to gracefully stop data acquisition and detector, it might take some time to switch back after command finished to Idle state.

If data collection is not running, the command has no effect.

-

Responses

Prepare detector to turn off

Responses

Prepare detector to turn off

Should be in Idle or Error state. +" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

Should be in Idle or Error state. Command deactivates data acquisition and turns off detector high voltage and ASIC. Should be used always before turning off power from the detector.

-

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Change detector configuration

Responses

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Change detector configuration

Detector settings are ones that have effect on calibration, i.e., pedestal has to be collected again after changing these settings. +" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

Detector settings are ones that have effect on calibration, i.e., pedestal has to be collected again after changing these settings. This can only be done when detector is Idle, Error or Inactive states. If detector is in Idle state , pedestal procedure will be executed automatically - there must be no X-rays on the detector during the operation. If detector is in Inactive or Error states, new settings will be saved, but no calibration will be executed.

-
Request Body schema: application/json
frame_time_us
required
integer <int64> >= 450

Interval between consecutive frames.

-
count_time_us
integer <int64>

Integration time of the detector. If not provided count time will be set to maximum value for a given frame time.

-
storage_cell_count
integer <int64> [ 1 .. 16 ]
Default: 1
internal_frame_generator
boolean
Default: false

Use internal frame generator in FPGA instead of getting data from a real detector

-
collect_raw_data
boolean
Default: false

Turn off conversion of pixel read-out to photon count

-
pedestal_g0_frames
integer <int64> >= 0
pedestal_g1_frames
integer <int64> >= 0
pedestal_g2_frames
integer <int64> >= 0
storage_cell_delay_ns
integer <int64>

Delay between two storage cells

-
fixed_gain_g1
boolean
Default: false

Fix gain to G1 (can be useful for storage cells)

-
use_gain_hg0
boolean
Default: false

Use high G0 (for low energy applications)

-

Responses

Request samples

Content type
application/json
{
  • "frame_time_us": 450,
  • "count_time_us": 0,
  • "storage_cell_count": 1,
  • "internal_frame_generator": false,
  • "collect_raw_data": false,
  • "pedestal_g0_frames": 0,
  • "pedestal_g1_frames": 0,
  • "pedestal_g2_frames": 0,
  • "storage_cell_delay_ns": 0,
  • "fixed_gain_g1": false,
  • "use_gain_hg0": false
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get detector configuration

Can be done anytime

-

Responses

Response samples

Content type
application/json
{
  • "frame_time_us": 450,
  • "count_time_us": 0,
  • "storage_cell_count": 1,
  • "internal_frame_generator": false,
  • "collect_raw_data": false,
  • "pedestal_g0_frames": 0,
  • "pedestal_g1_frames": 0,
  • "pedestal_g2_frames": 0,
  • "storage_cell_delay_ns": 0,
  • "fixed_gain_g1": false,
  • "use_gain_hg0": false
}

Configure spot finding

Can be done anytime, also while data collection is running

-
Request Body schema: application/json
signal_to_noise_threshold
required
number <float> >= 0
photon_count_threshold
required
integer <int64> >= 0
min_pix_per_spot
required
integer <int64> >= 1
max_pix_per_spot
required
integer <int64> >= 1
high_resolution_limit
required
number <float>
low_resolution_limit
required
number <float>
preview_indexed_only
boolean
Default: false

Responses

Request samples

Content type
application/json
{
  • "signal_to_noise_threshold": 0,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0,
  • "low_resolution_limit": 0,
  • "preview_indexed_only": false
}

Get data processing configuration

Can be done anytime

-

Responses

Response samples

Content type
application/json
{
  • "signal_to_noise_threshold": 0,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0,
  • "low_resolution_limit": 0,
  • "preview_indexed_only": false
}

Configure radial integration

Can be done when detector is Inactive or Idle

-
Request Body schema: application/json
polarization_factor
number <float> [ -1 .. 1 ]

If polarization factor is provided, than polarization correction is enabled.

-
solid_angle_corr
required
boolean
Default: true

Apply solid angle correction for radial integration

-
high_q_recipA
required
number <float>
low_q_recipA
required
number <float>
q_spacing
required
number <float>

Responses

Request samples

Content type
application/json
{
  • "polarization_factor": -1,
  • "solid_angle_corr": true,
  • "high_q_recipA": 0,
  • "low_q_recipA": 0,
  • "q_spacing": 0
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get data processing configuration

Can be done anytime

-

Responses

Response samples

Content type
application/json
{
  • "polarization_factor": -1,
  • "solid_angle_corr": true,
  • "high_q_recipA": 0,
  • "low_q_recipA": 0,
  • "q_spacing": 0
}

Select detector

Request Body schema: application/json
frame_time_us
required
integer <int64> >= 450

Interval between consecutive frames.

+
count_time_us
integer <int64>

Integration time of the detector. If not provided count time will be set to maximum value for a given frame time.

+
storage_cell_count
integer <int64> [ 1 .. 16 ]
Default: 1
internal_frame_generator
boolean
Default: false

Use internal frame generator in FPGA instead of getting data from a real detector

+
collect_raw_data
boolean
Default: false

Turn off conversion of pixel read-out to photon count

+
pedestal_g0_frames
integer <int64> >= 0
pedestal_g1_frames
integer <int64> >= 0
pedestal_g2_frames
integer <int64> >= 0
storage_cell_delay_ns
integer <int64>

Delay between two storage cells

+
detector_trigger_delay_ns
integer <int64>

Delay between TTL trigger and acquisition start

+
fixed_gain_g1
boolean
Default: false

Fix gain to G1 (can be useful for storage cells)

+
use_gain_hg0
boolean
Default: false

Use high G0 (for low energy applications)

+

Responses

Request samples

Content type
application/json
{
  • "frame_time_us": 450,
  • "count_time_us": 0,
  • "storage_cell_count": 1,
  • "internal_frame_generator": false,
  • "collect_raw_data": false,
  • "pedestal_g0_frames": 0,
  • "pedestal_g1_frames": 0,
  • "pedestal_g2_frames": 0,
  • "storage_cell_delay_ns": 0,
  • "detector_trigger_delay_ns": 0,
  • "fixed_gain_g1": false,
  • "use_gain_hg0": false
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get detector configuration

Can be done anytime

+

Responses

Response samples

Content type
application/json
{
  • "frame_time_us": 450,
  • "count_time_us": 0,
  • "storage_cell_count": 1,
  • "internal_frame_generator": false,
  • "collect_raw_data": false,
  • "pedestal_g0_frames": 0,
  • "pedestal_g1_frames": 0,
  • "pedestal_g2_frames": 0,
  • "storage_cell_delay_ns": 0,
  • "detector_trigger_delay_ns": 0,
  • "fixed_gain_g1": false,
  • "use_gain_hg0": false
}

Configure spot finding

Can be done anytime, also while data collection is running

+
Request Body schema: application/json
signal_to_noise_threshold
required
number <float> >= 0
photon_count_threshold
required
integer <int64> >= 0
min_pix_per_spot
required
integer <int64> >= 1
max_pix_per_spot
required
integer <int64> >= 1
high_resolution_limit
required
number <float>
low_resolution_limit
required
number <float>
preview_indexed_only
boolean
Default: false

Responses

Request samples

Content type
application/json
{
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "preview_indexed_only": false
}

Get data processing configuration

Can be done anytime

+

Responses

Response samples

Content type
application/json
{
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "preview_indexed_only": false
}

Configure radial integration

Can be done when detector is Inactive or Idle

+
Request Body schema: application/json
polarization_factor
number <float> [ -1 .. 1 ]

If polarization factor is provided, than polarization correction is enabled.

+
solid_angle_corr
required
boolean
Default: true

Apply solid angle correction for radial integration

+
high_q_recipA
required
number <float>
low_q_recipA
required
number <float>
q_spacing
required
number <float>

Responses

Request samples

Content type
application/json
{
  • "polarization_factor": -1,
  • "solid_angle_corr": true,
  • "high_q_recipA": 0.1,
  • "low_q_recipA": 0.1,
  • "q_spacing": 0.1
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get radial integration configuration

Can be done anytime

+

Responses

Response samples

Content type
application/json
{
  • "polarization_factor": -1,
  • "solid_angle_corr": true,
  • "high_q_recipA": 0.1,
  • "low_q_recipA": 0.1,
  • "q_spacing": 0.1
}

Select detector

Jungfraujoch allows to control multiple detectors and/or region-of-interests. +" class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS">

Jungfraujoch allows to control multiple detectors and/or region-of-interests. The command allows to choose one detector from the list (ID has to be consistent with one provided by GET response). Changing detector will set detector to Inactive state and will require reinitialization.

-
Request Body schema: application/json
id
required
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "id": 1
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

List available detectors

Configured detectors that can be selected by used

-

Responses

Response samples

Content type
application/json
{
  • "detectors": [
    ],
  • "current_id": 0
}

Get Jungfraujoch status

Status of the data acquisition

-

Responses

Response samples

Content type
application/json
{
  • "state": "Inactive",
  • "progress": 1,
  • "indexing_rate": 0.1
}

Generate background estimate plot

Mean intensity for d = 3 - 5 A per image; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate spot count plot

Number of spots per image; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate indexing rate plot

Image indexing rate; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate saturated pixels plot

Count of saturated pixels per image; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate error pixels plot

Count of error pixels per image; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate strong pixels plot

Count of strong pixels per image (from spot finding); binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate ROI sum plot

Sum of ROI rectangle per image; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate receiver delay plot

Amount of frames the receiver is behind the FPGA for each image - used for internal debugging; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate image collection efficiency plot

Ratio of collected and expected packets per image; binning is configurable

-
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate indexing rate per file

Indexing rate per each of data files; useful for example for time resolved data

-

Responses

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate radial integration profile

Generate average radial integration profile

-

Responses

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate radial integration profiles per file

Radial integration plots for both the whole dataset and per file; useful for time-resolved measurements

-

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get data collection statistics

Results of the last data collection

-

Responses

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "images_expected": 0,
  • "images_collected": 0,
  • "images_sent": 0,
  • "max_image_number_sent": 0,
  • "collection_efficiency": 1,
  • "compression_ratio": 5.3,
  • "cancelled": true,
  • "max_receiver_delay": 0,
  • "indexing_rate": 0,
  • "detector_width": 0,
  • "detector_height": 0,
  • "detector_pixel_depth": 2,
  • "bkg_estimate": 0
}

Get calibration statistics

Statistics are provided for each module/storage cell separately

-

Responses

Response samples

Content type
application/json
[
  • {
    }
]
+
Request Body schema: application/json
id
required
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "id": 1
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

List available detectors

Configured detectors that can be selected by used

+

Responses

Response samples

Content type
application/json
{
  • "detectors": [
    ],
  • "current_id": 0
}

Get Jungfraujoch status

Status of the data acquisition

+

Responses

Response samples

Content type
application/json
{
  • "state": "Inactive",
  • "progress": 1,
  • "indexing_rate": 0.1
}

Get detector status

Status of the JUNGFRAU detector

+

Responses

Response samples

Content type
application/json
{
  • "state": "idle",
  • "powerchip": "on",
  • "server_version": "string",
  • "number_of_triggers_left": 0,
  • "fpga_temp_degC": [
    ]
}

Generate background estimate plot

Mean intensity for d = 3 - 5 A per image; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate spot count plot

Number of spots per image; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate indexing rate plot

Image indexing rate; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate saturated pixels plot

Count of saturated pixels per image; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate error pixels plot

Count of error pixels per image; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate strong pixels plot

Count of strong pixels per image (from spot finding); binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate ROI sum plot

Sum of ROI rectangle per image; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate receiver delay plot

Amount of frames the receiver is behind the FPGA for each image - used for internal debugging; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate image collection efficiency plot

Ratio of collected and expected packets per image; binning is configurable

+
Request Body schema: application/json
binning
integer <int64>

Responses

Request samples

Content type
application/json
{
  • "binning": 0
}

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate indexing rate per file

Indexing rate per each of data files; useful for example for time resolved data

+

Responses

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate radial integration profile

Generate average radial integration profile

+

Responses

Response samples

Content type
application/json
{
  • "x": [
    ],
  • "y": [
    ]
}

Generate radial integration profiles per file

Radial integration plots for both the whole dataset and per file; useful for time-resolved measurements

+

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get data collection statistics

Results of the last data collection

+

Responses

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "images_expected": 0,
  • "images_collected": 0,
  • "images_sent": 0,
  • "max_image_number_sent": 0,
  • "collection_efficiency": 1,
  • "compression_ratio": 5.3,
  • "cancelled": true,
  • "max_receiver_delay": 0,
  • "indexing_rate": 0.1,
  • "detector_width": 0,
  • "detector_height": 0,
  • "detector_pixel_depth": 2,
  • "bkg_estimate": 0.1
}

Get calibration statistics

Statistics are provided for each module/storage cell separately

+

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get last preview image in JPEG format

Responses

Configure JPEG rendering of preview images

Can be done at any state of the detector

+
Request Body schema: application/json
saturation
required
integer <int64> [ 0 .. 65535 ]

Saturation value to set contrast in the preview image

+
show_spots
boolean
Default: true

Show spot finding results on the image

+
jpeg_quality
integer <int64> [ 0 .. 100 ]

Quality of JPEG image (100 - highest; 0 - lowest)

+

Responses

Request samples

Content type
application/json
{
  • "saturation": 65535,
  • "show_spots": true,
  • "jpeg_quality": 100
}

Response samples

Content type
application/json
{
  • "msg": "Detector in wrong state",
  • "reason": "WrongDAQState"
}

Get JPEG rendering configuration

Can be done anytime

+

Responses

Response samples

Content type
application/json
{
  • "saturation": 65535,
  • "show_spots": true,
  • "jpeg_quality": 100
}

Get last preview image in TIFF format

Responses

Get last preview image in TIFF format for calibration with PyFAI/Dioptas

Image is reduced to unsigned 16-bit images, all bad pixels are set to 65535 and image is mirrored in vertical direction

+

Responses