From 676979560f125c64228979732eb719f3e07aa4e3 Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sun, 15 Nov 2026 12:56:22 +0100 Subject: [PATCH] Unexplained blobs: the anomalous difference map's peak height at each, in the report and live MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each blob of the refined mFo-DFc map now carries the anomalous difference map's peak height (|F+| - |F-| on the model's phases less 90 degrees, in its rms): its highest point within 1 A of the blob's peak, not the value at the peak. The two maps are on grids of their own (up to ~0.7 A apart at 2 A) and the anomalous scatterer need not be the difference density's highest point; 1 A, half the shortest metal-ligand bond, keeps a neighbouring modelled S or metal from being read as the blob's own. NaN (null in _blobs.json) where the merge kept no Bijvoet pairs, instead of 0. The ION rule reads the same value. The report's blob list shows it only where the SUMMARY's Anomalous row says "signal present" (AnomalousRow, factored out of the summary so both read one decision); without the signal it is noise and is left out. --mode refine has no merge to judge on and leaves it out. Live: rugnux_live_blob.anomalous_sigma in /rugnux/status (C++ model, python docs, frontend client and Redoc regenerated); the Rugnux page's Details get a blob table with an "anom σ" column and the structure viewer's peak label an "anom" reading, both only where anomalous_signal is set. Tests: FindDensityBlobs_AnomalousPeakNearTheBlob (a scatterer 0.7 A off the difference peak read at its own height; no map, no reading), Refinement_blob_anomalous_peak (a model missing a zinc and a water, data with the zinc's f'': zinc blob 32 sigma, water -0.1), report and live checks. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK --- broker/OpenAPIConvert.cpp | 2 + broker/gen/model/Rugnux_live_blob.cpp | 33 ++++- broker/gen/model/Rugnux_live_blob.h | 9 ++ broker/jfjoch_api.yaml | 7 ++ broker/redoc-static.html | 4 +- docs/CBOR.md | 2 +- docs/CPU_DATA_ANALYSIS_REFINEMENT.md | 9 +- docs/JFJOCH_BROKER.md | 4 +- docs/RUGNUX_REPORT.md | 9 +- docs/python_client/docs/RugnuxLiveBlob.md | 1 + frontend/src/client/types.gen.ts | 7 ++ frontend/src/client/zod.gen.ts | 3 +- frontend/src/components/RugnuxPage.tsx | 3 +- frontend/src/components/RugnuxParts.tsx | 42 ++++++- .../src/components/RugnuxStructureViewer.tsx | 10 +- .../structure_refinement/DensityBlobs.cpp | 25 +++- .../structure_refinement/DensityBlobs.h | 4 +- receiver/RugnuxLiveStatus.cpp | 3 +- receiver/RugnuxLiveStatus.h | 3 + rugnux/ResultReport.cpp | 115 ++++++++++-------- tests/DensityBlobsTest.cpp | 31 +++++ tests/RefinementTest.cpp | 80 ++++++++++++ tests/ResultReportTest.cpp | 18 +++ tests/RugnuxLiveStatusTest.cpp | 6 +- 24 files changed, 354 insertions(+), 76 deletions(-) diff --git a/broker/OpenAPIConvert.cpp b/broker/OpenAPIConvert.cpp index 992b031b4..07a92ed97 100644 --- a/broker/OpenAPIConvert.cpp +++ b/broker/OpenAPIConvert.cpp @@ -1449,6 +1449,8 @@ org::openapitools::server::model::Rugnux_live_status Convert(const RugnuxLiveSna blob.setNearestAtom(b.nearest_atom); if (b.nearest_atom_distance_A) blob.setNearestAtomDistanceA(*b.nearest_atom_distance_A); + if (b.anomalous_sigma) + blob.setAnomalousSigma(*b.anomalous_sigma); blobs.push_back(blob); } refinement.setBlobs(blobs); diff --git a/broker/gen/model/Rugnux_live_blob.cpp b/broker/gen/model/Rugnux_live_blob.cpp index 187896f0b..984f1ee11 100644 --- a/broker/gen/model/Rugnux_live_blob.cpp +++ b/broker/gen/model/Rugnux_live_blob.cpp @@ -30,6 +30,8 @@ Rugnux_live_blob::Rugnux_live_blob() m_Nearest_atom = ""; m_Nearest_atom_distance_A = 0.0; m_Nearest_atom_distance_AIsSet = false; + m_Anomalous_sigma = 0.0; + m_Anomalous_sigmaIsSet = false; } @@ -52,7 +54,7 @@ bool Rugnux_live_blob::validate(std::stringstream& msg, const std::string& pathP bool success = true; const std::string _pathPrefix = pathPrefix.empty() ? "Rugnux_live_blob" : pathPrefix; - + return success; } @@ -83,7 +85,10 @@ bool Rugnux_live_blob::operator==(const Rugnux_live_blob& rhs) const && - ((!nearestAtomDistanceAIsSet() && !rhs.nearestAtomDistanceAIsSet()) || (nearestAtomDistanceAIsSet() && rhs.nearestAtomDistanceAIsSet() && getNearestAtomDistanceA() == rhs.getNearestAtomDistanceA())) + ((!nearestAtomDistanceAIsSet() && !rhs.nearestAtomDistanceAIsSet()) || (nearestAtomDistanceAIsSet() && rhs.nearestAtomDistanceAIsSet() && getNearestAtomDistanceA() == rhs.getNearestAtomDistanceA())) && + + + ((!anomalousSigmaIsSet() && !rhs.anomalousSigmaIsSet()) || (anomalousSigmaIsSet() && rhs.anomalousSigmaIsSet() && getAnomalousSigma() == rhs.getAnomalousSigma())) ; } @@ -105,6 +110,8 @@ void to_json(nlohmann::json& j, const Rugnux_live_blob& o) j["nearest_atom"] = o.m_Nearest_atom; if(o.nearestAtomDistanceAIsSet()) j["nearest_atom_distance_A"] = o.m_Nearest_atom_distance_A; + if(o.anomalousSigmaIsSet()) + j["anomalous_sigma"] = o.m_Anomalous_sigma; } @@ -122,6 +129,11 @@ void from_json(const nlohmann::json& j, Rugnux_live_blob& o) j.at("nearest_atom_distance_A").get_to(o.m_Nearest_atom_distance_A); o.m_Nearest_atom_distance_AIsSet = true; } + if(j.find("anomalous_sigma") != j.end()) + { + j.at("anomalous_sigma").get_to(o.m_Anomalous_sigma); + o.m_Anomalous_sigmaIsSet = true; + } } @@ -198,6 +210,23 @@ void Rugnux_live_blob::unsetNearest_atom_distance_A() { m_Nearest_atom_distance_AIsSet = false; } +double Rugnux_live_blob::getAnomalousSigma() const +{ + return m_Anomalous_sigma; +} +void Rugnux_live_blob::setAnomalousSigma(double const value) +{ + m_Anomalous_sigma = value; + m_Anomalous_sigmaIsSet = true; +} +bool Rugnux_live_blob::anomalousSigmaIsSet() const +{ + return m_Anomalous_sigmaIsSet; +} +void Rugnux_live_blob::unsetAnomalous_sigma() +{ + m_Anomalous_sigmaIsSet = false; +} } // namespace org::openapitools::server::model diff --git a/broker/gen/model/Rugnux_live_blob.h b/broker/gen/model/Rugnux_live_blob.h index a56f3c977..142f860a2 100644 --- a/broker/gen/model/Rugnux_live_blob.h +++ b/broker/gen/model/Rugnux_live_blob.h @@ -100,6 +100,13 @@ public: void setNearestAtomDistanceA(double const value); bool nearestAtomDistanceAIsSet() const; void unsetNearest_atom_distance_A(); + /// + /// The anomalous difference map's peak height within 1 Angstrom of the blob's peak, in the map's sigma. Absent where there is no anomalous map (`anomalous_map`); a measure of the blob only where the data carry anomalous signal (`anomalous_signal`), noise otherwise. + /// + double getAnomalousSigma() const; + void setAnomalousSigma(double const value); + bool anomalousSigmaIsSet() const; + void unsetAnomalous_sigma(); friend void to_json(nlohmann::json& j, const Rugnux_live_blob& o); friend void from_json(const nlohmann::json& j, Rugnux_live_blob& o); @@ -120,6 +127,8 @@ protected: double m_Nearest_atom_distance_A; bool m_Nearest_atom_distance_AIsSet; + double m_Anomalous_sigma; + bool m_Anomalous_sigmaIsSet; }; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 36dfec97a..21a60d85f 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -3130,6 +3130,13 @@ components: type: number format: double description: Absent where no atom is within 12 Angstrom + anomalous_sigma: + type: number + format: double + description: | + The anomalous difference map's peak height within 1 Angstrom of the blob's peak, in the map's sigma. + Absent where there is no anomalous map (`anomalous_map`); a measure of the blob only where the data + carry anomalous signal (`anomalous_signal`), noise otherwise. rugnux_live_stills: type: object description: | diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 71a30dce6..212c3cb81 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -892,7 +892,7 @@ and validation of every following rugnux live collection, until it is removed wi
Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "state": "Idle",
  • "placed_model": true,
  • "refined_model": true,
  • "anomalous_map": true,
  • "anomalous_signal": true,
  • "model": {
    },
  • "stills": {
    },
  • "shells_merge": "string",
  • "shells": [
    ],
  • "overall": {
    },
  • "frame_scales": [
    ],
  • "frame_ranges": [
    ],
  • "space_group": "string",
  • "d_min": 0.1,
  • "resolution_fit": 0.1,
  • "isa": 0.1,
  • "probe": "string",
  • "probe_s": 0.1,
  • "start_to_first_image_s": 0.1,
  • "message": "string",
  • "images_expected": 0,
  • "expected_collection_s": 0.1,
  • "images_received": 0,
  • "elapsed_s": 0.1,
  • "step_progress": 1,
  • "steps": [
    ],
  • "last_image_s": 0.1,
  • "cut": "string",
  • "cut_s": 0.1,
  • "last_image_to_written_s": 0.1,
  • "verdict": "string",
  • "verdict_text": "string",
  • "summary": [
    ],
  • "warnings": [
    ],
  • "triage": [
    ]
}

Clear the live rugnux result of the last collection

Puts /rugnux/status back to Idle with nothing of the last run - its merge, model, maps, steps and notes - +

http://localhost:5232/rugnux/status

Response samples

Content type
application/json
{
  • "state": "Idle",
  • "placed_model": true,
  • "refined_model": true,
  • "anomalous_map": true,
  • "anomalous_signal": true,
  • "model": {
    },
  • "stills": {
    },
  • "shells_merge": "string",
  • "shells": [
    ],
  • "overall": {
    },
  • "frame_scales": [
    ],
  • "frame_ranges": [
    ],
  • "space_group": "string",
  • "d_min": 0.1,
  • "resolution_fit": 0.1,
  • "isa": 0.1,
  • "probe": "string",
  • "probe_s": 0.1,
  • "start_to_first_image_s": 0.1,
  • "message": "string",
  • "images_expected": 0,
  • "expected_collection_s": 0.1,
  • "images_received": 0,
  • "elapsed_s": 0.1,
  • "step_progress": 1,
  • "steps": [
    ],
  • "last_image_s": 0.1,
  • "cut": "string",
  • "cut_s": 0.1,
  • "last_image_to_written_s": 0.1,
  • "verdict": "string",
  • "verdict_text": "string",
  • "summary": [
    ],
  • "warnings": [
    ],
  • "triage": [
    ]
}

Clear the live rugnux result of the last collection

Puts /rugnux/status back to Idle with nothing of the last run - its merge, model, maps, steps and notes - as before any collection. The collection's images, plots and the rugnux live settings are kept. Can be only run when Jungfraujoch is not collecting data.

Responses