Merge branch 'worktree-agent-a4c58d76a0be29dd6' into grid-scan-integration

# Conflicts:
#	rugnux/rugnux_cli.cpp
This commit is contained in:
leonarski_f committed 2026-09-08 07:55:31 +02:00
commit cb1d88dd4d
50 files changed
+2125 -72

No files matched your search

+40
View File
@@ -302,6 +302,39 @@ inline void CBOR_ENC(CborEncoder &encoder, const char* key, const std::vector<Sp
cborErr(cbor_encoder_close_container(&encoder, &arrayEncoder));
}
// A grid-scan crystal, as a map keyed by field name - the same shape as a spot above, so a reader
// that does not know a field skips it and the record survives a field being added.
inline void CBOR_ENC(CborEncoder &encoder, const GridScanCrystal& c) {
CborEncoder mapEncoder;
cborErr(cbor_encoder_create_map(&encoder, &mapEncoder, CborIndefiniteLength));
CBOR_ENC(mapEncoder, "nx", c.nx);
CBOR_ENC(mapEncoder, "ny", c.ny);
CBOR_ENC(mapEncoder, "x_um", c.x_um);
CBOR_ENC(mapEncoder, "y_um", c.y_um);
CBOR_ENC(mapEncoder, "image_number", c.image_number);
CBOR_ENC(mapEncoder, "major_um", c.major_um);
CBOR_ENC(mapEncoder, "minor_um", c.minor_um);
// An axis, in [0, 180): 179 deg and 0 deg are adjacent, so these do not average arithmetically.
CBOR_ENC(mapEncoder, "angle_deg", c.angle_deg);
CBOR_ENC(mapEncoder, "score", c.score);
CBOR_ENC(mapEncoder, "ice_score", c.ice_score);
CBOR_ENC(mapEncoder, "res_A", c.res_A);
CBOR_ENC(mapEncoder, "n_images", c.n_images);
cborErr(cbor_encoder_close_container(&encoder, &mapEncoder));
}
inline void CBOR_ENC(CborEncoder &encoder, const char* key, const std::vector<GridScanCrystal>& crystals) {
CborEncoder arrayEncoder;
cborErr(cbor_encode_text_stringz(&encoder, key));
cborErr(cbor_encoder_create_array(&encoder, &arrayEncoder, crystals.size()));
for (const auto &c: crystals)
CBOR_ENC(arrayEncoder, c);
cborErr(cbor_encoder_close_container(&encoder, &arrayEncoder));
}
inline void CBOR_ENC(CborEncoder &encoder, const char* key, const std::vector<Reflection>& refs) {
CborEncoder arrayEncoder, mapEncoder;
@@ -629,6 +662,11 @@ inline void CBOR_ENC_START_USER_DATA(CborEncoder& encoder, const char* key,
if (message.detect_ice_rings.has_value())
j["detect_ice_rings"] = message.detect_ice_rings.value();
// Which analysis produced this stream. One shared spelling table (AnalysisModeName), so the token
// in the stream is the same one the HDF5 master, the rugnux --mode option and the OpenAPI enum use.
if (message.analysis_mode.has_value())
j["analysis_mode"] = AnalysisModeName(message.analysis_mode.value());
switch(message.indexing_algorithm) {
case IndexingAlgorithmEnum::FFBIDX:
j["indexing_algorithm"] = "ffbidx";
@@ -817,6 +855,8 @@ void CBORStream2Serializer::SerializeSequenceEnd(const EndMessage& message) {
CBOR_ENC_FLOAT_ARRAY_NOKEY(arrayEncoder, el.GetVector());
cborErr(cbor_encoder_close_container(&mapEncoder, &arrayEncoder));
}
if (!message.grid_crystals.empty())
CBOR_ENC(mapEncoder, "grid_crystals", message.grid_crystals);
CBOR_ENC(mapEncoder, "data_collection_efficiency_image", message.data_collection_efficiency);
CBOR_ENC(mapEncoder, "spot_count", message.spot_count);
CBOR_ENC(mapEncoder, "spot_count_ice_ring", message.spot_count_ice_ring);