diff --git a/CMakeLists.txt b/CMakeLists.txt index c8520cfa..ddbdb688 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") SET(CMAKE_CXX_STANDARD 20) SET(CMAKE_CXX_STANDARD_REQUIRED True) -SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native") +SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -Wno-deprecated-enum-enum-conversion") SET(CMAKE_C_FLAGS_RELEASE "-O3 -march=native -mtune=native") INCLUDE(CheckLanguage) @@ -61,7 +61,7 @@ ELSE() ADD_SUBDIRECTORY(image_analysis) ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY(tools) - ADD_SUBDIRECTORY(export_images) + ADD_SUBDIRECTORY(preview) ADD_SUBDIRECTORY(resonet) SET(jfjoch_executables jfjoch_broker jfjoch_writer CatchTest CompressionBenchmark HDF5DatasetWriteTest jfjoch_udp_simulator sls_detector_put sls_detector_get) ENDIF() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e591e645..0b88cbe6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,9 +5,10 @@ We actively welcome community contributions, please use a pull request feature. To accept contributions into our codebase we need to have Contributor License Agreement (CLA) with you or your employer. The CLA is necessary because you own the copyright to your changes, even after your contribution becomes part of our codebase. -Since Jungfraujoch is supported by commercialization grant from the Innosuisse agency, we have to allow our commercial partner -(DECTRIS) to use our code without restrictions, and we have to ensure community contributions don't violate the requirement. -The obligations apply **only** if your contributions are merged into PSI codebase and don't apply to your fork of the repository. +Since Jungfraujoch development is supported by commercialization grant from the Innosuisse agency, which allows PSI to carry the development. +In return for the Innosuisse support, we need to allow our commercial partner (DECTRIS) to use the code without restrictions, +and we have to ensure community contributions don't violate this requirement. +The obligation applies only if your contributions are merged into PSI codebase. If you like to make a bigger contribution, like for example new data analysis method beyond what is available currently, please also contact us beforehand to figure out best licensing strategy. diff --git a/broker/CMakeLists.txt b/broker/CMakeLists.txt index 6002e971..b06cde1d 100644 --- a/broker/CMakeLists.txt +++ b/broker/CMakeLists.txt @@ -9,7 +9,7 @@ ADD_LIBRARY(JFJochBroker STATIC JFJochServices.cpp JFJochServices.h JFJochBrokerHttp.cpp JFJochBrokerHttp.h JFJochBrokerParser.cpp JFJochBrokerParser.h) -TARGET_LINK_LIBRARIES(JFJochBroker JFJochReceiver JFJochDetector JFJochCommon JFJochAPI) +TARGET_LINK_LIBRARIES(JFJochBroker JFJochReceiver JFJochDetector JFJochCommon JFJochAPI JFJochPreview) ADD_EXECUTABLE(jfjoch_broker jfjoch_broker.cpp) TARGET_LINK_LIBRARIES(jfjoch_broker JFJochBroker) diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index ea90e5a2..f58c2eff 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -245,15 +245,6 @@ inline org::openapitools::server::model::Plots Convert(const MultiLinePlot& inpu return output; } -inline PlotRequest Convert(const org::openapitools::server::model::Plot_request& request) { - PlotRequest ret{}; - if (request.binningIsSet()) - ret.binning = request.getBinning(); - else - ret.binning = 0; - return ret; -} - inline RadialIntegrationSettings Convert(const org::openapitools::server::model::Rad_int_settings& input) { RadialIntegrationSettings ret{}; ret.solid_angle_correction = input.isSolidAngleCorr(); @@ -410,7 +401,6 @@ inline DatasetSettings Convert(const org::openapitools::server::model::Dataset_s ret.SampleName(input.getSampleName()); ret.HeaderAppendix(input.getHeaderAppendix()); ret.ImageAppendix(input.getImageAppendix()); - ret.SaveCalibration(input.isSaveCalibration()); ret.ImagesPerFile(input.getImagesPerFile()); if (input.dataReductionFactorSerialmxIsSet()) @@ -538,50 +528,16 @@ void JFJochBrokerHttp::config_spot_finding_put( response.send(Pistache::Http::Code::Ok); } -void JFJochBrokerHttp::plot_bkg_estimate_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::BkgEstimate, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - void JFJochBrokerHttp::plot_indexing_rate_per_file_get(Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::IndexingRatePerFile}; - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - -void JFJochBrokerHttp::plot_indexing_rate_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::IndexingRate, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); - + GenericPlot(PlotType::IndexingRatePerTimePoint, 0, response); } void JFJochBrokerHttp::plot_rad_int_get(Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::RadInt}; - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); + GenericPlot(PlotType::RadInt, 0, response); } void JFJochBrokerHttp::plot_rad_int_per_file_get(Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::RadIntPerFile}; - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - -void JFJochBrokerHttp::plot_spot_count_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::SpotCount, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); + GenericPlot(PlotType::RadIntPerTimePoint, 0, response); } void JFJochBrokerHttp::statistics_calibration_get(Pistache::Http::ResponseWriter &response) { @@ -655,61 +611,6 @@ JFJochBrokerHttp &JFJochBrokerHttp::FrontendDirectory(const std::string &directo return *this; } -void JFJochBrokerHttp::plot_error_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ErrorPixels, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - -void JFJochBrokerHttp::plot_strong_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::StrongPixels, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - -void JFJochBrokerHttp::plot_image_collection_efficiency_post( - const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ImageCollectionEfficiency, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - -void JFJochBrokerHttp::plot_receiver_delay_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ReceiverDelay, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - -void JFJochBrokerHttp::plot_receiver_free_send_buffers_post( - const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ReceiverFreeSendBuf, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - -void JFJochBrokerHttp::plot_roi_sum_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ROISum, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); -} - void JFJochBrokerHttp::detector_status_get(Pistache::Http::ResponseWriter &response) { auto out = state_machine.GetDetectorStatus(); if (out) @@ -753,9 +654,7 @@ void JFJochBrokerHttp::preview_image_tiff_get(Pistache::Http::ResponseWriter &re } void JFJochBrokerHttp::plot_resolution_estimate_histogram_get(Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ResEstimation, .binning = 0}; - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); + GenericPlot(PlotType::ResEstimation, 0, response); } void JFJochBrokerHttp::config_internal_generator_image_put(const Pistache::Rest::Request &request, @@ -809,29 +708,87 @@ void JFJochBrokerHttp::xfel_pulse_id_get(Pistache::Http::ResponseWriter &respons response.send(Pistache::Http::Code::Ok, j.dump(), MIME(Application, Json)); } -void JFJochBrokerHttp::plot_roi_max_count_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ROIMaxCount, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); +void JFJochBrokerHttp::preview_pedestal_tiff_get(const std::optional &gainLevel, + const std::optional &sc, + Pistache::Http::ResponseWriter &response) { + if (!gainLevel) + response.send(Pistache::Http::Code::Bad_Request); + std::string s = state_machine.GetPedestalTIFF(gainLevel.value(), sc ? sc.value() : 0); + 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::GenericPlot(PlotType plot_type, const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + PlotRequest req{.type = plot_type, .binning = 0}; + if (binning) { + if (binning.value() < 0) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, + "Binning must be positive number or zero"); + req.binning = binning.value(); + } auto plot = state_machine.GetPlots(req); ProcessOutput(Convert(plot), response); } -void JFJochBrokerHttp::plot_roi_valid_pixels_post(const org::openapitools::server::model::Plot_request &plotRequest, +void JFJochBrokerHttp::plot_beam_center_drift_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::ROIPixels, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); + GenericPlot(PlotType::IndexingDrift, binning, response); } -void JFJochBrokerHttp::plot_beam_center_drift_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) { - PlotRequest req{.type = PlotType::IndexingDrift, .binning = 0}; - if (plotRequest.binningIsSet()) - req.binning = plotRequest.getBinning(); - auto plot = state_machine.GetPlots(req); - ProcessOutput(Convert(plot), response); +void JFJochBrokerHttp::plot_bkg_estimate_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::BkgEstimate, binning, response); +} + +void JFJochBrokerHttp::plot_error_pixel_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::ErrorPixels, binning, response); +} + +void JFJochBrokerHttp::plot_image_collection_efficiency_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::ImageCollectionEfficiency, binning, response); +} + +void JFJochBrokerHttp::plot_indexing_rate_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::IndexingRate, binning, response); +} + +void JFJochBrokerHttp::plot_receiver_delay_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::ReceiverDelay, binning, response); +} + +void JFJochBrokerHttp::plot_receiver_free_send_buffers_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::ReceiverFreeSendBuf, binning, response); +} + +void JFJochBrokerHttp::plot_roi_max_count_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::ROIMaxCount, binning, response); +} + +void JFJochBrokerHttp::plot_roi_sum_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::ROISum, binning, response); +} + +void JFJochBrokerHttp::plot_roi_valid_pixels_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::ROIPixels, binning, response); +} + +void JFJochBrokerHttp::plot_spot_count_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::SpotCount, binning, response); +} + +void JFJochBrokerHttp::plot_strong_pixel_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) { + GenericPlot(PlotType::StrongPixels, binning, response); } diff --git a/broker/JFJochBrokerHttp.h b/broker/JFJochBrokerHttp.h index aafdc8c7..442b0c93 100644 --- a/broker/JFJochBrokerHttp.h +++ b/broker/JFJochBrokerHttp.h @@ -11,6 +11,7 @@ #include "../common/Logger.h" #include "JFJochStateMachine.h" #include "gen/api/DefaultApi.h" +#include "pistache/include/pistache/http.h" class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { Logger logger{"JFJochBroker"}; @@ -40,47 +41,41 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { void config_spot_finding_put(const org::openapitools::server::model::Spot_finding_settings &spotFindingSettings, Pistache::Http::ResponseWriter &response) override; - void plot_roi_sum_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; + void GenericPlot(PlotType plot_type, + const std::optional &binning, + Pistache::Http::ResponseWriter &response); - void plot_error_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - void plot_strong_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, + void plot_beam_center_drift_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_bkg_estimate_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) override; - - void plot_receiver_free_send_buffers_post(const org::openapitools::server::model::Plot_request &plotRequest, + void plot_error_pixel_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_image_collection_efficiency_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) override; - - void plot_beam_center_drift_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - - void plot_receiver_delay_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - - void plot_image_collection_efficiency_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - - void plot_bkg_estimate_post(const org::openapitools::server::model::Plot_request &plotRequest, + void plot_indexing_rate_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) override; + void plot_receiver_delay_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_receiver_free_send_buffers_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_roi_max_count_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_roi_sum_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_roi_valid_pixels_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_spot_count_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; + void plot_strong_pixel_get(const std::optional &binning, + Pistache::Http::ResponseWriter &response) override; void plot_indexing_rate_per_file_get(Pistache::Http::ResponseWriter &response) override; - void plot_indexing_rate_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - void plot_rad_int_get(Pistache::Http::ResponseWriter &response) override; void plot_rad_int_per_file_get(Pistache::Http::ResponseWriter &response) override; - void plot_spot_count_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - - void plot_roi_max_count_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - - void plot_roi_valid_pixels_post(const org::openapitools::server::model::Plot_request &plotRequest, - Pistache::Http::ResponseWriter &response) override; - void plot_resolution_estimate_histogram_get(Pistache::Http::ResponseWriter &response) override; void statistics_calibration_get(Pistache::Http::ResponseWriter &response) override; @@ -104,6 +99,9 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { void preview_calibration_tiff_get(Pistache::Http::ResponseWriter &response) override; + void preview_pedestal_tiff_get(const std::optional &gainLevel, + const std::optional &sc, + Pistache::Http::ResponseWriter &response) override; void preview_image_jpeg_get(Pistache::Http::ResponseWriter &response) override; void preview_image_jpeg_post(const org::openapitools::server::model::Preview_settings &previewSettings, diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index dd412807..bbe82093 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -3,6 +3,7 @@ #include #include "JFJochStateMachine.h" +#include "../preview/WriteTIFF.h" void ApplyDetectorSettings(DiffractionExperiment& experiment, const DetectorSettings &settings) { auto tmp = experiment; @@ -667,6 +668,20 @@ std::string JFJochStateMachine::GetPreviewTIFF(bool calibration) const { return services.GetPreviewTIFF(calibration); } +std::string JFJochStateMachine::GetPedestalTIFF(size_t gain_level, size_t sc) const { + std::unique_lock ul(m); + + if (state != JFJochState::Idle) + throw WrongDAQStateException ("Pedestal can be only retrieved in Idle state"); + + if ((experiment.GetDetectorSetup().GetDetectorType() == DetectorType::JUNGFRAU) && calibration) { + auto tmp = calibration->GetPedestal(gain_level, sc); + return WriteTIFFToString(tmp.data(), RAW_MODULE_COLS, RAW_MODULE_LINES * experiment.GetModulesNum(), + sizeof(uint16_t), false); + } else + return {}; +} + void JFJochStateMachine::LoadInternalGeneratorImage(const void *data, size_t size, uint64_t image_number) { std::unique_lock ul(m); diff --git a/broker/JFJochStateMachine.h b/broker/JFJochStateMachine.h index 83e318aa..fddb6fbf 100644 --- a/broker/JFJochStateMachine.h +++ b/broker/JFJochStateMachine.h @@ -167,6 +167,7 @@ public: std::string GetPreviewJPEG(const PreviewJPEGSettings& settings) const; std::string GetPreviewTIFF(bool calibration) const; + std::string GetPedestalTIFF(size_t gain_level, size_t sc) const; void LoadInternalGeneratorImage(const void *data, size_t size, uint64_t image_number); diff --git a/broker/gen/api/DefaultApi.cpp b/broker/gen/api/DefaultApi.cpp index 87b9f6ab..299e8723 100644 --- a/broker/gen/api/DefaultApi.cpp +++ b/broker/gen/api/DefaultApi.cpp @@ -47,26 +47,27 @@ void DefaultApi::setupRoutes() { 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/beam_center_drift", Routes::bind(&DefaultApi::plot_beam_center_drift_post_handler, this)); - Routes::Post(*router, base + "/plot/bkg_estimate", Routes::bind(&DefaultApi::plot_bkg_estimate_post_handler, this)); - Routes::Post(*router, base + "/plot/error_pixel", Routes::bind(&DefaultApi::plot_error_pixel_post_handler, this)); - Routes::Post(*router, base + "/plot/image_collection_efficiency", Routes::bind(&DefaultApi::plot_image_collection_efficiency_post_handler, this)); + Routes::Get(*router, base + "/plot/beam_center_drift", Routes::bind(&DefaultApi::plot_beam_center_drift_get_handler, this)); + Routes::Get(*router, base + "/plot/bkg_estimate", Routes::bind(&DefaultApi::plot_bkg_estimate_get_handler, this)); + Routes::Get(*router, base + "/plot/error_pixel", Routes::bind(&DefaultApi::plot_error_pixel_get_handler, this)); + Routes::Get(*router, base + "/plot/image_collection_efficiency", Routes::bind(&DefaultApi::plot_image_collection_efficiency_get_handler, this)); + Routes::Get(*router, base + "/plot/indexing_rate", Routes::bind(&DefaultApi::plot_indexing_rate_get_handler, this)); Routes::Get(*router, base + "/plot/indexing_rate_per_file", Routes::bind(&DefaultApi::plot_indexing_rate_per_file_get_handler, this)); - Routes::Post(*router, base + "/plot/indexing_rate", Routes::bind(&DefaultApi::plot_indexing_rate_post_handler, this)); Routes::Get(*router, base + "/plot/rad_int", Routes::bind(&DefaultApi::plot_rad_int_get_handler, this)); Routes::Get(*router, base + "/plot/rad_int_per_file", Routes::bind(&DefaultApi::plot_rad_int_per_file_get_handler, this)); - Routes::Post(*router, base + "/plot/receiver_delay", Routes::bind(&DefaultApi::plot_receiver_delay_post_handler, this)); - Routes::Post(*router, base + "/plot/receiver_free_send_buffers", Routes::bind(&DefaultApi::plot_receiver_free_send_buffers_post_handler, this)); + Routes::Get(*router, base + "/plot/receiver_delay", Routes::bind(&DefaultApi::plot_receiver_delay_get_handler, this)); + Routes::Get(*router, base + "/plot/receiver_free_send_buffers", Routes::bind(&DefaultApi::plot_receiver_free_send_buffers_get_handler, this)); Routes::Get(*router, base + "/plot/resolution_estimate_histogram", Routes::bind(&DefaultApi::plot_resolution_estimate_histogram_get_handler, this)); - Routes::Post(*router, base + "/plot/roi_max_count", Routes::bind(&DefaultApi::plot_roi_max_count_post_handler, this)); - Routes::Post(*router, base + "/plot/roi_sum", Routes::bind(&DefaultApi::plot_roi_sum_post_handler, this)); - Routes::Post(*router, base + "/plot/roi_valid_pixels", Routes::bind(&DefaultApi::plot_roi_valid_pixels_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 + "/plot/roi_max_count", Routes::bind(&DefaultApi::plot_roi_max_count_get_handler, this)); + Routes::Get(*router, base + "/plot/roi_sum", Routes::bind(&DefaultApi::plot_roi_sum_get_handler, this)); + Routes::Get(*router, base + "/plot/roi_valid_pixels", Routes::bind(&DefaultApi::plot_roi_valid_pixels_get_handler, this)); + Routes::Get(*router, base + "/plot/spot_count", Routes::bind(&DefaultApi::plot_spot_count_get_handler, this)); + Routes::Get(*router, base + "/plot/strong_pixel", Routes::bind(&DefaultApi::plot_strong_pixel_get_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::Post(*router, base + "/preview/image.jpeg", Routes::bind(&DefaultApi::preview_image_jpeg_post_handler, this)); Routes::Get(*router, base + "/preview/image.tiff", Routes::bind(&DefaultApi::preview_image_tiff_get_handler, this)); + Routes::Get(*router, base + "/preview/pedestal.tiff", Routes::bind(&DefaultApi::preview_pedestal_tiff_get_handler, this)); Routes::Get(*router, base + "/roi/box", Routes::bind(&DefaultApi::roi_box_get_handler, this)); Routes::Put(*router, base + "/roi/box", Routes::bind(&DefaultApi::roi_box_put_handler, this)); Routes::Get(*router, base + "/roi/circle", Routes::bind(&DefaultApi::roi_circle_get_handler, this)); @@ -433,25 +434,22 @@ void DefaultApi::pedestal_post_handler(const Pistache::Rest::Request &, Pistache } } -void DefaultApi::plot_beam_center_drift_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_beam_center_drift_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_beam_center_drift_post(plotRequest, response); + this->plot_beam_center_drift_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -466,25 +464,22 @@ void DefaultApi::plot_beam_center_drift_post_handler(const Pistache::Rest::Reque } } -void DefaultApi::plot_bkg_estimate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_bkg_estimate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_bkg_estimate_post(plotRequest, response); + this->plot_bkg_estimate_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -499,25 +494,22 @@ void DefaultApi::plot_bkg_estimate_post_handler(const Pistache::Rest::Request &r } } -void DefaultApi::plot_error_pixel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_error_pixel_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_error_pixel_post(plotRequest, response); + this->plot_error_pixel_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -532,25 +524,52 @@ void DefaultApi::plot_error_pixel_post_handler(const Pistache::Rest::Request &re } } -void DefaultApi::plot_image_collection_efficiency_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_image_collection_efficiency_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } + } try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); + this->plot_image_collection_efficiency_get(binning, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(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::plot_indexing_rate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - this->plot_image_collection_efficiency_post(plotRequest, response); + + + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } + } + + try { + this->plot_indexing_rate_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -584,39 +603,6 @@ void DefaultApi::plot_indexing_rate_per_file_get_handler(const Pistache::Rest::R response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } -} -void DefaultApi::plot_indexing_rate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { - try { - - - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; - } - - try { - this->plot_indexing_rate_post(plotRequest, 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::plot_rad_int_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { @@ -658,25 +644,22 @@ void DefaultApi::plot_rad_int_per_file_get_handler(const Pistache::Rest::Request } } -void DefaultApi::plot_receiver_delay_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_receiver_delay_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_receiver_delay_post(plotRequest, response); + this->plot_receiver_delay_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -691,25 +674,22 @@ void DefaultApi::plot_receiver_delay_post_handler(const Pistache::Rest::Request } } -void DefaultApi::plot_receiver_free_send_buffers_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_receiver_free_send_buffers_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_receiver_free_send_buffers_post(plotRequest, response); + this->plot_receiver_free_send_buffers_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -744,25 +724,22 @@ void DefaultApi::plot_resolution_estimate_histogram_get_handler(const Pistache:: } } -void DefaultApi::plot_roi_max_count_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_roi_max_count_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_roi_max_count_post(plotRequest, response); + this->plot_roi_max_count_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -777,25 +754,22 @@ void DefaultApi::plot_roi_max_count_post_handler(const Pistache::Rest::Request & } } -void DefaultApi::plot_roi_sum_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_roi_sum_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_roi_sum_post(plotRequest, response); + this->plot_roi_sum_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -810,25 +784,22 @@ void DefaultApi::plot_roi_sum_post_handler(const Pistache::Rest::Request &reques } } -void DefaultApi::plot_roi_valid_pixels_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_roi_valid_pixels_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_roi_valid_pixels_post(plotRequest, response); + this->plot_roi_valid_pixels_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -843,25 +814,22 @@ void DefaultApi::plot_roi_valid_pixels_post_handler(const Pistache::Rest::Reques } } -void DefaultApi::plot_spot_count_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_spot_count_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_spot_count_post(plotRequest, response); + this->plot_spot_count_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -876,25 +844,22 @@ void DefaultApi::plot_spot_count_post_handler(const Pistache::Rest::Request &req } } -void DefaultApi::plot_strong_pixel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { +void DefaultApi::plot_strong_pixel_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { - // Getting the body param - - Plot_request plotRequest; - - try { - nlohmann::json::parse(request.body()).get_to(plotRequest); - plotRequest.validate(); - } catch (std::exception &e) { - const std::pair errorInfo = this->handleParsingException(e); - response.send(errorInfo.first, errorInfo.second); - return; + // Getting the query params + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } } - + try { - this->plot_strong_pixel_post(plotRequest, response); + this->plot_strong_pixel_get(binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; @@ -1001,6 +966,44 @@ void DefaultApi::preview_image_tiff_get_handler(const Pistache::Rest::Request &, response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } +} +void DefaultApi::preview_pedestal_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the query params + auto gainLevelQuery = request.query().get("gain_level"); + std::optional gainLevel; + if(gainLevelQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(gainLevelQuery.value(), valueQuery_instance)){ + gainLevel = valueQuery_instance; + } + } + auto scQuery = request.query().get("sc"); + std::optional sc; + if(scQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(scQuery.value(), valueQuery_instance)){ + sc = valueQuery_instance; + } + } + + try { + this->preview_pedestal_tiff_get(gainLevel, sc, 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::roi_box_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) { try { diff --git a/broker/gen/api/DefaultApi.h b/broker/gen/api/DefaultApi.h index e4cc4382..baafba4c 100644 --- a/broker/gen/api/DefaultApi.h +++ b/broker/gen/api/DefaultApi.h @@ -35,7 +35,6 @@ #include "Detector_status.h" #include "Error_message.h" #include "Measurement_statistics.h" -#include "Plot_request.h" #include "Plots.h" #include "Preview_settings.h" #include "Rad_int_settings.h" @@ -72,26 +71,27 @@ private: 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_beam_center_drift_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); - void plot_error_pixel_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void plot_image_collection_efficiency_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_beam_center_drift_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_bkg_estimate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_error_pixel_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_image_collection_efficiency_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_indexing_rate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void plot_indexing_rate_per_file_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void plot_indexing_rate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void plot_rad_int_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void plot_rad_int_per_file_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void plot_receiver_delay_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void plot_receiver_free_send_buffers_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_receiver_delay_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_receiver_free_send_buffers_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void plot_resolution_estimate_histogram_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void plot_roi_max_count_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void plot_roi_sum_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); - void plot_roi_valid_pixels_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 plot_roi_max_count_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_roi_sum_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_roi_valid_pixels_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_spot_count_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); + void plot_strong_pixel_get_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_jpeg_post_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_pedestal_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void roi_box_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void roi_box_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); void roi_circle_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response); @@ -230,32 +230,40 @@ private: /// /// Max count of beam center drift per image; binning is configurable /// - /// (optional) - virtual void plot_beam_center_drift_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_beam_center_drift_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate background estimate plot /// /// /// Mean intensity for d = 3 - 5 A per image; binning is configurable /// - /// (optional) - virtual void plot_bkg_estimate_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_bkg_estimate_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate error pixels plot /// /// /// Count of error (mean) and saturated (mean/max) pixels per image; binning is configurable /// - /// (optional) - virtual void plot_error_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_error_pixel_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate image collection efficiency plot /// /// /// Ratio of collected and expected packets per image; binning is configurable /// - /// (optional) - virtual void plot_image_collection_efficiency_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_image_collection_efficiency_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; + /// + /// Generate indexing rate plot + /// + /// + /// Image indexing rate; binning is configurable + /// + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_indexing_rate_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate indexing rate per file /// @@ -264,14 +272,6 @@ private: /// virtual void plot_indexing_rate_per_file_get(Pistache::Http::ResponseWriter &response) = 0; /// - /// Generate indexing rate plot - /// - /// - /// Image indexing rate; binning is configurable - /// - /// (optional) - virtual void plot_indexing_rate_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; - /// /// Generate radial integration profile /// /// @@ -291,16 +291,16 @@ private: /// /// Amount of frames the receiver is behind the FPGA for each image - used for internal debugging; binning is configurable /// - /// (optional) - virtual void plot_receiver_delay_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_receiver_delay_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate receiver free send buffer plot /// /// /// Amount of send buffers available during frame processing - used for internal debugging; binning is configurable /// - /// (optional) - virtual void plot_receiver_free_send_buffers_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_receiver_free_send_buffers_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate resolution estimate histogram /// @@ -314,40 +314,40 @@ private: /// /// Max count of ROI per image; binning is configurable /// - /// (optional) - virtual void plot_roi_max_count_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_roi_max_count_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate ROI sum plot /// /// /// Sum of ROI rectangle per image; binning is configurable /// - /// (optional) - virtual void plot_roi_sum_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_roi_sum_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate plot of ROI valid pixels /// /// /// Number of pixels within a ROI area; pixels with special values (overload, bad pixel) are excluded; multipixels are counted just once; binning is configurable /// - /// (optional) - virtual void plot_roi_valid_pixels_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_roi_valid_pixels_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate spot count plot /// /// /// Number of spots per image; binning is configurable /// - /// (optional) - virtual void plot_spot_count_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_spot_count_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate strong pixels plot /// /// /// Count of strong pixels per image (from spot finding); binning is configurable /// - /// (optional) - virtual void plot_strong_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void plot_strong_pixel_get(const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Get last preview image in TIFF format for calibration with PyFAI/Dioptas /// @@ -378,6 +378,15 @@ private: /// virtual void preview_image_tiff_get(Pistache::Http::ResponseWriter &response) = 0; /// + /// Get pedestal G0 in TIFF format + /// + /// + /// + /// + /// Gain level (0, 1, 2) + /// Storage cell number (optional, default to 0) + virtual void preview_pedestal_tiff_get(const std::optional &gainLevel, const std::optional &sc, Pistache::Http::ResponseWriter &response) = 0; + /// /// Get box ROIs /// /// diff --git a/broker/gen/model/Dataset_settings.cpp b/broker/gen/model/Dataset_settings.cpp index 751c681d..aa9bc642 100644 --- a/broker/gen/model/Dataset_settings.cpp +++ b/broker/gen/model/Dataset_settings.cpp @@ -38,8 +38,6 @@ Dataset_settings::Dataset_settings() m_Space_group_number = 0L; m_Space_group_numberIsSet = false; m_Sample_name = ""; - m_Save_calibration = false; - m_Save_calibrationIsSet = false; m_Fpga_output = "auto"; m_Fpga_outputIsSet = false; m_Compression = "bslz4"; @@ -188,7 +186,7 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP } } - + if (transmissionIsSet()) { const float& value = m_Transmission; @@ -288,9 +286,6 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const && - ((!saveCalibrationIsSet() && !rhs.saveCalibrationIsSet()) || (saveCalibrationIsSet() && rhs.saveCalibrationIsSet() && isSaveCalibration() == rhs.isSaveCalibration())) && - - ((!fpgaOutputIsSet() && !rhs.fpgaOutputIsSet()) || (fpgaOutputIsSet() && rhs.fpgaOutputIsSet() && getFpgaOutput() == rhs.getFpgaOutput())) && @@ -348,8 +343,6 @@ void to_json(nlohmann::json& j, const Dataset_settings& o) if(o.spaceGroupNumberIsSet()) j["space_group_number"] = o.m_Space_group_number; j["sample_name"] = o.m_Sample_name; - if(o.saveCalibrationIsSet()) - j["save_calibration"] = o.m_Save_calibration; if(o.fpgaOutputIsSet()) j["fpga_output"] = o.m_Fpga_output; if(o.compressionIsSet()) @@ -410,11 +403,6 @@ void from_json(const nlohmann::json& j, Dataset_settings& o) o.m_Space_group_numberIsSet = true; } j.at("sample_name").get_to(o.m_Sample_name); - if(j.find("save_calibration") != j.end()) - { - j.at("save_calibration").get_to(o.m_Save_calibration); - o.m_Save_calibrationIsSet = true; - } if(j.find("fpga_output") != j.end()) { j.at("fpga_output").get_to(o.m_Fpga_output); @@ -610,23 +598,6 @@ void Dataset_settings::setSampleName(std::string const& value) { m_Sample_name = value; } -bool Dataset_settings::isSaveCalibration() const -{ - return m_Save_calibration; -} -void Dataset_settings::setSaveCalibration(bool const value) -{ - m_Save_calibration = value; - m_Save_calibrationIsSet = true; -} -bool Dataset_settings::saveCalibrationIsSet() const -{ - return m_Save_calibrationIsSet; -} -void Dataset_settings::unsetSave_calibration() -{ - m_Save_calibrationIsSet = false; -} std::string Dataset_settings::getFpgaOutput() const { return m_Fpga_output; diff --git a/broker/gen/model/Dataset_settings.h b/broker/gen/model/Dataset_settings.h index 43612a0a..4b44157d 100644 --- a/broker/gen/model/Dataset_settings.h +++ b/broker/gen/model/Dataset_settings.h @@ -128,13 +128,6 @@ public: std::string getSampleName() const; void setSampleName(std::string const& value); /// - /// Save pedestal together with the dataset - /// - bool isSaveCalibration() const; - void setSaveCalibration(bool const value); - bool saveCalibrationIsSet() const; - void unsetSave_calibration(); - /// /// FPGA output data type /// std::string getFpgaOutput() const; @@ -230,8 +223,6 @@ protected: bool m_Space_group_numberIsSet; std::string m_Sample_name; - bool m_Save_calibration; - bool m_Save_calibrationIsSet; std::string m_Fpga_output; bool m_Fpga_outputIsSet; std::string m_Compression; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 38492b4e..af8f831a 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -114,10 +114,6 @@ components: description: | /entry/sample/name in NXmx Sample name - save_calibration: - type: boolean - default: false - description: Save pedestal together with the dataset fpga_output: type: string enum: [ @@ -530,12 +526,6 @@ components: example: 0.10 minimum: 0.0 maximum: 1.0 - plot_request: - type: object - properties: - binning: - type: integer - format: int64 plot: type: object required: @@ -1171,14 +1161,16 @@ paths: schema: $ref: '#/components/schemas/error_message' /plot/bkg_estimate: - post: + get: summary: Generate background estimate plot description: Mean intensity for d = 3 - 5 A per image; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1194,14 +1186,16 @@ paths: type: string description: Exception error /plot/spot_count: - post: + get: summary: Generate spot count plot description: Number of spots per image; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1217,14 +1211,16 @@ paths: type: string description: Exception error /plot/indexing_rate: - post: + get: summary: Generate indexing rate plot description: Image indexing rate; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1240,14 +1236,16 @@ paths: type: string description: Exception error /plot/error_pixel: - post: + get: summary: Generate error pixels plot description: Count of error (mean) and saturated (mean/max) pixels per image; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1263,14 +1261,16 @@ paths: type: string description: Exception error /plot/strong_pixel: - post: + get: summary: Generate strong pixels plot description: Count of strong pixels per image (from spot finding); binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1286,14 +1286,16 @@ paths: type: string description: Exception error /plot/roi_sum: - post: + get: summary: Generate ROI sum plot description: Sum of ROI rectangle per image; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1309,14 +1311,16 @@ paths: type: string description: Exception error /plot/beam_center_drift: - post: + get: summary: Generate plot of beam center drift (from indexing) description: Max count of beam center drift per image; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1333,14 +1337,16 @@ paths: description: Exception error /plot/roi_max_count: - post: + get: summary: Generate plot of ROI max count description: Max count of ROI per image; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1356,14 +1362,16 @@ paths: type: string description: Exception error /plot/roi_valid_pixels: - post: + get: summary: Generate plot of ROI valid pixels description: Number of pixels within a ROI area; pixels with special values (overload, bad pixel) are excluded; multipixels are counted just once; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1379,14 +1387,16 @@ paths: type: string description: Exception error /plot/receiver_delay: - post: + get: summary: Generate receiver delay plot description: Amount of frames the receiver is behind the FPGA for each image - used for internal debugging; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1402,14 +1412,16 @@ paths: type: string description: Exception error /plot/receiver_free_send_buffers: - post: + get: summary: Generate receiver free send buffer plot description: Amount of send buffers available during frame processing - used for internal debugging; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1426,14 +1438,16 @@ paths: description: Exception error /plot/image_collection_efficiency: - post: + get: summary: Generate image collection efficiency plot description: Ratio of collected and expected packets per image; binning is configurable - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/plot_request' + parameters: + - in: query + name: binning + required: false + schema: + type: integer + description: Binning of frames for the plot (0 = default binning) responses: "200": description: Everything OK @@ -1587,3 +1601,28 @@ paths: format: binary "404": description: No preview image recorded so far + /preview/pedestal.tiff: + get: + parameters: + - in: query + name: gain_level + required: true + schema: + type: integer + description: Gain level (0, 1, 2) + - in: query + name: sc + schema: + type: integer + description: Storage cell number + summary: Get pedestal G0 in TIFF format + responses: + "200": + description: Calibration image + content: + image/tiff: + schema: + type: string + format: binary + "404": + description: No calibration recorded so far \ No newline at end of file diff --git a/broker/jfjoch_broker.service b/broker/jfjoch_broker.service deleted file mode 100644 index adc34a72..00000000 --- a/broker/jfjoch_broker.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=jfjoch_broker -After=network.target - -[Service] -ExecStart=/opt/jfjoch/bin/jfjoch_broker /opt/jfjoch/etc/broker.json -Environment=LD_LIBRARY_PATH=/opt/jfjoch/lib64 -KillMode=process -Restart=on-failure - -[Install] -WantedBy=multi-user.target diff --git a/broker/pistache b/broker/pistache index feccbca4..51553b92 160000 --- a/broker/pistache +++ b/broker/pistache @@ -1 +1 @@ -Subproject commit feccbca4f135a7d21edd4f8109917ac089ba162d +Subproject commit 51553b92cc7bb25ac792462722ddd4fae33d14b1 diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 46107175..8468dab6 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -341,7 +341,7 @@ data-styled.g137[id="sc-cMdfCE"]{content:"dvQijr,"}/*!sc*/ -

/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>

Input parsing or validation error

Request samples

Content type
application/json
{
  • "images_per_trigger": 1,
  • "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": "",
  • "images_per_file": 1000,
  • "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",
  • "photon_energy_multiplier": 1,
  • "data_reduction_factor_serialmx": 1,
  • "unit_cell": {
    }
}

Response samples

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

Wait for acquisition done

Request samples

Content type
application/json
{
  • "images_per_trigger": 1,
  • "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": "",
  • "images_per_file": 1000,
  • "space_group_number": 0,
  • "sample_name": "string",
  • "fpga_output": "auto",
  • "compression": "bslz4",
  • "total_flux": 0.1,
  • "transmission": 1,
  • "omega": {
    },
  • "header_appendix": "string",
  • "image_appendix": "string",
  • "photon_energy_multiplier": 1,
  • "data_reduction_factor_serialmx": 1,
  • "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. @@ -645,105 +643,129 @@ Changing detector will set detector to Inactive state and will requ " class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

Input parsing or validation error

Request samples

Content type
application/json
{
  • "rois": [
    ]
}

Response samples

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

Generate background estimate plot

Request samples

Content type
application/json
{
  • "rois": [
    ]
}

Response samples

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

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate spot count plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate indexing rate plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate error pixels plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate error pixels plot

Count of error (mean) and saturated (mean/max) 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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate strong pixels plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate ROI sum plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate plot of beam center drift (from indexing)

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate plot of beam center drift (from indexing)

Max count of beam center drift 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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate plot of ROI max count

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate plot of ROI max count

Max count of ROI 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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate plot of ROI valid pixels

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate plot of ROI valid pixels

Number of pixels within a ROI area; pixels with special values (overload, bad pixel) are excluded; multipixels are counted just once; 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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate receiver delay plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate receiver free send buffer plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate receiver free send buffer plot

Amount of send buffers available during frame processing - 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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate image collection efficiency plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate indexing rate per file

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Generate resolution estimate histogram

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate resolution estimate histogram

Generate histogram of crystal resolutions from 1.0 to 5.0 A based on ML model

Responses

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate radial integration profile

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate radial integration profile

Generate average radial integration profile

Responses

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

Generate radial integration profiles per file

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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
{
  • "title": "string",
  • "plot": [
    ]
}

Get data collection statistics

Response samples

Content type
application/json
{
  • "title": "string",
  • "plot": [
    ]
}

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,
  • "images_discarded_lossy_compression": 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,
  • "beam_center_drift_x_pxl": 0.1,
  • "beam_center_drift_y_pxl": 0.1
}

Get calibration statistics

Response samples

Content type
application/json
{
  • "file_prefix": "string",
  • "images_expected": 0,
  • "images_collected": 0,
  • "images_sent": 0,
  • "images_discarded_lossy_compression": 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,
  • "beam_center_drift_x_pxl": 0.1,
  • "beam_center_drift_y_pxl": 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 using custom settings

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

Response samples

Content type
application/json
[
  • {
    }
]

Get last preview image in JPEG format using custom settings

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

@@ -761,7 +783,7 @@ Changing detector will set detector to Inactive state and will requ " class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

No preview image recorded so far

Request samples

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

Response samples

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

Get last preview image in JPEG format using default settings

Responses

Request samples

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

Response samples

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

Get last preview image in JPEG format using default settings

Responses

+

Get pedestal G0 in TIFF format

query Parameters
gain_level
required
integer

Gain level (0, 1, 2)

+
sc
integer

Storage cell number

+

Responses