OpenAPI: fix missing trim_energie_eV

This commit is contained in:
2026-06-23 16:52:16 +02:00
parent bcf01c28f4
commit 066c0dfa90
7 changed files with 81 additions and 1 deletions
+54
View File
@@ -40,6 +40,7 @@ Detector::Detector()
m_Min_frame_time_ns = 0L;
m_Min_frame_time_nsIsSet = false;
m_Calibration_fileIsSet = false;
m_Trim_energies_eVIsSet = false;
m_HostnameIsSet = false;
m_Sensor_material = "Si";
m_Sensor_materialIsSet = false;
@@ -221,6 +222,32 @@ bool Detector::validate(std::stringstream& msg, const std::string& pathPrefix) c
}
if (trimEnergiesEVIsSet())
{
const std::vector<int32_t>& value = m_Trim_energies_eV;
const std::string currentValuePath = _pathPrefix + ".trimEnergiesEV";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const int32_t& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
if (value < 100)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 100;";
}
i++;
}
}
}
if (hostnameIsSet())
{
const std::vector<std::string>& value = m_Hostname;
@@ -345,6 +372,9 @@ bool Detector::operator==(const Detector& rhs) const
((!calibrationFileIsSet() && !rhs.calibrationFileIsSet()) || (calibrationFileIsSet() && rhs.calibrationFileIsSet() && getCalibrationFile() == rhs.getCalibrationFile())) &&
((!trimEnergiesEVIsSet() && !rhs.trimEnergiesEVIsSet()) || (trimEnergiesEVIsSet() && rhs.trimEnergiesEVIsSet() && getTrimEnergiesEV() == rhs.getTrimEnergiesEV())) &&
((!hostnameIsSet() && !rhs.hostnameIsSet()) || (hostnameIsSet() && rhs.hostnameIsSet() && getHostname() == rhs.getHostname())) &&
@@ -406,6 +436,8 @@ void to_json(nlohmann::json& j, const Detector& o)
j["min_frame_time_ns"] = o.m_Min_frame_time_ns;
if(o.calibrationFileIsSet() || !o.m_Calibration_file.empty())
j["calibration_file"] = o.m_Calibration_file;
if(o.trimEnergiesEVIsSet() || !o.m_Trim_energies_eV.empty())
j["trim_energies_eV"] = o.m_Trim_energies_eV;
if(o.hostnameIsSet() || !o.m_Hostname.empty())
j["hostname"] = o.m_Hostname;
if(o.sensorMaterialIsSet())
@@ -482,6 +514,11 @@ void from_json(const nlohmann::json& j, Detector& o)
j.at("calibration_file").get_to(o.m_Calibration_file);
o.m_Calibration_fileIsSet = true;
}
if(j.find("trim_energies_eV") != j.end())
{
j.at("trim_energies_eV").get_to(o.m_Trim_energies_eV);
o.m_Trim_energies_eVIsSet = true;
}
if(j.find("hostname") != j.end())
{
j.at("hostname").get_to(o.m_Hostname);
@@ -713,6 +750,23 @@ void Detector::unsetCalibration_file()
{
m_Calibration_fileIsSet = false;
}
std::vector<int32_t> Detector::getTrimEnergiesEV() const
{
return m_Trim_energies_eV;
}
void Detector::setTrimEnergiesEV(std::vector<int32_t> const value)
{
m_Trim_energies_eV = value;
m_Trim_energies_eVIsSet = true;
}
bool Detector::trimEnergiesEVIsSet() const
{
return m_Trim_energies_eVIsSet;
}
void Detector::unsetTrim_energies_eV()
{
m_Trim_energies_eVIsSet = false;
}
std::vector<std::string> Detector::getHostname() const
{
return m_Hostname;
+9
View File
@@ -139,6 +139,13 @@ public:
bool calibrationFileIsSet() const;
void unsetCalibration_file();
/// <summary>
/// List of energies at which trimming calibration is provided. Only needed for PSI EIGER and compulsory in this case
/// </summary>
std::vector<int32_t> getTrimEnergiesEV() const;
void setTrimEnergiesEV(std::vector<int32_t> const value);
bool trimEnergiesEVIsSet() const;
void unsetTrim_energies_eV();
/// <summary>
/// Hostname for detector module. One entry per module One entry per module. Either empty or number of module entries.
/// </summary>
std::vector<std::string> getHostname() const;
@@ -234,6 +241,8 @@ protected:
bool m_Min_frame_time_nsIsSet;
std::vector<std::string> m_Calibration_file;
bool m_Calibration_fileIsSet;
std::vector<int32_t> m_Trim_energies_eV;
bool m_Trim_energies_eVIsSet;
std::vector<std::string> m_Hostname;
bool m_HostnameIsSet;
std::string m_Sensor_material;
+9
View File
@@ -2121,6 +2121,15 @@ components:
For EIGER: one directory (with detector settings) or list of trim bit files, one entry per half-module.
items:
type: string
trim_energies_eV:
type: array
description: |
List of energies at which trimming calibration is provided.
Only needed for PSI EIGER and compulsory in this case
items:
type: integer
format: int32
minimum: 100
hostname:
type: array
description: |
File diff suppressed because one or more lines are too long
+1
View File
@@ -16,6 +16,7 @@ Name | Type | Description | Notes
**min_count_time_ns** | **int** | Minimum count time available for the detector. | [optional]
**min_frame_time_ns** | **int** | Minimum frame time available for the detector. | [optional]
**calibration_file** | **List[str]** | Can be empty for all detectors - default calibration used. For JUNGFRAU: list of gain files, one entry per module. For EIGER: one directory (with detector settings) or list of trim bit files, one entry per half-module. | [optional]
**trim_energies_e_v** | **List[int]** | List of energies at which trimming calibration is provided. Only needed for PSI EIGER and compulsory in this case | [optional]
**hostname** | **List[str]** | Hostname for detector module. One entry per module One entry per module. Either empty or number of module entries. | [optional]
**sensor_material** | **str** | | [optional] [default to 'Si']
**tx_delay** | **List[int]** | | [optional]
+6
View File
@@ -1389,6 +1389,12 @@ export type detector = {
*
*/
calibration_file?: Array<string>;
/**
* List of energies at which trimming calibration is provided.
* Only needed for PSI EIGER and compulsory in this case
*
*/
trim_energies_eV?: Array<number>;
/**
* Hostname for detector module. One entry per module
* One entry per module. Either empty or number of module entries.
+1
View File
@@ -612,6 +612,7 @@ export const zDetector = z.object({
min_count_time_ns: z.coerce.bigint().gte(BigInt(0)).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
min_frame_time_ns: z.coerce.bigint().gte(BigInt(0)).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }).optional(),
calibration_file: z.array(z.string()).optional(),
trim_energies_eV: z.array(z.int().gte(100).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })).optional(),
hostname: z.array(z.string()).optional(),
sensor_material: z.string().optional().default('Si'),
tx_delay: z.array(z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })).optional(),