Merge branch '2404-fixed-g1' into 'main'

Further enhacements

See merge request jungfraujoch/nextgendcu!52
This commit is contained in:
2024-04-29 14:13:35 +02:00
65 changed files with 808 additions and 850 deletions
+2 -2
View File
@@ -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()
+4 -3
View File
@@ -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.
+1 -1
View File
@@ -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)
+80 -123
View File
@@ -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<int32_t> &gainLevel,
const std::optional<int32_t> &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<int32_t> &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<int32_t> &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<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::BkgEstimate, binning, response);
}
void JFJochBrokerHttp::plot_error_pixel_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ErrorPixels, binning, response);
}
void JFJochBrokerHttp::plot_image_collection_efficiency_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ImageCollectionEfficiency, binning, response);
}
void JFJochBrokerHttp::plot_indexing_rate_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::IndexingRate, binning, response);
}
void JFJochBrokerHttp::plot_receiver_delay_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ReceiverDelay, binning, response);
}
void JFJochBrokerHttp::plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ReceiverFreeSendBuf, binning, response);
}
void JFJochBrokerHttp::plot_roi_max_count_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ROIMaxCount, binning, response);
}
void JFJochBrokerHttp::plot_roi_sum_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ROISum, binning, response);
}
void JFJochBrokerHttp::plot_roi_valid_pixels_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::ROIPixels, binning, response);
}
void JFJochBrokerHttp::plot_spot_count_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::SpotCount, binning, response);
}
void JFJochBrokerHttp::plot_strong_pixel_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) {
GenericPlot(PlotType::StrongPixels, binning, response);
}
+28 -30
View File
@@ -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<int32_t> &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<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_bkg_estimate_get(const std::optional<int32_t> &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<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_image_collection_efficiency_get(const std::optional<int32_t> &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<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_receiver_delay_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_roi_max_count_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_roi_sum_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_roi_valid_pixels_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_spot_count_get(const std::optional<int32_t> &binning,
Pistache::Http::ResponseWriter &response) override;
void plot_strong_pixel_get(const std::optional<int32_t> &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<int32_t> &gainLevel,
const std::optional<int32_t> &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,
+15
View File
@@ -3,6 +3,7 @@
#include <thread>
#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<std::mutex> 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<std::mutex> ul(m);
+1
View File
@@ -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);
+196 -193
View File
@@ -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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<int32_t> 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<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
const std::pair<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
const std::pair<Pistache::Http::Code, std::string> 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<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> 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<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
const std::pair<Pistache::Http::Code, std::string> 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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<Pistache::Http::Code, std::string> errorInfo = this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
// Getting the query params
auto binningQuery = request.query().get("binning");
std::optional<int32_t> 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<Pistache::Http::Code>(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<int32_t> 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<int32_t> 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<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception &e) {
const std::pair<Pistache::Http::Code, std::string> 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 {
+52 -43
View File
@@ -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:
/// <remarks>
/// Max count of beam center drift per image; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_beam_center_drift_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_beam_center_drift_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate background estimate plot
/// </summary>
/// <remarks>
/// Mean intensity for d &#x3D; 3 - 5 A per image; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_bkg_estimate_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_bkg_estimate_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate error pixels plot
/// </summary>
/// <remarks>
/// Count of error (mean) and saturated (mean/max) pixels per image; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_error_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_error_pixel_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate image collection efficiency plot
/// </summary>
/// <remarks>
/// Ratio of collected and expected packets per image; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_image_collection_efficiency_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_image_collection_efficiency_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate indexing rate plot
/// </summary>
/// <remarks>
/// Image indexing rate; binning is configurable
/// </remarks>
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_indexing_rate_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate indexing rate per file
/// </summary>
@@ -264,14 +272,6 @@ private:
/// </remarks>
virtual void plot_indexing_rate_per_file_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate indexing rate plot
/// </summary>
/// <remarks>
/// Image indexing rate; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_indexing_rate_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate radial integration profile
/// </summary>
/// <remarks>
@@ -291,16 +291,16 @@ private:
/// <remarks>
/// Amount of frames the receiver is behind the FPGA for each image - used for internal debugging; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_receiver_delay_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_receiver_delay_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate receiver free send buffer plot
/// </summary>
/// <remarks>
/// Amount of send buffers available during frame processing - used for internal debugging; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_receiver_free_send_buffers_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_receiver_free_send_buffers_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate resolution estimate histogram
/// </summary>
@@ -314,40 +314,40 @@ private:
/// <remarks>
/// Max count of ROI per image; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_roi_max_count_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_roi_max_count_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate ROI sum plot
/// </summary>
/// <remarks>
/// Sum of ROI rectangle per image; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_roi_sum_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_roi_sum_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate plot of ROI valid pixels
/// </summary>
/// <remarks>
/// Number of pixels within a ROI area; pixels with special values (overload, bad pixel) are excluded; multipixels are counted just once; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_roi_valid_pixels_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_roi_valid_pixels_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate spot count plot
/// </summary>
/// <remarks>
/// Number of spots per image; binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_spot_count_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_spot_count_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Generate strong pixels plot
/// </summary>
/// <remarks>
/// Count of strong pixels per image (from spot finding); binning is configurable
/// </remarks>
/// <param name="plotRequest"> (optional)</param>
virtual void plot_strong_pixel_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0;
/// <param name="binning">Binning of frames for the plot (0 &#x3D; default binning) (optional, default to 0)</param>
virtual void plot_strong_pixel_get(const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get last preview image in TIFF format for calibration with PyFAI/Dioptas
/// </summary>
@@ -378,6 +378,15 @@ private:
/// </remarks>
virtual void preview_image_tiff_get(Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get pedestal G0 in TIFF format
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="gainLevel">Gain level (0, 1, 2)</param>
/// <param name="sc">Storage cell number (optional, default to 0)</param>
virtual void preview_pedestal_tiff_get(const std::optional<int32_t> &gainLevel, const std::optional<int32_t> &sc, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Get box ROIs
/// </summary>
/// <remarks>
+1 -30
View File
@@ -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;
-9
View File
@@ -128,13 +128,6 @@ public:
std::string getSampleName() const;
void setSampleName(std::string const& value);
/// <summary>
/// Save pedestal together with the dataset
/// </summary>
bool isSaveCalibration() const;
void setSaveCalibration(bool const value);
bool saveCalibrationIsSet() const;
void unsetSave_calibration();
/// <summary>
/// FPGA output data type
/// </summary>
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;
+121 -82
View File
@@ -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
-12
View File
@@ -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
File diff suppressed because one or more lines are too long
-10
View File
@@ -23,7 +23,6 @@ DatasetSettings::DatasetSettings() {
fpga_pixel_output = FPGAPixelOutput::Auto;
space_group_number = 0; // not set
compression = CompressionAlgorithm::BSHUF_LZ4;
save_calibration = false;
photon_energy_multiplier = 1.0f;
omega_start = 0.0f;
images_per_file = 1000;
@@ -199,11 +198,6 @@ DatasetSettings &DatasetSettings::PhotonEnergyMultiplayer(float input) {
return *this;
}
DatasetSettings &DatasetSettings::SaveCalibration(bool input) {
save_calibration = input;
return *this;
}
DatasetSettings &DatasetSettings::Summation(int64_t input) {
check_min("Summation", input, 1);
check_max("Summation", input, MAX_FPGA_SUMMATION);
@@ -266,10 +260,6 @@ int64_t DatasetSettings::GetSpaceGroupNumber() const {
return space_group_number;
}
bool DatasetSettings::GetSaveCalibration() const {
return save_calibration;
}
int64_t DatasetSettings::GetSummation() const {
return summation;
}
-3
View File
@@ -38,7 +38,6 @@ class DatasetSettings {
std::optional<UnitCell> unit_cell;
int64_t space_group_number;
bool save_calibration;
std::optional<float> total_flux;
std::optional<float> attenuator_transmission;
std::optional<float> omega_step;
@@ -72,7 +71,6 @@ public:
DatasetSettings& HeaderAppendix(const std::string& input);
DatasetSettings& ImageAppendix(const std::string& input);
DatasetSettings& PhotonEnergyMultiplayer(float input);
DatasetSettings& SaveCalibration(bool input);
DatasetSettings& Summation(int64_t input);
DatasetSettings& FPGAOutputMode(FPGAPixelOutput input);
DatasetSettings& ImagesPerFile(int64_t input);
@@ -88,7 +86,6 @@ public:
float GetPhotonEnergyMultiplier() const;
std::optional<UnitCell> GetUnitCell() const;
int64_t GetSpaceGroupNumber() const;
bool GetSaveCalibration() const;
int64_t GetSummation() const;
FPGAPixelOutput GetFPGAOutputMode() const;
std::string GetSampleName() const;
+3 -6
View File
@@ -831,13 +831,10 @@ float DiffractionExperiment::GetPolarizationFactor() const {
return rad_int_polarization_factor;
}
DiffractionExperiment &DiffractionExperiment::SaveCalibration(bool input) {
dataset.SaveCalibration(input);
return *this;
}
bool DiffractionExperiment::GetSaveCalibration() const {
return dataset.GetSaveCalibration();
// Calibration is saved if more than 4 images
// to limit cases were size of the file is determined by the calibration
return (GetImageNum() > 4) && (detector.GetDetectorType() == DetectorType::JUNGFRAU);
}
DiffractionExperiment &DiffractionExperiment::StorageCellDelay(std::chrono::nanoseconds input) {
-1
View File
@@ -167,7 +167,6 @@ public:
DiffractionExperiment& HeaderAppendix(const std::string& input);
DiffractionExperiment& ImageAppendix(const std::string& input);
DiffractionExperiment& PhotonEnergyMultiplayer(float input);
DiffractionExperiment& SaveCalibration(bool input);
DiffractionExperiment& Summation(int64_t input);
DiffractionExperiment& FPGAOutputMode(FPGAPixelOutput input);
DiffractionExperiment& MaxSpotCount(int64_t input);
+1 -1
View File
@@ -7,7 +7,7 @@
#include <cstdint>
#include <string>
enum class PlotType {BkgEstimate, RadInt, RadIntPerFile, SpotCount, IndexingRate, IndexingRatePerFile,
enum class PlotType {BkgEstimate, RadInt, RadIntPerTimePoint, SpotCount, IndexingRate, IndexingRatePerTimePoint,
ErrorPixels, ImageCollectionEfficiency, ReceiverDelay, ReceiverFreeSendBuf, StrongPixels,
ROISum, ROIMaxCount, ROIPixels, IndexingDrift,
ResEstimation};
+3
View File
@@ -14,6 +14,9 @@ ADD_LIBRARY(Compression STATIC
MaxCompressedSize.cpp
MaxCompressedSize.h)
SET(ZSTD_LEGACY_SUPPORT OFF)
SET(ZSTD_MULTITHREAD_SUPPORT OFF)
TARGET_COMPILE_DEFINITIONS(Compression PUBLIC -DZSTD_SUPPORT -DUSE_ZSTD)
TARGET_LINK_LIBRARIES(Compression libzstd_static)
TARGET_INCLUDE_DIRECTORIES(Compression PUBLIC . zstd/lib)
+2 -4
View File
@@ -8,16 +8,14 @@
"pedestal_g0_frames": 2000,
"pedestal_g1_frames": 300,
"pedestal_g2_frames": 300,
"frame_time_us": "1000 us",
"count_time_us": "980 us",
"spot_finding_period_us": "3000 us",
"frame_time_us": "500 us",
"count_time_us": "480 us",
"preview_period_us": "1 s",
"detector_ipv4": "10.10.85.0"
},
"frontend_directory":"/home/jungfrau/nextgendcu/frontend/build",
"numa_policy": "n2g2",
"zmq_image_addr": ["tcp://0.0.0.0:5500", "tcp://0.0.0.0:5501", "tcp://0.0.0.0:5502", "tcp://0.0.0.0:5503"],
"zmq_preview_addr": "tcp://0.0.0.0:5400",
"receiver_threads": 64,
"receiver": {
"type": "pcie",
+1 -2
View File
@@ -8,7 +8,7 @@
"pedestal_g0_frames": 2000,
"pedestal_g1_frames": 300,
"pedestal_g2_frames": 300,
"frame_time_us": "1000 us",
"frame_time_us": "10 ms",
"count_time_us": "10 us",
"preview_period_us": "1 s",
"detector_ipv4": "10.3.30.155",
@@ -17,7 +17,6 @@
"frontend_directory":"/home/jungfrau/nextgendcu/frontend/build",
"numa_policy": "n2g4",
"zmq_image_addr": ["tcp://0.0.0.0:5500"],
"zmq_preview_addr": "tcp://0.0.0.0:5400",
"receiver_threads": 64,
"receiver": {
"type": "pcie",
-2
View File
@@ -10,7 +10,6 @@
"pedestal_g2_frames": 0,
"frame_time_us": "1000 us",
"count_time_us": "980 us",
"spot_finding_period_us": "5 ms",
"preview_period_us": "1 s",
"detector_ipv4": "10.10.85.20",
"internal_frame_generator": true
@@ -21,7 +20,6 @@
},
"frontend_directory": "/home/leonarski_f/nextgendcu/frontend_ui/build/",
"zmq_image_addr": ["tcp://0.0.0.0:5500"],
"zmq_preview_addr": "tcp://0.0.0.0:5400",
"detectors": [
{
"standard_geometry": {
+5
View File
@@ -55,6 +55,7 @@ int main(int argc, char **argv) {
auto fpga_env_data = device.GetDeviceStatus();
auto spot_finder_settings = device.GetSpotFinderParameters();
auto source = device.GetDataSource();
auto config = device.GetConfig();
std::cout << "PCIe/JFJoch card detected " << std::endl;
std::cout << "Git SHA1 " << std::hex << fpga_status.git_sha1 << std::endl;
@@ -134,6 +135,10 @@ int main(int argc, char **argv) {
std::cout << "Frames int. pkt. gen. " << std::dec << cfg.nframes << std::endl;
std::cout << "Pulse ID " << fpga_status.current_pulseid << std::endl;
std::cout << std::endl;
std::cout << "Mode config reg. " << std::bitset<32>(config.mode) << std::endl;
std::cout << "Summation " << config.nsummation + 1 << std::endl;
std::cout << "Energy keV " << config.energy_kev << std::endl;
std::cout << std::endl;
std::cout << "Spot finder settings " << std::endl;
std::cout << "Count threshold " << spot_finder_settings.count_threshold << std::endl;
std::cout << "SNR threshold " << spot_finder_settings.snr_threshold / 4.0f << std::endl;
+1 -1
View File
@@ -460,7 +460,7 @@ namespace {
else if (key == "az_int_profile")
GetCBORFloatArray(value, message.az_int_profile);
else if (key == "indexing_result")
message.indexing_result = GetCBORUInt(value);
message.indexing_result = GetCBORBool(value);
else if (key == "indexing_lattice")
GetCBORFloatArray(value, message.indexing_lattice);
else if (key == "jf_info")
+1 -1
View File
@@ -48,7 +48,7 @@ struct DataMessage {
std::vector<float> az_int_profile;
float bkg_estimate;
uint64_t indexing_result; // 0 - not tried, 1 - tried and failed, 2 - tried and success
bool indexing_result;
std::vector<float> indexing_lattice;
std::optional<float> corr_beam_x_pxl;
std::optional<float> corr_beam_y_pxl;
+1 -1
View File
@@ -83,7 +83,7 @@ See [DECTRIS documentation](https://github.com/dectris/documentation/tree/main/s
| - I | float | intensity (photons) | | |
| - indexed | bool | indexed solution | | |
| az_int_profile | Array(float) | Azimuthal integration results, use az_int_bin_to_q from start message for legend | | |
| indexing_result | uint64 | Indexing result: 0 - failed, 1 - success | | |
| indexing_result | bool | Indexing successful | | |
| indexing_lattice | Array(float * 9) (optional) | Indexing result real lattice; present only if indexed | | |
| xfel_pulse_id | uint64 | Bunch ID (for SwissFEL) | | X |
| xfel_event_code | uint64 | Event code (for SwissFEL) | | X |
@@ -62,35 +62,35 @@ class DataProcessingPlot extends Component<MyProps, MyState> {
getValues() {
switch(this.props.type) {
case PlotType.ERROR_PIXELS:
DefaultService.postPlotErrorPixel({binning: this.props.binning})
DefaultService.getPlotErrorPixel(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.STRONG_PIXELS:
DefaultService.postPlotStrongPixel({binning: this.props.binning})
DefaultService.getPlotStrongPixel(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.COLLECTION_EFFICIENCY:
DefaultService.postPlotImageCollectionEfficiency({binning: this.props.binning})
DefaultService.getPlotImageCollectionEfficiency(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.SPOT_COUNT:
DefaultService.postPlotSpotCount({binning: this.props.binning})
DefaultService.getPlotSpotCount(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.BKG_ESTIMATE:
DefaultService.postPlotBkgEstimate({binning: this.props.binning})
DefaultService.getPlotBkgEstimate(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
@@ -111,35 +111,35 @@ class DataProcessingPlot extends Component<MyProps, MyState> {
});
break;
case PlotType.INDEXING_RATE:
DefaultService.postPlotIndexingRate({binning: this.props.binning})
DefaultService.getPlotIndexingRate(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.RECEIVER_DELAY:
DefaultService.postPlotReceiverDelay({binning: this.props.binning})
DefaultService.getPlotReceiverDelay(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.RECEIVER_FREE_SEND_BUFS:
DefaultService.postPlotReceiverFreeSendBuffers({binning: this.props.binning})
DefaultService.getPlotReceiverFreeSendBuffers(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.ROI_SUM:
DefaultService.postPlotRoiSum({binning: this.props.binning})
DefaultService.getPlotRoiSum(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
});
break;
case PlotType.ROI_MAX_COUNT:
DefaultService.postPlotRoiMaxCount({binning: this.props.binning})
DefaultService.getPlotRoiMaxCount(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
@@ -160,7 +160,7 @@ class DataProcessingPlot extends Component<MyProps, MyState> {
});
break;
case PlotType.BEAM_CENTER_DRIFT:
DefaultService.postPlotBeamCenterDrift({binning: this.props.binning})
DefaultService.getPlotBeamCenterDrift(this.props.binning)
.then(data => this.setState({plots: data, connection_error: false}))
.catch(error => {
this.setState({connection_error: true});
@@ -104,9 +104,9 @@ class DataProcessingPlots extends Component<MyProps, MyState> {
<MenuItem value={11}>ROI area sum</MenuItem>
<MenuItem value={6}>ROI area max count</MenuItem>
<MenuItem value={12}>Crystal resolution histogram</MenuItem>
<MenuItem value={4}>Indexing rate (per file)</MenuItem>
<MenuItem value={4}>Indexing rate (per time point)</MenuItem>
<MenuItem value={14}>Beam center drift (based on indexing)</MenuItem>
<MenuItem value={5}>Azimuthal integration profile (per file)</MenuItem>
<MenuItem value={5}>Azimuthal integration profile (per time point)</MenuItem>
<MenuItem value={8}>Error and saturated pixels</MenuItem>
<MenuItem value={10}>Strong pixels (for spot finding)</MenuItem>
<MenuItem value={7}>Image collection efficiency</MenuItem>
-1
View File
@@ -17,7 +17,6 @@ export { detector_status } from './models/detector_status';
export { error_message } from './models/error_message';
export { measurement_statistics } from './models/measurement_statistics';
export type { plot } from './models/plot';
export type { plot_request } from './models/plot_request';
export type { plots } from './models/plots';
export type { preview_settings } from './models/preview_settings';
export type { rad_int_settings } from './models/rad_int_settings';
@@ -63,10 +63,6 @@ export type dataset_settings = {
*
*/
sample_name: string;
/**
* Save pedestal together with the dataset
*/
save_calibration?: boolean;
/**
* FPGA output data type
*/
@@ -1,9 +0,0 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type plot_request = {
binning?: number;
};
@@ -10,7 +10,6 @@ import type { detector_selection } from '../models/detector_selection';
import type { detector_settings } from '../models/detector_settings';
import type { detector_status } from '../models/detector_status';
import type { measurement_statistics } from '../models/measurement_statistics';
import type { plot_request } from '../models/plot_request';
import type { plots } from '../models/plots';
import type { preview_settings } from '../models/preview_settings';
import type { rad_int_settings } from '../models/rad_int_settings';
@@ -473,18 +472,19 @@ export class DefaultService {
/**
* Generate background estimate plot
* Mean intensity for d = 3 - 5 A per image; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotBkgEstimate(
requestBody?: plot_request,
public static getPlotBkgEstimate(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/bkg_estimate',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -494,18 +494,19 @@ export class DefaultService {
/**
* Generate spot count plot
* Number of spots per image; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotSpotCount(
requestBody?: plot_request,
public static getPlotSpotCount(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/spot_count',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -515,18 +516,19 @@ export class DefaultService {
/**
* Generate indexing rate plot
* Image indexing rate; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotIndexingRate(
requestBody?: plot_request,
public static getPlotIndexingRate(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/indexing_rate',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -536,18 +538,19 @@ export class DefaultService {
/**
* Generate error pixels plot
* Count of error (mean) and saturated (mean/max) pixels per image; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotErrorPixel(
requestBody?: plot_request,
public static getPlotErrorPixel(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/error_pixel',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -557,18 +560,19 @@ export class DefaultService {
/**
* Generate strong pixels plot
* Count of strong pixels per image (from spot finding); binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotStrongPixel(
requestBody?: plot_request,
public static getPlotStrongPixel(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/strong_pixel',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -578,18 +582,19 @@ export class DefaultService {
/**
* Generate ROI sum plot
* Sum of ROI rectangle per image; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotRoiSum(
requestBody?: plot_request,
public static getPlotRoiSum(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/roi_sum',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -599,18 +604,19 @@ export class DefaultService {
/**
* Generate plot of beam center drift (from indexing)
* Max count of beam center drift per image; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotBeamCenterDrift(
requestBody?: plot_request,
public static getPlotBeamCenterDrift(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/beam_center_drift',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -620,18 +626,19 @@ export class DefaultService {
/**
* Generate plot of ROI max count
* Max count of ROI per image; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotRoiMaxCount(
requestBody?: plot_request,
public static getPlotRoiMaxCount(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/roi_max_count',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -641,18 +648,19 @@ export class DefaultService {
/**
* 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
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotRoiValidPixels(
requestBody?: plot_request,
public static getPlotRoiValidPixels(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/roi_valid_pixels',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -662,18 +670,19 @@ export class DefaultService {
/**
* Generate receiver delay plot
* Amount of frames the receiver is behind the FPGA for each image - used for internal debugging; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotReceiverDelay(
requestBody?: plot_request,
public static getPlotReceiverDelay(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/receiver_delay',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -683,18 +692,19 @@ export class DefaultService {
/**
* Generate receiver free send buffer plot
* Amount of send buffers available during frame processing - used for internal debugging; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotReceiverFreeSendBuffers(
requestBody?: plot_request,
public static getPlotReceiverFreeSendBuffers(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/receiver_free_send_buffers',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -704,18 +714,19 @@ export class DefaultService {
/**
* Generate image collection efficiency plot
* Ratio of collected and expected packets per image; binning is configurable
* @param requestBody
* @param binning Binning of frames for the plot (0 = default binning)
* @returns plots Everything OK
* @throws ApiError
*/
public static postPlotImageCollectionEfficiency(
requestBody?: plot_request,
public static getPlotImageCollectionEfficiency(
binning?: number,
): CancelablePromise<plots> {
return __request(OpenAPI, {
method: 'POST',
method: 'GET',
url: '/plot/image_collection_efficiency',
body: requestBody,
mediaType: 'application/json',
query: {
'binning': binning,
},
errors: {
400: `Input parsing or validation error`,
},
@@ -871,4 +882,28 @@ export class DefaultService {
});
}
/**
* Get pedestal G0 in TIFF format
* @param gainLevel Gain level (0, 1, 2)
* @param sc Storage cell number
* @returns binary Calibration image
* @throws ApiError
*/
public static getPreviewPedestalTiff(
gainLevel: number,
sc?: number,
): CancelablePromise<Blob> {
return __request(OpenAPI, {
method: 'GET',
url: '/preview/pedestal.tiff',
query: {
'gain_level': gainLevel,
'sc': sc,
},
errors: {
404: `No calibration recorded so far`,
},
});
}
}
+3 -23
View File
@@ -17,29 +17,9 @@ TARGET_LINK_LIBRARIES(JFJochImageAnalysis JFJochCommon)
TARGET_INCLUDE_DIRECTORIES(JFJochImageAnalysis PUBLIC fast-feedback-indexer/eigen)
IF (CMAKE_CUDA_COMPILER)
TARGET_SOURCES(JFJochImageAnalysis PRIVATE
fast-feedback-indexer/indexer/src/indexer.cpp
fast-feedback-indexer/indexer/src/indexer_gpu.cu
fast-feedback-indexer/indexer/src/log.cpp)
TARGET_SOURCES(JFJochImageAnalysis PUBLIC
fast-feedback-indexer/indexer/src/ffbidx/indexer.h
fast-feedback-indexer/indexer/src/ffbidx/indexer_gpu.h
fast-feedback-indexer/indexer/src/ffbidx/refine.h
fast-feedback-indexer/indexer/src/ffbidx/log.h
fast-feedback-indexer/indexer/src/ffbidx/exception.h)
ADD_CUSTOM_TARGET(version_txt
${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_SOURCE_DIR}/fast-feedback-indexer/indexer/src/version.h.in
-D DST=${CMAKE_CURRENT_SOURCE_DIR}/fast-feedback-indexer/indexer/src/ffbidx/version.h
-P ${CMAKE_CURRENT_SOURCE_DIR}/fast-feedback-indexer/indexer/src/GenerateVersionH.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/fast-feedback-indexer
)
ADD_DEPENDENCIES(JFJochImageAnalysis version_txt)
TARGET_COMPILE_DEFINITIONS(JFJochImageAnalysis PUBLIC -DVECTOR_CANDIDATE_REFINEMENT=1)
TARGET_INCLUDE_DIRECTORIES(JFJochImageAnalysis PUBLIC fast-feedback-indexer/indexer/src/)
TARGET_LINK_LIBRARIES(JFJochImageAnalysis ${CUDART_LIBRARY} ${CMAKE_DL_LIBS} rt)
SET(CMAKE_CUDA_ARCHITECTURES 70 75 80 86 89)
ADD_SUBDIRECTORY(fast-feedback-indexer)
TARGET_LINK_LIBRARIES(JFJochImageAnalysis fast_indexer_static)
ELSE()
MESSAGE(WARNING "CUDA is strongly recommended for image analysis." )
ENDIF()
+3 -2
View File
@@ -38,8 +38,9 @@ std::vector<IndexingResult> IndexerWrapper::Run(const std::vector<Coord> &coord,
// Get best cell
auto id = fast_feedback::refine::best_cell(indexer.oScoreV());
bool indexed = fast_feedback::refine::is_viable_cell(indexer.oCell(id), indexer.Spots(),
indexing_threshold, viable_cell_min_spots);
bool indexed = fast_feedback::refine::is_viable_cell(indexer.oCell(id), indexer.Spots(),
indexing_threshold, viable_cell_min_spots,
false);
// Check if result is viable
if (indexed) {
+15 -11
View File
@@ -61,15 +61,14 @@ void MXAnalyzer::ReadFromCPU(const int16_t *image, const SpotFindingSettings &se
ReadFromFPGA(&output, settings, module_number);
}
bool MXAnalyzer::Process(DataMessage &message, const SpotFindingSettings& settings) {
void MXAnalyzer::Process(DataMessage &message, const SpotFindingSettings& settings) {
message.indexing_result = 0;
if (!find_spots)
return false;
bool indexed = false;
return;
std::vector<DiffractionSpot> spots_out;
FilterSpotsByCount(experiment, spots, spots_out);
spots.clear();
for (const auto &spot: spots_out)
message.spots.push_back(spot);
@@ -82,21 +81,25 @@ bool MXAnalyzer::Process(DataMessage &message, const SpotFindingSettings& settin
auto indexer_result = indexer.Run(recip, settings.indexing_tolerance);
float x_drift = 0.0f, y_drift = 0.0f;
if (!indexer_result.empty()) {
message.indexing_result = 1;
CalculateBeamCenterAndDistance(spots_out,
indexer_result[0],
message);
// identify indexed spots
for (int i = 0; i < recip.size(); i++) {
auto predicted_pos = RecipToDector(experiment, indexer_result[0].predicted_spots[i]);
float x_diff = predicted_pos.first - spots_out[i].RawCoord().x;
float y_diff = predicted_pos.second - spots_out[i].RawCoord().y;
message.spots[i].indexed = (x_diff * x_diff + y_diff * y_diff
< spot_distance_threshold_pxl * spot_distance_threshold_pxl);
}
indexer_result[0].l.Save(message.indexing_lattice);
message.indexing_unit_cell = indexer_result[0].l.GetUnitCell();
}
}
spots.clear();
return indexed;
}
void MXAnalyzer::CalculateBeamCenterAndDistance(const std::vector<DiffractionSpot> &spots,
@@ -125,7 +128,8 @@ void MXAnalyzer::CalculateBeamCenterAndDistance(const std::vector<DiffractionSpo
auto reg_x = regression(spot_x_Sd1_over_Sd3, spot_x_position);
auto reg_y = regression(spot_y_Sd2_over_Sd3, spot_y_position);
message.corr_beam_x_pxl = experiment.GetBeamX_pxl() - reg_x.intercept / experiment.GetPixelSize_mm();
message.corr_beam_y_pxl = experiment.GetBeamY_pxl() - reg_y.intercept / experiment.GetPixelSize_mm();
// Subtract 0.5 pixel, to account for differences in definition of pixel coordinate (center or top-left corner)
message.corr_beam_x_pxl = experiment.GetBeamX_pxl() - reg_x.intercept / experiment.GetPixelSize_mm() - 0.5;
message.corr_beam_y_pxl = experiment.GetBeamY_pxl() - reg_y.intercept / experiment.GetPixelSize_mm() - 0.5;
message.corr_det_dist_mm = experiment.GetDetectorDistance_mm() - (reg_x.slope + reg_y.slope) / 2.0;
}
+2 -2
View File
@@ -13,7 +13,7 @@ class MXAnalyzer {
bool do_indexing = false;
bool find_spots = false;
std::vector<DiffractionSpot> spots;
constexpr static const float spot_distance_threshold = 2.0f * 2.0f;
constexpr static const float spot_distance_threshold_pxl = 2.0f;
public:
explicit MXAnalyzer(const DiffractionExperiment& experiment);
@@ -25,7 +25,7 @@ public:
const SpotFindingSettings& settings,
size_t module_number);
bool Process(DataMessage &message,
void Process(DataMessage &message,
const SpotFindingSettings& settings);
void CalculateBeamCenterAndDistance(const std::vector<DiffractionSpot> &spots,
+1
View File
@@ -3,6 +3,7 @@
#include "JFCalibration.h"
#include <cstring>
#include "../preview/WriteTIFF.h"
JFCalibration::JFCalibration(size_t in_nmodules, size_t in_nstorage_cells) :
nmodules(in_nmodules),
@@ -1,24 +1,25 @@
FIND_PACKAGE(TIFF COMPONENTS CXX REQUIRED)
FIND_PACKAGE(JPEG REQUIRED)
ADD_LIBRARY(JFJochImageExport STATIC
ADD_LIBRARY(JFJochPreview STATIC
WriteTIFF.cpp WriteTIFF.h
WriteJPEG.cpp WriteJPEG.h
PreviewCounter.cpp PreviewCounter.h
PreviewImage.cpp PreviewImage.h)
TARGET_LINK_LIBRARIES(JFJochImageExport PUBLIC JFJochCommon)
TARGET_LINK_LIBRARIES(JFJochPreview PUBLIC JFJochCommon)
IF((EXISTS ${TIFF_INCLUDE_DIR}/tiffio.hxx) AND (EXISTS ${TIFF_INCLUDE_DIR}/tiffio.h))
TARGET_INCLUDE_DIRECTORIES(JFJochImageExport PRIVATE ${TIFF_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(JFJochImageExport PUBLIC ${TIFF_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(JFJochPreview PRIVATE ${TIFF_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(JFJochPreview PUBLIC ${TIFF_LIBRARIES})
MESSAGE(STATUS "TIFF headers present and library included")
ELSE()
MESSAGE(FATAL_ERROR "TIFF headers tiffio.h and tiffio.hxx not present")
ENDIF()
IF (EXISTS ${JPEG_INCLUDE_DIR}/jpeglib.h)
TARGET_INCLUDE_DIRECTORIES(JFJochImageExport PRIVATE ${JPEG_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(JFJochImageExport PUBLIC ${JPEG_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(JFJochPreview PRIVATE ${JPEG_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(JFJochPreview PUBLIC ${JPEG_LIBRARIES})
MESSAGE(STATUS "JPEG headers present and library included")
ELSE()
MESSAGE(FATAL_ERROR "JPEG header jpeglib.h not found")
@@ -16,13 +16,16 @@ PreviewImage::PreviewImage(const DiffractionExperiment &experiment) :
pixel_depth_bytes(experiment.GetPixelDepth()),
pixel_is_signed(experiment.IsPixelSigned()),
uncompressed_image(experiment.GetPixelsNum() * experiment.GetPixelDepth()),
roi_mask(experiment.ROI().GetROIMap()) {}
roi_mask(experiment.ROI().GetROIMap()),
counter(experiment.GetPreviewPeriod()) {}
void PreviewImage::UpdateImage(const void *in_uncompressed_image,
const std::vector<SpotToSave> &in_spots) {
std::unique_lock<std::mutex> ul(m);
memcpy(uncompressed_image.data(), in_uncompressed_image, xpixel * ypixel * pixel_depth_bytes);
spots = in_spots;
if (counter.GeneratePreview()) {
std::unique_lock<std::mutex> ul(m);
memcpy(uncompressed_image.data(), in_uncompressed_image, xpixel * ypixel * pixel_depth_bytes);
spots = in_spots;
}
}
#define JFJOCH_JPEG_BASE_R (0x3f)
@@ -5,8 +5,10 @@
#include <vector>
#include <mutex>
#include "../common/SpotToSave.h"
#include "../common/DiffractionExperiment.h"
#include "PreviewCounter.h"
struct PreviewJPEGSettings {
int64_t saturation_value = 10;
@@ -32,6 +34,7 @@ class PreviewImage {
void AddBeamCenter(std::vector<uint8_t> &rgb_image) const;
void AddSpots(std::vector<uint8_t> &rgb_image) const;
void AddROI(std::vector<uint8_t> &rgb_image) const;
PreviewCounter counter;
public:
explicit PreviewImage(const DiffractionExperiment& experiment);
void UpdateImage(const void *uncompressed_image, const std::vector<SpotToSave> &spots);
+1 -3
View File
@@ -8,12 +8,10 @@ ADD_LIBRARY(JFJochReceiver STATIC
JFJochReceiverPlots.h
ImageMetadata.cpp
ImageMetadata.h
PreviewCounter.cpp
PreviewCounter.h
LossyFilter.cpp
LossyFilter.h)
TARGET_LINK_LIBRARIES(JFJochReceiver ImagePusher JFJochImageAnalysis JFJochAcquisitionDevice JFJochCommon JFJochHLSSimulation JFJochImageExport JFJochResonet)
TARGET_LINK_LIBRARIES(JFJochReceiver ImagePusher JFJochImageAnalysis JFJochAcquisitionDevice JFJochCommon JFJochHLSSimulation JFJochPreview JFJochResonet)
ADD_EXECUTABLE(jfjoch_action_test jfjoch_action_test.cpp)
TARGET_LINK_LIBRARIES(jfjoch_action_test JFJochReceiver)
+7 -8
View File
@@ -33,8 +33,6 @@ JFJochReceiver::JFJochReceiver(const DiffractionExperiment& in_experiment,
adu_histogram_module(experiment.GetModulesNum()),
az_int_mapping(experiment),
plots(experiment, az_int_mapping),
preview_counter(experiment.GetPreviewPeriod()),
preview_counter_indexed(experiment.GetPreviewPeriod()),
spot_finding_settings(in_spot_finding_settings),
preview_image(experiment),
preview_image_indexed(experiment),
@@ -138,6 +136,9 @@ void JFJochReceiver::SendCalibration() {
for (int sc = 0; sc < experiment.GetStorageCellNumber(); sc++) {
for (int gain = 0; gain < 3; gain++) {
if (experiment.IsFixedGainG1() && (gain != 1))
continue;
auto v = compressor.Compress(calibration->GetPedestal(gain, sc));
std::string channel = "pedestal_G" + std::to_string(gain);
@@ -333,7 +334,7 @@ void JFJochReceiver::FrameTransformationThread() {
continue;
}
bool indexed = analyzer.Process(message, local_spot_finding_settings);
analyzer.Process(message, local_spot_finding_settings);
message.receiver_free_send_buf = send_buf_ctrl.GetAvailBufLocations();
message.az_int_profile = az_int_profile_image.GetResult();
@@ -342,11 +343,9 @@ void JFJochReceiver::FrameTransformationThread() {
plots.Add(message, image_number % experiment.GetTimePointNumber(), az_int_profile_image);
if (preview_counter.GeneratePreview())
preview_image.UpdateImage(transformation.GetImage(), message.spots);
if (indexed && preview_counter_indexed.GeneratePreview())
preview_image_indexed.UpdateImage(transformation.GetImage(), message.spots);
preview_image.UpdateImage(transformation.GetImage(), message.spots);
if (message.indexing_result)
preview_image_indexed.UpdateImage(transformation.GetImage(), message.spots);
images_collected++;
+1 -6
View File
@@ -8,7 +8,6 @@
#include <atomic>
#include <future>
#include <latch>
#include <semaphore>
#include "../acquisition_device/AcquisitionDeviceGroup.h"
@@ -29,8 +28,7 @@
#include "../common/ADUHistogram.h"
#include "../common/Plot.h"
#include "JFJochReceiverPlots.h"
#include "PreviewCounter.h"
#include "../export_images/PreviewImage.h"
#include "../preview/PreviewImage.h"
#include "LossyFilter.h"
struct JFJochReceiverStatus {
@@ -111,10 +109,7 @@ class JFJochReceiver {
NUMAHWPolicy numa_policy;
PreviewCounter preview_counter;
PreviewImage preview_image;
PreviewCounter preview_counter_indexed;
PreviewImage preview_image_indexed;
LossyFilter serialmx_filter;
+11 -11
View File
@@ -4,13 +4,13 @@
JFJochReceiverPlots::JFJochReceiverPlots(const DiffractionExperiment &experiment,
const AzimuthalIntegrationMapping &mapping)
: indexing_solution_per_file(experiment.GetTimePointNumber()),
: indexing_solution_per_time_point(experiment.GetTimePointNumber()),
default_binning(experiment.GetDefaultPlotBinning()),
az_int_profile(mapping), resolution_estimation(50, 1.0, 5.0) {
az_int_profile.SetTitle("dataset");
for (int i = 0; i < experiment.GetTimePointNumber(); i++) {
az_int_profile_per_file.emplace_back(mapping);
az_int_profile_per_file[i].SetTitle(std::to_string(i));
az_int_profile_per_time_point.emplace_back(mapping);
az_int_profile_per_time_point[i].SetTitle(std::to_string(i));
}
for (const auto &[x, y]: experiment.ROI().GetROINameMap()) {
@@ -34,7 +34,7 @@ void JFJochReceiverPlots::Add(const DataMessage &msg, uint64_t file_number, cons
receiver_free_send_buf.AddElement(msg.number, msg.receiver_free_send_buf.value());
indexing_solution.AddElement(msg.number, msg.indexing_result);
indexing_solution_per_file.Add(file_number, msg.indexing_result);
indexing_solution_per_time_point.Add(file_number, msg.indexing_result);
if (msg.corr_beam_x_pxl)
corr_beam_x_pxl.AddElement(msg.number, msg.corr_beam_x_pxl.value());
@@ -47,7 +47,7 @@ void JFJochReceiverPlots::Add(const DataMessage &msg, uint64_t file_number, cons
resolution_estimation.Add(msg.resolution_estimation.value());
az_int_profile += profile;
az_int_profile_per_file.at(file_number) += profile;
az_int_profile_per_time_point.at(file_number) += profile;
if (msg.xfel_pulse_id)
xfel_pulse_id.AddElement(msg.number, msg.xfel_pulse_id.value());
@@ -84,8 +84,8 @@ MultiLinePlot JFJochReceiverPlots::GetPlots(const PlotRequest &request) {
return indexing_solution.GetMeanPlot(nbins);
case PlotType::BkgEstimate:
return bkg_estimate.GetMeanPlot(nbins);
case PlotType::IndexingRatePerFile:
return indexing_solution_per_file.GetPlot();
case PlotType::IndexingRatePerTimePoint:
return indexing_solution_per_time_point.GetPlot();
case PlotType::IndexingDrift:
tmp = corr_beam_x_pxl.GetMeanPlot(nbins);
tmp.at(0).title = "X beam drift (pxl)";
@@ -141,11 +141,11 @@ MultiLinePlot JFJochReceiverPlots::GetPlots(const PlotRequest &request) {
return ret;
case PlotType::ResEstimation:
return resolution_estimation.GetPlot();
case PlotType::RadIntPerFile:
case PlotType::RadIntPerTimePoint:
tmp = az_int_profile.GetPlot();
ret.emplace_back(tmp.at(0));
for (const auto & i : az_int_profile_per_file) {
for (const auto & i : az_int_profile_per_time_point) {
tmp = i.GetPlot();
ret.emplace_back(tmp.at(0));
}
@@ -194,8 +194,8 @@ std::vector<float> JFJochReceiverPlots::GetAzIntProfile() const {
}
std::vector<float> JFJochReceiverPlots::GetAzIntProfilePerFile(uint64_t file_number) {
if (file_number < az_int_profile_per_file.size())
return az_int_profile_per_file.at(file_number).GetResult();
if (file_number < az_int_profile_per_time_point.size())
return az_int_profile_per_time_point.at(file_number).GetResult();
else
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "JFJochReceiverPlots::GetAzIntProfilePerFile out of bounds");
}
+2 -2
View File
@@ -26,7 +26,7 @@ class JFJochReceiverPlots {
StatusVector<uint64_t> receiver_free_send_buf;
StatusVector<float> image_collection_efficiency;
StatusVector<float> unit_cell[6];
SetAverage<uint64_t> indexing_solution_per_file;
SetAverage<uint64_t> indexing_solution_per_time_point;
StatusVector<float> corr_beam_x_pxl;
StatusVector<float> corr_beam_y_pxl;
StatusVector<float> corr_det_dist_mm;
@@ -37,7 +37,7 @@ class JFJochReceiverPlots {
FloatHistogram resolution_estimation;
AzimuthalIntegrationProfile az_int_profile;
std::vector<AzimuthalIntegrationProfile> az_int_profile_per_file;
std::vector<AzimuthalIntegrationProfile> az_int_profile_per_time_point;
public:
JFJochReceiverPlots(const DiffractionExperiment& experiment, const AzimuthalIntegrationMapping& mapping);
void Add(const DataMessage& msg, uint64_t file_number, const AzimuthalIntegrationProfile &profile);
+2 -2
View File
@@ -433,7 +433,7 @@ TEST_CASE("CBORSerialize_Image_2", "[CBOR]") {
.number = 480,
.image = image,
.spots = spots,
.indexing_result = 3
.indexing_result = true
};
REQUIRE_NOTHROW(serializer.SerializeImage(message));
@@ -487,7 +487,7 @@ TEST_CASE("CBORSerialize_Image_Float", "[CBOR]") {
.number = 480,
.image = image,
.spots = spots,
.indexing_result = 3
.indexing_result = false
};
REQUIRE_NOTHROW(serializer.SerializeImage(message));
+1 -1
View File
@@ -40,7 +40,7 @@ ADD_EXECUTABLE(CatchTest
RegressionTest.cpp
)
target_link_libraries(CatchTest JFJochBroker JFJochReceiver JFJochWriter JFJochImageAnalysis JFJochCommon JFJochHLSSimulation JFJochImageExport JFJochResonet)
target_link_libraries(CatchTest JFJochBroker JFJochReceiver JFJochWriter JFJochImageAnalysis JFJochCommon JFJochHLSSimulation JFJochPreview JFJochResonet)
target_include_directories(CatchTest PRIVATE .)
INSTALL(TARGETS CatchTest RUNTIME)
+18
View File
@@ -457,6 +457,22 @@ TEST_CASE("DiffractionExperiment_SampleName", "[DiffractionExperiment]") {
REQUIRE_NOTHROW(x.SampleName("lyso1"));
REQUIRE(x.GetSampleName() == "lyso1");
}
TEST_CASE("DiffractionExperiment_SaveCalibration", "[DiffractionExperiment]") {
DiffractionExperiment x;
x.ImagesPerTrigger(2).NumTriggers(2);
REQUIRE(!x.GetSaveCalibration());
x.ImagesPerTrigger(1).NumTriggers(5);
REQUIRE(x.GetSaveCalibration());
x.ImagesPerTrigger(5).NumTriggers(1);
REQUIRE(x.GetSaveCalibration());
x.Mode(DetectorMode::PedestalG0);
REQUIRE(!x.GetSaveCalibration());
}
//TODO: Update
/*
TEST_CASE("DiffractionExperiment_FrameCountTime","[DiffractionExperiment]") {
@@ -825,6 +841,8 @@ TEST_CASE("DiffractionExperiment_EIGER","[DiffractionExperiment]") {
REQUIRE(!x.IsConversionOnFPGA());
REQUIRE(!x.IsPixelSigned());
REQUIRE(x.GetPhotonEnergyMultiplier() == 1.0f);
x.ImagesPerTrigger(245).NumTriggers(100);
REQUIRE(!x.GetSaveCalibration());
}
TEST_CASE("DiffractionExperiment_PhotonEnergyMultiplayer","[DiffractionExperiment]") {
+1 -61
View File
@@ -9,7 +9,7 @@
#include "../writer/HDF5Objects.h"
#include "../receiver/JFJochReceiverService.h"
#include "../common/DiffractionGeometry.h"
#include "../export_images/WriteTIFF.h"
#include "../preview/WriteTIFF.h"
#include "../common/ZMQWrappers.h"
#include "../frame_serialize/ZMQStream2Pusher.h"
#include "../writer/StreamWriter.h"
@@ -346,63 +346,3 @@ TEST_CASE("JFJochIntegrationTest_ZMQ_ROI", "[JFJochReceiver]") {
REQUIRE_NOTHROW(writer_future.get());
}
TEST_CASE("JFJochIntegrationTest_ZMQ_SaveCalibration", "[JFJochReceiver]") {
Logger logger("JFJochIntegrationTest_ZMQ_SaveCalibration");
RegisterHDF5Filter();
const uint16_t nthreads = 4;
DiffractionExperiment experiment(DetectorGeometry(8,2,8,36));
experiment.ImagesPerTrigger(5).NumTriggers(1).UseInternalPacketGenerator(true)
.FilePrefix("lyso_save_calibration").ConversionOnFPGA(false)
.DetectorDistance_mm(75).BeamY_pxl(1136).BeamX_pxl(1090).PhotonEnergy_keV(12.4)
.SaveCalibration(true);
// Load example image
HDF5ReadOnlyFile data("../../tests/test_data/compression_benchmark.h5");
HDF5DataSet dataset(data, "/entry/data/data");
HDF5DataSpace file_space(dataset);
REQUIRE(file_space.GetDimensions()[2] == experiment.GetXPixelsNum());
REQUIRE(file_space.GetDimensions()[1] == experiment.GetYPixelsNum());
std::vector<int16_t> image_conv (file_space.GetDimensions()[1] * file_space.GetDimensions()[2]);
std::vector<hsize_t> start = {5,0,0};
std::vector<hsize_t> file_size = {1, file_space.GetDimensions()[1], file_space.GetDimensions()[2]};
dataset.ReadVector(image_conv, start, file_size);
std::vector<int16_t> image_raw_geom(experiment.GetModulesNum() * RAW_MODULE_SIZE);
ConvertedToRawGeometry(experiment, image_raw_geom.data(), image_conv.data());
logger.Info("Loaded image");
// Setup acquisition device
AcquisitionDeviceGroup aq_devices;
std::unique_ptr<HLSSimulatedDevice> test = std::make_unique<HLSSimulatedDevice>(0, 64);
for (int m = 0; m < experiment.GetModulesNum(); m++)
test->SetInternalGeneratorFrame((uint16_t *) image_raw_geom.data() + m * RAW_MODULE_SIZE, m);
aq_devices.Add(std::move(test));
JFCalibration calib(experiment);
ZMQContext context;
context.NumThreads(4);
ZMQStream2Pusher pusher(context, "ipc://*");
StreamWriter writer(context, logger, pusher.GetAddress());
auto writer_future = std::async(std::launch::async, &StreamWriter::Run, &writer);
JFJochReceiverService service(aq_devices, logger, pusher);
service.NumThreads(nthreads);
service.Start(experiment, &calib);
auto receiver_out = service.Stop();
CHECK(receiver_out.efficiency == 1.0);
CHECK(receiver_out.status.images_sent == experiment.GetImageNum());
CHECK(!receiver_out.status.cancelled);
REQUIRE_NOTHROW(writer_future.get());
}
+2 -2
View File
@@ -3,8 +3,8 @@
#include <catch2/catch.hpp>
#include <fstream>
#include "../export_images/WriteJPEG.h"
#include "../export_images/PreviewImage.h"
#include "../preview//WriteJPEG.h"
#include "../preview//PreviewImage.h"
#include "../writer/HDF5Objects.h"
#include "../common/RawToConvertedGeometry.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include <thread>
#include <catch2/catch.hpp>
#include "../receiver/PreviewCounter.h"
#include "../preview/PreviewCounter.h"
TEST_CASE("PreviewCount", "") {
PreviewCounter counter(std::chrono::seconds(1));
+2 -2
View File
@@ -4,8 +4,8 @@
#include <fstream>
#include "../export_images/WriteTIFF.h"
#include "../export_images/PreviewImage.h"
#include "../preview/WriteTIFF.h"
#include "../preview/PreviewImage.h"
#include "../writer/HDF5Objects.h"
#include "../common/RawToConvertedGeometry.h"
+1 -1
View File
@@ -11,7 +11,7 @@
#include "../common/RawToConvertedGeometry.h"
#include "../receiver/FrameTransformation.h"
#include "../image_analysis/MXAnalyzer.h"
#include "../export_images/PreviewImage.h"
#include "../preview/PreviewImage.h"
#include "../receiver/LossyFilter.h"
Logger logger("jfjoch_spot_finding_test");
+5 -1
View File
@@ -244,7 +244,11 @@ void NXmx::Attenuator(const StartMessage &start) {
}
void NXmx::WriteCalibration(const CompressedImage &image) {
SaveCBORImage("/entry/instrument/detector/detectorSpecific/" + image.channel, image);
if (!calibration_group_created) {
calibration_group_created = true;
HDF5Group(*hdf5_file, "/entry/instrument/detector/calibration").NXClass("NXcollection");
}
SaveCBORImage("/entry/instrument/detector/calibration/" + image.channel, image);
}
void NXmx::SaveCBORImage(const std::string &hdf5_path, const CompressedImage &image) {
+1
View File
@@ -16,6 +16,7 @@ class NXmx {
const StartMessage start_message;
const std::string filename;
std::string tmp_filename;
bool calibration_group_created = false;
void LinkToData(const StartMessage &start, const EndMessage &end);