Minor modifications to jfjoch_writer and OpenAPI

This commit is contained in:
2024-06-28 20:44:51 +02:00
parent 81df571961
commit 30a92d8eb9
84 changed files with 430 additions and 650 deletions

View File

@@ -363,7 +363,8 @@ inline DatasetSettings Convert(const org::openapitools::server::model::Dataset_s
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Unknown output format");
}
ret.Summation(input.getSummation());
if (input.imageTimeUsIsSet())
ret.ImageTime(std::chrono::microseconds(input.getImageTimeUs()));
ret.BeamX_pxl(input.getBeamXPxl());
ret.BeamY_pxl(input.getBeamYPxl());
ret.DetectorDistance_mm(input.getDetectorDistanceMm());

View File

@@ -283,7 +283,8 @@ DetectorSetup ParseDetectorSetup(const nlohmann::json &j) {
setup.UDPInterfaceCount(GET_I64(j, "udp_interface_count", 2))
.SensorThickness_um(GET_FLOAT(j, "sensor_thickness_um", 320.0f))
.PixelSize_um(GET_FLOAT(j, "pixel_size_um", 75.0f))
.SensorMaterial(GET_STR(j, "sensor_material", "Si"));
.SensorMaterial(GET_STR(j, "sensor_material", "Si"))
.SerialNumber(GET_STR(j, "serial_number",""));
if (j.contains("tx_delay"))
setup.TxDelay(GET_I64_ARR(j, "tx_delay"));

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -25,8 +25,8 @@ Dataset_settings::Dataset_settings()
m_Images_per_triggerIsSet = false;
m_Ntrigger = 1L;
m_NtriggerIsSet = false;
m_Summation = 1L;
m_SummationIsSet = false;
m_Image_time_us = 0L;
m_Image_time_usIsSet = false;
m_Beam_x_pxl = 0.0f;
m_Beam_y_pxl = 0.0f;
m_Detector_distance_mm = 0.0f;
@@ -111,21 +111,16 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP
}
if (summationIsSet())
if (imageTimeUsIsSet())
{
const int64_t& value = m_Summation;
const std::string currentValuePath = _pathPrefix + ".summation";
const int64_t& value = m_Image_time_us;
const std::string currentValuePath = _pathPrefix + ".imageTimeUs";
if (value < 1ll)
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
if (value > 256ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 256;";
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
@@ -277,7 +272,7 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const
((!ntriggerIsSet() && !rhs.ntriggerIsSet()) || (ntriggerIsSet() && rhs.ntriggerIsSet() && getNtrigger() == rhs.getNtrigger())) &&
((!summationIsSet() && !rhs.summationIsSet()) || (summationIsSet() && rhs.summationIsSet() && getSummation() == rhs.getSummation())) &&
((!imageTimeUsIsSet() && !rhs.imageTimeUsIsSet()) || (imageTimeUsIsSet() && rhs.imageTimeUsIsSet() && getImageTimeUs() == rhs.getImageTimeUs())) &&
(getBeamXPxl() == rhs.getBeamXPxl())
&&
@@ -357,8 +352,8 @@ void to_json(nlohmann::json& j, const Dataset_settings& o)
j["images_per_trigger"] = o.m_Images_per_trigger;
if(o.ntriggerIsSet())
j["ntrigger"] = o.m_Ntrigger;
if(o.summationIsSet())
j["summation"] = o.m_Summation;
if(o.imageTimeUsIsSet())
j["image_time_us"] = o.m_Image_time_us;
j["beam_x_pxl"] = o.m_Beam_x_pxl;
j["beam_y_pxl"] = o.m_Beam_y_pxl;
j["detector_distance_mm"] = o.m_Detector_distance_mm;
@@ -411,10 +406,10 @@ void from_json(const nlohmann::json& j, Dataset_settings& o)
j.at("ntrigger").get_to(o.m_Ntrigger);
o.m_NtriggerIsSet = true;
}
if(j.find("summation") != j.end())
if(j.find("image_time_us") != j.end())
{
j.at("summation").get_to(o.m_Summation);
o.m_SummationIsSet = true;
j.at("image_time_us").get_to(o.m_Image_time_us);
o.m_Image_time_usIsSet = true;
}
j.at("beam_x_pxl").get_to(o.m_Beam_x_pxl);
j.at("beam_y_pxl").get_to(o.m_Beam_y_pxl);
@@ -538,22 +533,22 @@ void Dataset_settings::unsetNtrigger()
{
m_NtriggerIsSet = false;
}
int64_t Dataset_settings::getSummation() const
int64_t Dataset_settings::getImageTimeUs() const
{
return m_Summation;
return m_Image_time_us;
}
void Dataset_settings::setSummation(int64_t const value)
void Dataset_settings::setImageTimeUs(int64_t const value)
{
m_Summation = value;
m_SummationIsSet = true;
m_Image_time_us = value;
m_Image_time_usIsSet = true;
}
bool Dataset_settings::summationIsSet() const
bool Dataset_settings::imageTimeUsIsSet() const
{
return m_SummationIsSet;
return m_Image_time_usIsSet;
}
void Dataset_settings::unsetSummation()
void Dataset_settings::unsetImage_time_us()
{
m_SummationIsSet = false;
m_Image_time_usIsSet = false;
}
float Dataset_settings::getBeamXPxl() const
{

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
@@ -76,12 +76,12 @@ public:
bool ntriggerIsSet() const;
void unsetNtrigger();
/// <summary>
/// FPGA frame summation. For summation above two 32-bit pixel format will be used, unless explicitly specified. Frame summation factor applies only to conversion mode (assumed as 1 for raw data). In XFEL mode: summation happens for frames collected with multiple triggers. Ignored for storage cells (assumed as 1).
/// Image time. If not provided (or zero value) the frame time is assumed as default. For JUNGFRAU, image time must be multiple of frame time, up to 256 * frame_time. In XFEL mode: summation happens for frames collected with multiple triggers. Ignored for storage cells and if raw data are saved.
/// </summary>
int64_t getSummation() const;
void setSummation(int64_t const value);
bool summationIsSet() const;
void unsetSummation();
int64_t getImageTimeUs() const;
void setImageTimeUs(int64_t const value);
bool imageTimeUsIsSet() const;
void unsetImage_time_us();
/// <summary>
/// /entry/detector/beam_center_x in NXmx Beam center in X direction [pixels]
/// </summary>
@@ -227,8 +227,8 @@ protected:
bool m_Images_per_triggerIsSet;
int64_t m_Ntrigger;
bool m_NtriggerIsSet;
int64_t m_Summation;
bool m_SummationIsSet;
int64_t m_Image_time_us;
bool m_Image_time_usIsSet;
float m_Beam_x_pxl;
float m_Beam_y_pxl;

View File

@@ -1,133 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Dataset_settings_roi_sum_area.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Dataset_settings_roi_sum_area::Dataset_settings_roi_sum_area()
{
m_X_min = 0L;
m_X_max = 0L;
m_Y_min = 0L;
m_Y_max = 0L;
}
void Dataset_settings_roi_sum_area::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Dataset_settings_roi_sum_area::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Dataset_settings_roi_sum_area::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Dataset_settings_roi_sum_area" : pathPrefix;
return success;
}
bool Dataset_settings_roi_sum_area::operator==(const Dataset_settings_roi_sum_area& rhs) const
{
return
(getXMin() == rhs.getXMin())
&&
(getXMax() == rhs.getXMax())
&&
(getYMin() == rhs.getYMin())
&&
(getYMax() == rhs.getYMax())
;
}
bool Dataset_settings_roi_sum_area::operator!=(const Dataset_settings_roi_sum_area& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Dataset_settings_roi_sum_area& o)
{
j = nlohmann::json();
j["x_min"] = o.m_X_min;
j["x_max"] = o.m_X_max;
j["y_min"] = o.m_Y_min;
j["y_max"] = o.m_Y_max;
}
void from_json(const nlohmann::json& j, Dataset_settings_roi_sum_area& o)
{
j.at("x_min").get_to(o.m_X_min);
j.at("x_max").get_to(o.m_X_max);
j.at("y_min").get_to(o.m_Y_min);
j.at("y_max").get_to(o.m_Y_max);
}
int64_t Dataset_settings_roi_sum_area::getXMin() const
{
return m_X_min;
}
void Dataset_settings_roi_sum_area::setXMin(int64_t const value)
{
m_X_min = value;
}
int64_t Dataset_settings_roi_sum_area::getXMax() const
{
return m_X_max;
}
void Dataset_settings_roi_sum_area::setXMax(int64_t const value)
{
m_X_max = value;
}
int64_t Dataset_settings_roi_sum_area::getYMin() const
{
return m_Y_min;
}
void Dataset_settings_roi_sum_area::setYMin(int64_t const value)
{
m_Y_min = value;
}
int64_t Dataset_settings_roi_sum_area::getYMax() const
{
return m_Y_max;
}
void Dataset_settings_roi_sum_area::setYMax(int64_t const value)
{
m_Y_max = value;
}
} // namespace org::openapitools::server::model

View File

@@ -1,97 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Dataset_settings_roi_sum_area.h
*
* Rectangle for ROI summation
*/
#ifndef Dataset_settings_roi_sum_area_H_
#define Dataset_settings_roi_sum_area_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
/// Rectangle for ROI summation
/// </summary>
class Dataset_settings_roi_sum_area
{
public:
Dataset_settings_roi_sum_area();
virtual ~Dataset_settings_roi_sum_area() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Dataset_settings_roi_sum_area& rhs) const;
bool operator!=(const Dataset_settings_roi_sum_area& rhs) const;
/////////////////////////////////////////////
/// Dataset_settings_roi_sum_area members
/// <summary>
///
/// </summary>
int64_t getXMin() const;
void setXMin(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getXMax() const;
void setXMax(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getYMin() const;
void setYMin(int64_t const value);
/// <summary>
///
/// </summary>
int64_t getYMax() const;
void setYMax(int64_t const value);
friend void to_json(nlohmann::json& j, const Dataset_settings_roi_sum_area& o);
friend void from_json(const nlohmann::json& j, Dataset_settings_roi_sum_area& o);
protected:
int64_t m_X_min;
int64_t m_X_max;
int64_t m_Y_min;
int64_t m_Y_max;
};
} // namespace org::openapitools::server::model
#endif /* Dataset_settings_roi_sum_area_H_ */

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -1,106 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "Plot_request.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Plot_request::Plot_request()
{
m_Binning = 0L;
m_BinningIsSet = false;
}
void Plot_request::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Plot_request::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Plot_request::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Plot_request" : pathPrefix;
return success;
}
bool Plot_request::operator==(const Plot_request& rhs) const
{
return
((!binningIsSet() && !rhs.binningIsSet()) || (binningIsSet() && rhs.binningIsSet() && getBinning() == rhs.getBinning()))
;
}
bool Plot_request::operator!=(const Plot_request& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Plot_request& o)
{
j = nlohmann::json();
if(o.binningIsSet())
j["binning"] = o.m_Binning;
}
void from_json(const nlohmann::json& j, Plot_request& o)
{
if(j.find("binning") != j.end())
{
j.at("binning").get_to(o.m_Binning);
o.m_BinningIsSet = true;
}
}
int64_t Plot_request::getBinning() const
{
return m_Binning;
}
void Plot_request::setBinning(int64_t const value)
{
m_Binning = value;
m_BinningIsSet = true;
}
bool Plot_request::binningIsSet() const
{
return m_BinningIsSet;
}
void Plot_request::unsetBinning()
{
m_BinningIsSet = false;
}
} // namespace org::openapitools::server::model

View File

@@ -1,78 +0,0 @@
/**
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Plot_request.h
*
*
*/
#ifndef Plot_request_H_
#define Plot_request_H_
#include <nlohmann/json.hpp>
namespace org::openapitools::server::model
{
/// <summary>
///
/// </summary>
class Plot_request
{
public:
Plot_request();
virtual ~Plot_request() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes an error
/// message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and calls it's validate.
/// Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Plot_request& rhs) const;
bool operator!=(const Plot_request& rhs) const;
/////////////////////////////////////////////
/// Plot_request members
/// <summary>
///
/// </summary>
int64_t getBinning() const;
void setBinning(int64_t const value);
bool binningIsSet() const;
void unsetBinning();
friend void to_json(nlohmann::json& j, const Plot_request& o);
friend void from_json(const nlohmann::json& j, Plot_request& o);
protected:
int64_t m_Binning;
bool m_BinningIsSet;
};
} // namespace org::openapitools::server::model
#endif /* Plot_request_H_ */

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,8 +2,8 @@
* Jungfraujoch
* Jungfraujoch Broker Web API
*
* The version of the OpenAPI document: 1.0.1
*
* The version of the OpenAPI document: 1.0.0_rc.10
* Contact: filip.leonarski@psi.ch
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech

View File

@@ -2,7 +2,9 @@ openapi: 3.0.3
info:
title: Jungfraujoch
description: Jungfraujoch Broker Web API
version: 1.0.1
version: 1.0.0_rc.10
contact:
email: filip.leonarski@psi.ch
components:
schemas:
rotation_axis:
@@ -61,17 +63,16 @@ components:
minimum: 1
description: |
Number of TTL trigger that the detector is expected to receive during data collection
summation:
image_time_us:
type: integer
format: int64
minimum: 1
maximum: 256
default: 1
minimum: 0
description: |
FPGA frame summation. For summation above two 32-bit pixel format will be used, unless explicitly specified.
Frame summation factor applies only to conversion mode (assumed as 1 for raw data).
Image time.
If not provided (or zero value) the frame time is assumed as default.
Image time must be multiple of frame time; max value is 256 * frame_time.
In XFEL mode: summation happens for frames collected with multiple triggers.
Ignored for storage cells (assumed as 1).
Ignored for storage cells and if raw data are saved.
beam_x_pxl:
type: number
format: float

File diff suppressed because one or more lines are too long

View File

@@ -19,7 +19,6 @@ DatasetSettings::DatasetSettings() {
file_prefix = "test";
ntrigger = 1;
images_per_trigger = 1;
summation = 1;
fpga_pixel_output = FPGAPixelOutput::Auto;
space_group_number = 0; // not set
compression = CompressionAlgorithm::BSHUF_LZ4;
@@ -191,13 +190,6 @@ DatasetSettings &DatasetSettings::PhotonEnergyMultiplayer(float input) {
return *this;
}
DatasetSettings &DatasetSettings::Summation(int64_t input) {
check_min("Summation", input, 1);
check_max("Summation", input, MAX_FPGA_SUMMATION);
summation = input;
return *this;
}
DatasetSettings &DatasetSettings::FPGAOutputMode(FPGAPixelOutput input) {
switch (input) {
case FPGAPixelOutput::Auto:
@@ -249,10 +241,6 @@ int64_t DatasetSettings::GetSpaceGroupNumber() const {
return space_group_number;
}
int64_t DatasetSettings::GetSummation() const {
return summation;
}
FPGAPixelOutput DatasetSettings::GetFPGAOutputMode() const {
return fpga_pixel_output;
}
@@ -355,3 +343,15 @@ std::optional<std::string> DatasetSettings::GetRunName() const {
std::string DatasetSettings::GetExperimentGroup() const {
return group;
}
std::optional<std::chrono::microseconds> DatasetSettings::GetImageTime() const {
return image_time;
}
DatasetSettings &DatasetSettings::ImageTime(const std::optional<std::chrono::microseconds> input) {
if (input && (input.value().count() == 0))
image_time = {};
else
image_time = input;
return *this;
}

View File

@@ -21,7 +21,6 @@ class DatasetSettings {
int64_t ntrigger;
FPGAPixelOutput fpga_pixel_output;
int64_t summation;
float beam_x_pxl;
float beam_y_pxl;
@@ -48,6 +47,7 @@ class DatasetSettings {
float data_reduction_factor_serialmx;
std::optional<std::chrono::microseconds> image_time;
std::optional<uint64_t> run_number;
std::optional<std::string> run_name;
std::string group;
@@ -73,13 +73,13 @@ public:
DatasetSettings& HeaderAppendix(const nlohmann::json& input);
DatasetSettings& ImageAppendix(const nlohmann::json& input);
DatasetSettings& PhotonEnergyMultiplayer(float input);
DatasetSettings& Summation(int64_t input);
DatasetSettings& FPGAOutputMode(FPGAPixelOutput input);
DatasetSettings& ImagesPerFile(int64_t input);
DatasetSettings& DataReductionFactorSerialMX(float input);
DatasetSettings& RunNumber(const std::optional<uint64_t> &run_number);
DatasetSettings& RunName(const std::optional<std::string> &input);
DatasetSettings& ExperimentGroup(const std::string &group);
DatasetSettings& ImageTime(const std::optional<std::chrono::microseconds> input);
std::optional<float> GetAttenuatorTransmission() const;
std::optional<float> GetTotalFlux() const;
@@ -90,7 +90,6 @@ public:
float GetPhotonEnergyMultiplier() const;
std::optional<UnitCell> GetUnitCell() const;
int64_t GetSpaceGroupNumber() const;
int64_t GetSummation() const;
FPGAPixelOutput GetFPGAOutputMode() const;
std::string GetSampleName() const;
float GetPhotonEnergy_keV() const;
@@ -112,6 +111,7 @@ public:
std::optional<uint64_t> GetRunNumber() const;
std::optional<std::string> GetRunName() const;
std::string GetExperimentGroup() const;
std::optional<std::chrono::microseconds> GetImageTime() const;
};
#endif //JUNGFRAUJOCH_DATASETSETTINGS_H

View File

@@ -148,3 +148,12 @@ void DetectorSetup::SetTrimFiles(const std::vector<std::string> &filenames) {
const std::vector<std::string> &DetectorSetup::GetTrimFileNames() const {
return trim_file_names;
}
std::string DetectorSetup::GetSerialNumber() const {
return serial_number;
}
DetectorSetup &DetectorSetup::SerialNumber(const std::string &input) {
serial_number = input;
return *this;
}

View File

@@ -10,6 +10,7 @@ enum class DetectorType {EIGER, JUNGFRAU};
class DetectorSetup {
std::string description;
std::string serial_number;
DetectorGeometry geometry;
std::vector<std::string> det_modules_hostname;
std::vector<std::string> gain_file_names;
@@ -41,6 +42,7 @@ public:
DetectorSetup& SensorThickness_um(float input);
DetectorSetup& PixelSize_um(float input);
DetectorSetup& HighVoltage(int32_t input);
DetectorSetup& SerialNumber(const std::string &input);
[[nodiscard]] DetectorType GetDetectorType() const;
[[nodiscard]] const DetectorGeometry& GetGeometry() const;
@@ -56,6 +58,7 @@ public:
[[nodiscard]] const std::vector<std::string> &GetGainFileNames() const;
[[nodiscard]] const std::vector<std::string> &GetTrimFileNames() const;
[[nodiscard]] int32_t GetHighVoltage() const;
[[nodiscard]] std::string GetSerialNumber() const;
};

View File

@@ -67,6 +67,8 @@ DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup)
mode = DetectorMode::Conversion;
max_spot_count = MAX_SPOT_COUNT;
summation = 1;
}
// setter functions
@@ -751,8 +753,8 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
message.rotation_axis[2] = GetRotationAxis().z;
}
message.series_id = GetRunNumber();
message.series_unique_id = GetRunName();
message.run_number = GetRunNumber();
message.run_name = GetRunName();
message.gain_file_names = detector.GetGainFileNames();
@@ -762,6 +764,7 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
message.data_reduction_factor_serialmx = GetDataReductionFactorSerialMX();
message.experiment_group = dataset.GetExperimentGroup();
message.jfjoch_release = jfjoch_version();
message.detector_serial_number = detector.GetSerialNumber();
}
float DiffractionExperiment::GetPixelSize_mm() const {
@@ -882,7 +885,9 @@ std::chrono::nanoseconds DiffractionExperiment::GetStorageCellDelay() const {
}
DiffractionExperiment &DiffractionExperiment::Summation(int64_t input) {
dataset.Summation(input);
check_min("Summation factor", input, 1);
check_max("Summation factor", input, MAX_FPGA_SUMMATION);
summation = input;
return *this;
}
@@ -898,7 +903,7 @@ int64_t DiffractionExperiment::GetSummation() const {
if (GetStorageCellNumber() > 1)
return 1;
else
return dataset.GetSummation();
return summation;
}
}
@@ -1138,6 +1143,19 @@ int64_t DiffractionExperiment::GetInternalPacketGeneratorImages() const {
DiffractionExperiment &DiffractionExperiment::ImportDatasetSettings(const DatasetSettings &input) {
auto tmp = dataset;
dataset = input;
auto image_time = input.GetImageTime();
if (image_time) {
if (image_time->count() % GetFrameTime().count() != 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Image time must be multiple of frame time");
if (GetFrameTime().count() == 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Frame time cannot be zero");
this->Summation(image_time.value() / GetFrameTime());
} else
summation = 1;
if (GetFrameNum() >= MAX_FRAMES) {
dataset = tmp;
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,

View File

@@ -98,6 +98,8 @@ class DiffractionExperiment {
ROIMap roi_mask;
int64_t max_spot_count;
int64_t summation;
public:
// Public methods are atomic
DiffractionExperiment();

View File

@@ -91,7 +91,7 @@ void DetectorWrapper::Initialize(const DiffractionExperiment& experiment,
throw JFJochException(JFJochExceptionCategory::Detector,
"Discrepancy in module number between DAQ and detector");
}
det.setDynamicRange(16);
det.setTenGiga(true);
auto trim_files = experiment.GetDetectorSetup().GetTrimFileNames();

View File

@@ -441,9 +441,9 @@ namespace {
else if (key == "data")
ProcessImageData(value, message.image);
else if (key == "series_unique_id")
message.series_unique_id = GetCBORString(value);
message.run_name = GetCBORString(value);
else if (key == "series_id")
message.series_id = GetCBORUInt(value);
message.run_number = GetCBORUInt(value);
else if (key == "real_time") {
auto r = GetRational(value);
message.exptime = r.first;
@@ -715,9 +715,9 @@ namespace {
else if (key == "detector_serial_number")
message.detector_serial_number = GetCBORString(value);
else if (key == "series_unique_id")
message.series_unique_id = GetCBORString(value);
message.run_name = GetCBORString(value);
else if (key == "series_id")
message.series_id = GetCBORUInt(value);
message.run_number = GetCBORUInt(value);
else if (key == "pixel_mask")
ProcessPixelMaskElement(message, value);
else if (key == "channels")
@@ -837,9 +837,9 @@ namespace {
if (key == "end_date")
message.end_date = GetCBORString(value);
else if (key == "series_unique_id")
message.series_unique_id = GetCBORString(value);
message.run_name = GetCBORString(value);
else if (key == "series_id")
message.series_id = GetCBORUInt(value);
message.run_number = GetCBORUInt(value);
else if (key == "max_image_number")
message.max_image_number = GetCBORUInt(value);
else if (key == "images_collected")

View File

@@ -372,8 +372,8 @@ void CBORStream2Serializer::SerializeSequenceStart(const StartMessage& message)
CBOR_ENC(mapEncoder, "pixel_mask_enabled", message.pixel_mask_enabled);
CBOR_ENC(mapEncoder, "detector_description", message.detector_description);
CBOR_ENC(mapEncoder, "detector_serial_number", message.detector_serial_number);
CBOR_ENC(mapEncoder, "series_unique_id", message.series_unique_id);
CBOR_ENC(mapEncoder, "series_id", message.series_id);
CBOR_ENC(mapEncoder, "series_unique_id", message.run_name);
CBOR_ENC(mapEncoder, "series_id", message.run_number);
CBOR_ENC_AXIS(mapEncoder, "detector_translation", message.detector_translation);
CBOR_ENC_GONIOMETER_MAP(mapEncoder, "goniometer", message);
@@ -418,8 +418,8 @@ void CBORStream2Serializer::SerializeSequenceEnd(const EndMessage& message) {
CBOR_ENC(mapEncoder, "type", "end");
CBOR_ENC(mapEncoder, "magic_number", user_data_magic_number);
CBOR_ENC(mapEncoder, "series_unique_id", message.series_unique_id);
CBOR_ENC(mapEncoder, "series_id", message.series_id);
CBOR_ENC(mapEncoder, "series_unique_id", message.run_name);
CBOR_ENC(mapEncoder, "series_id", message.run_number);
CBOR_ENC(mapEncoder, "end_date", message.end_date);
CBOR_ENC(mapEncoder, "max_image_number", message.max_image_number);
@@ -444,8 +444,8 @@ void CBORStream2Serializer::SerializeImage(const DataMessage& message) {
CBOR_ENC(mapEncoder, "type", "image");
CBOR_ENC(mapEncoder, "magic_number", user_data_magic_number);
CBOR_ENC(mapEncoder, "series_unique_id", message.series_unique_id);
CBOR_ENC(mapEncoder, "series_id", message.series_id);
CBOR_ENC(mapEncoder, "series_unique_id", message.run_name);
CBOR_ENC(mapEncoder, "series_id", message.run_number);
CBOR_ENC(mapEncoder, "image_id", message.number);
CBOR_ENC(mapEncoder, "original_image_id", message.original_number);

View File

@@ -64,8 +64,8 @@ struct DataMessage {
uint32_t exptime;
uint32_t exptime_base;
std::string series_unique_id;
uint64_t series_id;
std::string run_name;
uint64_t run_number;
uint64_t saturated_pixel_count;
uint64_t error_pixel_count;
@@ -140,8 +140,8 @@ struct StartMessage {
std::string detector_description;
std::string detector_serial_number;
std::string series_unique_id;
uint64_t series_id;
std::string run_name;
uint64_t run_number;
std::vector<std::string> gain_file_names;
std::vector<std::string> roi_names;
@@ -189,8 +189,8 @@ struct EndMessage {
std::optional<std::string> end_date;
std::string series_unique_id;
uint64_t series_id;
std::string run_name;
uint64_t run_number;
std::map<std::string, std::vector<float>> az_int_result;
std::map<std::string, std::vector<uint64_t>> adu_histogram;

View File

@@ -303,8 +303,8 @@ void JFJochReceiver::FrameTransformationThread(uint32_t threadid) {
message.number = image_number;
message.original_number = image_number;
message.user_data = experiment.GetImageAppendix();
message.series_id = experiment.GetRunNumber();
message.series_unique_id = experiment.GetRunName();
message.run_number = experiment.GetRunNumber();
message.run_name = experiment.GetRunName();
ImageMetadata metadata(experiment);
@@ -458,8 +458,8 @@ void JFJochReceiver::FinalizeMeasurement() {
message.max_receiver_delay = max_delay;
message.efficiency = GetEfficiency();
message.end_date = time_UTC(std::chrono::system_clock::now());
message.series_id = experiment.GetRunNumber();
message.series_unique_id = experiment.GetRunName();
message.run_number = experiment.GetRunNumber();
message.run_name = experiment.GetRunName();
message.az_int_result["dataset"] = plots.GetAzIntProfile();
for (int i = 0; i < experiment.GetTimePointNumber(); i++)

View File

@@ -44,8 +44,8 @@ TEST_CASE("CBORSerialize_Start", "[CBOR]") {
.channels = {"default", "sc2"},
.detector_description = "EIGER 16M",
.detector_serial_number = "123",
.series_unique_id = "bla",
.series_id = 4567,
.run_name = "bla",
.run_number = 4567,
.gain_file_names = {"abc" , "def", "/dsadasdsa/dadsadas/dsadsa/M056.bin"},
.roi_names = {"roi0", "roi1"},
.goniometer = GoniometerAxis{
@@ -110,8 +110,8 @@ TEST_CASE("CBORSerialize_Start", "[CBOR]") {
CHECK(output_message.channels == message.channels);
CHECK(output_message.detector_description == message.detector_description);
CHECK(output_message.detector_serial_number == message.detector_serial_number);
CHECK(output_message.series_unique_id == message.series_unique_id);
CHECK(output_message.series_id == message.series_id);
CHECK(output_message.run_name == message.run_name);
CHECK(output_message.run_number == message.run_number);
CHECK(output_message.source_type == message.source_type);
CHECK(output_message.source_name == message.source_name);
CHECK(output_message.source_name_short == message.source_name_short);
@@ -241,8 +241,8 @@ TEST_CASE("CBORSerialize_End", "[CBOR]") {
.max_receiver_delay = 3456,
.efficiency = 0.99,
.end_date = "ccc",
.series_unique_id = "bla5",
.series_id = 45676782
.run_name = "bla5",
.run_number = 45676782
};
REQUIRE_NOTHROW(serializer.SerializeSequenceEnd(message));
@@ -260,8 +260,8 @@ TEST_CASE("CBORSerialize_End", "[CBOR]") {
REQUIRE(output_message.efficiency);
REQUIRE(output_message.efficiency == Catch::Approx(message.efficiency.value()));
REQUIRE(output_message.end_date == message.end_date);
REQUIRE(output_message.series_id == message.series_id);
REQUIRE(output_message.series_unique_id == message.series_unique_id);
REQUIRE(output_message.run_number == message.run_number);
REQUIRE(output_message.run_name == message.run_name);
REQUIRE(output_message.az_int_result.empty());
}
@@ -274,8 +274,8 @@ TEST_CASE("CBORSerialize_End_RadIntResult", "[CBOR]") {
.max_receiver_delay = 3456,
.efficiency = 0.99,
.end_date = "ccc",
.series_unique_id = "bla5",
.series_id = 45676782
.run_name = "bla5",
.run_number = 45676782
};
message.az_int_result["avg"] = {11.0, 12.0, 13.0};
@@ -304,8 +304,8 @@ TEST_CASE("CBORSerialize_End_ADUHistogram", "[CBOR]") {
.max_receiver_delay = 3456,
.efficiency = 0.99,
.end_date = "ccc",
.series_unique_id = "bla5",
.series_id = 45676782,
.run_name = "bla5",
.run_number = 45676782,
.adu_histogram_bin_width = 55
};
@@ -361,8 +361,8 @@ TEST_CASE("CBORSerialize_Image", "[CBOR]") {
.adu_histogram = {3, 4, 5, 8},
.timestamp = 1ul<<27 | 1ul <<35,
.exptime = 1000,
.series_unique_id = "bla2",
.series_id = 4567678,
.run_name = "bla2",
.run_number = 4567678,
.saturated_pixel_count = 378,
.error_pixel_count = 123,
.strong_pixel_count = 1234,
@@ -393,8 +393,8 @@ TEST_CASE("CBORSerialize_Image", "[CBOR]") {
REQUIRE(image_array.image.size == test.size());
REQUIRE(image_array.indexing_result == message.indexing_result);
REQUIRE(image_array.number == 456);
REQUIRE(image_array.series_id == message.series_id);
REQUIRE(image_array.series_unique_id == message.series_unique_id);
REQUIRE(image_array.run_number == message.run_number);
REQUIRE(image_array.run_name == message.run_name);
REQUIRE(memcmp(image_array.image.data, test.data(), test.size()) == 0);
REQUIRE(image_array.xfel_pulse_id == message.xfel_pulse_id);

View File

@@ -661,6 +661,23 @@ TEST_CASE("DiffractionExperiment_StorageCells_Pedestal_FixedG1","[DiffractionExp
REQUIRE(x.GetFrameNum() == 323 * 15);
}
TEST_CASE("DiffractionExperiment_ImageTime","[DiffractionExperiment]") {
DiffractionExperiment x(DetectorSetup(3, DetectorType::JUNGFRAU));
DatasetSettings s;
x.FrameTime(583us);
s.ImageTime(583us * 4);
x.ImportDatasetSettings(s);
REQUIRE(x.GetSummation() == 4);
s.ImageTime({});
x.ImportDatasetSettings(s);
REQUIRE(x.GetSummation() == 1);
s.ImageTime(585us);
REQUIRE_THROWS(x.ImportDatasetSettings(s));
}
TEST_CASE("DiffractionExperiment_PulsedSource","[DiffractionExperiment]") {
DiffractionExperiment x;
REQUIRE(!x.IsPulsedSource()); // default must be off

View File

@@ -229,7 +229,7 @@ TEST_CASE("HDF5Writer_Socket", "[HDF5][Full]") {
d.FilePrefix("run0345_lysozyme_acq").ImagesPerTrigger(5).ImagesPerFile(2).Compression(CompressionAlgorithm::NO_COMPRESSION)
.HeaderAppendix(R"({"z":567})"_json).DetectorDistance_mm(155).BeamX_pxl(1606.62).BeamY_pxl(1669.59)
.PhotonEnergy_keV(12.07).SetUnitCell(UnitCell{.a = 97, .b = 97, .c = 38, .alpha= 90, .beta = 90, .gamma = 90})
.SpaceGroupNumber(96).RunNumber(345).ExperimentGroup("p12345").SampleName("lysozyme");
.SpaceGroupNumber(96).RunNumber(345).ExperimentGroup("p12345").SampleName("lysozyme").RunName("run1");
x.ImportDatasetSettings(d);
std::vector<SpotToSave> spots;
@@ -271,10 +271,11 @@ TEST_CASE("HDF5Writer_Socket", "[HDF5][Full]") {
REQUIRE(j["filename"] == "run0345_lysozyme_acq_data_000001.h5");
REQUIRE(j["file_number"] == 1);
REQUIRE(j["nimages"] == 2);
REQUIRE(j["photon_energy_eV"] == Catch::Approx(x.GetPhotonEnergy_keV() * 1000.0));
REQUIRE(j["incident_energy_eV"] == Catch::Approx(x.GetPhotonEnergy_keV() * 1000.0));
REQUIRE(j["space_group_number"] == 96);
REQUIRE(j["experiment_group"] == "p12345");
REQUIRE(j["run_number"] == 345);
REQUIRE(j["run_name"] == "run1");
REQUIRE(j.contains("user_data"));
REQUIRE(j["user_data"]["z"] == 567);
std::cout << j.dump(4) << std::endl;
@@ -383,10 +384,26 @@ TEST_CASE("HDF5Writer_Rad_Int_Profile", "[HDF5][Full]") {
}
TEST_CASE("HDF5NXmx_DataFileName", "[HDF5]") {
REQUIRE(HDF5Metadata::DataFileName("z/x", 34) == "z/x_data_000035.h5");
REQUIRE(HDF5Metadata::DataFileName("z/x", 0) == "z/x_data_000001.h5");
REQUIRE_THROWS(HDF5Metadata::DataFileName("z/x", 1000000));
REQUIRE_THROWS(HDF5Metadata::DataFileName("z/x", -1));
StartMessage message;
message.file_prefix = "z/x";
REQUIRE(HDF5Metadata::DataFileName(message, 34) == "z/x_data_000035.h5");
REQUIRE(HDF5Metadata::DataFileName(message, 0) == "z/x_data_000001.h5");
REQUIRE_THROWS(HDF5Metadata::DataFileName(message, 1000000));
REQUIRE_THROWS(HDF5Metadata::DataFileName(message, -1));
}
TEST_CASE("HDF5NXmx_DataFileName_SwissFEL", "[HDF5]") {
StartMessage message;
message.file_prefix = "acq";
message.source_name = "SwissFEL";
message.detector_serial_number = "JF17T16V01";
REQUIRE(HDF5Metadata::DataFileName(message, 34) == "acq0035.JF17T16V01.h5");
REQUIRE(HDF5Metadata::DataFileName(message, 0) == "acq0001.JF17T16V01.h5");
REQUIRE_THROWS(HDF5Metadata::DataFileName(message, 10000));
REQUIRE_THROWS(HDF5Metadata::DataFileName(message, -1));
message.detector_serial_number = "";
REQUIRE(HDF5Metadata::DataFileName(message, 34) == "acq0035.JF.h5");
}
TEST_CASE("HDF5Objects_ExtractFilename", "[HDF5]") {

View File

@@ -101,6 +101,7 @@ TEST_CASE("JFJochBrokerParser_DetectorSetup") {
"description": "PSI JUNGFRAU 2M",
"udp_interface_count": 1,
"module_hostname": ["mx1", "mx2", "mx3", "mx4"],
"serial_number": "JF1",
"gain_files": [
"../../tests/test_data/gainMaps_M049.bin",
"../../tests/test_data/gainMaps_M049.bin",
@@ -121,6 +122,7 @@ TEST_CASE("JFJochBrokerParser_DetectorSetup") {
REQUIRE(detector.GetDetectorModuleHostname()[2] == "mx3");
REQUIRE(detector.GetGainCalibration().size() == 4);
REQUIRE(detector.GetUDPInterfaceCount() == 1);
REQUIRE(detector.GetSerialNumber() == "JF1");
}
TEST_CASE("JFJochBrokerParser_DetectorType_implicit") {

View File

@@ -20,7 +20,7 @@ HDF5DataFile::HDF5DataFile(const StartMessage &msg, uint64_t in_file_number) {
ypixel = 0;
max_image_number = 0;
nimages = 0;
filename = HDF5Metadata::DataFileName(msg.file_prefix, file_number);
filename = HDF5Metadata::DataFileName(msg, file_number);
image_low = file_number * msg.images_per_file;
tmp_filename = fmt::format("{}.tmp{:8x}", filename, std::chrono::system_clock::now().time_since_epoch().count());

View File

@@ -40,15 +40,26 @@ NXmx::~NXmx() {
std::rename(tmp_filename.c_str(), filename.c_str());
}
std::string HDF5Metadata::DataFileName(const std::string &prefix, int64_t file_number) {
std::string HDF5Metadata::DataFileName(const StartMessage &msg, int64_t file_number) {
if (file_number < 0)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"File number cannot be negative");
else if (file_number >= 1000000)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Format doesn't allow for 1 million or more files");
else
return fmt::format("{:s}_data_{:06d}.h5", prefix, file_number + 1);
if (msg.source_name == "SwissFEL") {
if (file_number >= 10000)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Format doesn't allow for 10'000 or more files");
else if (msg.detector_serial_number.empty())
return fmt::format("{:s}{:04d}.JF.h5", msg.file_prefix, file_number + 1);
else
return fmt::format("{:s}{:04d}.{:s}.h5", msg.file_prefix, file_number + 1, msg.detector_serial_number);
} else {
if (file_number >= 1000000)
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Format doesn't allow for 1 million or more files");
else
return fmt::format("{:s}_data_{:06d}.h5", msg.file_prefix, file_number + 1);
}
}
void NXmx::LinkToData(const StartMessage &start, const EndMessage &end) {
@@ -66,7 +77,7 @@ void NXmx::LinkToData(const StartMessage &start, const EndMessage &end) {
for (uint32_t file_id = 0; file_id < file_count; file_id++) {
char buff[32];
snprintf(buff,32,"/entry/data/data_%06d", file_id+1);
hdf5_file->ExternalLink(HDF5Metadata::DataFileName(start.file_prefix, file_id),
hdf5_file->ExternalLink(HDF5Metadata::DataFileName(start, file_id),
"/entry/data/data",
std::string(buff));
}

View File

@@ -8,7 +8,7 @@
#include "HDF5Objects.h"
namespace HDF5Metadata {
std::string DataFileName(const std::string &prefix, int64_t file_number);
std::string DataFileName(const StartMessage &msg, int64_t file_number);
}
class NXmx {

View File

@@ -62,11 +62,11 @@ void HDF5Writer::AddStats(const std::optional<HDF5DataFileStatistics>& s) {
j["pixel_size_m"] = start_message.pixel_size_x;
j["detector_width_pxl"] = start_message.image_size_x;
j["detector_height_pxl"] = start_message.image_size_y;
j["photon_energy_eV"] = start_message.incident_energy;
j["incident_energy_eV"] = start_message.incident_energy;
j["saturation"] = start_message.saturation_value;
j["sample_name"] = start_message.sample_name;
j["run_number"] = start_message.series_id;
j["run_name"] = start_message.series_unique_id;
j["run_number"] = start_message.run_number;
j["run_name"] = start_message.run_name;
if (start_message.experiment_group)
j["experiment_group"] = start_message.experiment_group.value();

View File

@@ -2,6 +2,7 @@
#include "../common/GitInfo.h"
#include "JFJochWriterHttp.h"
#include "gen/model/Writer_statistics.h"
void JFJochWriterHttp::status_get(Pistache::Http::ResponseWriter &response) {
auto stat = writer.GetStatistics();
@@ -10,6 +11,9 @@ void JFJochWriterHttp::status_get(Pistache::Http::ResponseWriter &response) {
resp_struct.setPerformanceMBs(stat.performance_MBs);
resp_struct.setPerformanceHz(stat.performance_Hz);
resp_struct.setFilePrefix(stat.file_prefix);
resp_struct.setRunName(stat.run_name);
resp_struct.setRunNumber(stat.run_number);
switch (stat.state) {
case StreamWriterState::Idle:
resp_struct.setState("idle");

View File

@@ -43,14 +43,19 @@ Creates PUB socket to inform about finalized data files. For each closed file, t
```
{
"filename": <string>: HDF5 data file name (relative to writer root directory),
"nimages": <int> number of images in the file,
"user_data": <string> or <json> user_data
"nimages": <int> number of images in the file (counting from 1!),
"file_number": <int> number of file within the acquisition,
"sample_name": <string> name of sample,
"run_name": <string> name of run,
"run_number": <int> number of run,
"experiment_group": <string> number of p-group / proposal (optional),
"user_data": <any json> user_data,
"beam_x_pxl": <float> beam center (X) in pixels,
"beam_y_pxl": <float> beam center (Y) in pixels,
"detector_distance_m": <float> detector distance (X) in m,
"detector_height_pxl": <int> detector size (X) in pixels,
"detector_width_pxl": <int> detector size (Y) in pixels,
"photon_energy_eV": <float> photon energy of the X-ray beam,
"incident_energy_eV": <float> photon energy of the X-ray beam,
"pixel_size_m": <float> pixel size in meter (assuming pixel X == Y),
"saturation": <int> this count and higher mean saturation,
"space_group_number": <int> space group number (optional),
@@ -70,6 +75,11 @@ For example `header_appendix` of `{"param1": "test1", "param2": ["test1", "test2
{
"filename": "dataset_name_data_000001.h5",
"nimages": 1000,
"file_number": 0,
"sample_name": "lysozyme",
"run_name": "lyso_cryo",
"run_number": 25,
"experiment_group": "p00001",
"beam_x_pxl": 1200,
"beam_y_pxl": 1500,
"detector_distance_m": 0.155,
@@ -77,7 +87,7 @@ For example `header_appendix` of `{"param1": "test1", "param2": ["test1", "test2
"detector_width_pxl": 2068,
"image_time_s": 0.001,
"nimages": 2,
"photon_energy_eV": 12400.0,
"incident_energy_eV": 12400.0,
"pixel_size_m": 7.5e-05,
"saturation": 32766,
"space_group_number": 96,
@@ -97,8 +107,8 @@ For example `header_appendix` of `{"param1": "test1", "param2": ["test1", "test2
}
```
Notifications for finalized files are optional, if notification port number is omitted this functionality is not enabled.
## NXmx extensions
Jungfraujoch aims to generate files compliant with NXmx format, as well as make them as close as possible to files
written by DECTRIS Filewriter. This ensures the file compatibility of Neggia and Durin XDS plugins, as well as Albula viewer.

View File

@@ -37,7 +37,10 @@ void StreamWriter::CollectImages(std::vector<HDF5DataFileStatistics> &v) {
processed_images = 0;
processed_image_size = 0;
file_prefix = image_puller_output.cbor->start_message->file_prefix;
run_number = image_puller_output.cbor->start_message->run_number;
run_name = image_puller_output.cbor->start_message->run_name;
CheckPath(image_puller_output.cbor->start_message->file_prefix);
MakeDirectory(image_puller_output.cbor->start_message->file_prefix);
@@ -141,6 +144,8 @@ StreamWriterStatistics StreamWriter::GetStatistics() const {
.performance_MBs = perf_MBs,
.performance_Hz = perf_Hz,
.file_prefix = file_prefix,
.run_name = run_name,
.run_number = run_number,
.state = state
};
}

View File

@@ -15,6 +15,8 @@ struct StreamWriterStatistics {
float performance_MBs;
float performance_Hz;
std::string file_prefix;
std::string run_name;
uint64_t run_number;
StreamWriterState state;
};
@@ -35,6 +37,8 @@ class StreamWriter {
std::chrono::time_point<std::chrono::system_clock> start_time;
std::chrono::time_point<std::chrono::system_clock> end_time;
std::string file_prefix;
std::string run_name;
uint64_t run_number;
ZMQImagePuller image_puller;
Logger &logger;

View File

@@ -2,7 +2,7 @@
* Jungfraujoch writer
* Jungfraujoch Writer Web API
*
* The version of the OpenAPI document: 1.0.0
* The version of the OpenAPI document: 1.0.0.rc_10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View File

@@ -2,7 +2,7 @@
* Jungfraujoch writer
* Jungfraujoch Writer Web API
*
* The version of the OpenAPI document: 1.0.0
* The version of the OpenAPI document: 1.0.0.rc_10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View File

@@ -2,7 +2,7 @@
* Jungfraujoch writer
* Jungfraujoch Writer Web API
*
* The version of the OpenAPI document: 1.0.0
* The version of the OpenAPI document: 1.0.0.rc_10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View File

@@ -2,7 +2,7 @@
* Jungfraujoch writer
* Jungfraujoch Writer Web API
*
* The version of the OpenAPI document: 1.0.0
* The version of the OpenAPI document: 1.0.0.rc_10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View File

@@ -2,7 +2,7 @@
* Jungfraujoch writer
* Jungfraujoch Writer Web API
*
* The version of the OpenAPI document: 1.0.0
* The version of the OpenAPI document: 1.0.0.rc_10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -27,6 +27,10 @@ Writer_statistics::Writer_statistics()
m_Performance_MBsIsSet = false;
m_Performance_Hz = 0.0f;
m_Performance_HzIsSet = false;
m_Run_number = 0L;
m_Run_numberIsSet = false;
m_Run_name = "";
m_Run_nameIsSet = false;
m_File_prefix = "";
m_File_prefixIsSet = false;
m_State = "";
@@ -53,7 +57,7 @@ bool Writer_statistics::validate(std::stringstream& msg, const std::string& path
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Writer_statistics" : pathPrefix;
return success;
}
@@ -72,6 +76,12 @@ bool Writer_statistics::operator==(const Writer_statistics& rhs) const
((!performanceHzIsSet() && !rhs.performanceHzIsSet()) || (performanceHzIsSet() && rhs.performanceHzIsSet() && getPerformanceHz() == rhs.getPerformanceHz())) &&
((!runNumberIsSet() && !rhs.runNumberIsSet()) || (runNumberIsSet() && rhs.runNumberIsSet() && getRunNumber() == rhs.getRunNumber())) &&
((!runNameIsSet() && !rhs.runNameIsSet()) || (runNameIsSet() && rhs.runNameIsSet() && getRunName() == rhs.getRunName())) &&
((!filePrefixIsSet() && !rhs.filePrefixIsSet()) || (filePrefixIsSet() && rhs.filePrefixIsSet() && getFilePrefix() == rhs.getFilePrefix())) &&
@@ -94,6 +104,10 @@ void to_json(nlohmann::json& j, const Writer_statistics& o)
j["performance_MBs"] = o.m_Performance_MBs;
if(o.performanceHzIsSet())
j["performance_Hz"] = o.m_Performance_Hz;
if(o.runNumberIsSet())
j["run_number"] = o.m_Run_number;
if(o.runNameIsSet())
j["run_name"] = o.m_Run_name;
if(o.filePrefixIsSet())
j["file_prefix"] = o.m_File_prefix;
if(o.stateIsSet())
@@ -118,6 +132,16 @@ void from_json(const nlohmann::json& j, Writer_statistics& o)
j.at("performance_Hz").get_to(o.m_Performance_Hz);
o.m_Performance_HzIsSet = true;
}
if(j.find("run_number") != j.end())
{
j.at("run_number").get_to(o.m_Run_number);
o.m_Run_numberIsSet = true;
}
if(j.find("run_name") != j.end())
{
j.at("run_name").get_to(o.m_Run_name);
o.m_Run_nameIsSet = true;
}
if(j.find("file_prefix") != j.end())
{
j.at("file_prefix").get_to(o.m_File_prefix);
@@ -182,6 +206,40 @@ void Writer_statistics::unsetPerformance_Hz()
{
m_Performance_HzIsSet = false;
}
int64_t Writer_statistics::getRunNumber() const
{
return m_Run_number;
}
void Writer_statistics::setRunNumber(int64_t const value)
{
m_Run_number = value;
m_Run_numberIsSet = true;
}
bool Writer_statistics::runNumberIsSet() const
{
return m_Run_numberIsSet;
}
void Writer_statistics::unsetRun_number()
{
m_Run_numberIsSet = false;
}
std::string Writer_statistics::getRunName() const
{
return m_Run_name;
}
void Writer_statistics::setRunName(std::string const& value)
{
m_Run_name = value;
m_Run_nameIsSet = true;
}
bool Writer_statistics::runNameIsSet() const
{
return m_Run_nameIsSet;
}
void Writer_statistics::unsetRun_name()
{
m_Run_nameIsSet = false;
}
std::string Writer_statistics::getFilePrefix() const
{
return m_File_prefix;

View File

@@ -2,7 +2,7 @@
* Jungfraujoch writer
* Jungfraujoch Writer Web API
*
* The version of the OpenAPI document: 1.0.0
* The version of the OpenAPI document: 1.0.0.rc_10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -80,6 +80,20 @@ public:
bool performanceHzIsSet() const;
void unsetPerformance_Hz();
/// <summary>
///
/// </summary>
int64_t getRunNumber() const;
void setRunNumber(int64_t const value);
bool runNumberIsSet() const;
void unsetRun_number();
/// <summary>
///
/// </summary>
std::string getRunName() const;
void setRunName(std::string const& value);
bool runNameIsSet() const;
void unsetRun_name();
/// <summary>
/// File prefix for the last written dataset
/// </summary>
std::string getFilePrefix() const;
@@ -103,6 +117,10 @@ protected:
bool m_Performance_MBsIsSet;
float m_Performance_Hz;
bool m_Performance_HzIsSet;
int64_t m_Run_number;
bool m_Run_numberIsSet;
std::string m_Run_name;
bool m_Run_nameIsSet;
std::string m_File_prefix;
bool m_File_prefixIsSet;
std::string m_State;

View File

@@ -2,7 +2,7 @@ openapi: 3.0.3
info:
title: Jungfraujoch writer
description: Jungfraujoch Writer Web API
version: 1.0.0
version: 1.0.0.rc_10
components:
schemas:
writer_statistics:
@@ -20,6 +20,11 @@ components:
type: number
format: float
description: Performance in images/s
run_number:
type: integer
format: int64
run_name:
type: string
file_prefix:
type: string
description: File prefix for the last written dataset