diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index b364f60d..14fcf466 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -21,6 +21,7 @@ inline SpotFindingSettings Convert(const org::openapitools::server::model::Spot_ ret.low_resolution_limit = input.getLowResolutionLimit(); ret.enable = input.isEnable(); ret.indexing = input.isIndexing(); + ret.indexing_tolerance = input.getIndexingTolerance(); return ret; } @@ -34,6 +35,7 @@ inline org::openapitools::server::model::Spot_finding_settings Convert(const Spo ret.setLowResolutionLimit(input.low_resolution_limit); ret.setEnable(input.enable); ret.setIndexing(input.indexing); + ret.setIndexingTolerance(input.indexing_tolerance); return ret; } @@ -47,9 +49,14 @@ inline org::openapitools::server::model::Measurement_statistics Convert(const Me ret.setImagesCollected(input.images_collected); ret.setImagesSent(input.images_sent); ret.setMaxImageNumberSent(input.max_image_number_sent); - if (input.collection_efficiency >= 0.0) - ret.setCollectionEfficiency(input.collection_efficiency); - ret.setCompressionRatio(input.compression_ratio); + if (input.collection_efficiency) + ret.setCollectionEfficiency(input.collection_efficiency.value()); + if (input.compression_ratio) + ret.setCompressionRatio(input.compression_ratio.value()); + if (input.beam_center_drift_pxl) { + ret.setBeamCenterDriftXPxl(input.beam_center_drift_pxl->first); + ret.setBeamCenterDriftYPxl(input.beam_center_drift_pxl->second); + } ret.setCancelled(input.cancelled); ret.setMaxReceiverDelay(input.max_receive_delay); @@ -58,11 +65,11 @@ inline org::openapitools::server::model::Measurement_statistics Convert(const Me ret.setDetectorHeight(input.detector_height); ret.setDetectorPixelDepth(input.detector_pixel_depth); - if (input.indexing_rate >= 0.0) - ret.setIndexingRate(input.indexing_rate); + if (input.indexing_rate) + ret.setIndexingRate(input.indexing_rate.value()); - if (input.bkg_estimate >= 0.0) - ret.setBkgEstimate(input.bkg_estimate); + if (input.bkg_estimate) + ret.setBkgEstimate(input.bkg_estimate.value()); return ret; } @@ -404,6 +411,10 @@ inline DatasetSettings Convert(const org::openapitools::server::model::Dataset_s ret.ImageAppendix(input.getImageAppendix()); ret.SaveCalibration(input.isSaveCalibration()); ret.ImagesPerFile(input.getImagesPerFile()); + + if (input.dataReductionFactorSerialmxIsSet()) + ret.DataReductionFactorSerialMX(input.getDataReductionFactorSerialmx()); + return ret; } @@ -814,3 +825,12 @@ void JFJochBrokerHttp::plot_roi_valid_pixels_post(const org::openapitools::serve auto plot = state_machine.GetPlots(req); ProcessOutput(Convert(plot), 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); +} diff --git a/broker/JFJochBrokerHttp.h b/broker/JFJochBrokerHttp.h index d5da8c77..aafdc8c7 100644 --- a/broker/JFJochBrokerHttp.h +++ b/broker/JFJochBrokerHttp.h @@ -51,6 +51,9 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { void plot_receiver_free_send_buffers_post(const org::openapitools::server::model::Plot_request &plotRequest, 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; diff --git a/broker/JFJochServices.cpp b/broker/JFJochServices.cpp index 9c408216..66019a80 100644 --- a/broker/JFJochServices.cpp +++ b/broker/JFJochServices.cpp @@ -68,10 +68,16 @@ JFJochServicesOutput JFJochServices::Stop() { logger.Info("Wait for receiver done"); ret.receiver_output = receiver->Stop(); + if (ret.receiver_output.status.compressed_ratio) logger.Info(" ... Receiver efficiency: {} % Max delay: {} Compression ratio {}x", static_cast(ret.receiver_output.efficiency * 100.0), ret.receiver_output.status.max_receive_delay, - static_cast(std::round(ret.receiver_output.status.compressed_ratio))); + static_cast(std::round(ret.receiver_output.status.compressed_ratio.value()))); + else + logger.Info(" ... Receiver efficiency: {} % Max delay: {}", + static_cast(ret.receiver_output.efficiency * 100.0), + ret.receiver_output.status.max_receive_delay); + if (ret.receiver_output.efficiency < 1.0) { for (int i = 0; i < ret.receiver_output.received_packets.size(); i++) { if (ret.receiver_output.received_packets[i] != ret.receiver_output.expected_packets[i]) diff --git a/broker/JFJochStateMachine.cpp b/broker/JFJochStateMachine.cpp index 6c755c9f..4a504217 100644 --- a/broker/JFJochStateMachine.cpp +++ b/broker/JFJochStateMachine.cpp @@ -411,6 +411,7 @@ void JFJochStateMachine::SetFullMeasurementOutput(const JFJochServicesOutput &ou tmp.max_receive_delay = output.receiver_output.status.max_receive_delay; tmp.indexing_rate = output.receiver_output.status.indexing_rate; tmp.bkg_estimate = output.receiver_output.status.bkg_estimate; + tmp.beam_center_drift_pxl = output.receiver_output.status.beam_center_drift_pxl; measurement_statistics = tmp; } @@ -445,7 +446,7 @@ std::optional JFJochStateMachine::GetMeasurementStatistic tmp.images_expected = experiment.GetImageNum(); tmp.compression_ratio = rcv_status->compressed_ratio; - tmp.collection_efficiency = -1.0; + tmp.beam_center_drift_pxl = rcv_status->beam_center_drift_pxl; tmp.images_collected = rcv_status->images_collected; tmp.images_sent = rcv_status->images_sent; tmp.cancelled = rcv_status->cancelled; diff --git a/broker/JFJochStateMachine.h b/broker/JFJochStateMachine.h index 806ee26b..69f90e4d 100644 --- a/broker/JFJochStateMachine.h +++ b/broker/JFJochStateMachine.h @@ -41,19 +41,20 @@ struct MeasurementStatistics { int64_t images_collected; int64_t images_sent; int64_t max_image_number_sent; - float collection_efficiency; - float compression_ratio; + std::optional collection_efficiency; + std::optional compression_ratio; bool cancelled; int64_t max_receive_delay; - float indexing_rate; + std::optional indexing_rate; int64_t detector_width; int64_t detector_height; int64_t detector_pixel_depth; - float bkg_estimate; + std::optional bkg_estimate; + std::optional> beam_center_drift_pxl; }; struct DetectorSettings { diff --git a/broker/gen/api/DefaultApi.cpp b/broker/gen/api/DefaultApi.cpp index 5310ccfa..87b9f6ab 100644 --- a/broker/gen/api/DefaultApi.cpp +++ b/broker/gen/api/DefaultApi.cpp @@ -47,6 +47,7 @@ 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)); @@ -431,6 +432,39 @@ void DefaultApi::pedestal_post_handler(const Pistache::Rest::Request &, Pistache response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); } +} +void DefaultApi::plot_beam_center_drift_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { + try { + + + // Getting the body param + + Plot_request plotRequest; + + try { + nlohmann::json::parse(request.body()).get_to(plotRequest); + plotRequest.validate(); + } catch (std::exception &e) { + const std::pair errorInfo = this->handleParsingException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + try { + this->plot_beam_center_drift_post(plotRequest, response); + } catch (Pistache::Http::HttpError &e) { + response.send(static_cast(e.code()), e.what()); + return; + } catch (std::exception &e) { + const std::pair errorInfo = this->handleOperationException(e); + response.send(errorInfo.first, errorInfo.second); + return; + } + + } catch (std::exception &e) { + response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); + } + } void DefaultApi::plot_bkg_estimate_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { try { diff --git a/broker/gen/api/DefaultApi.h b/broker/gen/api/DefaultApi.h index 29e8914d..e4cc4382 100644 --- a/broker/gen/api/DefaultApi.h +++ b/broker/gen/api/DefaultApi.h @@ -72,6 +72,7 @@ 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); @@ -224,6 +225,14 @@ private: /// virtual void pedestal_post(Pistache::Http::ResponseWriter &response) = 0; /// + /// Generate plot of beam center drift (from indexing) + /// + /// + /// Max count of beam center drift per image; binning is configurable + /// + /// (optional) + virtual void plot_beam_center_drift_post(const org::openapitools::server::model::Plot_request &plotRequest, Pistache::Http::ResponseWriter &response) = 0; + /// /// Generate background estimate plot /// /// diff --git a/broker/gen/model/Dataset_settings.cpp b/broker/gen/model/Dataset_settings.cpp index 9efe9527..751c681d 100644 --- a/broker/gen/model/Dataset_settings.cpp +++ b/broker/gen/model/Dataset_settings.cpp @@ -55,6 +55,8 @@ Dataset_settings::Dataset_settings() m_Image_appendixIsSet = false; m_Photon_energy_multiplier = 1.0f; m_Photon_energy_multiplierIsSet = false; + m_Data_reduction_factor_serialmx = 1.0f; + m_Data_reduction_factor_serialmxIsSet = false; m_Unit_cellIsSet = false; } @@ -224,6 +226,25 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP } } + + if (dataReductionFactorSerialmxIsSet()) + { + const float& value = m_Data_reduction_factor_serialmx; + const std::string currentValuePath = _pathPrefix + ".dataReductionFactorSerialmx"; + + + if (value < static_cast(0.0)) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 0.0;"; + } + if (value > static_cast(1.0)) + { + success = false; + msg << currentValuePath << ": must be less than or equal to 1.0;"; + } + + } return success; } @@ -294,6 +315,9 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const ((!photonEnergyMultiplierIsSet() && !rhs.photonEnergyMultiplierIsSet()) || (photonEnergyMultiplierIsSet() && rhs.photonEnergyMultiplierIsSet() && getPhotonEnergyMultiplier() == rhs.getPhotonEnergyMultiplier())) && + ((!dataReductionFactorSerialmxIsSet() && !rhs.dataReductionFactorSerialmxIsSet()) || (dataReductionFactorSerialmxIsSet() && rhs.dataReductionFactorSerialmxIsSet() && getDataReductionFactorSerialmx() == rhs.getDataReductionFactorSerialmx())) && + + ((!unitCellIsSet() && !rhs.unitCellIsSet()) || (unitCellIsSet() && rhs.unitCellIsSet() && getUnitCell() == rhs.getUnitCell())) ; @@ -342,6 +366,8 @@ void to_json(nlohmann::json& j, const Dataset_settings& o) j["image_appendix"] = o.m_Image_appendix; if(o.photonEnergyMultiplierIsSet()) j["photon_energy_multiplier"] = o.m_Photon_energy_multiplier; + if(o.dataReductionFactorSerialmxIsSet()) + j["data_reduction_factor_serialmx"] = o.m_Data_reduction_factor_serialmx; if(o.unitCellIsSet()) j["unit_cell"] = o.m_Unit_cell; @@ -429,6 +455,11 @@ void from_json(const nlohmann::json& j, Dataset_settings& o) j.at("photon_energy_multiplier").get_to(o.m_Photon_energy_multiplier); o.m_Photon_energy_multiplierIsSet = true; } + if(j.find("data_reduction_factor_serialmx") != j.end()) + { + j.at("data_reduction_factor_serialmx").get_to(o.m_Data_reduction_factor_serialmx); + o.m_Data_reduction_factor_serialmxIsSet = true; + } if(j.find("unit_cell") != j.end()) { j.at("unit_cell").get_to(o.m_Unit_cell); @@ -732,6 +763,23 @@ void Dataset_settings::unsetPhoton_energy_multiplier() { m_Photon_energy_multiplierIsSet = false; } +float Dataset_settings::getDataReductionFactorSerialmx() const +{ + return m_Data_reduction_factor_serialmx; +} +void Dataset_settings::setDataReductionFactorSerialmx(float const value) +{ + m_Data_reduction_factor_serialmx = value; + m_Data_reduction_factor_serialmxIsSet = true; +} +bool Dataset_settings::dataReductionFactorSerialmxIsSet() const +{ + return m_Data_reduction_factor_serialmxIsSet; +} +void Dataset_settings::unsetData_reduction_factor_serialmx() +{ + m_Data_reduction_factor_serialmxIsSet = false; +} org::openapitools::server::model::Dataset_settings_unit_cell Dataset_settings::getUnitCell() const { return m_Unit_cell; diff --git a/broker/gen/model/Dataset_settings.h b/broker/gen/model/Dataset_settings.h index 4b2070aa..43612a0a 100644 --- a/broker/gen/model/Dataset_settings.h +++ b/broker/gen/model/Dataset_settings.h @@ -191,6 +191,13 @@ public: bool photonEnergyMultiplierIsSet() const; void unsetPhoton_energy_multiplier(); /// + /// Rate at which non-indexed images are accepted to be forwarded to writer. Value of 1.0 (default) means that all images are written. Values below zero mean that non-indexed images will be accepted with a given probability. + /// + float getDataReductionFactorSerialmx() const; + void setDataReductionFactorSerialmx(float const value); + bool dataReductionFactorSerialmxIsSet() const; + void unsetData_reduction_factor_serialmx(); + /// /// /// org::openapitools::server::model::Dataset_settings_unit_cell getUnitCell() const; @@ -241,6 +248,8 @@ protected: bool m_Image_appendixIsSet; float m_Photon_energy_multiplier; bool m_Photon_energy_multiplierIsSet; + float m_Data_reduction_factor_serialmx; + bool m_Data_reduction_factor_serialmxIsSet; org::openapitools::server::model::Dataset_settings_unit_cell m_Unit_cell; bool m_Unit_cellIsSet; diff --git a/broker/gen/model/Measurement_statistics.cpp b/broker/gen/model/Measurement_statistics.cpp index faf5c55a..c4ef1e93 100644 --- a/broker/gen/model/Measurement_statistics.cpp +++ b/broker/gen/model/Measurement_statistics.cpp @@ -49,6 +49,10 @@ Measurement_statistics::Measurement_statistics() m_Detector_pixel_depthIsSet = false; m_Bkg_estimate = 0.0f; m_Bkg_estimateIsSet = false; + m_Beam_center_drift_x_pxl = 0.0f; + m_Beam_center_drift_x_pxlIsSet = false; + m_Beam_center_drift_y_pxl = 0.0f; + m_Beam_center_drift_y_pxlIsSet = false; } @@ -104,7 +108,7 @@ bool Measurement_statistics::validate(std::stringstream& msg, const std::string& } } - + return success; } @@ -153,7 +157,13 @@ bool Measurement_statistics::operator==(const Measurement_statistics& rhs) const ((!detectorPixelDepthIsSet() && !rhs.detectorPixelDepthIsSet()) || (detectorPixelDepthIsSet() && rhs.detectorPixelDepthIsSet() && getDetectorPixelDepth() == rhs.getDetectorPixelDepth())) && - ((!bkgEstimateIsSet() && !rhs.bkgEstimateIsSet()) || (bkgEstimateIsSet() && rhs.bkgEstimateIsSet() && getBkgEstimate() == rhs.getBkgEstimate())) + ((!bkgEstimateIsSet() && !rhs.bkgEstimateIsSet()) || (bkgEstimateIsSet() && rhs.bkgEstimateIsSet() && getBkgEstimate() == rhs.getBkgEstimate())) && + + + ((!beamCenterDriftXPxlIsSet() && !rhs.beamCenterDriftXPxlIsSet()) || (beamCenterDriftXPxlIsSet() && rhs.beamCenterDriftXPxlIsSet() && getBeamCenterDriftXPxl() == rhs.getBeamCenterDriftXPxl())) && + + + ((!beamCenterDriftYPxlIsSet() && !rhs.beamCenterDriftYPxlIsSet()) || (beamCenterDriftYPxlIsSet() && rhs.beamCenterDriftYPxlIsSet() && getBeamCenterDriftYPxl() == rhs.getBeamCenterDriftYPxl())) ; } @@ -194,6 +204,10 @@ void to_json(nlohmann::json& j, const Measurement_statistics& o) j["detector_pixel_depth"] = o.m_Detector_pixel_depth; if(o.bkgEstimateIsSet()) j["bkg_estimate"] = o.m_Bkg_estimate; + if(o.beamCenterDriftXPxlIsSet()) + j["beam_center_drift_x_pxl"] = o.m_Beam_center_drift_x_pxl; + if(o.beamCenterDriftYPxlIsSet()) + j["beam_center_drift_y_pxl"] = o.m_Beam_center_drift_y_pxl; } @@ -269,6 +283,16 @@ void from_json(const nlohmann::json& j, Measurement_statistics& o) j.at("bkg_estimate").get_to(o.m_Bkg_estimate); o.m_Bkg_estimateIsSet = true; } + if(j.find("beam_center_drift_x_pxl") != j.end()) + { + j.at("beam_center_drift_x_pxl").get_to(o.m_Beam_center_drift_x_pxl); + o.m_Beam_center_drift_x_pxlIsSet = true; + } + if(j.find("beam_center_drift_y_pxl") != j.end()) + { + j.at("beam_center_drift_y_pxl").get_to(o.m_Beam_center_drift_y_pxl); + o.m_Beam_center_drift_y_pxlIsSet = true; + } } @@ -510,6 +534,40 @@ void Measurement_statistics::unsetBkg_estimate() { m_Bkg_estimateIsSet = false; } +float Measurement_statistics::getBeamCenterDriftXPxl() const +{ + return m_Beam_center_drift_x_pxl; +} +void Measurement_statistics::setBeamCenterDriftXPxl(float const value) +{ + m_Beam_center_drift_x_pxl = value; + m_Beam_center_drift_x_pxlIsSet = true; +} +bool Measurement_statistics::beamCenterDriftXPxlIsSet() const +{ + return m_Beam_center_drift_x_pxlIsSet; +} +void Measurement_statistics::unsetBeam_center_drift_x_pxl() +{ + m_Beam_center_drift_x_pxlIsSet = false; +} +float Measurement_statistics::getBeamCenterDriftYPxl() const +{ + return m_Beam_center_drift_y_pxl; +} +void Measurement_statistics::setBeamCenterDriftYPxl(float const value) +{ + m_Beam_center_drift_y_pxl = value; + m_Beam_center_drift_y_pxlIsSet = true; +} +bool Measurement_statistics::beamCenterDriftYPxlIsSet() const +{ + return m_Beam_center_drift_y_pxlIsSet; +} +void Measurement_statistics::unsetBeam_center_drift_y_pxl() +{ + m_Beam_center_drift_y_pxlIsSet = false; +} } // namespace org::openapitools::server::model diff --git a/broker/gen/model/Measurement_statistics.h b/broker/gen/model/Measurement_statistics.h index fb6597c1..2bf3c711 100644 --- a/broker/gen/model/Measurement_statistics.h +++ b/broker/gen/model/Measurement_statistics.h @@ -156,6 +156,20 @@ public: void setBkgEstimate(float const value); bool bkgEstimateIsSet() const; void unsetBkg_estimate(); + /// + /// + /// + float getBeamCenterDriftXPxl() const; + void setBeamCenterDriftXPxl(float const value); + bool beamCenterDriftXPxlIsSet() const; + void unsetBeam_center_drift_x_pxl(); + /// + /// + /// + float getBeamCenterDriftYPxl() const; + void setBeamCenterDriftYPxl(float const value); + bool beamCenterDriftYPxlIsSet() const; + void unsetBeam_center_drift_y_pxl(); friend void to_json(nlohmann::json& j, const Measurement_statistics& o); friend void from_json(const nlohmann::json& j, Measurement_statistics& o); @@ -188,6 +202,10 @@ protected: bool m_Detector_pixel_depthIsSet; float m_Bkg_estimate; bool m_Bkg_estimateIsSet; + float m_Beam_center_drift_x_pxl; + bool m_Beam_center_drift_x_pxlIsSet; + float m_Beam_center_drift_y_pxl; + bool m_Beam_center_drift_y_pxlIsSet; }; diff --git a/broker/gen/model/Spot_finding_settings.cpp b/broker/gen/model/Spot_finding_settings.cpp index 029996e6..1ad37c0b 100644 --- a/broker/gen/model/Spot_finding_settings.cpp +++ b/broker/gen/model/Spot_finding_settings.cpp @@ -29,6 +29,7 @@ Spot_finding_settings::Spot_finding_settings() m_Max_pix_per_spot = 0L; m_High_resolution_limit = 0.0f; m_Low_resolution_limit = 0.0f; + m_Indexing_tolerance = 0.0f; } @@ -107,7 +108,26 @@ bool Spot_finding_settings::validate(std::stringstream& msg, const std::string& } } - + + + /* Indexing_tolerance */ { + const float& value = m_Indexing_tolerance; + const std::string currentValuePath = _pathPrefix + ".indexingTolerance"; + + + if (value < static_cast(0.0)) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 0.0;"; + } + if (value > static_cast(1.0)) + { + success = false; + msg << currentValuePath << ": must be less than or equal to 1.0;"; + } + + } + return success; } @@ -138,6 +158,9 @@ bool Spot_finding_settings::operator==(const Spot_finding_settings& rhs) const && (getLowResolutionLimit() == rhs.getLowResolutionLimit()) + && + + (getIndexingTolerance() == rhs.getIndexingTolerance()) ; @@ -159,6 +182,7 @@ void to_json(nlohmann::json& j, const Spot_finding_settings& o) j["max_pix_per_spot"] = o.m_Max_pix_per_spot; j["high_resolution_limit"] = o.m_High_resolution_limit; j["low_resolution_limit"] = o.m_Low_resolution_limit; + j["indexing_tolerance"] = o.m_Indexing_tolerance; } @@ -172,6 +196,7 @@ void from_json(const nlohmann::json& j, Spot_finding_settings& o) j.at("max_pix_per_spot").get_to(o.m_Max_pix_per_spot); j.at("high_resolution_limit").get_to(o.m_High_resolution_limit); j.at("low_resolution_limit").get_to(o.m_Low_resolution_limit); + j.at("indexing_tolerance").get_to(o.m_Indexing_tolerance); } @@ -239,6 +264,14 @@ void Spot_finding_settings::setLowResolutionLimit(float const value) { m_Low_resolution_limit = value; } +float Spot_finding_settings::getIndexingTolerance() const +{ + return m_Indexing_tolerance; +} +void Spot_finding_settings::setIndexingTolerance(float const value) +{ + m_Indexing_tolerance = value; +} } // namespace org::openapitools::server::model diff --git a/broker/gen/model/Spot_finding_settings.h b/broker/gen/model/Spot_finding_settings.h index 33ce9a8c..b556d4d7 100644 --- a/broker/gen/model/Spot_finding_settings.h +++ b/broker/gen/model/Spot_finding_settings.h @@ -97,6 +97,11 @@ public: /// float getLowResolutionLimit() const; void setLowResolutionLimit(float const value); + /// + /// Acceptance tolerance for spots after the indexing run - the larger the number, the more spots will be accepted + /// + float getIndexingTolerance() const; + void setIndexingTolerance(float const value); friend void to_json(nlohmann::json& j, const Spot_finding_settings& o); friend void from_json(const nlohmann::json& j, Spot_finding_settings& o); @@ -117,6 +122,8 @@ protected: float m_Low_resolution_limit; + float m_Indexing_tolerance; + }; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 5fb64385..7c93bf3c 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -167,6 +167,16 @@ components: minimum: 0.015625 maximum: 4.0 description: For JUNGFRAU conversion it is possible to multiply energy by a given factor to get fractional/multiplied photon counts + data_reduction_factor_serialmx: + type: number + format: float + default: 1.0 + minimum: 0.0 + maximum: 1.0 + description: | + Rate at which non-indexed images are accepted to be forwarded to writer. + Value of 1.0 (default) means that all images are written. + Values below zero mean that non-indexed images will be accepted with a given probability. unit_cell: type: object description: Units of angstrom and degree @@ -322,6 +332,7 @@ components: - min_pix_per_spot - high_resolution_limit - low_resolution_limit + - indexing_tolerance properties: enable: type: boolean @@ -353,6 +364,12 @@ components: low_resolution_limit: type: number format: float + indexing_tolerance: + type: number + format: float + minimum: 0.0 + maximum: 1.0 + description: Acceptance tolerance for spots after the indexing run - the larger the number, the more spots will be accepted rad_int_settings: type: object required: @@ -478,6 +495,12 @@ components: bkg_estimate: type: number format: float + beam_center_drift_x_pxl: + type: number + format: float + beam_center_drift_y_pxl: + type: number + format: float broker_status: type: object required: @@ -1276,6 +1299,30 @@ paths: schema: type: string description: Exception error + /plot/beam_center_drift: + post: + 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' + responses: + "200": + description: Everything OK + content: + application/json: + schema: + $ref: '#/components/schemas/plots' + "400": + description: Input parsing or validation error + content: + text/plain: + schema: + type: string + description: + Exception error /plot/roi_max_count: post: summary: Generate plot of ROI max count diff --git a/broker/redoc-static.html b/broker/redoc-static.html index c21316ef..00b66ef9 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -341,7 +341,7 @@ data-styled.g137[id="sc-cMdfCE"]{content:"dvQijr,"}/*!sc*/ -

Image appendix, added as user_data to image message

photon_energy_multiplier
number <float> [ 0.015625 .. 4 ]
Default: 1

For JUNGFRAU conversion it is possible to multiply energy by a given factor to get fractional/multiplied photon counts

+
data_reduction_factor_serialmx
number <float> [ 0 .. 1 ]
Default: 1

Rate at which non-indexed images are accepted to be forwarded to writer. +Value of 1.0 (default) means that all images are written. +Values below zero mean that non-indexed images will be accepted with a given probability.

object

Units of angstrom and degree

Responses

Request samples

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

Response samples

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

Wait for acquisition done

Request samples

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

Response samples

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

Wait for acquisition done

Block execution of external script till initialization, data collection or pedestal is finished. @@ -545,15 +551,17 @@ If detector is in Inactive or Error states, new settin " class="sc-iKOmoZ sc-cCzLxZ WVNwY jaVotg">

Enable spot finding

indexing
required
boolean
Default: true

Enable indexing

-
signal_to_noise_threshold
required
number <float> >= 0
photon_count_threshold
required
integer <int64> >= 0
min_pix_per_spot
required
integer <int64> >= 1
max_pix_per_spot
required
integer <int64> >= 1
high_resolution_limit
required
number <float>
low_resolution_limit
required
number <float>

Responses

Request samples

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

Get data processing configuration

Request samples

Content type
application/json
{
  • "enable": true,
  • "indexing": true,
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "indexing_tolerance": 1
}

Get data processing configuration

Can be done anytime

Responses

Response samples

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

Configure radial integration

Response samples

Content type
application/json
{
  • "enable": true,
  • "indexing": true,
  • "signal_to_noise_threshold": 0.1,
  • "photon_count_threshold": 0,
  • "min_pix_per_spot": 1,
  • "max_pix_per_spot": 1,
  • "high_resolution_limit": 0.1,
  • "low_resolution_limit": 0.1,
  • "indexing_tolerance": 1
}

Configure radial integration

Can be done when detector is Inactive or Idle

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

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

@@ -673,63 +681,69 @@ Changing detector will set detector to Inactive state and will requ " class="sc-iKOmoZ sc-cCzLxZ WVNwY VEBGS sc-ckdEwu LxEPk">

Everything OK

Request samples

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

Response samples

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

Generate plot of ROI max count

Request samples

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

Response samples

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

Generate plot of beam center drift (from indexing)

Max count of beam center drift per image; binning is configurable

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

Responses

Request samples

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

Response samples

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

Generate plot of ROI max count

Max count of ROI per image; binning is configurable

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

Responses

Request samples

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

Response samples

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

Generate plot of ROI valid pixels

Request samples

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

Response samples

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

Generate plot of ROI valid pixels

Number of pixels within a ROI area; pixels with special values (overload, bad pixel) are excluded; multipixels are counted just once; binning is configurable

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

Responses

Request samples

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

Response samples

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

Generate receiver delay plot

Request samples

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

Response samples

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

Generate receiver delay plot

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

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

Responses

Request samples

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

Response samples

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

Generate receiver free send buffer plot

Request samples

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

Response samples

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

Generate receiver free send buffer plot

Amount of send buffers available during frame processing - used for internal debugging; binning is configurable

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

Responses

Request samples

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

Response samples

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

Generate image collection efficiency plot

Request samples

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

Response samples

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

Generate image collection efficiency plot

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

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

Responses

Request samples

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

Response samples

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

Generate indexing rate per file

Request samples

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

Response samples

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

Generate indexing rate per file

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

Responses

Response samples

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

Generate resolution estimate histogram

Response samples

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

Generate resolution estimate histogram

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

Responses

Response samples

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

Generate radial integration profile

Response samples

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

Generate radial integration profile

Generate average radial integration profile

Responses

Response samples

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

Generate radial integration profiles per file

Response samples

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

Generate radial integration profiles per file

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

Responses

Response samples

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

Get data collection statistics

Response samples

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

Get data collection statistics

Results of the last data collection

Responses

Response samples

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

Get calibration statistics

Response samples

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

Get calibration statistics

Statistics are provided for each module/storage cell separately

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get last preview image in JPEG format using custom settings

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

Response samples

Content type
application/json
[
  • {
    }
]

Get last preview image in JPEG format using custom settings

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

Saturation value to set contrast in the preview image

show_spots
boolean
Default: true

Show spot finding results on the image

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

No preview image recorded so far

Request samples

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

Response samples

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

Get last preview image in JPEG format using default settings

Responses

Request samples

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

Response samples

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

Get last preview image in JPEG format using default settings

Responses