smargon: write chi/phi goniometer position into NXmx transformations
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 14m15s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 15m13s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 15m9s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 15m11s
Build Packages / build:rpm (rocky8) (push) Successful in 15m14s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 15m30s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 15m52s
Build Packages / build:windows:nocuda (push) Successful in 15m54s
Build Packages / build:windows:cuda (push) Successful in 17m32s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m30s
Build Packages / Generate python client (push) Successful in 30s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 8m31s
Build Packages / Create release (push) Skipped
Build Packages / XDS test (durin plugin) (push) Successful in 8m47s
Build Packages / Build documentation (push) Successful in 58s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 11m37s
Build Packages / build:rpm (rocky9) (push) Successful in 12m37s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m44s
Build Packages / DIALS test (push) Successful in 12m55s
Build Packages / Unit tests (push) Successful in 1h0m54s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 14m15s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 15m13s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 15m9s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 15m11s
Build Packages / build:rpm (rocky8) (push) Successful in 15m14s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 15m30s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 15m52s
Build Packages / build:windows:nocuda (push) Successful in 15m54s
Build Packages / build:windows:cuda (push) Successful in 17m32s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m30s
Build Packages / Generate python client (push) Successful in 30s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 8m31s
Build Packages / Create release (push) Skipped
Build Packages / XDS test (durin plugin) (push) Successful in 8m47s
Build Packages / Build documentation (push) Successful in 58s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 11m37s
Build Packages / build:rpm (rocky9) (push) Successful in 12m37s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m44s
Build Packages / DIALS test (push) Successful in 12m55s
Build Packages / Unit tests (push) Successful in 1h0m54s
Add an optional Smargon static positioner (chi/phi angles + rotation axes)
that is reconstructed into the NXmx sample transformation chain. Chi/phi are
appended at the innermost end of the chain (closest to the sample) for both
the goniometer and grid-scan branches, with axes defaulting to chi {0,0,1}
and phi = omega default {1,0,0}.
- SmargonPosition gains chi_axis/phi_axis (common/JFJochMessages.h)
- OpenAPI: optional phi_axis/chi_axis arrays; clients regenerated
- OpenAPIConvert wires Dataset_settings.smargon -> DatasetSettings
- CBOR serializer/deserializer round-trip the axes
- tests: CBORSerialize_Start_Smargon
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -694,6 +694,18 @@ DatasetSettings Convert(const org::openapitools::server::model::Dataset_settings
|
||||
ret.FluorescenceSpectrum({fl.getEnergyEV(), fl.getData()});
|
||||
}
|
||||
|
||||
if (input.smargonIsSet()) {
|
||||
auto sm = input.getSmargon();
|
||||
SmargonPosition smargon;
|
||||
smargon.phi_deg = sm.getPhiDeg();
|
||||
smargon.chi_deg = sm.getChiDeg();
|
||||
if (sm.phiAxisIsSet())
|
||||
smargon.phi_axis = ConvertOpenAPI(sm.getPhiAxis());
|
||||
if (sm.chiAxisIsSet())
|
||||
smargon.chi_axis = ConvertOpenAPI(sm.getChiAxis());
|
||||
ret.Smargon(smargon);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ Dataset_settings::Dataset_settings()
|
||||
m_Unit_cellIsSet = false;
|
||||
m_Spot_finding = true;
|
||||
m_Spot_findingIsSet = false;
|
||||
m_SmargonIsSet = false;
|
||||
m_Max_spot_count = 250;
|
||||
m_Max_spot_countIsSet = false;
|
||||
m_Detect_ice_rings = false;
|
||||
@@ -406,7 +407,7 @@ bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathP
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (maxSpotCountIsSet())
|
||||
{
|
||||
const int32_t& value = m_Max_spot_count;
|
||||
@@ -537,6 +538,9 @@ bool Dataset_settings::operator==(const Dataset_settings& rhs) const
|
||||
((!spotFindingIsSet() && !rhs.spotFindingIsSet()) || (spotFindingIsSet() && rhs.spotFindingIsSet() && isSpotFinding() == rhs.isSpotFinding())) &&
|
||||
|
||||
|
||||
((!smargonIsSet() && !rhs.smargonIsSet()) || (smargonIsSet() && rhs.smargonIsSet() && getSmargon() == rhs.getSmargon())) &&
|
||||
|
||||
|
||||
((!maxSpotCountIsSet() && !rhs.maxSpotCountIsSet()) || (maxSpotCountIsSet() && rhs.maxSpotCountIsSet() && getMaxSpotCount() == rhs.getMaxSpotCount())) &&
|
||||
|
||||
|
||||
@@ -623,6 +627,8 @@ void to_json(nlohmann::json& j, const Dataset_settings& o)
|
||||
j["unit_cell"] = o.m_Unit_cell;
|
||||
if(o.spotFindingIsSet())
|
||||
j["spot_finding"] = o.m_Spot_finding;
|
||||
if(o.smargonIsSet())
|
||||
j["smargon"] = o.m_Smargon;
|
||||
if(o.maxSpotCountIsSet())
|
||||
j["max_spot_count"] = o.m_Max_spot_count;
|
||||
if(o.detectIceRingsIsSet())
|
||||
@@ -790,6 +796,11 @@ void from_json(const nlohmann::json& j, Dataset_settings& o)
|
||||
j.at("spot_finding").get_to(o.m_Spot_finding);
|
||||
o.m_Spot_findingIsSet = true;
|
||||
}
|
||||
if(j.find("smargon") != j.end())
|
||||
{
|
||||
j.at("smargon").get_to(o.m_Smargon);
|
||||
o.m_SmargonIsSet = true;
|
||||
}
|
||||
if(j.find("max_spot_count") != j.end())
|
||||
{
|
||||
j.at("max_spot_count").get_to(o.m_Max_spot_count);
|
||||
@@ -1355,6 +1366,23 @@ void Dataset_settings::unsetSpot_finding()
|
||||
{
|
||||
m_Spot_findingIsSet = false;
|
||||
}
|
||||
org::openapitools::server::model::Dataset_settings_smargon Dataset_settings::getSmargon() const
|
||||
{
|
||||
return m_Smargon;
|
||||
}
|
||||
void Dataset_settings::setSmargon(org::openapitools::server::model::Dataset_settings_smargon const& value)
|
||||
{
|
||||
m_Smargon = value;
|
||||
m_SmargonIsSet = true;
|
||||
}
|
||||
bool Dataset_settings::smargonIsSet() const
|
||||
{
|
||||
return m_SmargonIsSet;
|
||||
}
|
||||
void Dataset_settings::unsetSmargon()
|
||||
{
|
||||
m_SmargonIsSet = false;
|
||||
}
|
||||
int32_t Dataset_settings::getMaxSpotCount() const
|
||||
{
|
||||
return m_Max_spot_count;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "Grid_scan.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "Dataset_settings_smargon.h"
|
||||
#include "Rotation_axis.h"
|
||||
#include "Unit_cell.h"
|
||||
#include <string>
|
||||
@@ -294,6 +295,13 @@ public:
|
||||
bool spotFindingIsSet() const;
|
||||
void unsetSpot_finding();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
org::openapitools::server::model::Dataset_settings_smargon getSmargon() const;
|
||||
void setSmargon(org::openapitools::server::model::Dataset_settings_smargon const& value);
|
||||
bool smargonIsSet() const;
|
||||
void unsetSmargon();
|
||||
/// <summary>
|
||||
/// Maximum number of spots that are saved/used for indexing; spots with highest intensity are selected
|
||||
/// </summary>
|
||||
int32_t getMaxSpotCount() const;
|
||||
@@ -393,6 +401,8 @@ protected:
|
||||
bool m_Unit_cellIsSet;
|
||||
bool m_Spot_finding;
|
||||
bool m_Spot_findingIsSet;
|
||||
org::openapitools::server::model::Dataset_settings_smargon m_Smargon;
|
||||
bool m_SmargonIsSet;
|
||||
int32_t m_Max_spot_count;
|
||||
bool m_Max_spot_countIsSet;
|
||||
bool m_Detect_ice_rings;
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
/**
|
||||
* 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.155
|
||||
* 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 "Dataset_settings_smargon.h"
|
||||
#include "Helpers.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace org::openapitools::server::model
|
||||
{
|
||||
|
||||
Dataset_settings_smargon::Dataset_settings_smargon()
|
||||
{
|
||||
m_Phi_deg = 0.0f;
|
||||
m_Chi_deg = 0.0f;
|
||||
m_Phi_axisIsSet = false;
|
||||
m_Chi_axisIsSet = false;
|
||||
|
||||
}
|
||||
|
||||
void Dataset_settings_smargon::validate() const
|
||||
{
|
||||
std::stringstream msg;
|
||||
if (!validate(msg))
|
||||
{
|
||||
throw org::openapitools::server::helpers::ValidationException(msg.str());
|
||||
}
|
||||
}
|
||||
|
||||
bool Dataset_settings_smargon::validate(std::stringstream& msg) const
|
||||
{
|
||||
return validate(msg, "");
|
||||
}
|
||||
|
||||
bool Dataset_settings_smargon::validate(std::stringstream& msg, const std::string& pathPrefix) const
|
||||
{
|
||||
bool success = true;
|
||||
const std::string _pathPrefix = pathPrefix.empty() ? "Dataset_settings_smargon" : pathPrefix;
|
||||
|
||||
|
||||
|
||||
/* Chi_deg */ {
|
||||
const float& value = m_Chi_deg;
|
||||
const std::string currentValuePath = _pathPrefix + ".chiDeg";
|
||||
|
||||
|
||||
if (value < static_cast<float>(0.0))
|
||||
{
|
||||
success = false;
|
||||
msg << currentValuePath << ": must be greater than or equal to 0.0;";
|
||||
}
|
||||
if (value > static_cast<float>(90.0))
|
||||
{
|
||||
success = false;
|
||||
msg << currentValuePath << ": must be less than or equal to 90.0;";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (phiAxisIsSet())
|
||||
{
|
||||
const std::vector<float>& value = m_Phi_axis;
|
||||
const std::string currentValuePath = _pathPrefix + ".phiAxis";
|
||||
|
||||
|
||||
if (value.size() < 3)
|
||||
{
|
||||
success = false;
|
||||
msg << currentValuePath << ": must have at least 3 elements;";
|
||||
}
|
||||
if (value.size() > 3)
|
||||
{
|
||||
success = false;
|
||||
msg << currentValuePath << ": must have at most 3 elements;";
|
||||
}
|
||||
{ // Recursive validation of array elements
|
||||
const std::string oldValuePath = currentValuePath;
|
||||
int i = 0;
|
||||
for (const float& value : value)
|
||||
{
|
||||
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
|
||||
|
||||
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (chiAxisIsSet())
|
||||
{
|
||||
const std::vector<float>& value = m_Chi_axis;
|
||||
const std::string currentValuePath = _pathPrefix + ".chiAxis";
|
||||
|
||||
|
||||
if (value.size() < 3)
|
||||
{
|
||||
success = false;
|
||||
msg << currentValuePath << ": must have at least 3 elements;";
|
||||
}
|
||||
if (value.size() > 3)
|
||||
{
|
||||
success = false;
|
||||
msg << currentValuePath << ": must have at most 3 elements;";
|
||||
}
|
||||
{ // Recursive validation of array elements
|
||||
const std::string oldValuePath = currentValuePath;
|
||||
int i = 0;
|
||||
for (const float& value : value)
|
||||
{
|
||||
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
|
||||
|
||||
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool Dataset_settings_smargon::operator==(const Dataset_settings_smargon& rhs) const
|
||||
{
|
||||
return
|
||||
|
||||
|
||||
(getPhiDeg() == rhs.getPhiDeg())
|
||||
&&
|
||||
|
||||
(getChiDeg() == rhs.getChiDeg())
|
||||
&&
|
||||
|
||||
|
||||
((!phiAxisIsSet() && !rhs.phiAxisIsSet()) || (phiAxisIsSet() && rhs.phiAxisIsSet() && getPhiAxis() == rhs.getPhiAxis())) &&
|
||||
|
||||
|
||||
((!chiAxisIsSet() && !rhs.chiAxisIsSet()) || (chiAxisIsSet() && rhs.chiAxisIsSet() && getChiAxis() == rhs.getChiAxis()))
|
||||
|
||||
;
|
||||
}
|
||||
|
||||
bool Dataset_settings_smargon::operator!=(const Dataset_settings_smargon& rhs) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
void to_json(nlohmann::json& j, const Dataset_settings_smargon& o)
|
||||
{
|
||||
j = nlohmann::json::object();
|
||||
j["phi_deg"] = o.m_Phi_deg;
|
||||
j["chi_deg"] = o.m_Chi_deg;
|
||||
if(o.phiAxisIsSet() || !o.m_Phi_axis.empty())
|
||||
j["phi_axis"] = o.m_Phi_axis;
|
||||
if(o.chiAxisIsSet() || !o.m_Chi_axis.empty())
|
||||
j["chi_axis"] = o.m_Chi_axis;
|
||||
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json& j, Dataset_settings_smargon& o)
|
||||
{
|
||||
j.at("phi_deg").get_to(o.m_Phi_deg);
|
||||
j.at("chi_deg").get_to(o.m_Chi_deg);
|
||||
if(j.find("phi_axis") != j.end())
|
||||
{
|
||||
j.at("phi_axis").get_to(o.m_Phi_axis);
|
||||
o.m_Phi_axisIsSet = true;
|
||||
}
|
||||
if(j.find("chi_axis") != j.end())
|
||||
{
|
||||
j.at("chi_axis").get_to(o.m_Chi_axis);
|
||||
o.m_Chi_axisIsSet = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float Dataset_settings_smargon::getPhiDeg() const
|
||||
{
|
||||
return m_Phi_deg;
|
||||
}
|
||||
void Dataset_settings_smargon::setPhiDeg(float const value)
|
||||
{
|
||||
m_Phi_deg = value;
|
||||
}
|
||||
float Dataset_settings_smargon::getChiDeg() const
|
||||
{
|
||||
return m_Chi_deg;
|
||||
}
|
||||
void Dataset_settings_smargon::setChiDeg(float const value)
|
||||
{
|
||||
m_Chi_deg = value;
|
||||
}
|
||||
std::vector<float> Dataset_settings_smargon::getPhiAxis() const
|
||||
{
|
||||
return m_Phi_axis;
|
||||
}
|
||||
void Dataset_settings_smargon::setPhiAxis(std::vector<float> const value)
|
||||
{
|
||||
m_Phi_axis = value;
|
||||
m_Phi_axisIsSet = true;
|
||||
}
|
||||
bool Dataset_settings_smargon::phiAxisIsSet() const
|
||||
{
|
||||
return m_Phi_axisIsSet;
|
||||
}
|
||||
void Dataset_settings_smargon::unsetPhi_axis()
|
||||
{
|
||||
m_Phi_axisIsSet = false;
|
||||
}
|
||||
std::vector<float> Dataset_settings_smargon::getChiAxis() const
|
||||
{
|
||||
return m_Chi_axis;
|
||||
}
|
||||
void Dataset_settings_smargon::setChiAxis(std::vector<float> const value)
|
||||
{
|
||||
m_Chi_axis = value;
|
||||
m_Chi_axisIsSet = true;
|
||||
}
|
||||
bool Dataset_settings_smargon::chiAxisIsSet() const
|
||||
{
|
||||
return m_Chi_axisIsSet;
|
||||
}
|
||||
void Dataset_settings_smargon::unsetChi_axis()
|
||||
{
|
||||
m_Chi_axisIsSet = false;
|
||||
}
|
||||
|
||||
|
||||
} // namespace org::openapitools::server::model
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* 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.155
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
* Dataset_settings_smargon.h
|
||||
*
|
||||
* Geometry of Smargon goniometer at SLS 2.0 / MX beamlines. Assuming that Smargon is used as static positioner and not moving during the scan, allowing to reconstruct geometry.
|
||||
*/
|
||||
|
||||
#ifndef Dataset_settings_smargon_H_
|
||||
#define Dataset_settings_smargon_H_
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace org::openapitools::server::model
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Geometry of Smargon goniometer at SLS 2.0 / MX beamlines. Assuming that Smargon is used as static positioner and not moving during the scan, allowing to reconstruct geometry.
|
||||
/// </summary>
|
||||
class Dataset_settings_smargon
|
||||
{
|
||||
public:
|
||||
Dataset_settings_smargon();
|
||||
virtual ~Dataset_settings_smargon() = 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_smargon& rhs) const;
|
||||
bool operator!=(const Dataset_settings_smargon& rhs) const;
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/// Dataset_settings_smargon members
|
||||
|
||||
/// <summary>
|
||||
/// Phi angle in degrees
|
||||
/// </summary>
|
||||
float getPhiDeg() const;
|
||||
void setPhiDeg(float const value);
|
||||
/// <summary>
|
||||
/// Chi angle in degrees
|
||||
/// </summary>
|
||||
float getChiDeg() const;
|
||||
void setChiDeg(float const value);
|
||||
/// <summary>
|
||||
/// Phi rotation axis (defaults to the omega axis)
|
||||
/// </summary>
|
||||
std::vector<float> getPhiAxis() const;
|
||||
void setPhiAxis(std::vector<float> const value);
|
||||
bool phiAxisIsSet() const;
|
||||
void unsetPhi_axis();
|
||||
/// <summary>
|
||||
/// Chi rotation axis
|
||||
/// </summary>
|
||||
std::vector<float> getChiAxis() const;
|
||||
void setChiAxis(std::vector<float> const value);
|
||||
bool chiAxisIsSet() const;
|
||||
void unsetChi_axis();
|
||||
|
||||
friend void to_json(nlohmann::json& j, const Dataset_settings_smargon& o);
|
||||
friend void from_json(const nlohmann::json& j, Dataset_settings_smargon& o);
|
||||
protected:
|
||||
float m_Phi_deg;
|
||||
|
||||
float m_Chi_deg;
|
||||
|
||||
std::vector<float> m_Phi_axis;
|
||||
bool m_Phi_axisIsSet;
|
||||
std::vector<float> m_Chi_axis;
|
||||
bool m_Chi_axisIsSet;
|
||||
|
||||
};
|
||||
|
||||
} // namespace org::openapitools::server::model
|
||||
|
||||
#endif /* Dataset_settings_smargon_H_ */
|
||||
@@ -567,6 +567,43 @@ components:
|
||||
type: boolean
|
||||
description: Enable spot finding and save spots
|
||||
default: true
|
||||
smargon:
|
||||
type: object
|
||||
description: |
|
||||
Geometry of Smargon goniometer at SLS 2.0 / MX beamlines.
|
||||
Assuming that Smargon is used as static positioner and not moving during the scan, allowing to reconstruct geometry.
|
||||
required:
|
||||
- phi_deg
|
||||
- chi_deg
|
||||
properties:
|
||||
phi_deg:
|
||||
type: number
|
||||
format: float
|
||||
description: Phi angle in degrees
|
||||
chi_deg:
|
||||
minimum: 0.0
|
||||
maximum: 90.0
|
||||
type: number
|
||||
format: float
|
||||
description: Chi angle in degrees
|
||||
phi_axis:
|
||||
type: array
|
||||
description: Phi rotation axis (defaults to the omega axis)
|
||||
example: [ 1, 0, 0 ]
|
||||
items:
|
||||
type: number
|
||||
format: float
|
||||
minItems: 3
|
||||
maxItems: 3
|
||||
chi_axis:
|
||||
type: array
|
||||
description: Chi rotation axis
|
||||
example: [ 0, 0, 1 ]
|
||||
items:
|
||||
type: number
|
||||
format: float
|
||||
minItems: 3
|
||||
maxItems: 3
|
||||
max_spot_count:
|
||||
type: integer
|
||||
minimum: 10
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -501,3 +501,12 @@ const XrayFluorescenceSpectrum & DatasetSettings::GetFluorescenceSpectrum() cons
|
||||
int64_t DatasetSettings::GetMaxSpotCount() const {
|
||||
return max_spot_count;
|
||||
}
|
||||
|
||||
std::optional<SmargonPosition> DatasetSettings::GetSmargonPosition() const {
|
||||
return smargon_position;
|
||||
}
|
||||
|
||||
DatasetSettings &DatasetSettings::Smargon(const std::optional<SmargonPosition> &input) {
|
||||
smargon_position = input;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ class DatasetSettings {
|
||||
bool detect_ice_rings; // Enable special handling of ice rings
|
||||
XrayFluorescenceSpectrum fluorescence_spectrum;
|
||||
|
||||
std::optional<SmargonPosition> smargon_position;
|
||||
public:
|
||||
|
||||
DatasetSettings();
|
||||
@@ -110,6 +111,7 @@ public:
|
||||
DatasetSettings& MaxSpotCount(int64_t input);
|
||||
DatasetSettings& DetectIceRings(bool input);
|
||||
DatasetSettings& FluorescenceSpectrum(const XrayFluorescenceSpectrum& input);
|
||||
DatasetSettings& Smargon(const std::optional<SmargonPosition>& input);
|
||||
|
||||
std::optional<float> GetAttenuatorTransmission() const;
|
||||
std::optional<float> GetTotalFlux() const;
|
||||
@@ -165,4 +167,5 @@ public:
|
||||
|
||||
bool IsDetectIceRings() const;
|
||||
const XrayFluorescenceSpectrum &GetFluorescenceSpectrum() const;
|
||||
std::optional<SmargonPosition> GetSmargonPosition() const;
|
||||
};
|
||||
|
||||
@@ -721,6 +721,8 @@ void DiffractionExperiment::FillMessage(StartMessage &message) const {
|
||||
|
||||
message.channels = {"default"};
|
||||
|
||||
message.smargon_position = dataset.GetSmargonPosition();
|
||||
|
||||
switch (GetDetectorType()) {
|
||||
case DetectorType::JUNGFRAU:
|
||||
message.jungfrau_conversion_enabled = IsJungfrauConvPhotonCnt();
|
||||
|
||||
@@ -78,6 +78,13 @@ struct LatticeMessage {
|
||||
gemmi::CrystalSystem crystal_system;
|
||||
};
|
||||
|
||||
struct SmargonPosition {
|
||||
float phi_deg = 0;
|
||||
float chi_deg = 0;
|
||||
Coord chi_axis = {0, 0, 1};
|
||||
Coord phi_axis = {1, 0, 0}; // Default omega axis
|
||||
};
|
||||
|
||||
struct DataMessage {
|
||||
int64_t number = INT64_MIN;
|
||||
CompressedImage image;
|
||||
@@ -314,6 +321,8 @@ struct StartMessage {
|
||||
|
||||
std::vector<HDF5DataSourceMessage> hdf5_source_data;
|
||||
std::optional<std::string> master_suffix;
|
||||
|
||||
std::optional<SmargonPosition> smargon_position;
|
||||
};
|
||||
|
||||
struct EndMessage {
|
||||
|
||||
@@ -172,6 +172,7 @@ Class | Method | HTTP request | Description
|
||||
- [CalibrationStatisticsInner](docs/CalibrationStatisticsInner.md)
|
||||
- [DarkMaskSettings](docs/DarkMaskSettings.md)
|
||||
- [DatasetSettings](docs/DatasetSettings.md)
|
||||
- [DatasetSettingsSmargon](docs/DatasetSettingsSmargon.md)
|
||||
- [DatasetSettingsXrayFluorescenceSpectrum](docs/DatasetSettingsXrayFluorescenceSpectrum.md)
|
||||
- [Detector](docs/Detector.md)
|
||||
- [DetectorList](docs/DetectorList.md)
|
||||
|
||||
@@ -39,6 +39,7 @@ Name | Type | Description | Notes
|
||||
**poni_rot3_rad** | **float** | PONI angle rot3 (see PyFAI documentation for details) in radians | [optional] [default to 0.0]
|
||||
**unit_cell** | [**UnitCell**](UnitCell.md) | | [optional]
|
||||
**spot_finding** | **bool** | Enable spot finding and save spots | [optional] [default to True]
|
||||
**smargon** | [**DatasetSettingsSmargon**](DatasetSettingsSmargon.md) | | [optional]
|
||||
**max_spot_count** | **int** | Maximum number of spots that are saved/used for indexing; spots with highest intensity are selected | [optional] [default to 250]
|
||||
**detect_ice_rings** | **bool** | Flag spots as ice rings and reduce their effect on indexing | [optional]
|
||||
**async_start** | **bool** | When set to true, `/start` will not wait for detector and Jungfraujoch to be ready for the measurement. | [optional] [default to False]
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# DatasetSettingsSmargon
|
||||
|
||||
Geometry of Smargon goniometer at SLS 2.0 / MX beamlines. Assuming that Smargon is used as static positioner and not moving during the scan, allowing to reconstruct geometry.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**phi_deg** | **float** | Phi angle in degrees |
|
||||
**chi_deg** | **float** | Chi angle in degrees |
|
||||
**phi_axis** | **List[float]** | Phi rotation axis (defaults to the omega axis) | [optional]
|
||||
**chi_axis** | **List[float]** | Chi rotation axis | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from jfjoch_client.models.dataset_settings_smargon import DatasetSettingsSmargon
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of DatasetSettingsSmargon from a JSON string
|
||||
dataset_settings_smargon_instance = DatasetSettingsSmargon.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(DatasetSettingsSmargon.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
dataset_settings_smargon_dict = dataset_settings_smargon_instance.to_dict()
|
||||
# create an instance of DatasetSettingsSmargon from a dict
|
||||
dataset_settings_smargon_from_dict = DatasetSettingsSmargon.from_dict(dataset_settings_smargon_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1161,7 +1161,28 @@ namespace {
|
||||
else
|
||||
message.geom_refinement_algorithm = GeomRefinementAlgorithmEnum::None;
|
||||
}
|
||||
if (j.contains("smargon")
|
||||
&& j["smargon"].is_object()
|
||||
&& j["smargon"].contains("chi_deg")
|
||||
&& j["smargon"].contains("phi_deg")
|
||||
&& j["smargon"]["chi_deg"].is_number()
|
||||
&& j["smargon"]["phi_deg"].is_number()) {
|
||||
|
||||
SmargonPosition smargon;
|
||||
smargon.phi_deg = j["smargon"]["phi_deg"].get<float>();
|
||||
smargon.chi_deg = j["smargon"]["chi_deg"].get<float>();
|
||||
if (j["smargon"].contains("chi_axis") && j["smargon"]["chi_axis"].is_array()
|
||||
&& j["smargon"]["chi_axis"].size() == 3)
|
||||
smargon.chi_axis = {j["smargon"]["chi_axis"][0].get<float>(),
|
||||
j["smargon"]["chi_axis"][1].get<float>(),
|
||||
j["smargon"]["chi_axis"][2].get<float>()};
|
||||
if (j["smargon"].contains("phi_axis") && j["smargon"]["phi_axis"].is_array()
|
||||
&& j["smargon"]["phi_axis"].size() == 3)
|
||||
smargon.phi_axis = {j["smargon"]["phi_axis"][0].get<float>(),
|
||||
j["smargon"]["phi_axis"][1].get<float>(),
|
||||
j["smargon"]["phi_axis"][2].get<float>()};
|
||||
message.smargon_position = smargon;
|
||||
}
|
||||
if (j.contains("ring_current_mA"))
|
||||
message.ring_current_mA = j["ring_current_mA"];
|
||||
if (j.contains("sample_temperature_K"))
|
||||
|
||||
@@ -620,6 +620,17 @@ inline void CBOR_ENC_START_USER_DATA(CborEncoder& encoder, const char* key,
|
||||
break;
|
||||
}
|
||||
|
||||
if (message.smargon_position.has_value()) {
|
||||
j["smargon"]["chi_deg"] = message.smargon_position->chi_deg;
|
||||
j["smargon"]["phi_deg"] = message.smargon_position->phi_deg;
|
||||
j["smargon"]["chi_axis"] = {message.smargon_position->chi_axis.x,
|
||||
message.smargon_position->chi_axis.y,
|
||||
message.smargon_position->chi_axis.z};
|
||||
j["smargon"]["phi_axis"] = {message.smargon_position->phi_axis.x,
|
||||
message.smargon_position->phi_axis.y,
|
||||
message.smargon_position->phi_axis.z};
|
||||
}
|
||||
|
||||
auto str = j.dump();
|
||||
|
||||
CBOR_ENC(encoder, key, str);
|
||||
|
||||
@@ -297,6 +297,37 @@ export type dataset_settings = {
|
||||
* Enable spot finding and save spots
|
||||
*/
|
||||
spot_finding?: boolean;
|
||||
/**
|
||||
* Geometry of Smargon goniometer at SLS 2.0 / MX beamlines.
|
||||
* Assuming that Smargon is used as static positioner and not moving during the scan, allowing to reconstruct geometry.
|
||||
*
|
||||
*/
|
||||
smargon?: {
|
||||
/**
|
||||
* Phi angle in degrees
|
||||
*/
|
||||
phi_deg: number;
|
||||
/**
|
||||
* Chi angle in degrees
|
||||
*/
|
||||
chi_deg: number;
|
||||
/**
|
||||
* Phi rotation axis (defaults to the omega axis)
|
||||
*/
|
||||
phi_axis?: [
|
||||
number,
|
||||
number,
|
||||
number
|
||||
];
|
||||
/**
|
||||
* Chi rotation axis
|
||||
*/
|
||||
chi_axis?: [
|
||||
number,
|
||||
number,
|
||||
number
|
||||
];
|
||||
};
|
||||
/**
|
||||
* Maximum number of spots that are saved/used for indexing; spots with highest intensity are selected
|
||||
*/
|
||||
|
||||
@@ -127,6 +127,20 @@ export const zDatasetSettings = z.object({
|
||||
poni_rot3_rad: z.number().gte(-6.28318530718).lte(6.28318530718).optional().default(0),
|
||||
unit_cell: zUnitCell.optional(),
|
||||
spot_finding: z.boolean().optional().default(true),
|
||||
smargon: z.object({
|
||||
phi_deg: z.number(),
|
||||
chi_deg: z.number().gte(0).lte(90),
|
||||
phi_axis: z.tuple([
|
||||
z.number(),
|
||||
z.number(),
|
||||
z.number()
|
||||
]).optional(),
|
||||
chi_axis: z.tuple([
|
||||
z.number(),
|
||||
z.number(),
|
||||
z.number()
|
||||
]).optional()
|
||||
}).optional(),
|
||||
max_spot_count: z.int().gte(10).lte(2000).optional().default(250),
|
||||
detect_ice_rings: z.boolean().optional(),
|
||||
async_start: z.boolean().optional().default(false),
|
||||
|
||||
@@ -260,6 +260,33 @@ TEST_CASE("CBORSerialize_Start_Fluorescence", "[CBOR]") {
|
||||
CHECK(out.fluorescence_spectrum.GetData() == data);
|
||||
}
|
||||
|
||||
TEST_CASE("CBORSerialize_Start_Smargon", "[CBOR]") {
|
||||
std::vector<uint8_t> buffer(8 * 1024 * 1024);
|
||||
CBORStream2Serializer serializer(buffer.data(), buffer.size());
|
||||
|
||||
StartMessage message{};
|
||||
SmargonPosition smargon;
|
||||
smargon.phi_deg = 45.0f;
|
||||
smargon.chi_deg = 30.0f;
|
||||
smargon.phi_axis = {0, -1, 0};
|
||||
smargon.chi_axis = {0, 0, 1};
|
||||
message.smargon_position = smargon;
|
||||
|
||||
REQUIRE_NOTHROW(serializer.SerializeSequenceStart(message));
|
||||
|
||||
auto deserialized = CBORStream2Deserialize(buffer.data(), serializer.GetBufferSize());
|
||||
REQUIRE(deserialized);
|
||||
REQUIRE(deserialized->msg_type == CBORImageType::START);
|
||||
REQUIRE(deserialized->start_message);
|
||||
const StartMessage &out = *deserialized->start_message;
|
||||
|
||||
REQUIRE(out.smargon_position.has_value());
|
||||
CHECK(out.smargon_position->phi_deg == 45.0f);
|
||||
CHECK(out.smargon_position->chi_deg == 30.0f);
|
||||
CHECK(out.smargon_position->phi_axis == Coord{0, -1, 0});
|
||||
CHECK(out.smargon_position->chi_axis == Coord{0, 0, 1});
|
||||
}
|
||||
|
||||
TEST_CASE("CBORSerialize_ROI", "[CBOR]") {
|
||||
std::vector<uint8_t> buffer(8 * 1024 * 1024);
|
||||
CBORStream2Serializer serializer(buffer.data(), buffer.size());
|
||||
|
||||
+21
-1
@@ -677,6 +677,23 @@ void NXmx::Sample(const StartMessage &start, const EndMessage &end) {
|
||||
|
||||
std::string depends_on = ".";
|
||||
|
||||
// Smargon chi/phi are static positioners closest to the sample, so they are appended
|
||||
// at the innermost end of the transformation chain (whatever depends_on currently is).
|
||||
auto write_smargon = [&start](HDF5Group& transformations, std::string& depends_on) {
|
||||
if (!start.smargon_position)
|
||||
return;
|
||||
SaveScalar(transformations, "chi", start.smargon_position->chi_deg)->
|
||||
Transformation("deg", depends_on, "", "", "rotation",
|
||||
{start.smargon_position->chi_axis.x, start.smargon_position->chi_axis.y,
|
||||
start.smargon_position->chi_axis.z}, {0, 0, 0}, "");
|
||||
depends_on = "/entry/sample/transformations/chi";
|
||||
SaveScalar(transformations, "phi", start.smargon_position->phi_deg)->
|
||||
Transformation("deg", depends_on, "", "", "rotation",
|
||||
{start.smargon_position->phi_axis.x, start.smargon_position->phi_axis.y,
|
||||
start.smargon_position->phi_axis.z}, {0, 0, 0}, "");
|
||||
depends_on = "/entry/sample/transformations/phi";
|
||||
};
|
||||
|
||||
if ((end.max_image_number > 0) && start.goniometer) {
|
||||
HDF5Group transformations(group, "transformations");
|
||||
transformations.NXClass("NXtransformations");
|
||||
@@ -697,9 +714,10 @@ void NXmx::Sample(const StartMessage &start, const EndMessage &end) {
|
||||
SaveScalar(transformations, start.goniometer->GetName() + "_range_total",
|
||||
start.goniometer->GetIncrement_deg() * end.max_image_number)
|
||||
->Units("deg");
|
||||
|
||||
depends_on = "/entry/sample/transformations/" + start.goniometer->GetName();
|
||||
|
||||
write_smargon(transformations, depends_on);
|
||||
|
||||
auto helical = start.goniometer->GetHelicalStep();
|
||||
if (helical.has_value()) {
|
||||
SaveVector(transformations,
|
||||
@@ -746,6 +764,8 @@ void NXmx::Sample(const StartMessage &start, const EndMessage &end) {
|
||||
->Transformation("m", depends_on, "", "",
|
||||
"translation", {0, 1, 0}, {0,0,0}, "");
|
||||
depends_on = "/entry/sample/transformations/grid_scan_y";
|
||||
|
||||
write_smargon(transformations, depends_on);
|
||||
}
|
||||
|
||||
group.SaveScalar("depends_on", depends_on);
|
||||
|
||||
Reference in New Issue
Block a user