Merge rc187-live-anom: anomalous peak height of each unexplained blob
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Failing after 25s
Build Packages / Create release (push) Successful in 44s
Build Packages / Build documentation (push) Canceled after 5m25s
Build Packages / build:jfjoch:rocky8:nocuda (push) Canceled after 5m17s
Build Packages / build:portable:linux-x86_64:cuda (push) Canceled after 5m21s
Build Packages / build:portable:linux-x86_64:nocuda (push) Canceled after 5m23s
Build Packages / build:portable:windows-x86_64:cuda (push) Canceled after 0s
Build Packages / build:portable:windows-x86_64:nocuda (push) Canceled after 0s
Build Packages / build:portable:macos-arm64:nocuda (push) Canceled after 0s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Canceled after 5m19s
Build Packages / Unit tests (push) Canceled after 6m15s
Build Packages / Validation Battery (push) Canceled after 0s
Build Packages / build:jfjoch:rocky8:cuda (push) Canceled after 0s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Canceled after 0s
Build Packages / build:jfjoch:rocky9:cuda (push) Canceled after 0s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Canceled after 0s
Build Packages / build:jfjoch:rocky9:nocuda (push) Canceled after 0s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Canceled after 0s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Canceled after 0s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Canceled after 0s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Canceled after 0s
Build Packages / Generate python client (push) Canceled after 0s

This commit is contained in:
leonarski_f committed 2026-11-15 13:59:11 +01:00
commit 313ec1fcda
24 files changed
+354 -76

No files matched your search

+2
View File
@@ -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);
+31 -2
View File
@@ -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
+9
View File
@@ -100,6 +100,13 @@ public:
void setNearestAtomDistanceA(double const value);
bool nearestAtomDistanceAIsSet() const;
void unsetNearest_atom_distance_A();
/// <summary>
/// The anomalous difference map&#39;s peak height within 1 Angstrom of the blob&#39;s peak, in the map&#39;s sigma. Absent where there is no anomalous map (&#x60;anomalous_map&#x60;); a measure of the blob only where the data carry anomalous signal (&#x60;anomalous_signal&#x60;), noise otherwise.
/// </summary>
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;
};
+7
View File
@@ -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: |
+2 -2
View File
@@ -892,7 +892,7 @@ and validation of every following rugnux live collection, until it is removed wi
</div></div><div class="sc-jaXxmE eqYzvz"><div class="sc-iMTnTL fkPTul"><h5 class="sc-dAlyuH sc-hwdzOV jbQuod JjoyL">Authorizations:</h5><svg class="sc-cwHptR iZRiKW" version="1.1" viewBox="0 0 24 24" x="0" xmlns="http://www.w3.org/2000/svg" y="0" aria-hidden="true"><polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "></polygon></svg></div><div class="sc-krNlru gkwgxc"><span class="sc-jMakVo bPNrjo"><span class="sc-ihgnxF jlNGfN"><i>bearerAuth</i></span></span></div></div><div><h3 class="sc-fMMURN egoxtT">Responses</h3><div><button class="sc-kzqdkY jgSwKD"><svg class="sc-cwHptR hWEnWx" version="1.1" viewBox="0 0 24 24" x="0" xmlns="http://www.w3.org/2000/svg" y="0" aria-hidden="true"><polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "></polygon></svg><strong class="sc-dSIIpw bpEYcE">200<!-- --> </strong><div class="sc-eeDRCY sc-eBMEME sc-dCFHLb gTGgei kekOtA kCaLQd"><p>Everything OK</p>
</div></button></div><div><button class="sc-kzqdkY bXzzUN"><svg class="sc-cwHptR cSkZlF" version="1.1" viewBox="0 0 24 24" x="0" xmlns="http://www.w3.org/2000/svg" y="0" aria-hidden="true"><polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "></polygon></svg><strong class="sc-dSIIpw bpEYcE">401<!-- --> </strong><div class="sc-eeDRCY sc-eBMEME sc-dCFHLb gTGgei kekOtA kCaLQd"><p>The current dataset is protected and no valid bearer token was presented.</p>
</div></button></div></div></div><div class="sc-iGgWBj sc-gsFSXq ibAZSi eDeKjd"><div class="sc-ejfMa-d bNUPQg"><button class="sc-EgOXT cFEcOl"><span type="get" class="sc-eZYNyq qGfV http-verb get">get</span><span class="sc-iEXKAA gUNSDu">/rugnux/status</span><svg class="sc-cwHptR iVFMLx" style="margin-right:-25px" version="1.1" viewBox="0 0 24 24" x="0" xmlns="http://www.w3.org/2000/svg" y="0" aria-hidden="true"><polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "></polygon></svg></button><div aria-hidden="true" class="sc-dlWCHZ kWacYr"><div class="sc-hHOBiw cndTNO"><div class="sc-eeDRCY sc-eBMEME gTGgei fbXBig"><p>Test Jungfraujoch system</p>
</div><div tabindex="0" role="button"><div class="sc-kWtpeL gEncxT"><span>http://localhost:5232</span>/rugnux/status</div></div></div></div></div><div><h3 class="sc-kpDqfm eBBgSB"> <!-- -->Response samples<!-- --> </h3><div class="sc-bXCLTC dHowgL" data-rttabs="true"><ul class="react-tabs__tab-list" role="tablist"><li class="tab-success react-tabs__tab--selected" role="tab" id="tab_R_jiia_0" aria-selected="true" aria-disabled="false" aria-controls="panel_R_jiia_0" tabindex="0" data-rttab="true">200</li></ul><div class="react-tabs__tab-panel react-tabs__tab-panel--selected" role="tabpanel" id="panel_R_jiia_0" aria-labelledby="tab_R_jiia_0"><div><div class="sc-bbSZdi gCVTxk"><span class="sc-fjvvzt jWReSk">Content type</span><div class="sc-JrDLc iTKzPJ">application/json</div></div><div class="sc-uVWWZ gQROPU"><div class="sc-esYiGF dWQNJI"><div class="sc-koXPp efufqz"><button><div class="sc-fhzFiK kwZDms">Copy</div></button><button> Expand all </button><button> Collapse all </button></div><div tabindex="0" class="sc-eeDRCY gTGgei sc-fXSgeo bnrBiz"><div class="redoc-json"><code><button class="collapser" aria-label="collapse"></button><span class="token punctuation">{</span><span class="ellipsis"></span><ul class="obj collapsible"><li><div class="hoverable "><span class="property token string">"state"</span>: <span class="token string">&quot;Idle&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"placed_model"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"refined_model"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"anomalous_map"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"anomalous_signal"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"model"</span>: <button class="collapser" aria-label="collapse"></button><span class="token punctuation">{</span><span class="ellipsis"></span><ul class="obj collapsible"><li><div class="hoverable collapsed"><span class="property token string">"placement"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"model_name"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"predicted"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"reason"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"r_work"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"r_free"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"cc_model"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"fit_sigma"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"map_atom_sigma"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"rigid_body_angle_deg"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"rigid_body_shift_A"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"mr_decision"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"mr_space_group"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"copies"</span>: <span class="token number">0</span><span class="token punctuation">,</span></div>Line truncated
</div><div tabindex="0" role="button"><div class="sc-kWtpeL gEncxT"><span>http://localhost:5232</span>/rugnux/status</div></div></div></div></div><div><h3 class="sc-kpDqfm eBBgSB"> <!-- -->Response samples<!-- --> </h3><div class="sc-bXCLTC dHowgL" data-rttabs="true"><ul class="react-tabs__tab-list" role="tablist"><li class="tab-success react-tabs__tab--selected" role="tab" id="tab_R_jiia_0" aria-selected="true" aria-disabled="false" aria-controls="panel_R_jiia_0" tabindex="0" data-rttab="true">200</li></ul><div class="react-tabs__tab-panel react-tabs__tab-panel--selected" role="tabpanel" id="panel_R_jiia_0" aria-labelledby="tab_R_jiia_0"><div><div class="sc-bbSZdi gCVTxk"><span class="sc-fjvvzt jWReSk">Content type</span><div class="sc-JrDLc iTKzPJ">application/json</div></div><div class="sc-uVWWZ gQROPU"><div class="sc-esYiGF dWQNJI"><div class="sc-koXPp efufqz"><button><div class="sc-fhzFiK kwZDms">Copy</div></button><button> Expand all </button><button> Collapse all </button></div><div tabindex="0" class="sc-eeDRCY gTGgei sc-fXSgeo bnrBiz"><div class="redoc-json"><code><button class="collapser" aria-label="collapse"></button><span class="token punctuation">{</span><span class="ellipsis"></span><ul class="obj collapsible"><li><div class="hoverable "><span class="property token string">"state"</span>: <span class="token string">&quot;Idle&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"placed_model"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"refined_model"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"anomalous_map"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"anomalous_signal"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable "><span class="property token string">"model"</span>: <button class="collapser" aria-label="collapse"></button><span class="token punctuation">{</span><span class="ellipsis"></span><ul class="obj collapsible"><li><div class="hoverable collapsed"><span class="property token string">"placement"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"model_name"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"predicted"</span>: <span class="token boolean">true</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"reason"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"r_work"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"r_free"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"cc_model"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"fit_sigma"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"map_atom_sigma"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"rigid_body_angle_deg"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"rigid_body_shift_A"</span>: <span class="token number">0.1</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"mr_decision"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"mr_space_group"</span>: <span class="token string">&quot;string&quot;</span><span class="token punctuation">,</span></div></li><li><div class="hoverable collapsed"><span class="property token string">"copies"</span>: <span class="token number">0</span><span class="token punctuation">,</span></div>Line truncated
as before any collection. The collection&#39;s images, plots and the rugnux live settings are kept.
Can be only run when Jungfraujoch is not collecting data.</p>
</div></div><div><h3 class="sc-fMMURN egoxtT">Responses</h3><div><button class="sc-kzqdkY jkjMMR" disabled=""><strong class="sc-dSIIpw bpEYcE">200<!-- --> </strong><div class="sc-eeDRCY sc-eBMEME sc-dCFHLb gTGgei kekOtA kCaLQd"><p>Done</p>
@@ -1157,7 +1157,7 @@ then image might be replaced in the buffer between calling /images and /image.cb
</div></button></div></div></div><div class="sc-iGgWBj sc-gsFSXq ibAZSi eDeKjd"><div class="sc-ejfMa-d bNUPQg"><button class="sc-EgOXT cFEcOl"><span type="get" class="sc-eZYNyq qGfV http-verb get">get</span><span class="sc-iEXKAA gUNSDu">/version</span><svg class="sc-cwHptR iVFMLx" style="margin-right:-25px" version="1.1" viewBox="0 0 24 24" x="0" xmlns="http://www.w3.org/2000/svg" y="0" aria-hidden="true"><polygon points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 "></polygon></svg></button><div aria-hidden="true" class="sc-dlWCHZ kWacYr"><div class="sc-hHOBiw cndTNO"><div class="sc-eeDRCY sc-eBMEME gTGgei fbXBig"><p>Test Jungfraujoch system</p>
</div><div tabindex="0" role="button"><div class="sc-kWtpeL gEncxT"><span>http://localhost:5232</span>/version</div></div></div></div></div></div></div></div></div><div class="sc-dExYaf gZbfaQ"></div></div></div>
<script>
const __redoc_state = {"menu":{"activeItemIdx":-1},"spec":{"data":{"openapi":"3.0.3","info":{"title":"Jungfraujoch","description":"API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland).\nJungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU.\nJungfraujoch uses FPGA boards to acquire data at high data rates.\n\n# License Clarification\n\nWhile this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply**\nwhen this file is used solely to generate OpenAPI clients or when implementing applications that\ninteract with the API. Generated client code and applications using this API definition are not\nsubject to the GPL license requirements and may be distributed under terms of your choosing.\n\nThis exception is similar in spirit to the Linux Kernel's approach to userspace API headers and\nthe GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that\nuser programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not\nderivative works of the kernel and are not subject to the terms of the GPL.\n\nThis exception is intended to allow wider use of this API specification without imposing GPL\nrequirements on applications that merely interact with the API, regardless of whether they\ncommunicate through network calls or other mechanisms.\n","version":"1.0.0-rc.186","contact":{"name":"Filip Leonarski (Paul Scherrer Institute)","email":"filip.leonarski@psi.ch"},"license":{"name":"GPL-3.0","url":"https://www.gnu.org/licenses/gpl-3.0.html"}},"servers":[{"url":"http://localhost:5232","description":"Test Jungfraujoch system"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Per-dataset secret. `/start` may carry one or more equivalent `tokens`; while the current\ndataset has any, the operations marked with this scheme require `Authorization: Bearer <token>`\nand answer 401 otherwise. A dataset started without `tokens` is not protected and the header is ignored.\n"}},"parameters":{"binning":{"in":"query","name":"binning","required":false,"schema":{"default":1,"type":"integer"},"description":"Binning of frames for the plot (0 = default binning)"},"experimental_coord":{"in":"query","name":"experimental_coord","required":false,"schema":{"type":"boolean","default":false},"description":"If measurement has goniometer axis defined, plot X-axis will represent rotation angle\nIf measurement has grid scan defined, plot X-axis and Y-axis will represent grid position, Z will be used as the final value\nFor still measurement the number is ignored\n"},"azint_unit":{"in":"query","name":"azint_unit","required":false,"schema":{"type":"string","enum":["Q_recipA","d_A","two_theta_deg"],"default":"Q_recipA"},"description":"Unit used for azim int.\n"},"fill_value":{"in":"query","name":"fill","required":false,"schema":{"type":"number","format":"float"},"description":"Fill value for elements that were missed during data collection\n"},"plot_type":{"in":"query","name":"type","required":true,"description":"Type of requested plot","schema":{"type":"string","enum":["bkg_estimate","spindle_blind_fraction","azint","azint_1d","spot_count","spot_count_low_res","spot_count_indexed","spot_count_ice","indexing_rate","indexing_lattice_count","indexing_unit_cell_length","indexing_unit_cell_angle","profile_radius","mosaicity","b_factor","error_pixels","saturated_pixels","image_collection_efficiency","receiver_delay","receiver_free_send_buf","strong_pixels","roi_sum","roi_mean","roi_max_count","roi_pixels","roi_weighted_x","roi_weighted_y","packets_received","max_pixel_value","resolution_estimate","pixel_sum","processing_time","beam_center_x","beam_center_y","integrated_reflections","image_scale_factor","image_scale_cc","compression_ratio","ice_ring_score"]}},"roi":{"in":"query","name":"roi","required":false,"schema":{"type":"string","minLength":1},"description":"Name of ROI for which plot is requested"},"image_id":{"in":"query","name":"id","required":false,"schema":{"type":"integer","format":"int64","default":-1,"minimum":-2},"description":"Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer"},"saturation":{"in":"query","name":"saturation","required":false,"schema":{"type":"number","format":"float","minimum":-32767,"maximum":32767},"description":"Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used"},"background":{"in":"query","name":"background","required":false,"schema":{"type":"number","format":"float","default":0,"minimum":-32767,"maximum":32767},"description":"Background value to set contrast in the preview image"},"show_spots":{"in":"query","name":"show_spots","schema":{"type":"boolean","default":true},"description":"Show spot finding results on the image"},"show_predictions":{"in":"query","name":"show_predictions","schema":Line truncated
const __redoc_state = {"menu":{"activeItemIdx":-1},"spec":{"data":{"openapi":"3.0.3","info":{"title":"Jungfraujoch","description":"API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland).\nJungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU.\nJungfraujoch uses FPGA boards to acquire data at high data rates.\n\n# License Clarification\n\nWhile this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply**\nwhen this file is used solely to generate OpenAPI clients or when implementing applications that\ninteract with the API. Generated client code and applications using this API definition are not\nsubject to the GPL license requirements and may be distributed under terms of your choosing.\n\nThis exception is similar in spirit to the Linux Kernel's approach to userspace API headers and\nthe GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that\nuser programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not\nderivative works of the kernel and are not subject to the terms of the GPL.\n\nThis exception is intended to allow wider use of this API specification without imposing GPL\nrequirements on applications that merely interact with the API, regardless of whether they\ncommunicate through network calls or other mechanisms.\n","version":"1.0.0-rc.186","contact":{"name":"Filip Leonarski (Paul Scherrer Institute)","email":"filip.leonarski@psi.ch"},"license":{"name":"GPL-3.0","url":"https://www.gnu.org/licenses/gpl-3.0.html"}},"servers":[{"url":"http://localhost:5232","description":"Test Jungfraujoch system"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Per-dataset secret. `/start` may carry one or more equivalent `tokens`; while the current\ndataset has any, the operations marked with this scheme require `Authorization: Bearer <token>`\nand answer 401 otherwise. A dataset started without `tokens` is not protected and the header is ignored.\n"}},"parameters":{"binning":{"in":"query","name":"binning","required":false,"schema":{"default":1,"type":"integer"},"description":"Binning of frames for the plot (0 = default binning)"},"experimental_coord":{"in":"query","name":"experimental_coord","required":false,"schema":{"type":"boolean","default":false},"description":"If measurement has goniometer axis defined, plot X-axis will represent rotation angle\nIf measurement has grid scan defined, plot X-axis and Y-axis will represent grid position, Z will be used as the final value\nFor still measurement the number is ignored\n"},"azint_unit":{"in":"query","name":"azint_unit","required":false,"schema":{"type":"string","enum":["Q_recipA","d_A","two_theta_deg"],"default":"Q_recipA"},"description":"Unit used for azim int.\n"},"fill_value":{"in":"query","name":"fill","required":false,"schema":{"type":"number","format":"float"},"description":"Fill value for elements that were missed during data collection\n"},"plot_type":{"in":"query","name":"type","required":true,"description":"Type of requested plot","schema":{"type":"string","enum":["bkg_estimate","spindle_blind_fraction","azint","azint_1d","spot_count","spot_count_low_res","spot_count_indexed","spot_count_ice","indexing_rate","indexing_lattice_count","indexing_unit_cell_length","indexing_unit_cell_angle","profile_radius","mosaicity","b_factor","error_pixels","saturated_pixels","image_collection_efficiency","receiver_delay","receiver_free_send_buf","strong_pixels","roi_sum","roi_mean","roi_max_count","roi_pixels","roi_weighted_x","roi_weighted_y","packets_received","max_pixel_value","resolution_estimate","pixel_sum","processing_time","beam_center_x","beam_center_y","integrated_reflections","image_scale_factor","image_scale_cc","compression_ratio","ice_ring_score"]}},"roi":{"in":"query","name":"roi","required":false,"schema":{"type":"string","minLength":1},"description":"Name of ROI for which plot is requested"},"image_id":{"in":"query","name":"id","required":false,"schema":{"type":"integer","format":"int64","default":-1,"minimum":-2},"description":"Image ID in the image buffer. Special values: -1 - last image in the buffer, -2: last indexed image in the buffer"},"saturation":{"in":"query","name":"saturation","required":false,"schema":{"type":"number","format":"float","minimum":-32767,"maximum":32767},"description":"Saturation value to set contrast in the preview image; if not provided, then autocontrast procedure is used"},"background":{"in":"query","name":"background","required":false,"schema":{"type":"number","format":"float","default":0,"minimum":-32767,"maximum":32767},"description":"Background value to set contrast in the preview image"},"show_spots":{"in":"query","name":"show_spots","schema":{"type":"boolean","default":true},"description":"Show spot finding results on the image"},"show_predictions":{"in":"query","name":"show_predictions","schema":Line truncated
var container = document.getElementById('redoc');
Redoc.hydrate(__redoc_state, container);
+1 -1
View File
@@ -330,7 +330,7 @@ Every scalar of the image message is optional: a quantity that was not computed
| placed_model | object (optional) | Atomic model placed against the data, written as `<file_prefix>_model.cif` and `<file_prefix>_model.pdb`. `name` (string), `unit_cell` (object, as above), `space_group_name` (the data's, gemmi extended H-M), `model_space_group_name` (the coordinates'), then one array per atom: `model_number`, `seq_num`, `charge` (int32), `chain`, `residue_name`, `atom_name`, `element` (Array(string)), `icode` (uint8, space where none), `het_flag` (uint8, `A`, `H` or 0 where unknown), `altloc` (uint8, 0 where none), `x`, `y`, `z` (double, Angstrom), `b_iso`, `occupancy` (float), `aniso` (float, 6 per atom: U11 U22 U33 U12 U13 U23; empty where no atom has one), `subchain`, `entity_id` (Array(string), mmCIF label_asym_id / label_entity_id), `label_seq` (int32, label_seq_id, INT32_MIN where none) - these three optional; `metadata_mmcif` (gzipped string, optional, see [Notes on gzipped text](#notes-on-gzipped-text)): the input model's metadata (entities, sequences, references, authors, software, secondary structure) as mmCIF categories without coordinates, parsed by the writer with gemmi | |
| refined_model | object (optional) | The placed model after refinement, written as `<file_prefix>_refined_model.cif` and `<file_prefix>_refined_model.pdb`; same layout as `placed_model` | |
| refined_map_coefficients | object (optional) | Map coefficients of the refined model, written as `<file_prefix>_refined_maps.mtz`. An MTZ table (layout below) | |
| blobs | object (optional) | Unexplained blobs of the refined model's mFo-DFc map, strongest first, written as `<file_prefix>_blobs.json`. One array per field, one entry per blob: `kind` (Array(string): `WATER`, `ION`, `LIGAND`, `MODEL_ERROR`, `UNASSIGNED`), `x`, `y`, `z` (double, centroid, Angstrom), `peak_sigma` (double, map rms), `volume` (double, Angstrom^3), `score` (double, sigma Angstrom^3), `nearest_atom` (Array(string)), `nearest_atom_distance` (double, Angstrom), `polar_contacts`, `metal_contacts` (int32), `anomalous_sigma` (double, 0 where there is no anomalous map) | |
| blobs | object (optional) | Unexplained blobs of the refined model's mFo-DFc map, strongest first, written as `<file_prefix>_blobs.json`. One array per field, one entry per blob: `kind` (Array(string): `WATER`, `ION`, `LIGAND`, `MODEL_ERROR`, `UNASSIGNED`), `x`, `y`, `z` (double, centroid, Angstrom), `peak_sigma` (double, map rms), `volume` (double, Angstrom^3), `score` (double, sigma Angstrom^3), `nearest_atom` (Array(string)), `nearest_atom_distance` (double, Angstrom), `polar_contacts`, `metal_contacts` (int32), `anomalous_sigma` (double, the anomalous difference map's peak height within 1 Angstrom of the blob's peak in its rms, NaN where there is no anomalous map) | |
| report | gzipped string (optional) | The in-broker analysis run's results report, written as `<file_prefix>_report.txt`: the text `rugnux` writes as its own `_report.txt` (see [RUGNUX_REPORT](RUGNUX_REPORT.md)) | |
End-message vector fields are optional. When present, they provide master-file summary data so readers can inspect scan-level and per-image analysis results without opening every linked data file. Missing optional per-image values are encoded by the producer as zero unless otherwise noted.
+7 -2
View File
@@ -450,7 +450,11 @@ The $mF_o - DF_c$ map of the refined model is searched for what the model leaves
regions above 3 σ that peak above 4 σ, found by flood fill (GEMMI's `find_blobs_by_flood_fill`, the method
of Coot's "unmodelled blobs"), each moved to the copy nearest the model and measured - peak, volume, the
density integrated above the cutoff, the nearest atom, the polar (N, O) atoms at 2.4-3.4 Å and the N, O or S
at 1.8-2.6 Å, and the anomalous map at its peak. Each gets one reading, by rules on what is measured:
at 1.8-2.6 Å, and the anomalous difference map's peak height at it: the map's highest point within 1 Å of the
blob's peak, in its rms. The two maps are sampled on different grids and the anomalous scatterer need not be the
difference density's highest point, so the reading looks a little around the peak; 1 Å, half the shortest
metal-ligand bond, keeps a neighbouring modelled sulfur or metal from being read as the blob's own. Each gets one
reading, by rules on what is measured:
| Reading | Rule |
|---|---|
@@ -461,7 +465,8 @@ at 1.8-2.6 Å, and the anomalous map at its peak. Each gets one reading, by rule
| `UNASSIGNED` | anything else |
They are listed strongest first (by the integrated density) in `<prefix>_blobs.json`, and the five strongest
in the report, each with the anomalous difference map's height at its peak where there is that map. A blob
in the report, each with its anomalous peak height where the data carry anomalous signal (the SUMMARY's Anomalous
row; without it the reading is noise, and the report and the live page leave it out). A blob
read as `LIGAND` is density of ligand size where the model has nothing: a buffer molecule or an unmodelled side
chain is that as well as the compound that was soaked. The readings point a
person at the density; they do not identify a compound.
+3 -1
View File
@@ -295,7 +295,9 @@ and before the end message - seconds on a GPU, minutes on a broker without one.
cut while it runs cuts it short with what its finished weight trials found (`model.refinement.cancelled`). The refined model and its maps stay with the broker: the
writer writes the placed model, as without refinement. `GET /rugnux/status` gives the refined R-work and
R-free, the bond and angle rmsd, the time it took and the unexplained blobs of the refined difference map
(`model.refinement`), and `/rugnux/model.cif` and `/rugnux/map.ccp4` serve the refined model and its maps
(`model.refinement`; each with the anomalous difference map's peak height at it, `anomalous_sigma`, where the merge
kept the Bijvoet pairs - a reading of the blob only where `anomalous_signal` is set, and the page shows it only
then), and `/rugnux/model.cif` and `/rugnux/map.ccp4` serve the refined model and its maps
(`stage=placed` for the model as placed; the anomalous map is always on the placed model's phases).
`GET /rugnux/status` reports the live run of the last collection, kept until the next one starts or
+6 -3
View File
@@ -1593,11 +1593,14 @@ Where a model was placed and refined ([Refinement](RUGNUX_MODEL_AND_REFERENCE.md
| `REFINE_SOLVENT_BUILD_SECONDS` | The build's time: its maps, audits and refinements of the solvent (REFINE_SECONDS includes it too) |
A prose paragraph after the blob keys lists the five strongest blobs with their reading, peak, volume, position,
nearest atom and, where the merge kept the Bijvoet pairs, the anomalous difference map's height at the peak (in its
rms: an ion that scatters anomalously stands out there, a water does not); all of them are in `<prefix>_blobs.json`, strongest first, one object per blob: `kind`,
nearest atom and, where the SUMMARY's Anomalous row says "signal present", the anomalous difference map's peak height
at the blob (`anomalous peak ... sigma`: its highest point within 1 Å of the blob's peak, in its rms - a heavier atom
that scatters anomalously, a metal or a halide, stands out there, a water does not; without anomalous signal the
reading is noise and is left out); all of them are in `<prefix>_blobs.json`, strongest first, one object per blob: `kind`,
`centroid` (Å, Cartesian, the copy nearest the model), `peak_sigma`, `volume_A3`, `score_sigma_A3` (the
density above the cutoff integrated), `nearest_atom`, `nearest_atom_distance_A`, `polar_contacts`,
`metal_contacts` and `anomalous_sigma`.
`metal_contacts` and `anomalous_sigma` (that peak height, written whatever the signal; `null` where the merge kept no
Bijvoet pairs).
A second paragraph, after the solvent keys, lists the ions, label → best-supported species, their N and O in the bands
1.9-2.3/2.3-2.6/2.6-3.2 Å and their neighbours closer than 3.4 Å. Every site is in `<prefix>_solvent.json`,
@@ -14,6 +14,7 @@ Name | Type | Description | Notes
**volume_a3** | **float** | Volume above 3 sigma, in cubic Angstrom |
**nearest_atom** | **str** | e.g. \&quot;OG1 THR A42\&quot; |
**nearest_atom_distance_a** | **float** | Absent where no atom is within 12 Angstrom | [optional]
**anomalous_sigma** | **float** | The anomalous difference map&#39;s peak height within 1 Angstrom of the blob&#39;s peak, in the map&#39;s sigma. Absent where there is no anomalous map (&#x60;anomalous_map&#x60;); a measure of the blob only where the data carry anomalous signal (&#x60;anomalous_signal&#x60;), noise otherwise. | [optional]
## Example
+7
View File
@@ -2290,6 +2290,13 @@ export type rugnux_live_blob = {
* Absent where no atom is within 12 Angstrom
*/
nearest_atom_distance_A?: number;
/**
* 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.
*
*/
anomalous_sigma?: number;
};
/**
+2 -1
View File
@@ -920,7 +920,8 @@ export const zRugnuxLiveBlob = z.object({
peak_sigma: z.number(),
volume_A3: z.number(),
nearest_atom: z.string(),
nearest_atom_distance_A: z.number().optional()
nearest_atom_distance_A: z.number().optional(),
anomalous_sigma: z.number().optional()
});
/**
+2 -1
View File
@@ -19,7 +19,7 @@ import RugnuxShellPlots from "./RugnuxShellPlots";
import RugnuxProgress from "./RugnuxProgress";
import RugnuxImage from "./RugnuxImage";
import RugnuxCollectionPlots from "./RugnuxCollectionPlots";
import {lastImageTime, ModelScores, StepTable, VerdictAlert} from "./RugnuxParts";
import {BlobTable, lastImageTime, ModelScores, StepTable, VerdictAlert} from "./RugnuxParts";
import BoltIcon from "@mui/icons-material/Bolt";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import ClearAllIcon from "@mui/icons-material/ClearAll";
@@ -356,6 +356,7 @@ function Details({s, deadline_s}: { s: rugnux_live_status, deadline_s: number })
<RugnuxTimeline s={s} deadline_s={deadline_s}/>
{s.stills && <RugnuxStills st={s.stills}/>}
{s.model && <ModelScores m={s.model} mrSeconds={mrSeconds} anomalousSignal={s.anomalous_signal}/>}
{s.model?.refinement && <BlobTable blobs={s.model.refinement.blobs} anomalousSignal={s.anomalous_signal}/>}
<Box sx={{display: "grid", gridTemplateColumns: {xs: "1fr", lg: "1fr 1fr"}, gap: 3, alignItems: "start"}}>
<StepTable steps={s.steps}/>
<Stack spacing={2}>
+40 -2
View File
@@ -1,7 +1,7 @@
import {Alert, AlertTitle, Box, Chip, Paper, Table, TableBody, TableCell, TableContainer, TableRow, Typography} from "@mui/material";
import {Alert, AlertTitle, Box, Chip, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Typography} from "@mui/material";
import {indigo, lime, deepOrange, grey} from "@mui/material/colors";
import {alpha, SxProps, Theme} from "@mui/material/styles";
import {rugnux_live_model, rugnux_live_status, rugnux_live_step} from "../client";
import {rugnux_live_blob, rugnux_live_model, rugnux_live_status, rugnux_live_step} from "../client";
// Pieces of the rugnux live status shared by the dashboard card and the Rugnux page.
@@ -189,3 +189,41 @@ export function ModelScores({m, mrSeconds, anomalousSignal}:
</Box>
);
}
const BLOB_KIND: Record<rugnux_live_blob["kind"], string> = {
ION: "ion", WATER: "water", LIGAND: "ligand", MODEL_ERROR: "model error", UNASSIGNED: "unassigned"};
// The refined model's unexplained blobs, strongest first. The anomalous map's peak at each is shown only where the
// data carry anomalous signal: without it, it is noise.
export function BlobTable({blobs, anomalousSignal}: { blobs: rugnux_live_blob[], anomalousSignal: boolean }) {
if (blobs.length === 0)
return null;
const anomalous = anomalousSignal && blobs.some(b => b.anomalous_sigma != null);
return (
<TableContainer component={Paper} variant="outlined" sx={{maxHeight: 400}}>
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
<TableCell>Blob</TableCell>
<TableCell align="right">peak σ</TableCell>
<TableCell align="right">volume ų</TableCell>
<TableCell>nearest atom</TableCell>
{anomalous && <TableCell align="right">anom σ</TableCell>}
</TableRow>
</TableHead>
<TableBody>
{blobs.map((b, i) => (
<TableRow key={i}>
<TableCell>{i + 1}. {BLOB_KIND[b.kind]}</TableCell>
<TableCell align="right">{b.peak_sigma.toFixed(1)}</TableCell>
<TableCell align="right">{b.volume_A3.toFixed(1)}</TableCell>
<TableCell>{b.nearest_atom_distance_A != null
? `${b.nearest_atom} ${b.nearest_atom_distance_A.toFixed(1)} Å` : ""}</TableCell>
{anomalous && <TableCell align="right">{b.anomalous_sigma?.toFixed(1)}</TableCell>}
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
}
@@ -36,10 +36,12 @@ const TWOFOFC_ALPHA = {model: 0.35, peak: 0.5};
const KIND_WORD: Record<rugnux_live_blob['kind'], string> = {
ION: 'ion', WATER: 'water', LIGAND: 'ligand', MODEL_ERROR: 'model error', UNASSIGNED: 'unassigned'};
// ["peak 1/20 · 23.4 σ", "ion · NE2 HIS A19 1.9 Å"]
function peakLabel(p: rugnux_live_blob, i: number, n: number): [string, string] {
// ["peak 1/20 · 23.4 σ · anom 12.1 σ", "ion · NE2 HIS A19 1.9 Å"]; the anomalous peak only where the data carry
// anomalous signal
function peakLabel(p: rugnux_live_blob, i: number, n: number, anomalousSignal: boolean): [string, string] {
const near = p.nearest_atom_distance_A != null ? `${p.nearest_atom} ${p.nearest_atom_distance_A.toFixed(1)} Å` : '';
return [`peak ${i + 1}/${n} · ${p.peak_sigma.toFixed(1)} σ`, [KIND_WORD[p.kind], near].filter(Boolean).join(' · ')];
const anom = anomalousSignal && p.anomalous_sigma != null ? ` · anom ${p.anomalous_sigma.toFixed(1)} σ` : '';
return [`peak ${i + 1}/${n} · ${p.peak_sigma.toFixed(1)} σ${anom}`, [KIND_WORD[p.kind], near].filter(Boolean).join(' · ')];
}
const hex = (c: number) => '#' + c.toString(16).padStart(6, '0');
@@ -249,7 +251,7 @@ function RugnuxStructureViewer({resultKey, anomalous, anomalousSignal, fill, pea
const busy = modelLoading || mapsLoading;
const [label, detail] = peak === null
? [`${n} Fo−Fc peak${n === 1 ? '' : 's'}`, `highest ${sorted[0]?.peak_sigma.toFixed(1)} σ`]
: peakLabel(sorted[peak], peak, n);
: peakLabel(sorted[peak], peak, n, anomalousSignal);
const arrow = {color: '#c9d3e6', '&.Mui-disabled': {color: 'rgba(154,165,196,.3)'}};
return (
@@ -24,6 +24,29 @@ constexpr double ION_ANOMALOUS_SIGMA = 4.0;
// The smallest blob called ligand-like, A^3, and at low resolution one and a half of the resolution's spheres: at
// high resolution a strong single atom's blob already spans several of them.
constexpr double LIGAND_MIN_VOLUME = 8.0;
// How far from the difference map's peak the anomalous map's peak is looked for, A. The two maps are on different
// grids (each sampled at a third of its resolution, up to ~0.7 A apart at 2 A) and the anomalous scatterer need
// not be the difference density's highest point, so a reading at the peak alone can miss it; half the shortest
// metal-ligand bond (~2.0 A) keeps a neighbouring modelled sulfur or metal from being read as the blob's own.
constexpr double ANOMALOUS_PEAK_RADIUS = 1.0;
// The anomalous map's highest point within ANOMALOUS_PEAK_RADIUS of p, in its rms.
double AnomalousPeak(const gemmi::Grid<float> &anomalous, double rms, const gemmi::Position &p) {
double peak = anomalous.interpolate_value(p);
const gemmi::Fractional f = anomalous.unit_cell.fractionalize(p);
const int u0 = static_cast<int>(std::round(f.x * anomalous.nu));
const int v0 = static_cast<int>(std::round(f.y * anomalous.nv));
const int w0 = static_cast<int>(std::round(f.z * anomalous.nw));
const int du = static_cast<int>(std::ceil(ANOMALOUS_PEAK_RADIUS / anomalous.spacing[0]));
const int dv = static_cast<int>(std::ceil(ANOMALOUS_PEAK_RADIUS / anomalous.spacing[1]));
const int dw = static_cast<int>(std::ceil(ANOMALOUS_PEAK_RADIUS / anomalous.spacing[2]));
for (int u = u0 - du; u <= u0 + du; u++)
for (int v = v0 - dv; v <= v0 + dv; v++)
for (int w = w0 - dw; w <= w0 + dw; w++)
if (anomalous.get_position(u, v, w).dist(p) <= ANOMALOUS_PEAK_RADIUS)
peak = std::max(peak, static_cast<double>(anomalous.get_value(u, v, w)));
return peak / rms;
}
bool Polar(const gemmi::Element &el) {
return el == gemmi::El::N || el == gemmi::El::O;
@@ -117,7 +140,7 @@ std::vector<DensityBlob> FindDensityBlobs(const gemmi::Grid<float> &difference,
d.metal_contacts++;
});
if (anomalous != nullptr && anomalous_rms > 0)
d.anomalous_sigma = anomalous->interpolate_value(b.peak_pos) / anomalous_rms;
d.anomalous_sigma = AnomalousPeak(*anomalous, anomalous_rms, b.peak_pos);
if (d.nearest_atom_distance < MODEL_ERROR_DISTANCE)
d.kind = DensityBlob::Kind::ModelError;
@@ -3,6 +3,7 @@
#pragma once
#include <cmath>
#include <string>
#include <vector>
@@ -29,7 +30,8 @@ struct DensityBlob {
std::string nearest_atom; // e.g. "OG1 THR A42"
int polar_contacts = 0; // N or O of the model at 2.4-3.4 A
int metal_contacts = 0; // N, O or S of the model at 1.8-2.6 A
double anomalous_sigma = 0; // the anomalous difference map at the peak, 0 where there is none
// The anomalous difference map's peak height within 1 A of the blob's peak, in its rms; NaN where there is none
double anomalous_sigma = NAN;
};
const char *DensityBlobKindName(DensityBlob::Kind kind);
+2 -1
View File
@@ -384,8 +384,9 @@ std::optional<RugnuxLiveModel> LiveModel(const ProcessResult &result) {
for (size_t i = 0; i < std::min(rf.blobs.size(), RugnuxLiveRefinement::MAX_BLOBS); i++) {
const DensityBlob &b = rf.blobs[i];
RugnuxLiveBlob blob{DensityBlobKindName(b.kind), b.centroid.x, b.centroid.y, b.centroid.z, b.peak_sigma,
b.volume, b.nearest_atom, std::nullopt};
b.volume, b.nearest_atom, std::nullopt, std::nullopt};
SetIfFinite(blob.nearest_atom_distance_A, b.nearest_atom_distance); // infinite: no atom near
SetIfFinite(blob.anomalous_sigma, b.anomalous_sigma); // NaN: no anomalous map
r.blobs.push_back(blob);
}
m.refinement = std::move(r);
+3
View File
@@ -39,6 +39,9 @@ struct RugnuxLiveBlob {
double volume_A3 = 0;
std::string nearest_atom;
std::optional<double> nearest_atom_distance_A; // unset where no atom is within reach
// The anomalous difference map's peak height at the blob, in its rms; unset where there is no anomalous map.
// Signal only where the data carry anomalous signal (RugnuxLiveSnapshot::anomalous_signal).
std::optional<double> anomalous_sigma;
};
// The placed model refined (ProcessResult::refinement), in the numbers of the report's REFINE_ keys.
+62 -53
View File
@@ -698,9 +698,63 @@ namespace {
}
}
// The SUMMARY's Anomalous row, its verdict first ("signal present", "weak signal" or "no usable signal"); empty where
// the merge has no anomalous split.
std::string AnomalousRow(const ProcessResult &result) {
const auto &o = result.merge_statistics.overall;
if (!std::isfinite(o.cc_anom) && !std::isfinite(o.abs_diff_over_sigma_anomalous))
return "";
// The lowest shell's SigAno: the anomalous signal lives where I/sigma is highest, and
// the overall value averages it away with the outer shells' noise floor.
double sigano_low = NAN;
for (const auto &sh : result.merge_statistics.shells)
if (std::isfinite(sh.abs_diff_over_sigma_anomalous)) {
sigano_low = sh.abs_diff_over_sigma_anomalous;
break;
}
std::string stats;
if (std::isfinite(sigano_low))
stats += fmt::format("SigAno {:.2f} in the lowest shell (0.80 = none)", sigano_low);
if (std::isfinite(o.cc_anom))
stats += fmt::format("{}CC_anom {:.2f} over {} pairs", stats.empty() ? "" : ", ", o.cc_anom,
o.cc_anom_pairs);
if (std::isfinite(o.anomalous_measurability))
stats += fmt::format(", measurability {:.2f}", o.anomalous_measurability);
// With a placed model the anomalous difference map at it decides, in both directions:
// it pools every Bijvoet pair coherently, so it reads a signal the per-reflection
// statistics cannot, and it reads nothing where a systematic Friedel difference gave
// them a value. Its strongest reading: the mean over the scatterers (many weak sulfurs),
// the highest site at any atom (a water that is an ion), or a peak off the model.
// A model that was tried and rejected has a map too, but it is the negative result:
// the row reads as a run without the model writes it.
const auto *mv = result.model_validation ? &*result.model_validation : nullptr;
const char *verdict;
if (mv && result.ModelPlaced() && mv->anomalous_scatterers > 0) {
double peak = -INFINITY;
std::string at;
for (const auto &site : mv->anomalous_sites)
if (site.sigma > peak) { peak = site.sigma; at = site.label; }
for (const auto &p : mv->anomalous_unexplained)
if (p.sigma > peak) { peak = p.sigma; at = fmt::format("a peak {:.1f} A from {}", p.nearest_atom_distance, p.nearest_atom); }
const double mean = mv->anomalous_scatterer_mean_sigma;
verdict = mean >= ANOM_MAP_MEAN_SIGNAL || peak >= ANOM_MAP_PEAK_SIGNAL ? "signal present"
: mean >= ANOM_MAP_MEAN_WEAK || peak >= ANOM_MAP_PEAK_WEAK ? "weak signal"
: "no usable signal";
return fmt::format("{}: the model-phased anomalous map reads {:.1f} sigma over the "
"model's {} anomalous scatterers, {:.1f} at most ({}); {}",
verdict, mean, mv->anomalous_scatterers, peak, at, stats);
} else {
verdict = sigano_low >= ANOM_SIGANO_SIGNAL ? "signal present"
: sigano_low >= ANOM_SIGANO_WEAK ? "weak signal" : "no usable signal";
return fmt::format("{} ({}; no model to read an anomalous map at)", verdict, stats);
}
}
// The refinement's keys (Refinement.h): REFINE_ of the refinement of a placed model and of --mode refine, with every term of the
// score of the refined model under REFINE_SCORE_.
void AddRefinementKeys(ReportSection &s, const RefinementResult &rf, const std::string &output_prefix) {
// score of the refined model under REFINE_SCORE_. anomalous_signal: the SUMMARY's Anomalous row says the data
// carry usable anomalous signal, so the blobs list the anomalous map's peak at each; without it that is noise.
void AddRefinementKeys(ReportSection &s, const RefinementResult &rf, const std::string &output_prefix,
bool anomalous_signal) {
Add(s, Blank());
if (!rf.ok) {
Add(s, KeyEnum("REFINE", "NOT_PERFORMED", {"PERFORMED", "NOT_PERFORMED"}));
@@ -802,9 +856,8 @@ namespace {
top += fmt::format("\n {:<11} peak {:5.1f} sigma, {:6.1f} A^3, at {:7.2f} {:7.2f} {:7.2f}, {:.1f} A from {}",
DensityBlobKindName(b.kind), b.peak_sigma, b.volume, b.centroid.x, b.centroid.y,
b.centroid.z, b.nearest_atom_distance, b.nearest_atom);
// the anomalous difference map at its peak, where the merge kept the Bijvoet pairs
if (rf.anomalous_map)
top += fmt::format(", anomalous {:.1f} sigma", b.anomalous_sigma);
if (anomalous_signal && std::isfinite(b.anomalous_sigma))
top += fmt::format(", anomalous peak {:.1f} sigma", b.anomalous_sigma);
}
Add(s, Prose(fmt::format(
" The placed model was refined against these data: each chain as a rigid body and\n"
@@ -3652,7 +3705,7 @@ ReportDocument BuildReportDocument(const std::string &output_prefix,
// The placed model refined (Refinement.h; always, where a model is placed). Keys of their own: R_WORK / R_FREE above stay the
// unrefined model's.
if (result.refinement.has_value())
AddRefinementKeys(s, *result.refinement, output_prefix);
AddRefinementKeys(s, *result.refinement, output_prefix, AnomalousRow(result).starts_with("signal present"));
doc.sections.push_back(std::move(s));
}
@@ -3869,52 +3922,8 @@ ReportDocument BuildReportDocument(const std::string &output_prefix,
}
}
row("Signal", sig);
if (std::isfinite(o.cc_anom) || std::isfinite(o.abs_diff_over_sigma_anomalous)) {
// The lowest shell's SigAno: the anomalous signal lives where I/sigma is highest, and
// the overall value averages it away with the outer shells' noise floor.
double sigano_low = NAN;
for (const auto &sh : result.merge_statistics.shells)
if (std::isfinite(sh.abs_diff_over_sigma_anomalous)) {
sigano_low = sh.abs_diff_over_sigma_anomalous;
break;
}
std::string stats;
if (std::isfinite(sigano_low))
stats += fmt::format("SigAno {:.2f} in the lowest shell (0.80 = none)", sigano_low);
if (std::isfinite(o.cc_anom))
stats += fmt::format("{}CC_anom {:.2f} over {} pairs", stats.empty() ? "" : ", ", o.cc_anom,
o.cc_anom_pairs);
if (std::isfinite(o.anomalous_measurability))
stats += fmt::format(", measurability {:.2f}", o.anomalous_measurability);
// With a placed model the anomalous difference map at it decides, in both directions:
// it pools every Bijvoet pair coherently, so it reads a signal the per-reflection
// statistics cannot, and it reads nothing where a systematic Friedel difference gave
// them a value. Its strongest reading: the mean over the scatterers (many weak sulfurs),
// the highest site at any atom (a water that is an ion), or a peak off the model.
// A model that was tried and rejected has a map too, but it is the negative result:
// the row reads as a run without the model writes it.
const auto *mv = result.model_validation ? &*result.model_validation : nullptr;
const char *verdict;
if (mv && result.ModelPlaced() && mv->anomalous_scatterers > 0) {
double peak = -INFINITY;
std::string at;
for (const auto &site : mv->anomalous_sites)
if (site.sigma > peak) { peak = site.sigma; at = site.label; }
for (const auto &p : mv->anomalous_unexplained)
if (p.sigma > peak) { peak = p.sigma; at = fmt::format("a peak {:.1f} A from {}", p.nearest_atom_distance, p.nearest_atom); }
const double mean = mv->anomalous_scatterer_mean_sigma;
verdict = mean >= ANOM_MAP_MEAN_SIGNAL || peak >= ANOM_MAP_PEAK_SIGNAL ? "signal present"
: mean >= ANOM_MAP_MEAN_WEAK || peak >= ANOM_MAP_PEAK_WEAK ? "weak signal"
: "no usable signal";
row("Anomalous", fmt::format("{}: the model-phased anomalous map reads {:.1f} sigma over the "
"model's {} anomalous scatterers, {:.1f} at most ({}); {}",
verdict, mean, mv->anomalous_scatterers, peak, at, stats));
} else {
verdict = sigano_low >= ANOM_SIGANO_SIGNAL ? "signal present"
: sigano_low >= ANOM_SIGANO_WEAK ? "weak signal" : "no usable signal";
row("Anomalous", fmt::format("{} ({}; no model to read an anomalous map at)", verdict, stats));
}
}
if (const std::string anomalous = AnomalousRow(result); !anomalous.empty())
row("Anomalous", anomalous);
const auto &an = result.merge_statistics.anisotropy;
if (an.n_reflections == 0)
untested("Anisotropy", {PathologyCode::ANISOTROPY});
@@ -4098,7 +4107,7 @@ ReportDocument BuildRefineReportDocument(const std::string &output_prefix, const
}
if (r.d_min_limit > 0)
Add(s, KeyReal("REFINE_D_MIN_LIMIT", r.d_min_limit, "{:.3f}"));
AddRefinementKeys(s, rf, output_prefix);
AddRefinementKeys(s, rf, output_prefix, false); // no merge to judge an anomalous signal on
doc.sections.push_back(std::move(s));
doc.verdict = rf.ok ? "OK" : "FAILED";
if (!rf.ok)
+31
View File
@@ -73,3 +73,34 @@ TEST_CASE("FindDensityBlobs_SymmetryMatesOnce", "[DensityBlobs]") {
}
CHECK(found_twice > 0);
}
// The anomalous reading of a blob is the anomalous map's peak near the difference map's: an anomalous scatterer
// 0.7 A from the difference peak (the two maps on grids of their own, or the scatterer not the highest point of the
// blob) is read at its own height, not at the lower value its tail has at the difference peak. No map: no reading.
TEST_CASE("FindDensityBlobs_AnomalousPeakNearTheBlob", "[DensityBlobs]") {
const gemmi::UnitCell cell(60, 60, 70, 90, 90, 120);
const gemmi::SpaceGroup *sg = gemmi::find_spacegroup_by_name("P 32 2 1");
REQUIRE(sg != nullptr);
std::mt19937 rng(2);
const gemmi::Fractional f(0.31, 0.22, 0.13);
const gemmi::Position p = cell.orthogonalize(f);
const gemmi::Fractional g = cell.fractionalize(p + gemmi::Position(0.7, 0, 0));
const gemmi::Grid<float> difference = PeakMap(cell, sg, f, rng);
const gemmi::Grid<float> anomalous = PeakMap(cell, sg, g, rng);
const std::string pdb = fmt::format(
"CRYST1 60.000 60.000 70.000 90.00 90.00 120.00 P 32 2 1\n"
"HETATM 1 O HOH A 1 {:8.3f}{:8.3f}{:8.3f} 1.00 20.00 O\nEND\n",
p.x + 3.0, p.y, p.z);
const gemmi::Structure st = gemmi::read_pdb_string(pdb, "one water");
const std::vector<DensityBlob> without = FindDensityBlobs(difference, 1.0, st, 2.0);
REQUIRE(without.size() == 1);
CHECK(std::isnan(without[0].anomalous_sigma));
const std::vector<DensityBlob> with = FindDensityBlobs(difference, 1.0, st, 2.0, &anomalous, 1.0);
REQUIRE(with.size() == 1);
CHECK(anomalous.interpolate_value(p) < 8.5); // the Gaussian's tail at the difference peak: 10 exp(-0.245)
CHECK(with[0].anomalous_sigma > 9.0); // its own height, 10, sampled on the grid
CHECK(with[0].anomalous_sigma < 10.5);
CHECK(with[0].kind == DensityBlob::Kind::Ion);
}
+80
View File
@@ -13,10 +13,13 @@
#include <set>
#include <vector>
#include <gemmi/it92.hpp>
#include <gemmi/mmread_gz.hpp>
#include <gemmi/neighbor.hpp>
#include <gemmi/modify.hpp>
#include <gemmi/sfcalc.hpp>
#include <gemmi/symmetry.hpp>
#include <spdlog/fmt/fmt.h>
#include "../common/CUDAWrapper.h"
#include "../common/Logger.h"
@@ -1485,6 +1488,83 @@ TEST_CASE("Refinement_ion_form_factors", "[Refinement]") {
}
}
// A model missing one anomalous scatterer, a zinc, and one water: the zinc's blob in the difference map reads a strong
// peak in the anomalous difference map (|F+| - |F-| on the model's phases less 90 degrees), the water's none.
TEST_CASE("Refinement_blob_anomalous_peak", "[Refinement]") {
const gemmi::UnitCell cell(30, 32, 34, 90, 90, 90);
const gemmi::SpaceGroup &sg = *gemmi::find_spacegroup_by_name("P 21 21 21");
gemmi::Structure truth = residue_crystal({"TRP", "LYS", "ARG", "TYR"}, cell, "P 21 21 21", 5);
const gemmi::Structure start = truth;
// a site 4 A from every atom and every symmetry mate, the new atom's own among them
std::mt19937 rng(6);
std::uniform_real_distribution<double> frac(0.0, 1.0);
auto add_free_site = [&](const char *name, gemmi::El el) {
for (;;) {
const gemmi::Position p = cell.orthogonalize(gemmi::Fractional(frac(rng), frac(rng), frac(rng)));
gemmi::NeighborSearch ns(truth.models[0], truth.cell, 5.0);
ns.populate();
if (ns.find_nearest_atom(p, 4.0) != nullptr ||
truth.cell.find_nearest_image(p, p, gemmi::Asu::Different).dist_sq < 16.0)
continue;
gemmi::Residue res;
res.name = name;
res.seqid = gemmi::SeqId(static_cast<int>(truth.models[0].chains[0].residues.size()) + 1, ' ');
res.het_flag = 'H';
gemmi::Atom a;
a.name = name;
a.element = el;
a.pos = p;
a.b_iso = 20.0f;
a.occ = 1.0f;
res.atoms.push_back(a);
truth.models[0].chains[0].residues.push_back(res);
return a;
}
};
const gemmi::Atom zn = add_free_site("ZN", gemmi::El::Zn);
const gemmi::Atom water = add_free_site("O", gemmi::El::O);
// F(h) of the truth with the zinc's f'' (3 e) added, i f'' times its structure factor, and F(-h)
std::vector<MergedReflection> merged = asu_reflections(cell, sg, 2.0);
gemmi::UnitCell images = cell;
images.set_cell_images_from_spacegroup(&sg);
gemmi::StructureFactorCalculator<gemmi::IT92<double>> calc(images);
for (MergedReflection &r : merged) {
const gemmi::Miller h{{r.h, r.k, r.l}};
const std::complex<double> f = calc.calculate_sf_from_model(truth.models[0], h);
const std::complex<double> fpp = calc.calculate_sf_from_atom_sf(images.fractionalize(zn.pos), zn, h, 3.0);
const std::complex<double> i(0, 1);
r.F_plus = static_cast<float>(std::abs(f + i * fpp));
r.F_minus = static_cast<float>(std::abs(std::conj(f) + i * std::conj(fpp)));
r.F = 0.5f * (r.F_plus + r.F_minus);
r.sigmaF = 0.05f;
}
Logger logger("Refinement_blob_anomalous_peak");
RefinementSettings settings;
settings.score_only = true;
settings.nthreads = 4;
settings.gpu = false;
const RefinementResult r = RefineModel(start, merged, cell, sg, 1.0, logger, settings);
REQUIRE(r.ok);
REQUIRE(r.anomalous_map);
const DensityBlob *at_zn = nullptr, *at_water = nullptr;
for (const DensityBlob &b : r.blobs) {
const double to_zn = images.find_nearest_image(zn.pos, b.centroid, gemmi::Asu::Any).dist();
const double to_water = images.find_nearest_image(water.pos, b.centroid, gemmi::Asu::Any).dist();
if (to_zn < 1.0 && at_zn == nullptr)
at_zn = &b;
if (to_water < 1.0 && at_water == nullptr)
at_water = &b;
}
REQUIRE(at_zn != nullptr);
REQUIRE(at_water != nullptr);
INFO(fmt::format("zinc: anomalous {:.1f} sigma, water: {:.1f} sigma", at_zn->anomalous_sigma, at_water->anomalous_sigma));
CHECK(at_zn->anomalous_sigma > 8.0);
CHECK(at_zn->kind == DensityBlob::Kind::Ion);
CHECK(std::abs(at_water->anomalous_sigma) < 3.0);
}
// Two copies of one RNA chain in the asymmetric unit, the second turned and moved, a fragment of it and the chain in
// another conformation: the two found as copies of one molecule, the fragment and the other conformation not, held
// to each other by local distance restraints whose gradient is right on the CPU and the GPU, and let go where the
+18
View File
@@ -1691,4 +1691,22 @@ TEST_CASE("ResultReport_AnomalousRow", "[Diagnostics]") {
row = anomalous_row(result);
CHECK(row.find("signal present") == 0);
CHECK(row.find("26.6 at most (a peak 3.2 A from O HOH A2019)") != std::string::npos);
// The refined model's blobs carry the anomalous map's peak at each while the row says signal present, and not
// without the signal, where it is noise.
RefinementResult rf;
rf.ok = true;
DensityBlob b;
b.kind = DensityBlob::Kind::Ion;
b.peak_sigma = 12.0;
b.nearest_atom = "SG CYS A14";
b.nearest_atom_distance = 2.3;
b.anomalous_sigma = 21.4;
rf.blobs = {b};
result.refinement = rf;
const auto report = [&] { return RenderReportText(BuildReportDocument("p", "in.h5", x, result), false); };
CHECK(report().find("anomalous peak 21.4 sigma") != std::string::npos);
result.model_validation->anomalous_unexplained.clear();
CHECK(anomalous_row(result).find("no usable signal") == 0);
CHECK(report().find("anomalous peak") == std::string::npos);
}
+5 -1
View File
@@ -229,6 +229,7 @@ TEST_CASE("RugnuxLiveModel_Refinement", "[RugnuxLive]") {
b.volume = 40.0;
b.nearest_atom = "OG1 THR A42";
b.nearest_atom_distance = 3.1;
b.anomalous_sigma = 2.5;
rf.blobs.assign(RugnuxLiveRefinement::MAX_BLOBS + 5, b);
r.refinement = rf;
@@ -240,6 +241,7 @@ TEST_CASE("RugnuxLiveModel_Refinement", "[RugnuxLive]") {
CHECK(lr.rmsd_bonds_A.value() == Catch::Approx(0.011));
CHECK(lr.blob_count == static_cast<int64_t>(RugnuxLiveRefinement::MAX_BLOBS + 5));
CHECK(lr.blobs.size() == RugnuxLiveRefinement::MAX_BLOBS);
CHECK(lr.blobs[0].anomalous_sigma.value() == Catch::Approx(2.5));
// the placed model's R-factors are untouched
CHECK(m->r_free.value() == Catch::Approx(0.40));
@@ -320,7 +322,7 @@ TEST_CASE("RugnuxLiveModel_NonFiniteScores", "[RugnuxLive]") {
rf.r_free = 0.25;
rf.geometry.rmsd_bonds = NAN;
DensityBlob b;
b.nearest_atom_distance = INFINITY;
b.nearest_atom_distance = INFINITY; // and no anomalous map: anomalous_sigma NaN
rf.blobs = {b};
r.refinement = rf;
@@ -335,6 +337,7 @@ TEST_CASE("RugnuxLiveModel_NonFiniteScores", "[RugnuxLive]") {
CHECK(m->refinement->r_free.value() == Catch::Approx(0.25));
CHECK(!m->refinement->rmsd_bonds_A);
CHECK(!m->refinement->blobs.at(0).nearest_atom_distance_A);
CHECK(!m->refinement->blobs.at(0).anomalous_sigma);
RugnuxLiveStatus status;
status.Start(10, 1.0, std::chrono::steady_clock::now());
@@ -345,6 +348,7 @@ TEST_CASE("RugnuxLiveModel_NonFiniteScores", "[RugnuxLive]") {
CHECK(!j["model"].contains("r_free"));
CHECK(!j["model"]["refinement"].contains("r_work"));
CHECK(!j["model"]["refinement"]["blobs"][0].contains("nearest_atom_distance_A"));
CHECK(!j["model"]["refinement"]["blobs"][0].contains("anomalous_sigma"));
CHECK(j.dump().find("null") == std::string::npos);
}