From ae67b36160f7835924daf6207ac647ace4abbf19 Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Fri, 5 Jun 2026 13:34:13 +0200 Subject: [PATCH] Adding machinery to include indexing lattice count --- common/JFJochMessages.h | 1 + common/Plot.h | 2 +- docs/CBOR.md | 1 + frame_serialize/CBORStream2Deserializer.cpp | 2 ++ frame_serialize/CBORStream2Serializer.cpp | 1 + receiver/JFJochReceiverPlots.cpp | 8 ++++++++ receiver/JFJochReceiverPlots.h | 1 + 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/common/JFJochMessages.h b/common/JFJochMessages.h index 83600b05..9d9c2bbf 100644 --- a/common/JFJochMessages.h +++ b/common/JFJochMessages.h @@ -112,6 +112,7 @@ struct DataMessage { std::optional bkg_estimate; std::optional indexing_result; + std::optional indexing_lattice_count; std::optional indexing_lattice; std::optional indexing_unit_cell; std::optional spot_count_indexed; diff --git a/common/Plot.h b/common/Plot.h index 2ac99093..1075b5c4 100644 --- a/common/Plot.h +++ b/common/Plot.h @@ -15,7 +15,7 @@ enum class PlotType { ROISum, ROIMean, ROIMaxCount, ROIPixels, ROIWeightedX, ROIWeightedY, PacketsReceived, MaxValue, ResolutionEstimate, ProfileRadius, Mosaicity, BFactor, PixelSum, StrongPixels, RefinementBeamX, RefinementBeamY, ImageProcessingTime, IntegratedReflections, - ImageScaleFactor, ImageScaleCC, ImageScaleBFactor, CompressionRatio + ImageScaleFactor, ImageScaleCC, ImageScaleBFactor, CompressionRatio, IndexingLatticeCount }; enum class PlotAzintUnit { diff --git a/docs/CBOR.md b/docs/CBOR.md index 7731bc35..4fe098ee 100644 --- a/docs/CBOR.md +++ b/docs/CBOR.md @@ -161,6 +161,7 @@ See [DECTRIS documentation](https://github.com/dectris/documentation/tree/main/s | az_int_std | Array(float) | Standard deviation for azimuthal integration. (NaN for less than 2 samples) | | | | az_int_count | Array(uint64) | Number of pixels contributing to azimuthal bin | | | | indexing_result | bool | Indexing successful | | | +| indexing_lattice_count | uint64 | Number of lattices found in indexing | | X | | indexing_lattice | Array(9 * float) | Indexing result real lattice; present only if indexed | | X | | indexing_unit_cell | object | Indexing result unit cell: a, b, c \[angstrom\] and alpha, beta, gamma \[degree\]; present only if indexed | | X | | | | Unit cell is redundant to lattice - yet to simplify downstream programs to analyze results, both are provided | | | diff --git a/frame_serialize/CBORStream2Deserializer.cpp b/frame_serialize/CBORStream2Deserializer.cpp index 645059f2..fff2fa91 100644 --- a/frame_serialize/CBORStream2Deserializer.cpp +++ b/frame_serialize/CBORStream2Deserializer.cpp @@ -717,6 +717,8 @@ namespace { GetCBORUInt64Array(value, message.az_int_profile_count); else if (key == "indexing_result") message.indexing_result = GetCBORBool(value); + else if (key == "indexing_lattice_count") + message.indexing_lattice_count = GetCBORUInt(value); else if (key == "indexing_lattice") { std::vector tmp; GetCBORFloatArray(value, tmp); diff --git a/frame_serialize/CBORStream2Serializer.cpp b/frame_serialize/CBORStream2Serializer.cpp index 1e255573..8f3cde3c 100644 --- a/frame_serialize/CBORStream2Serializer.cpp +++ b/frame_serialize/CBORStream2Serializer.cpp @@ -765,6 +765,7 @@ void CBORStream2Serializer::SerializeImageInternal(CborEncoder &mapEncoder, cons CBOR_ENC(mapEncoder, "az_int_profile_count", message.az_int_profile_count); CBOR_ENC(mapEncoder, "indexing_result", message.indexing_result); + CBOR_ENC(mapEncoder, "indexing_lattice_count", message.indexing_lattice_count); if (message.indexing_lattice) CBOR_ENC(mapEncoder, "indexing_lattice", message.indexing_lattice->GetVector()); CBOR_ENC(mapEncoder, "profile_radius", message.profile_radius); diff --git a/receiver/JFJochReceiverPlots.cpp b/receiver/JFJochReceiverPlots.cpp index c87d9d69..3f7e2599 100644 --- a/receiver/JFJochReceiverPlots.cpp +++ b/receiver/JFJochReceiverPlots.cpp @@ -122,6 +122,7 @@ void JFJochReceiverPlots::Setup(const DiffractionExperiment &experiment, const A indexing_analysis_time.Clear(r); image_scale_time.Clear(r); compression_ratio.Clear(r); + indexing_lattice_count.Clear(r); } void JFJochReceiverPlots::Add(const DataMessage &msg, const AzimuthalIntegrationProfile &profile) { @@ -167,6 +168,7 @@ void JFJochReceiverPlots::Add(const DataMessage &msg, const AzimuthalIntegration indexing_uc_gamma.AddElement(msg.number, msg.indexing_unit_cell->gamma); } + indexing_lattice_count.AddElement(msg.number, msg.indexing_lattice_count); beam_center_x.AddElement(msg.number, msg.beam_corr_x); beam_center_y.AddElement(msg.number, msg.beam_corr_y); @@ -300,6 +302,9 @@ MultiLinePlot JFJochReceiverPlots::GetPlots(const PlotRequest &request) { case PlotType::CompressionRatio: ret = compression_ratio.GetMeanPlot(nbins, start, incr, request.fill_value); break; + case PlotType::IndexingLatticeCount: + ret = indexing_lattice_count.GetMeanPlot(nbins, start, incr, request.fill_value); + break; case PlotType::ReceiverFreeSendBuf: { auto available = receiver_buf_available.GetMeanPerBin(nbins, start, incr, request.fill_value); auto sending = receiver_buf_in_sending.GetMeanPerBin(nbins, start, incr, request.fill_value); @@ -568,6 +573,9 @@ void JFJochReceiverPlots::GetPlotRaw(std::vector &v, PlotType type, const case PlotType::CompressionRatio: v = compression_ratio.ExportArray(); break; + case PlotType::IndexingLatticeCount: + v = indexing_lattice_count.ExportArray(); + break; case PlotType::ROISum: case PlotType::ROIMaxCount: case PlotType::ROIPixels: diff --git a/receiver/JFJochReceiverPlots.h b/receiver/JFJochReceiverPlots.h index 9ef32efe..ab04602d 100644 --- a/receiver/JFJochReceiverPlots.h +++ b/receiver/JFJochReceiverPlots.h @@ -48,6 +48,7 @@ class JFJochReceiverPlots { StatusVector spot_count_ice; StatusVector indexing_solution; + StatusVector indexing_lattice_count; StatusVector indexing_uc_a; StatusVector indexing_uc_b; StatusVector indexing_uc_c;