jfjoch_broker: Bit more options for preview/plot.bin
This commit is contained in:
@@ -580,15 +580,34 @@ void JFJochBrokerHttp::preview_plot_get(const std::optional<std::string> &type,
|
||||
}
|
||||
|
||||
void JFJochBrokerHttp::preview_plot_bin_get(const std::optional<std::string> &type,
|
||||
const std::optional<std::string> &azintUnit,
|
||||
const std::optional<int32_t> &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();
|
||||
|
||||
|
||||
@@ -169,7 +169,8 @@ class JFJochBrokerHttp : public org::openapitools::server::api::DefaultApi {
|
||||
const std::optional<bool> &compression, const std::optional<float> &fill,
|
||||
const std::optional<bool> &experimentalCoord, const std::optional<std::string> &azintUnit,
|
||||
Pistache::Http::ResponseWriter &response) override;
|
||||
void preview_plot_bin_get(const std::optional<std::string> &type, Pistache::Http::ResponseWriter &response) override;
|
||||
void preview_plot_bin_get(const std::optional<std::string> &type, const std::optional<std::string> &azintUnit,
|
||||
const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) override;
|
||||
|
||||
void config_indexing_get(Pistache::Http::ResponseWriter &response) override;
|
||||
|
||||
|
||||
@@ -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<std::string> 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<int32_t> 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<Pistache::Http::Code>(e.code()), e.what());
|
||||
return;
|
||||
|
||||
@@ -515,13 +515,15 @@ private:
|
||||
/// <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>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <param name="type">Type of requested plot</param>
|
||||
virtual void preview_plot_bin_get(const std::optional<std::string> &type, Pistache::Http::ResponseWriter &response) = 0;
|
||||
/// <param name="azintUnit">Unit used for azim int. (optional, default to "Q_recipA")</param>
|
||||
/// <param name="binning">Binning of frames for the plot (0 = default binning) (optional, default to 0)</param>
|
||||
virtual void preview_plot_bin_get(const std::optional<std::string> &type, const std::optional<std::string> &azintUnit, const std::optional<int32_t> &binning, Pistache::Http::ResponseWriter &response) = 0;
|
||||
/// <summary>
|
||||
/// Generate 1D plot from Jungfraujoch
|
||||
/// </summary>
|
||||
|
||||
@@ -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.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -148,7 +148,7 @@ Class | Method | HTTP request | Description
|
||||
*DefaultApi* | [**initialize_post**](docs/DefaultApi.md#initialize_post) | **POST** /initialize | Initialize detector and data acquisition
|
||||
*DefaultApi* | [**pedestal_post**](docs/DefaultApi.md#pedestal_post) | **POST** /pedestal | Collect dark current for the detector
|
||||
*DefaultApi* | [**preview_pedestal_tiff_get**](docs/DefaultApi.md#preview_pedestal_tiff_get) | **GET** /preview/pedestal.tiff | Get pedestal in TIFF format
|
||||
*DefaultApi* | [**preview_plot_bin_get**](docs/DefaultApi.md#preview_plot_bin_get) | **GET** /preview/plot.bin | 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.
|
||||
*DefaultApi* | [**preview_plot_bin_get**](docs/DefaultApi.md#preview_plot_bin_get) | **GET** /preview/plot.bin | 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.
|
||||
*DefaultApi* | [**preview_plot_get**](docs/DefaultApi.md#preview_plot_get) | **GET** /preview/plot | Generate 1D plot from Jungfraujoch
|
||||
*DefaultApi* | [**result_scan_get**](docs/DefaultApi.md#result_scan_get) | **GET** /result/scan | Get full scan result
|
||||
*DefaultApi* | [**start_post**](docs/DefaultApi.md#start_post) | **POST** /start | Start detector
|
||||
|
||||
@@ -51,7 +51,7 @@ Method | HTTP request | Description
|
||||
[**initialize_post**](DefaultApi.md#initialize_post) | **POST** /initialize | Initialize detector and data acquisition
|
||||
[**pedestal_post**](DefaultApi.md#pedestal_post) | **POST** /pedestal | Collect dark current for the detector
|
||||
[**preview_pedestal_tiff_get**](DefaultApi.md#preview_pedestal_tiff_get) | **GET** /preview/pedestal.tiff | Get pedestal in TIFF format
|
||||
[**preview_plot_bin_get**](DefaultApi.md#preview_plot_bin_get) | **GET** /preview/plot.bin | 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.
|
||||
[**preview_plot_bin_get**](DefaultApi.md#preview_plot_bin_get) | **GET** /preview/plot.bin | 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.
|
||||
[**preview_plot_get**](DefaultApi.md#preview_plot_get) | **GET** /preview/plot | Generate 1D plot from Jungfraujoch
|
||||
[**result_scan_get**](DefaultApi.md#result_scan_get) | **GET** /result/scan | Get full scan result
|
||||
[**start_post**](DefaultApi.md#start_post) | **POST** /start | Start detector
|
||||
@@ -3140,9 +3140,9 @@ No authorization required
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **preview_plot_bin_get**
|
||||
> bytearray preview_plot_bin_get(type)
|
||||
> bytearray preview_plot_bin_get(type, azint_unit=azint_unit, binning=binning)
|
||||
|
||||
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.
|
||||
|
||||
### Example
|
||||
|
||||
@@ -3164,10 +3164,12 @@ with jfjoch_client.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = jfjoch_client.DefaultApi(api_client)
|
||||
type = 'type_example' # str | Type of requested plot
|
||||
azint_unit = Q_recipA # str | Unit used for azim int. (optional) (default to Q_recipA)
|
||||
binning = 56 # int | Binning of frames for the plot (0 = default binning) (optional)
|
||||
|
||||
try:
|
||||
# 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.
|
||||
api_response = api_instance.preview_plot_bin_get(type)
|
||||
# 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.
|
||||
api_response = api_instance.preview_plot_bin_get(type, azint_unit=azint_unit, binning=binning)
|
||||
print("The response of DefaultApi->preview_plot_bin_get:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
@@ -3182,6 +3184,8 @@ with jfjoch_client.ApiClient(configuration) as api_client:
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**type** | **str**| Type of requested plot |
|
||||
**azint_unit** | **str**| Unit used for azim int. | [optional] [default to Q_recipA]
|
||||
**binning** | **int**| Binning of frames for the plot (0 = default binning) | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
|
||||
@@ -1016,22 +1016,29 @@ export class DefaultService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param type Type of requested plot
|
||||
* @param azintUnit Unit used for azim int.
|
||||
*
|
||||
* @param binning Binning of frames for the plot (0 = default binning)
|
||||
* @returns binary Everything OK.
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static getPreviewPlotBin(
|
||||
type: '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',
|
||||
azintUnit: 'Q_recipA' | 'd_A' | 'two_theta_deg' = 'Q_recipA',
|
||||
binning?: number,
|
||||
): CancelablePromise<Blob> {
|
||||
return __request(OpenAPI, {
|
||||
method: 'GET',
|
||||
url: '/preview/plot.bin',
|
||||
query: {
|
||||
'type': type,
|
||||
'azint_unit': azintUnit,
|
||||
'binning': binning,
|
||||
},
|
||||
errors: {
|
||||
400: `Input parsing or validation error`,
|
||||
|
||||
Reference in New Issue
Block a user