diff --git a/broker/JFJochBrokerHttp.cpp b/broker/JFJochBrokerHttp.cpp index 5e336f0f..95c6040e 100644 --- a/broker/JFJochBrokerHttp.cpp +++ b/broker/JFJochBrokerHttp.cpp @@ -580,15 +580,34 @@ void JFJochBrokerHttp::preview_plot_get(const std::optional &type, } void JFJochBrokerHttp::preview_plot_bin_get(const std::optional &type, + const std::optional &azintUnit, + const std::optional &binning, Pistache::Http::ResponseWriter &response) { + PlotAzintUnit unit = PlotAzintUnit::Q_recipA; + if (azintUnit.has_value()) { + if (azintUnit == "Q_recipA" || azintUnit == "q_recipa") + unit = PlotAzintUnit::Q_recipA; + else if (azintUnit == "d_A" || azintUnit == "d_a") + unit = PlotAzintUnit::D_A; + else if (azintUnit == "two_theta_deg") + unit = PlotAzintUnit::TwoTheta_deg; + } + PlotRequest req{ .type = ConvertPlotType(type), .binning = 1, .experimental_coord = false, - .azint_unit = PlotAzintUnit::Q_recipA, + .azint_unit = unit, .fill_value = NAN }; + if (binning) { + if (binning.value() < 0) + throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, + "Binning must be positive number or zero"); + req.binning = binning.value(); + } + auto plots_container = state_machine.GetPlots(req); const auto &plots = plots_container.GetPlots(); diff --git a/broker/JFJochBrokerHttp.h b/broker/JFJochBrokerHttp.h index d98e2148..6c6ad0fe 100644 --- a/broker/JFJochBrokerHttp.h +++ b/broker/JFJochBrokerHttp.h @@ -169,7 +169,8 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi { const std::optional &compression, const std::optional &fill, const std::optional &experimentalCoord, const std::optional &azintUnit, Pistache::Http::ResponseWriter &response) override; - void preview_plot_bin_get(const std::optional &type, Pistache::Http::ResponseWriter &response) override; + void preview_plot_bin_get(const std::optional &type, const std::optional &azintUnit, + const std::optional &binning, Pistache::Http::ResponseWriter &response) override; void config_indexing_get(Pistache::Http::ResponseWriter &response) override; diff --git a/broker/gen/api/DefaultApi.cpp b/broker/gen/api/DefaultApi.cpp index 6d68b9dc..7b31572f 100644 --- a/broker/gen/api/DefaultApi.cpp +++ b/broker/gen/api/DefaultApi.cpp @@ -1294,9 +1294,25 @@ void DefaultApi::preview_plot_bin_get_handler(const Pistache::Rest::Request &req type = valueQuery_instance; } } + auto azintUnitQuery = request.query().get("azint_unit"); + std::optional azintUnit; + if(azintUnitQuery.has_value()){ + std::string valueQuery_instance; + if(fromStringValue(azintUnitQuery.value(), valueQuery_instance)){ + azintUnit = valueQuery_instance; + } + } + auto binningQuery = request.query().get("binning"); + std::optional binning; + if(binningQuery.has_value()){ + int32_t valueQuery_instance; + if(fromStringValue(binningQuery.value(), valueQuery_instance)){ + binning = valueQuery_instance; + } + } try { - this->preview_plot_bin_get(type, response); + this->preview_plot_bin_get(type, azintUnit, binning, response); } catch (Pistache::Http::HttpError &e) { response.send(static_cast(e.code()), e.what()); return; diff --git a/broker/gen/api/DefaultApi.h b/broker/gen/api/DefaultApi.h index 88b5bda7..085deceb 100644 --- a/broker/gen/api/DefaultApi.h +++ b/broker/gen/api/DefaultApi.h @@ -515,13 +515,15 @@ private: /// Storage cell number (optional, default to 0) virtual void preview_pedestal_tiff_get(const std::optional &gainLevel, const std::optional &sc, Pistache::Http::ResponseWriter &response) = 0; /// - /// Generate 1D plot from Jungfraujoch and send in binary format. This format is unsuitable for azimuthal integration plots, only to per image plots for a dataset. No binning is available. + /// Generate 1D plot from Jungfraujoch and send in raw binary format. Data are provided as (32-bit) float binary array. This format doesn't transmit information about X-axis, only values, so it is of limited use for azimuthal integration. /// /// /// /// /// Type of requested plot - virtual void preview_plot_bin_get(const std::optional &type, Pistache::Http::ResponseWriter &response) = 0; + /// Unit used for azim int. (optional, default to "Q_recipA") + /// Binning of frames for the plot (0 = default binning) (optional, default to 0) + virtual void preview_plot_bin_get(const std::optional &type, const std::optional &azintUnit, const std::optional &binning, Pistache::Http::ResponseWriter &response) = 0; /// /// Generate 1D plot from Jungfraujoch /// diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index f0f559d9..a4f99348 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -3139,11 +3139,13 @@ paths: /preview/plot.bin: get: summary: | - Generate 1D plot from Jungfraujoch and send in binary format. - This format is unsuitable for azimuthal integration plots, only to per image plots for a dataset. - No binning is available. + Generate 1D plot from Jungfraujoch and send in raw binary format. + Data are provided as (32-bit) float binary array. + This format doesn't transmit information about X-axis, only values, so it is of limited use for azimuthal integration. parameters: - $ref: "#/components/parameters/plot_type" + - $ref: "#/components/parameters/azint_unit" + - $ref: "#/components/parameters/binning" responses: "200": description: Everything OK. diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 0c9bcab7..a7e5c455 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -387,12 +387,12 @@ Get user mask of the detector (binary) Get user mask of the detector (TIFF) " aria-expanded="false" class="sc-cgHfjM ixknQI">

Input parsing or validation error

Response samples

Content type
application/json
{
  • "title": "string",
  • "unit_x": "image_number",
  • "size_x": 0.1,
  • "size_y": 0.1,
  • "plot": [
    ]
}

Generate 1D plot from Jungfraujoch and send in binary format. -This format is unsuitable for azimuthal integration plots, only to per image plots for a dataset. -No binning is available. -

query Parameters
type
required
string
Enum: "bkg_estimate" "azint" "azint_1d" "spot_count" "spot_count_low_res" "spot_count_indexed" "spot_count_ice" "indexing_rate" "indexing_time" "indexing_unit_cell_length" "indexing_unit_cell_angle" "profile_radius" "b_factor" "error_pixels" "saturated_pixels" "image_collection_efficiency" "receiver_delay" "receiver_free_send_buf" "strong_pixels" "roi_sum" "roi_mean" "roi_max_count" "roi_pixels" "roi_weighted_x" "roi_weighted_y" "packets_received" "max_pixel_value" "resolution_estimate" "pixel_sum" "processing_time" "beam_center_x" "beam_center_y"
http://localhost:5232/preview/plot

Response samples

Content type
application/json
{
  • "title": "string",
  • "unit_x": "image_number",
  • "size_x": 0.1,
  • "size_y": 0.1,
  • "plot": [
    ]
}

Generate 1D plot from Jungfraujoch and send in raw binary format. +Data are provided as (32-bit) float binary array. +This format doesn't transmit information about X-axis, only values, so it is of limited use for azimuthal integration. +

query Parameters
type
required
string
Enum: "bkg_estimate" "azint" "azint_1d" "spot_count" "spot_count_low_res" "spot_count_indexed" "spot_count_ice" "indexing_rate" "indexing_time" "indexing_unit_cell_length" "indexing_unit_cell_angle" "profile_radius" "b_factor" "error_pixels" "saturated_pixels" "image_collection_efficiency" "receiver_delay" "receiver_free_send_buf" "strong_pixels" "roi_sum" "roi_mean" "roi_max_count" "roi_pixels" "roi_weighted_x" "roi_weighted_y" "packets_received" "max_pixel_value" "resolution_estimate" "pixel_sum" "processing_time" "beam_center_x" "beam_center_y"

Type of requested plot

+
azint_unit
string
Default: "Q_recipA"
Enum: "Q_recipA" "d_A" "two_theta_deg"

Unit used for azim int.

+
binning
integer

Binning of frames for the plot (0 = default binning)

Responses