From 8d4e64703b3e9183627b950ae5bd26b7a7c99d57 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Thu, 12 Nov 2026 19:22:45 +0100 Subject: [PATCH] receiver: the run's lattice takes the place of the probe's answer The lattice probe's "no lattice on the first 60 deg" stayed on the dashboard while the main rotation run indexed the sweep. When the run reports its lattice (the first pass's "lattice ..." note), the probe banner becomes "lattice on the sweep: ..." and a probe answer that comes later is not shown. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01HVeDQsU5a8AJUdJPgWevAK --- broker/gen/model/Rugnux_live_status.h | 4 ++-- broker/jfjoch_api.yaml | 4 ++-- receiver/JFJochReceiverRugnuxRotation.cpp | 7 ++++++- receiver/RugnuxLiveStatus.cpp | 11 +++++++++++ receiver/RugnuxLiveStatus.h | 3 +++ tests/RugnuxLiveStatusTest.cpp | 19 +++++++++++++++++++ 6 files changed, 43 insertions(+), 5 deletions(-) diff --git a/broker/gen/model/Rugnux_live_status.h b/broker/gen/model/Rugnux_live_status.h index 1113d4d96..06f4edded 100644 --- a/broker/gen/model/Rugnux_live_status.h +++ b/broker/gen/model/Rugnux_live_status.h @@ -162,12 +162,12 @@ public: bool isaIsSet() const; void unsetIsa(); /// - /// Answer of the early lattice probe on the first 60 degrees; empty until it answers + /// Answer of the early lattice probe on the first 60 degrees; empty until it answers, and the run's own lattice once the run has indexed /// std::string getProbe() const; void setProbe(std::string const& value); /// - /// When the probe answered, since the first image + /// When the probe answered (or the run indexed), since the first image /// double getProbeS() const; void setProbeS(double const value); diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 788c23fd3..2a2237417 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -3348,11 +3348,11 @@ components: description: ISa of the error model; absent until the run is over, or where it was not determined probe: type: string - description: Answer of the early lattice probe on the first 60 degrees; empty until it answers + description: Answer of the early lattice probe on the first 60 degrees; empty until it answers, and the run's own lattice once the run has indexed probe_s: type: number format: double - description: When the probe answered, since the first image + description: When the probe answered (or the run indexed), since the first image start_to_first_image_s: type: number format: double diff --git a/receiver/JFJochReceiverRugnuxRotation.cpp b/receiver/JFJochReceiverRugnuxRotation.cpp index c6e00a3ea..b7d40a13a 100644 --- a/receiver/JFJochReceiverRugnuxRotation.cpp +++ b/receiver/JFJochReceiverRugnuxRotation.cpp @@ -74,7 +74,12 @@ namespace { } void OnProgress(uint64_t done, uint64_t total) override { status.Progress(done, total); } void OnStep(const std::string &title) override { status.Step(title); } - void OnNote(const std::string &text) override { status.Note(text); } + void OnNote(const std::string &text) override { + status.Note(text); + // The run has its lattice (RugnuxFirstPassAccept): the probe's answer on the first degrees is overtaken + if (text.starts_with("lattice ")) + status.Lattice("lattice on the sweep: " + text.substr(8)); + } }; std::string StateName(RugnuxLiveState state) { diff --git a/receiver/RugnuxLiveStatus.cpp b/receiver/RugnuxLiveStatus.cpp index f94d69e14..7304a1149 100644 --- a/receiver/RugnuxLiveStatus.cpp +++ b/receiver/RugnuxLiveStatus.cpp @@ -86,6 +86,7 @@ void RugnuxLiveStatus::Start(int64_t images_expected, std::optional expe snapshot.expected_collection_s = expected_collection_s; start = start_received; last_image.reset(); + lattice = false; } void RugnuxLiveStatus::ImageReceived(std::chrono::steady_clock::time_point received) { @@ -226,10 +227,19 @@ void RugnuxLiveStatus::Cut(const std::string &reason) { void RugnuxLiveStatus::Probe(const std::string &text) { std::unique_lock ul(status_mutex); + if (lattice) + return; snapshot.probe = text; snapshot.probe_s = Now(); } +void RugnuxLiveStatus::Lattice(const std::string &text) { + std::unique_lock ul(status_mutex); + snapshot.probe = text; + snapshot.probe_s = Now(); + lattice = true; +} + void RugnuxLiveStatus::Warning(const std::string &text) { std::unique_lock ul(status_mutex); snapshot.warnings.push_back(text); @@ -246,6 +256,7 @@ void RugnuxLiveStatus::Clear() { std::unique_lock ul(status_mutex); snapshot = RugnuxLiveSnapshot{}; last_image.reset(); + lattice = false; } RugnuxLiveSnapshot RugnuxLiveStatus::Get() const { diff --git a/receiver/RugnuxLiveStatus.h b/receiver/RugnuxLiveStatus.h index 90cee0a16..902de6e90 100644 --- a/receiver/RugnuxLiveStatus.h +++ b/receiver/RugnuxLiveStatus.h @@ -181,6 +181,7 @@ class RugnuxLiveStatus { // Kept since the START message, shifted to the first image by Get(). std::chrono::steady_clock::time_point start; std::optional last_image; + bool lattice = false; // the run has its lattice: the probe's answer is overtaken double Since(std::chrono::steady_clock::time_point t) const; double Now() const; void CloseStep(); @@ -204,7 +205,9 @@ public: // The collection is over: last_image_s is set, and the last image's time is returned (none if no image came). std::optional LastImage(); void Cut(const std::string &reason); + // The probe's answer, unless the run has its lattice already; Lattice: the run's, in the probe's place void Probe(const std::string &text); + void Lattice(const std::string &text); void Warning(const std::string &text); void Structure(std::shared_ptr structure, std::shared_ptr refined_structure = nullptr); diff --git a/tests/RugnuxLiveStatusTest.cpp b/tests/RugnuxLiveStatusTest.cpp index bd3b33483..57a6a1471 100644 --- a/tests/RugnuxLiveStatusTest.cpp +++ b/tests/RugnuxLiveStatusTest.cpp @@ -54,6 +54,25 @@ TEST_CASE("RugnuxLiveStatus_BeforeFirstImage", "[RugnuxLive]") { CHECK(!status.LastImage()); } +TEST_CASE("RugnuxLiveStatus_RunLatticeOvertakesProbe", "[RugnuxLive]") { + RugnuxLiveStatus status; + status.Start(10, 1.0, std::chrono::steady_clock::now()); + + // The probe answers first, the run indexes later: the banner is the run's + status.Probe("no lattice on the first 60 deg"); + CHECK(status.Get().probe == "no lattice on the first 60 deg"); + status.Lattice("lattice on the sweep: monoclinic P: 35.00 29.00 63.00 90.0 105.0 90.0"); + CHECK(status.Get().probe.starts_with("lattice on the sweep")); + // The run indexed before the probe answered: the probe's answer is not shown + status.Probe("no lattice on the first 60 deg"); + CHECK(status.Get().probe.starts_with("lattice on the sweep")); + + // The next collection starts afresh + status.Start(10, 1.0, std::chrono::steady_clock::now()); + status.Probe("no lattice on the first 60 deg"); + CHECK(status.Get().probe == "no lattice on the first 60 deg"); +} + TEST_CASE("RugnuxLiveStatus_Clear", "[RugnuxLive]") { RugnuxLiveStatus status; status.Start(10, 1.0, std::chrono::steady_clock::now() - 2s);