The JSON a calibration writes was a shape invented at its writer, described only by the comments around it. That is enough for a file somebody reads with jq and not enough for anything else: a client cannot type it, and an endpoint returning it later would have to declare the shape a second time and keep the two in step by hand. So declare it where every other shape in this system is declared. calibration_output holds dataset_settings and a calibration member; the latter is calibration_quality, which nests calibration_fit_sigma and calibration_spot_check. The descriptions carry what a reader has to know to use the numbers rather than only what they are named - that beam_x_pxl is the PONI and the direct beam is elsewhere, that the rotations travel together because a body omitting them states a flat detector, that a tilt below about three sigma was declined and pinned, and that the two correlations approach 1 as the tilt stops being separable from the beam centre. Nothing references it yet. It is declared now because /powder_calibration will return exactly this, and because the file rugnux already writes is decodable today: jfjoch_client's CalibrationOutput.from_dict reads it as it stands, with o.calibration.fit_sigma.correlation_beam_x_rot1 and the rest typed. Generated clients regenerated from the spec, as the spec requires: the C++ server model (four new pairs under broker/gen/model), the TypeScript frontend client, and broker/redoc-static.html. Both regenerations are purely additive - no existing generated file changed except to export the new names. The python client regenerates from the same spec and is gitignored. The test now validates the WHOLE file against the generated Calibration_output rather than only its geometry member against Dataset_settings, so the quality block is under the same contract: a field renamed or newly required in jfjoch_api.yaml fails here rather than at a client. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NfuDvf5ipV3Hi8TiCUKD27
152 lines
5.0 KiB
C++
152 lines
5.0 KiB
C++
/**
|
|
* Jungfraujoch
|
|
* API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms.
|
|
*
|
|
* The version of the OpenAPI document: 1.0.0-rc.166
|
|
* Contact: filip.leonarski@psi.ch
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
|
|
#include "Calibration_output.h"
|
|
#include "Helpers.h"
|
|
|
|
#include <sstream>
|
|
|
|
namespace org::openapitools::server::model
|
|
{
|
|
|
|
Calibration_output::Calibration_output()
|
|
{
|
|
m_CalibrationIsSet = false;
|
|
m_Jfjoch_version = "";
|
|
m_Jfjoch_versionIsSet = false;
|
|
|
|
}
|
|
|
|
void Calibration_output::validate() const
|
|
{
|
|
std::stringstream msg;
|
|
if (!validate(msg))
|
|
{
|
|
throw org::openapitools::server::helpers::ValidationException(msg.str());
|
|
}
|
|
}
|
|
|
|
bool Calibration_output::validate(std::stringstream& msg) const
|
|
{
|
|
return validate(msg, "");
|
|
}
|
|
|
|
bool Calibration_output::validate(std::stringstream& msg, const std::string& pathPrefix) const
|
|
{
|
|
bool success = true;
|
|
const std::string _pathPrefix = pathPrefix.empty() ? "Calibration_output" : pathPrefix;
|
|
|
|
|
|
if (!m_Dataset_settings.validate(msg, _pathPrefix + ".datasetSettings")) {
|
|
msg << _pathPrefix << ": Dataset_settings is invalid;";
|
|
success = false;
|
|
}
|
|
return success;
|
|
}
|
|
|
|
bool Calibration_output::operator==(const Calibration_output& rhs) const
|
|
{
|
|
return
|
|
|
|
|
|
(getDatasetSettings() == rhs.getDatasetSettings())
|
|
&&
|
|
|
|
|
|
((!calibrationIsSet() && !rhs.calibrationIsSet()) || (calibrationIsSet() && rhs.calibrationIsSet() && getCalibration() == rhs.getCalibration())) &&
|
|
|
|
|
|
((!jfjochVersionIsSet() && !rhs.jfjochVersionIsSet()) || (jfjochVersionIsSet() && rhs.jfjochVersionIsSet() && getJfjochVersion() == rhs.getJfjochVersion()))
|
|
|
|
;
|
|
}
|
|
|
|
bool Calibration_output::operator!=(const Calibration_output& rhs) const
|
|
{
|
|
return !(*this == rhs);
|
|
}
|
|
|
|
void to_json(nlohmann::json& j, const Calibration_output& o)
|
|
{
|
|
j = nlohmann::json::object();
|
|
j["dataset_settings"] = o.m_Dataset_settings;
|
|
if(o.calibrationIsSet())
|
|
j["calibration"] = o.m_Calibration;
|
|
if(o.jfjochVersionIsSet())
|
|
j["jfjoch_version"] = o.m_Jfjoch_version;
|
|
|
|
}
|
|
|
|
void from_json(const nlohmann::json& j, Calibration_output& o)
|
|
{
|
|
j.at("dataset_settings").get_to(o.m_Dataset_settings);
|
|
if(j.find("calibration") != j.end())
|
|
{
|
|
j.at("calibration").get_to(o.m_Calibration);
|
|
o.m_CalibrationIsSet = true;
|
|
}
|
|
if(j.find("jfjoch_version") != j.end())
|
|
{
|
|
j.at("jfjoch_version").get_to(o.m_Jfjoch_version);
|
|
o.m_Jfjoch_versionIsSet = true;
|
|
}
|
|
|
|
}
|
|
|
|
org::openapitools::server::model::Dataset_settings Calibration_output::getDatasetSettings() const
|
|
{
|
|
return m_Dataset_settings;
|
|
}
|
|
void Calibration_output::setDatasetSettings(org::openapitools::server::model::Dataset_settings const& value)
|
|
{
|
|
m_Dataset_settings = value;
|
|
}
|
|
org::openapitools::server::model::Calibration_quality Calibration_output::getCalibration() const
|
|
{
|
|
return m_Calibration;
|
|
}
|
|
void Calibration_output::setCalibration(org::openapitools::server::model::Calibration_quality const& value)
|
|
{
|
|
m_Calibration = value;
|
|
m_CalibrationIsSet = true;
|
|
}
|
|
bool Calibration_output::calibrationIsSet() const
|
|
{
|
|
return m_CalibrationIsSet;
|
|
}
|
|
void Calibration_output::unsetCalibration()
|
|
{
|
|
m_CalibrationIsSet = false;
|
|
}
|
|
std::string Calibration_output::getJfjochVersion() const
|
|
{
|
|
return m_Jfjoch_version;
|
|
}
|
|
void Calibration_output::setJfjochVersion(std::string const& value)
|
|
{
|
|
m_Jfjoch_version = value;
|
|
m_Jfjoch_versionIsSet = true;
|
|
}
|
|
bool Calibration_output::jfjochVersionIsSet() const
|
|
{
|
|
return m_Jfjoch_versionIsSet;
|
|
}
|
|
void Calibration_output::unsetJfjoch_version()
|
|
{
|
|
m_Jfjoch_versionIsSet = false;
|
|
}
|
|
|
|
|
|
} // namespace org::openapitools::server::model
|
|
|