Merge rc187-live-fe (base layout): unit cell and merge results early, simpler shell plots, clean title line, steady time axis
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
commit
2ae487eca5
22 files changed
+339
-166
No files matched your search
@@ -1322,6 +1322,8 @@ org::openapitools::server::model::Rugnux_live_status Convert(const RugnuxLiveSna
|
||||
ret.setSpaceGroup(input.space_group);
|
||||
if (input.d_min)
|
||||
ret.setDMin(input.d_min.value());
|
||||
if (input.resolution_fit)
|
||||
ret.setResolutionFit(input.resolution_fit.value());
|
||||
if (input.isa)
|
||||
ret.setIsa(input.isa.value());
|
||||
if (input.stills) {
|
||||
|
||||
@@ -38,6 +38,8 @@ Rugnux_live_status::Rugnux_live_status()
|
||||
m_Space_groupIsSet = false;
|
||||
m_D_min = 0.0;
|
||||
m_D_minIsSet = false;
|
||||
m_Resolution_fit = 0.0;
|
||||
m_Resolution_fitIsSet = false;
|
||||
m_Isa = 0.0;
|
||||
m_IsaIsSet = false;
|
||||
m_Probe = "";
|
||||
@@ -149,7 +151,7 @@ bool Rugnux_live_status::validate(std::stringstream& msg, const std::string& pat
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (stepProgressIsSet())
|
||||
{
|
||||
const float& value = m_Step_progress;
|
||||
@@ -304,6 +306,9 @@ bool Rugnux_live_status::operator==(const Rugnux_live_status& rhs) const
|
||||
((!dMinIsSet() && !rhs.dMinIsSet()) || (dMinIsSet() && rhs.dMinIsSet() && getDMin() == rhs.getDMin())) &&
|
||||
|
||||
|
||||
((!resolutionFitIsSet() && !rhs.resolutionFitIsSet()) || (resolutionFitIsSet() && rhs.resolutionFitIsSet() && getResolutionFit() == rhs.getResolutionFit())) &&
|
||||
|
||||
|
||||
((!isaIsSet() && !rhs.isaIsSet()) || (isaIsSet() && rhs.isaIsSet() && getIsa() == rhs.getIsa())) &&
|
||||
|
||||
(getProbe() == rhs.getProbe())
|
||||
@@ -397,6 +402,8 @@ void to_json(nlohmann::json& j, const Rugnux_live_status& o)
|
||||
j["space_group"] = o.m_Space_group;
|
||||
if(o.dMinIsSet())
|
||||
j["d_min"] = o.m_D_min;
|
||||
if(o.resolutionFitIsSet())
|
||||
j["resolution_fit"] = o.m_Resolution_fit;
|
||||
if(o.isaIsSet())
|
||||
j["isa"] = o.m_Isa;
|
||||
j["probe"] = o.m_Probe;
|
||||
@@ -482,6 +489,11 @@ void from_json(const nlohmann::json& j, Rugnux_live_status& o)
|
||||
j.at("d_min").get_to(o.m_D_min);
|
||||
o.m_D_minIsSet = true;
|
||||
}
|
||||
if(j.find("resolution_fit") != j.end())
|
||||
{
|
||||
j.at("resolution_fit").get_to(o.m_Resolution_fit);
|
||||
o.m_Resolution_fitIsSet = true;
|
||||
}
|
||||
if(j.find("isa") != j.end())
|
||||
{
|
||||
j.at("isa").get_to(o.m_Isa);
|
||||
@@ -738,6 +750,23 @@ void Rugnux_live_status::unsetD_min()
|
||||
{
|
||||
m_D_minIsSet = false;
|
||||
}
|
||||
double Rugnux_live_status::getResolutionFit() const
|
||||
{
|
||||
return m_Resolution_fit;
|
||||
}
|
||||
void Rugnux_live_status::setResolutionFit(double const value)
|
||||
{
|
||||
m_Resolution_fit = value;
|
||||
m_Resolution_fitIsSet = true;
|
||||
}
|
||||
bool Rugnux_live_status::resolutionFitIsSet() const
|
||||
{
|
||||
return m_Resolution_fitIsSet;
|
||||
}
|
||||
void Rugnux_live_status::unsetResolution_fit()
|
||||
{
|
||||
m_Resolution_fitIsSet = false;
|
||||
}
|
||||
double Rugnux_live_status::getIsa() const
|
||||
{
|
||||
return m_Isa;
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
bool shellsMergeIsSet() const;
|
||||
void unsetShells_merge();
|
||||
/// <summary>
|
||||
/// Merging statistics by resolution shell of the latest merge, coarse to fine, as the shell table of `_report.txt`. Rotation: once the run is over; serial: at each provisional merge and at the end. `overall` is the same table's \"Overall\" row (whole-merge completeness, multiplicity, I/sigma, CC1/2, R_meas or R_split, CCref, and the R-free of the final model - refined where rugnux refined it, as `model.refinement.r_free`, else as placed, as `model.r_free`), present with `shells`.
|
||||
/// Merging statistics by resolution shell of the latest merge, coarse to fine, as the shell table of `_report.txt`. Rotation: once the collection is scaled and merged (before the model work), again at the end; serial: at each provisional merge and at the end. `overall` is the same table's \"Overall\" row (whole-merge completeness, multiplicity, I/sigma, CC1/2, R_meas or R_split, CCref, and the R-free of the final model - refined where rugnux refined it, as `model.refinement.r_free`, else as placed, as `model.r_free`), present with `shells`.
|
||||
/// </summary>
|
||||
std::vector<org::openapitools::server::model::Rugnux_live_shell> getShells() const;
|
||||
void setShells(std::vector<org::openapitools::server::model::Rugnux_live_shell> const& value);
|
||||
@@ -141,21 +141,28 @@ public:
|
||||
bool frameRangesIsSet() const;
|
||||
void unsetFrame_ranges();
|
||||
/// <summary>
|
||||
/// Space group of the result (the summary's \"Space group\" row); absent until the run is over
|
||||
/// Space group of the result (the summary's \"Space group\" row); absent until the collection is scaled and merged
|
||||
/// </summary>
|
||||
std::string getSpaceGroup() const;
|
||||
void setSpaceGroup(std::string const& value);
|
||||
bool spaceGroupIsSet() const;
|
||||
void unsetSpace_group();
|
||||
/// <summary>
|
||||
/// High-resolution limit of the merge, in Angstrom; absent until the run is over, or without a merge
|
||||
/// High-resolution limit of the merge, in Angstrom; absent until the collection is scaled and merged, or without a merge
|
||||
/// </summary>
|
||||
double getDMin() const;
|
||||
void setDMin(double const value);
|
||||
bool dMinIsSet() const;
|
||||
void unsetD_min();
|
||||
/// <summary>
|
||||
/// ISa of the error model; absent until the run is over, or where it was not determined
|
||||
/// Where the CC1/2 fall-off is fitted, in Angstrom: the resolution to quote. The written range (`d_min`) deliberately reaches one shell beyond it. Absent without a fit (a serial merge's `d_min` is the fit itself).
|
||||
/// </summary>
|
||||
double getResolutionFit() const;
|
||||
void setResolutionFit(double const value);
|
||||
bool resolutionFitIsSet() const;
|
||||
void unsetResolution_fit();
|
||||
/// <summary>
|
||||
/// ISa of the error model; absent until the collection is scaled and merged, or where it was not determined
|
||||
/// </summary>
|
||||
double getIsa() const;
|
||||
void setIsa(double const value);
|
||||
@@ -306,6 +313,8 @@ protected:
|
||||
bool m_Space_groupIsSet;
|
||||
double m_D_min;
|
||||
bool m_D_minIsSet;
|
||||
double m_Resolution_fit;
|
||||
bool m_Resolution_fitIsSet;
|
||||
double m_Isa;
|
||||
bool m_IsaIsSet;
|
||||
std::string m_Probe;
|
||||
|
||||
+11
-4
@@ -3344,7 +3344,8 @@ components:
|
||||
type: array
|
||||
description: |
|
||||
Merging statistics by resolution shell of the latest merge, coarse to fine, as the shell table of
|
||||
`_report.txt`. Rotation: once the run is over; serial: at each provisional merge and at the end.
|
||||
`_report.txt`. Rotation: once the collection is scaled and merged (before the model work), again at
|
||||
the end; serial: at each provisional merge and at the end.
|
||||
`overall` is the same table's "Overall" row (whole-merge completeness, multiplicity, I/sigma, CC1/2,
|
||||
R_meas or R_split, CCref, and the R-free of the final model - refined where rugnux refined it, as
|
||||
`model.refinement.r_free`, else as placed, as `model.r_free`), present with `shells`.
|
||||
@@ -3371,15 +3372,21 @@ components:
|
||||
$ref: '#/components/schemas/rugnux_live_frame_range'
|
||||
space_group:
|
||||
type: string
|
||||
description: Space group of the result (the summary's "Space group" row); absent until the run is over
|
||||
description: Space group of the result (the summary's "Space group" row); absent until the collection is scaled and merged
|
||||
d_min:
|
||||
type: number
|
||||
format: double
|
||||
description: High-resolution limit of the merge, in Angstrom; absent until the run is over, or without a merge
|
||||
description: High-resolution limit of the merge, in Angstrom; absent until the collection is scaled and merged, or without a merge
|
||||
resolution_fit:
|
||||
type: number
|
||||
format: double
|
||||
description: |
|
||||
Where the CC1/2 fall-off is fitted, in Angstrom: the resolution to quote. The written range (`d_min`)
|
||||
deliberately reaches one shell beyond it. Absent without a fit (a serial merge's `d_min` is the fit itself).
|
||||
isa:
|
||||
type: number
|
||||
format: double
|
||||
description: ISa of the error model; absent until the run is over, or where it was not determined
|
||||
description: ISa of the error model; absent until the collection is scaled and merged, 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, and the run's own lattice once the run has indexed
|
||||
|
||||
@@ -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">"Idle"</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">"string"</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">"string"</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">"string"</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">"string"</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">"string"</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">"Idle"</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">"string"</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">"string"</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">"string"</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">"string"</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">"string"</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'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);
|
||||
|
||||
@@ -306,8 +306,10 @@ found, and once it is over the verdict, the summary, warnings and the time from
|
||||
every result written. `shells` carries the merging statistics by resolution shell - the rows of the shell
|
||||
table of `<file_prefix>_report.txt`, on the same shells: multiplicity, ⟨I/σ⟩, completeness, CC1/2, R_meas
|
||||
(rotation), R_split (serial), CCref (with reference data) and the R-free of the placed model as given (with a
|
||||
model), each absent where the run does not measure it - and `shells_merge` the merge they are of. A rotation
|
||||
run fills them when it is over; a serial one at each provisional merge and at the end, the R-free once the model
|
||||
model), each absent where the run does not measure it - and `shells_merge` the merge they are of. With them come
|
||||
the merge's `d_min`, the written range, and `resolution_fit`, where the CC1/2 fall-off is fitted: the resolution to
|
||||
quote, which the written range deliberately reaches a shell beyond (the page marks the fit on its shell plots).
|
||||
A rotation run fills them at the scaling checkpoint, before the model work; a serial one at each provisional merge and at the end, the R-free once the model
|
||||
step on that same merge has its result. A rotation run also leaves `frame_scales`, the per-image scale factor of
|
||||
the merge, and `frame_ranges`, the stretches of the sweep the merge downgraded or rejected (the report's SWEEP
|
||||
section) with the reason it saw there - which frames rugnux left out, and why. The web frontend shows it on the
|
||||
|
||||
@@ -17,7 +17,7 @@ Name | Type | Description | Notes
|
||||
**cc_half** | **float** | CC1/2 of the shell table | [optional]
|
||||
**cc_ref** | **float** | CC against the reference data, where reference data were given | [optional]
|
||||
**r_split** | **float** | Serial data only, with every frame whole in one half-set | [optional]
|
||||
**r_free** | **float** | R-free of the placed model (as given, not refined) over the shell's free reflections | [optional]
|
||||
**r_free** | **float** | R-free of the placed model (as given, not refined) over the shell's free reflections. In `overall`, the R-free of the model the run ended with: the refined model's (`model.refinement.r_free`) where rugnux refined it, else the placed model's (`model.r_free`). | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@@ -14,13 +14,14 @@ Name | Type | Description | Notes
|
||||
**model** | [**RugnuxLiveModel**](RugnuxLiveModel.md) | | [optional]
|
||||
**stills** | [**RugnuxLiveStills**](RugnuxLiveStills.md) | | [optional]
|
||||
**shells_merge** | **str** | Which merge `shells` are of - \"the collection\", or on serial data a provisional merge such as \"50% of the images (provisional)\"; absent until there is a merge | [optional]
|
||||
**shells** | [**List[RugnuxLiveShell]**](RugnuxLiveShell.md) | Merging statistics by resolution shell of the latest merge, coarse to fine, as the shell table of `_report.txt`. Rotation: once the run is over; serial: at each provisional merge and at the end. `overall` is the same table's \"Overall\" row (whole-merge completeness, multiplicity, I/sigma, CC1/2, R_meas or R_split, CCref, and the overall R-free of the model validated on it), present with `shells`. | [optional]
|
||||
**shells** | [**List[RugnuxLiveShell]**](RugnuxLiveShell.md) | Merging statistics by resolution shell of the latest merge, coarse to fine, as the shell table of `_report.txt`. Rotation: once the collection is scaled and merged (before the model work), again at the end; serial: at each provisional merge and at the end. `overall` is the same table's \"Overall\" row (whole-merge completeness, multiplicity, I/sigma, CC1/2, R_meas or R_split, CCref, and the R-free of the final model - refined where rugnux refined it, as `model.refinement.r_free`, else as placed, as `model.r_free`), present with `shells`. | [optional]
|
||||
**overall** | [**RugnuxLiveShell**](RugnuxLiveShell.md) | | [optional]
|
||||
**frame_scales** | **List[float]** | Rotation, once the run is over: the per-image scale factor of the merge, one entry per image of the collection in its order, 0 where the image got none (not indexed, or rejected). Absent on serial data and until there is a merge. | [optional]
|
||||
**frame_ranges** | [**List[RugnuxLiveFrameRange]**](RugnuxLiveFrameRange.md) | Rotation, once the run is over: the stretches of the sweep the merge downgraded or rejected, in order; every image outside them is merged at its own weight. Absent on serial data and until there is a merge; empty where the whole sweep was merged. | [optional]
|
||||
**space_group** | **str** | Space group of the result (the summary's \"Space group\" row); absent until the run is over | [optional]
|
||||
**d_min** | **float** | High-resolution limit of the merge, in Angstrom; absent until the run is over, or without a merge | [optional]
|
||||
**isa** | **float** | ISa of the error model; absent until the run is over, or where it was not determined | [optional]
|
||||
**space_group** | **str** | Space group of the result (the summary's \"Space group\" row); absent until the collection is scaled and merged | [optional]
|
||||
**d_min** | **float** | High-resolution limit of the merge, in Angstrom; absent until the collection is scaled and merged, or without a merge | [optional]
|
||||
**resolution_fit** | **float** | Where the CC1/2 fall-off is fitted, in Angstrom: the resolution to quote. The written range (`d_min`) deliberately reaches one shell beyond it. Absent without a fit (a serial merge's `d_min` is the fit itself). | [optional]
|
||||
**isa** | **float** | ISa of the error model; absent until the collection is scaled and merged, or where it was not determined | [optional]
|
||||
**probe** | **str** | 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** | **float** | When the probe answered (or the run indexed), since the first image | [optional]
|
||||
**start_to_first_image_s** | **float** | From the START message to the first image; set once the first image arrives | [optional]
|
||||
|
||||
@@ -205,7 +205,8 @@ function App() {
|
||||
<DataCollection frame_time_us={s.detector_settings?.frame_time_us ?? 500}/>
|
||||
)},
|
||||
{ id: 'rugnux', label: 'Rugnux live', icon: <AutoGraphIcon/>, wide: true, render: () => (
|
||||
<RugnuxPage measuring={isMeasuring || s.broker?.state === 'Busy'}/>
|
||||
<RugnuxPage measuring={isMeasuring || s.broker?.state === 'Busy'} name={s.measurement?.file_prefix}
|
||||
givenCell={s.measurement?.unit_cell}/>
|
||||
)},
|
||||
]},
|
||||
{ subheader: 'Expert', items: [
|
||||
|
||||
@@ -2459,7 +2459,8 @@ export type rugnux_live_status = {
|
||||
shells_merge?: string;
|
||||
/**
|
||||
* Merging statistics by resolution shell of the latest merge, coarse to fine, as the shell table of
|
||||
* `_report.txt`. Rotation: once the run is over; serial: at each provisional merge and at the end.
|
||||
* `_report.txt`. Rotation: once the collection is scaled and merged (before the model work), again at
|
||||
* the end; serial: at each provisional merge and at the end.
|
||||
* `overall` is the same table's "Overall" row (whole-merge completeness, multiplicity, I/sigma, CC1/2,
|
||||
* R_meas or R_split, CCref, and the R-free of the final model - refined where rugnux refined it, as
|
||||
* `model.refinement.r_free`, else as placed, as `model.r_free`), present with `shells`.
|
||||
@@ -2482,15 +2483,21 @@ export type rugnux_live_status = {
|
||||
*/
|
||||
frame_ranges?: Array<rugnux_live_frame_range>;
|
||||
/**
|
||||
* Space group of the result (the summary's "Space group" row); absent until the run is over
|
||||
* Space group of the result (the summary's "Space group" row); absent until the collection is scaled and merged
|
||||
*/
|
||||
space_group?: string;
|
||||
/**
|
||||
* High-resolution limit of the merge, in Angstrom; absent until the run is over, or without a merge
|
||||
* High-resolution limit of the merge, in Angstrom; absent until the collection is scaled and merged, or without a merge
|
||||
*/
|
||||
d_min?: number;
|
||||
/**
|
||||
* ISa of the error model; absent until the run is over, or where it was not determined
|
||||
* Where the CC1/2 fall-off is fitted, in Angstrom: the resolution to quote. The written range (`d_min`)
|
||||
* deliberately reaches one shell beyond it. Absent without a fit (a serial merge's `d_min` is the fit itself).
|
||||
*
|
||||
*/
|
||||
resolution_fit?: number;
|
||||
/**
|
||||
* ISa of the error model; absent until the collection is scaled and merged, or where it was not determined
|
||||
*/
|
||||
isa?: number;
|
||||
/**
|
||||
|
||||
@@ -1068,6 +1068,7 @@ export const zRugnuxLiveStatus = z.object({
|
||||
frame_ranges: z.array(zRugnuxLiveFrameRange).optional(),
|
||||
space_group: z.string().optional(),
|
||||
d_min: z.number().optional(),
|
||||
resolution_fit: z.number().optional(),
|
||||
isa: z.number().optional(),
|
||||
probe: z.string(),
|
||||
probe_s: z.number().optional(),
|
||||
|
||||
@@ -3,8 +3,9 @@ import {keyframes} from "@mui/system";
|
||||
import {rugnux_live_status} from "../client";
|
||||
|
||||
// The headline of a rugnux live run as big numbers with one-word captions, in the order a crystallographer
|
||||
// reads a merge: how far, how clean, how complete, in what symmetry, and whether the model fits. "—" until
|
||||
// the merge the numbers are of exists (the end of a rotation run, each provisional merge of a serial one).
|
||||
// reads a merge: how far, how clean, how complete, in what symmetry and cell, and whether the model fits. "—" until
|
||||
// the merge the numbers are of exists (the scaling of a rotation run, each provisional merge of a serial one);
|
||||
// the unit cell comes earlier, with the lattice probe.
|
||||
// Everything explanatory is in the tooltips.
|
||||
|
||||
const fadeIn = keyframes`
|
||||
@@ -71,6 +72,7 @@ function overallStatistics(s: rugnux_live_status) {
|
||||
const pct = (x: number | undefined) => x === undefined ? undefined : 100 * x;
|
||||
return {
|
||||
d_min: o?.d_min ?? s.d_min,
|
||||
fit: s.resolution_fit,
|
||||
cc_half: o?.cc_half ?? summaryNumber(s, /^signal/i, /CC1\/2\s+([\d.]+)/),
|
||||
i_over_sigma: o?.i_over_sigma ?? summaryNumber(s, /^signal/i, /I\/sigma\s+([\d.]+)/),
|
||||
completeness: pct(o?.completeness) ?? summaryNumber(s, /^completeness/i, /([\d.]+)\s*%/),
|
||||
@@ -84,6 +86,42 @@ const FIT_TIP = "Fit over random: how far the placed model's R-work stands below
|
||||
+ "in random orientations, in standard deviations of those. It is the test rugnux places a model by. "
|
||||
+ "Green: rugnux placed the model; red: it did not.";
|
||||
|
||||
// The unit cell as soon as there is one: the merge's (the summary's Unit cell row), else the lattice the run indexed,
|
||||
// else the probe's on the first degrees - each a status line with the six numbers in it - else the one the
|
||||
// collection was started with (a serial run's, which has no probe).
|
||||
function unitCell(s: rugnux_live_status, givenCell?: string) {
|
||||
const six = (text?: string) => text?.match(/\d+(\.\d+)?([,\s]+\d+(\.\d+)?){5}/)?.[0].split(/[,\s]+/).map(parseFloat);
|
||||
const merged = six(s.summary.find(r => /^unit cell/i.test(r.label))?.value);
|
||||
if (merged)
|
||||
return {cell: merged, stage: "", source: "Unit cell of the merge."};
|
||||
const probe = six(s.probe);
|
||||
if (probe)
|
||||
return s.probe.startsWith("lattice on the sweep")
|
||||
? {cell: probe, stage: " · indexed", source: "Unit cell of the lattice the run indexed; the merge's follows with scaling."}
|
||||
: {cell: probe, stage: " · probe", source: "Unit cell of the early lattice probe on the first degrees of the sweep: "
|
||||
+ "the reduced cell, preliminary."};
|
||||
const given = six(givenCell);
|
||||
if (given)
|
||||
return {cell: given, stage: " · given", source: "Unit cell the collection was started with."};
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function CellTile({s, givenCell}: { s: rugnux_live_status, givenCell?: string }) {
|
||||
const c = unitCell(s, givenCell);
|
||||
if (!c) {
|
||||
if (s.probe.startsWith("no lattice"))
|
||||
return <Tile value="none" caption="Unit cell" tone="bad" tip={s.probe}/>;
|
||||
return <Tile value="—" caption="Unit cell" tone="pending" tip="Comes with the lattice probe on the first degrees of the sweep."/>;
|
||||
}
|
||||
const len = (x: number) => x.toFixed(1);
|
||||
const ang = (x: number) => Number.isInteger(Math.round(x * 10) / 10) ? x.toFixed(0) : x.toFixed(1);
|
||||
return <Tile caption={`Unit cell${c.stage}`} tone="plain" tip={<>{s.probe && <>{s.probe}<br/><br/></>}{c.source}</>}
|
||||
value={<>
|
||||
<Box sx={{fontSize: "0.75em"}}>{c.cell.slice(0, 3).map(len).join(" ")}</Box>
|
||||
<Box sx={{fontSize: "0.55em", fontWeight: 600, color: "text.secondary"}}>{c.cell.slice(3).map(ang).join(" ")} °</Box>
|
||||
</>}/>;
|
||||
}
|
||||
|
||||
// The model tile: green where rugnux placed the model, red where it did not, plain where there was none.
|
||||
// Once refined, the refined R-free is the number. modelLoaded: a model is uploaded now.
|
||||
function ModelTile({s, modelLoaded}: { s: rugnux_live_status, modelLoaded: boolean }) {
|
||||
@@ -120,7 +158,9 @@ function ModelTile({s, modelLoaded}: { s: rugnux_live_status, modelLoaded: boole
|
||||
|
||||
// column: the tiles as a rail, top to bottom, sharing the rail's height (two or three to a row on a phone,
|
||||
// where the rail is the width of the screen)
|
||||
function RugnuxHero({s, modelLoaded, column}: { s: rugnux_live_status, modelLoaded: boolean, column?: boolean }) {
|
||||
// givenCell: the unit cell the collection was started with, if any
|
||||
function RugnuxHero({s, modelLoaded, givenCell, column}:
|
||||
{ s: rugnux_live_status, modelLoaded: boolean, givenCell?: string, column?: boolean }) {
|
||||
// the numbers are of a merge that exists: rotation - the run is over; serial - a provisional merge is in
|
||||
const merged = s.d_min !== undefined || (s.shells !== undefined && s.shells.length > 0);
|
||||
const pending: Tone = merged ? "plain" : "pending";
|
||||
@@ -136,9 +176,11 @@ function RugnuxHero({s, modelLoaded, column}: { s: rugnux_live_status, modelLoad
|
||||
<Box sx={{display: "grid", gap: 1, minHeight: 0, ...(column
|
||||
? {gridTemplateColumns: {xs: "repeat(2, minmax(0, 1fr))", sm: "repeat(3, minmax(0, 1fr))", md: "1fr"}, gridAutoRows: {md: "minmax(0, 1fr)"}, flexGrow: 1,
|
||||
"& > *": {display: "flex", flexDirection: "column", justifyContent: "center"}}
|
||||
: {gridTemplateColumns: {xs: "repeat(3, minmax(0, 1fr))", md: "repeat(9, minmax(0, 1fr))"}})}}>
|
||||
<Tile value={num(o.d_min, x => `${x.toFixed(2)} Å`)} caption="Resolution" tone={pending}
|
||||
tip="High-resolution limit of the merge (d_min)."/>
|
||||
: {gridTemplateColumns: {xs: "repeat(3, minmax(0, 1fr))", md: "repeat(10, minmax(0, 1fr))"}})}}>
|
||||
<Tile value={num(o.fit ?? o.d_min, x => `${x.toFixed(2)} Å`)} caption="Resolution" tone={pending}
|
||||
tip={o.fit !== undefined
|
||||
? `Where the CC½ fall-off is fitted: the resolution to quote. The reflections are written to ${o.d_min?.toFixed(2)} Å, a shell beyond, on purpose.`
|
||||
: "High-resolution limit of the merge (d_min)."}/>
|
||||
<Tile value={num(o.cc_half, x => x.toFixed(3))} caption="CC½" tone={pending}
|
||||
tip="CC½ of the whole merge; by shell in the plot."/>
|
||||
<Tile value={num(o.i_over_sigma, x => x.toFixed(1))} caption="I/σ" tone={pending}
|
||||
@@ -158,8 +200,9 @@ function RugnuxHero({s, modelLoaded, column}: { s: rugnux_live_status, modelLoad
|
||||
: <Tile value={num(s.isa, x => x.toFixed(1))} caption="ISa" tone={pending}
|
||||
tip="ISa: the I/σ the strongest reflections level off at, from the error model (XDS's meaning). It measures the crystal and the instrument, not the exposure."/>}
|
||||
<Tile value={s.space_group ? <SpaceGroup hm={s.space_group}/> : "—"} caption="Space group" tone={s.space_group ? "plain" : pending}
|
||||
tip={<>{s.space_group ?? "Determined from the data when the run is over"}{cell && <>, unit cell {cell}</>}
|
||||
tip={<>{s.space_group ?? "Determined from the data when the collection is scaled"}{cell && <>, unit cell {cell}</>}
|
||||
{mrGroup && s.space_group && mrGroup !== s.space_group && <>. The model was placed in {mrGroup}</>}</>}/>
|
||||
<CellTile s={s} givenCell={givenCell}/>
|
||||
<ModelTile s={s} modelLoaded={modelLoaded}/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -7,10 +7,12 @@ import {authHeaders, noteResponse} from "../auth";
|
||||
// The diffraction image the broker is on, as a square window of the live page: the last image of the buffer
|
||||
// (or the last indexed one), with its spots, the beam centre and the resolution estimate drawn by the broker
|
||||
// (`/image_buffer/image.jpeg`), fetched every two seconds while images come in. Wheel to zoom, drag to pan,
|
||||
// nothing else on screen but three pills: which image, spots on or off, predictions on or off. White with
|
||||
// indigo by day, black with white by night.
|
||||
// nothing else on screen but three pills: which image, spots on or off, predictions on or off - shown only where
|
||||
// the images carry them (overlays: a serial run's images after the pre-pass; a rotation run's images are
|
||||
// analysed inside rugnux's passes, so the buffer's copies never get spots, predictions or the indexed mark).
|
||||
// White with indigo by day, black with white by night.
|
||||
|
||||
type Props = { measuring: boolean };
|
||||
type Props = { measuring: boolean, overlays: boolean };
|
||||
|
||||
const POLL_MS = 2000;
|
||||
|
||||
@@ -28,7 +30,7 @@ function Pill({on, label, tip, onClick}: { on: boolean, label: string, tip: stri
|
||||
);
|
||||
}
|
||||
|
||||
function RugnuxImage({measuring}: Props) {
|
||||
function RugnuxImage({measuring, overlays}: Props) {
|
||||
const dark = useTheme().palette.mode === "dark";
|
||||
const [indexed, setIndexed] = useState(false);
|
||||
const [spots, setSpots] = useState(true);
|
||||
@@ -37,7 +39,7 @@ function RugnuxImage({measuring}: Props) {
|
||||
const [missing, setMissing] = useState(false);
|
||||
const urlRef = useRef<string | undefined>(undefined);
|
||||
|
||||
const query = `id=${indexed ? -2 : -1}&show_spots=${spots}&show_predictions=${predictions}&show_beam_center=true`
|
||||
const query = `id=${overlays && indexed ? -2 : -1}&show_spots=${overlays && spots}&show_predictions=${overlays && predictions}&show_beam_center=true`
|
||||
+ `&show_res_est=true&jpeg_quality=85&color=${dark ? color_scale.WB : color_scale.INDIGO}`;
|
||||
|
||||
// One fetch per change of the query, then every POLL_MS while measuring; the object URL of the image on
|
||||
@@ -79,12 +81,12 @@ function RugnuxImage({measuring}: Props) {
|
||||
</TransformWrapper>
|
||||
: <Typography sx={{position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center",
|
||||
color: "text.disabled"}}>no image</Typography>}
|
||||
<Box sx={{position: "absolute", left: 8, bottom: 8, display: "flex", gap: 0.5}}>
|
||||
{overlays && <Box sx={{position: "absolute", left: 8, bottom: 8, display: "flex", gap: 0.5}}>
|
||||
<Pill on={indexed} label={indexed ? "indexed" : "last"} onClick={() => setIndexed(i => !i)}
|
||||
tip={indexed ? "The last image that indexed; click for the last image" : "The last image; click for the last that indexed"}/>
|
||||
<Pill on={spots} label="spots" onClick={() => setSpots(s => !s)} tip="The spots found on the image"/>
|
||||
<Pill on={predictions} label="pred" onClick={() => setPredictions(p => !p)} tip="Where the lattice predicts reflections"/>
|
||||
</Box>
|
||||
</Box>}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Alert, Box, Button, Collapse, Paper, Stack, Typography, useMediaQuery, useTheme} from "@mui/material";
|
||||
import {Alert, Box, Button, Collapse, Paper, Stack, Tooltip, Typography, useMediaQuery, useTheme} from "@mui/material";
|
||||
import {keyframes} from "@mui/system";
|
||||
import {useQuery, useQueryClient} from "@tanstack/react-query";
|
||||
import {
|
||||
@@ -53,7 +53,7 @@ function phase(s: rugnux_live_status, pal: LivePalette): { label: string, colour
|
||||
? {label: "Collecting", colour: pal.collecting} : {label: "Processing", colour: pal.processing};
|
||||
if (s.state === "Done")
|
||||
return s.verdict === "OK" || !s.verdict ? {label: "Done", colour: pal.ok}
|
||||
: s.verdict === "WARNINGS" ? {label: "Done · warnings", colour: pal.attention}
|
||||
: s.verdict === "WARNINGS" ? {label: "Done", colour: pal.attention}
|
||||
: {label: `Done · ${s.verdict.toLowerCase()}`, colour: pal.serious};
|
||||
if (s.state === "Failed")
|
||||
return {label: "Failed", colour: pal.serious};
|
||||
@@ -70,7 +70,7 @@ function ClearButton() {
|
||||
<>
|
||||
<Button size="small" variant="outlined" color="inherit" startIcon={<ClearAllIcon/>}
|
||||
disabled={clear.pending} onClick={() => clear.submit(undefined)}
|
||||
sx={{ml: "auto", flexShrink: 0, alignSelf: "center", color: "text.secondary"}}>
|
||||
sx={{ml: "auto !important", flexShrink: 0, height: 30, color: "text.secondary"}}>
|
||||
Clear
|
||||
</Button>
|
||||
<UploadSnackbarView snackbar={clear.snackbar}/>
|
||||
@@ -78,9 +78,12 @@ function ClearButton() {
|
||||
);
|
||||
}
|
||||
|
||||
// Phase, the progress block and the clock: the number the run is judged by - seconds since the first image
|
||||
// while it runs, from the last image to all results written once it is over.
|
||||
function Header({s, deadline_s, measuring, pal}: { s: rugnux_live_status, deadline_s: number, measuring: boolean, pal: LivePalette }) {
|
||||
// Phase, the dataset, the progress block and the clock: the number the run is judged by - seconds since the first
|
||||
// image while it runs, from the last image to all results written once it is over. The line of the phase keeps
|
||||
// its height whatever comes on it (the Clear button), so nothing under it moves at the end. What the run found
|
||||
// wrong is not here: the checks on the side say it.
|
||||
function Header({s, name, deadline_s, measuring, pal}:
|
||||
{ s: rugnux_live_status, name?: string, deadline_s: number, measuring: boolean, pal: LivePalette }) {
|
||||
const p = phase(s, pal);
|
||||
const running = s.state === "Running";
|
||||
const lastImage = lastImageTime(s);
|
||||
@@ -95,14 +98,17 @@ function Header({s, deadline_s, measuring, pal}: { s: rugnux_live_status, deadli
|
||||
return (
|
||||
<Box sx={{display: "grid", gridTemplateColumns: {xs: "1fr", md: "minmax(0, 1fr) auto"}, gap: 4, alignItems: "center"}}>
|
||||
<Box sx={{minWidth: 0}}>
|
||||
<Stack direction="row" spacing={2} alignItems="baseline" sx={{minWidth: 0, mb: 1.5}}>
|
||||
<Stack direction="row" spacing={2} alignItems="center" sx={{minWidth: 0, height: 32, mb: 1.5}}>
|
||||
<Typography sx={{fontSize: "1.5rem", fontWeight: 900, letterSpacing: ".08em", textTransform: "uppercase",
|
||||
color: p.colour, whiteSpace: "nowrap", lineHeight: 1, ...(running && {animation: `${pulse} 2.4s ease-in-out infinite`,
|
||||
"@media (prefers-reduced-motion: reduce)": {animation: "none"}})}}>
|
||||
{p.label}
|
||||
</Typography>
|
||||
{s.state === "Failed" && s.message &&
|
||||
<Typography noWrap sx={{color: "text.secondary", minWidth: 0}}>{s.message}</Typography>}
|
||||
{name && <Tooltip arrow title={`File prefix: ${name}`}>
|
||||
<Typography noWrap sx={{fontSize: "1.25rem", fontWeight: 700, minWidth: 0, flexShrink: 0, maxWidth: "40%"}}>
|
||||
{name.split("/").pop()}
|
||||
</Typography>
|
||||
</Tooltip>}
|
||||
{!running && !measuring && <ClearButton/>}
|
||||
</Stack>
|
||||
<RugnuxProgress s={s} deadline_s={deadline_s}/>
|
||||
@@ -124,8 +130,8 @@ function Later({text}: { text: string }) {
|
||||
return <Typography sx={{color: "text.disabled", m: "auto", textAlign: "center", px: 2}}>{text}</Typography>;
|
||||
}
|
||||
|
||||
// The step rugnux is on, large with its progress, filling the centre until there is a model to show; the
|
||||
// steps behind it are on the strip under the bars.
|
||||
// The step rugnux is on, large with its progress and what it has noted so far, filling the centre until there
|
||||
// is a model to show; the steps behind it are on the strip under the bars.
|
||||
function RunConsole({s, pal}: { s: rugnux_live_status, pal: LivePalette }) {
|
||||
const running = s.state === "Running";
|
||||
const current = running && s.steps.length > 0 && s.steps[s.steps.length - 1].duration_s === undefined
|
||||
@@ -134,11 +140,11 @@ function RunConsole({s, pal}: { s: rugnux_live_status, pal: LivePalette }) {
|
||||
return <Later text={running ? "waiting for images" : s.state === "Failed" ? "failed" : "no model"}/>;
|
||||
return (
|
||||
<Box sx={{py: 2}}>
|
||||
<Typography sx={{...LABEL_SX, color: pal.processing}}>now</Typography>
|
||||
<Typography sx={{fontSize: "2rem", fontWeight: 800, lineHeight: 1.1, animation: `${pulse} 2.4s ease-in-out infinite`,
|
||||
"@media (prefers-reduced-motion: reduce)": {animation: "none"}}}>
|
||||
{current.title}{s.step_progress !== undefined && <Box component="span" sx={{color: pal.processing, ml: 2}}>{(100 * s.step_progress).toFixed(0)} %</Box>}
|
||||
</Typography>
|
||||
{current.notes.map((note, i) => <Typography key={i} sx={{color: "text.secondary", mt: i === 0 ? 1.5 : 0.5}}>{note}</Typography>)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -153,11 +159,13 @@ function Division({label, children, sx}: { label?: React.ReactNode, children: Re
|
||||
);
|
||||
}
|
||||
|
||||
// The model shows once a rotation run is over; serial data place it on each provisional merge
|
||||
const modelShown = (s: rugnux_live_status) => s.model !== undefined && s.placed_model && (s.state !== "Running" || s.stills !== undefined);
|
||||
|
||||
function Centre({s, pal}: { s: rugnux_live_status, pal: LivePalette }) {
|
||||
const m = s.model;
|
||||
// The model shows once a rotation run is over; serial data place it on each provisional merge, and the viewer
|
||||
// reloads when the model step has a new result, not every time the status is polled.
|
||||
if (m && s.placed_model && (s.state !== "Running" || s.stills)) {
|
||||
// The viewer reloads when the model step has a new result, not every time the status is polled.
|
||||
if (m && modelShown(s)) {
|
||||
const resultKey = s.stills
|
||||
? `${m.placement} ${m.r_work} ${m.r_free} ${m.refinement?.r_free} ${s.refined_model}`
|
||||
: `${s.elapsed_s}`;
|
||||
@@ -195,39 +203,48 @@ const STRIP = "clamp(150px, 11vh, 260px)";
|
||||
const IMAGE = "clamp(240px, min(calc(88vh - 430px), 30vw), 1500px)";
|
||||
const RAIL = "clamp(200px, 12vw, 420px)";
|
||||
|
||||
function Dashboard({s, deadline_s, modelLoaded, measuring, pal}:
|
||||
{ s: rugnux_live_status, deadline_s: number, modelLoaded: boolean, measuring: boolean, pal: LivePalette }) {
|
||||
function Dashboard({s, name, givenCell, deadline_s, modelLoaded, measuring, pal}:
|
||||
{ s: rugnux_live_status, name?: string, givenCell?: string, deadline_s: number, modelLoaded: boolean,
|
||||
measuring: boolean, pal: LivePalette }) {
|
||||
// Only on the fixed-height stage (xl) do the plots take their height from their box; below it the
|
||||
// stage flows and the boxes take their height from the plots, so a measured height would feed back.
|
||||
const stage = useMediaQuery(useTheme().breakpoints.up("xl"));
|
||||
const [plotsRef, plotsHeight] = useHeight();
|
||||
const [stripRef, stripHeight] = useHeight();
|
||||
const later = s.stills ? "after the first merge" : "after the run";
|
||||
const later = s.stills ? "after the first merge" : "after scaling";
|
||||
// Spots and predictions are drawn on an image only where the broker analysed it: a serial run's images after
|
||||
// the pre-pass. A rotation run's images are analysed by rugnux's own passes and carry neither.
|
||||
const overlays = s.stills !== undefined && s.stills.images_analysed > 0;
|
||||
const hairline = {borderLeft: {xl: "1px solid"}, borderColor: {xl: "divider"}, pl: {xl: 2.5}};
|
||||
return (
|
||||
<Box sx={{display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", gap: 2.5, height: "100%", minHeight: 0}}>
|
||||
<Header s={s} deadline_s={deadline_s} measuring={measuring} pal={pal}/>
|
||||
<Header s={s} name={name} deadline_s={deadline_s} measuring={measuring} pal={pal}/>
|
||||
<Box sx={{display: "grid", gap: 2.5, minHeight: 0,
|
||||
gridTemplateColumns: {xs: "1fr", md: `${RAIL} minmax(0, 1fr)`, xl: `${RAIL} ${IMAGE} minmax(0, 1fr) minmax(360px, 27%)`},
|
||||
gridTemplateRows: {xs: "auto", xl: `minmax(0, 1fr) ${STRIP}`}}}>
|
||||
<Division label="Merge" sx={{gridColumn: {xl: 1}, gridRow: {xl: "1 / 3"}}}>
|
||||
<RugnuxHero s={s} modelLoaded={modelLoaded} column/>
|
||||
<RugnuxHero s={s} modelLoaded={modelLoaded} givenCell={givenCell} column/>
|
||||
</Division>
|
||||
<Division label="Image" sx={{...hairline, gridColumn: {xl: 2}, minHeight: {xs: 320, xl: 0}}}>
|
||||
<RugnuxImage measuring={measuring}/>
|
||||
<RugnuxImage measuring={measuring} overlays={overlays}/>
|
||||
</Division>
|
||||
<Box sx={{gridColumn: {xl: 3}, minHeight: {xs: 480, xl: 0}, display: "flex", flexDirection: "column"}}>
|
||||
{/* below the stage the model takes the whole width under the image, only as tall as Mol* needs, and
|
||||
nothing when there is no model to show */}
|
||||
<Box sx={{gridColumn: {md: "1 / 3", xl: 3}, minHeight: {xs: modelShown(s) ? 480 : 0, xl: 0}, display: "flex", flexDirection: "column"}}>
|
||||
<Centre s={s} pal={pal}/>
|
||||
</Box>
|
||||
<Box sx={{display: "flex", flexDirection: "column", gap: 2.5, minHeight: 0, gridColumn: {xl: 4}, gridRow: {xl: "1 / 3"}, ...hairline}}>
|
||||
<Box sx={{display: "flex", flexDirection: "column", gap: 2.5, minHeight: 0, gridColumn: {md: "1 / 3", xl: 4}, gridRow: {xl: "1 / 3"}, ...hairline}}>
|
||||
<Division sx={{flex: "0 1 auto", maxHeight: "40%", overflowY: "auto", "& > *": {flexShrink: 0}}}>
|
||||
{s.triage && s.triage.length > 0 ? <RugnuxTriage items={s.triage}/> : <Later text={later}/>}
|
||||
{s.triage && s.triage.length > 0 ? <RugnuxTriage items={s.triage}/>
|
||||
: s.state === "Failed" ? <Typography sx={{color: pal.serious, fontWeight: 600}}>{s.message}</Typography>
|
||||
: <Later text={s.stills ? "checks after the first merge" : "checks after the run"}/>}
|
||||
</Division>
|
||||
<Division sx={{flex: {xs: "none", xl: "1 1 0"}}} label={<>By resolution{s.stills && s.shells_merge && ` · ${s.shells_merge}`}</>}>
|
||||
<Box ref={plotsRef} sx={{flexGrow: 1, minHeight: {xs: 200, xl: 0}, display: "flex"}}>
|
||||
{s.shells && s.shells.length > 0
|
||||
? <Box sx={{width: "100%"}}>
|
||||
<RugnuxShellPlots shells={s.shells} height={stage ? Math.max(150, (plotsHeight - 16) / 2) : 220}/>
|
||||
<RugnuxShellPlots shells={s.shells} d_min={s.overall?.d_min ?? s.d_min} fit={s.resolution_fit}
|
||||
height={stage ? Math.max(150, plotsHeight / 2) : 220}/>
|
||||
</Box>
|
||||
: <Later text={later}/>}
|
||||
</Box>
|
||||
@@ -279,7 +296,8 @@ function Details({s, deadline_s}: { s: rugnux_live_status, deadline_s: number })
|
||||
);
|
||||
}
|
||||
|
||||
function RugnuxPage({measuring}: { measuring: boolean }) {
|
||||
// name: the file prefix of the collection; givenCell: the unit cell it was started with, if any
|
||||
function RugnuxPage({measuring, name, givenCell}: { measuring: boolean, name?: string, givenCell?: string }) {
|
||||
const {data: settings} = useQuery({...getConfigRugnuxOptions(), refetchInterval: 2000});
|
||||
const enabled = settings?.enable === true;
|
||||
const {data: s, isError} = useQuery({
|
||||
@@ -308,7 +326,7 @@ function RugnuxPage({measuring}: { measuring: boolean }) {
|
||||
? <Box sx={{height: "100%", display: "flex", "& .MuiSvgIcon-root, & p": {color: "text.secondary"}}}>
|
||||
<Box sx={{m: "auto"}}><EmptyState icon={<BoltIcon fontSize="inherit"/>} text={empty ?? ""}/></Box>
|
||||
</Box>
|
||||
: <Dashboard s={s} deadline_s={settings?.deadline_s ?? 0} modelLoaded={settings?.model_loaded === true}
|
||||
: <Dashboard s={s} name={name} givenCell={givenCell} deadline_s={settings?.deadline_s ?? 0} modelLoaded={settings?.model_loaded === true}
|
||||
measuring={measuring} pal={pal}/>}
|
||||
</Paper>
|
||||
{s && !empty && <Details s={s} deadline_s={settings?.deadline_s ?? 0}/>}
|
||||
|
||||
@@ -10,7 +10,9 @@ import {inkOn, LivePalette, livePalette} from "../livePalette";
|
||||
// one segment each, as wide as the step took - the running one growing to "now" - so what takes how long is
|
||||
// read off the bar. Each kind of step has a tag of a few letters and a colour of its own, the same on every
|
||||
// pass and on the strip under the bars that gives each kind its time; the full titles are on hover. The last
|
||||
// image and the deadline are lines across both bars.
|
||||
// image and the deadline are lines across both bars. The axis spans the collection and the deadline after it
|
||||
// from the start and keeps that scale: nothing moves under the eye as the run goes, and it extends only once
|
||||
// the run is past it.
|
||||
|
||||
const stripes = keyframes`
|
||||
from { background-position: 0 0; }
|
||||
@@ -90,10 +92,10 @@ function RugnuxProgress({s, deadline_s}: { s: rugnux_live_status, deadline_s: nu
|
||||
// n images span n - 1 intervals from the first to the last
|
||||
const rate = s.images_received > 1 && collectionEnd > 0 ? (s.images_received - 1) / collectionEnd : 0;
|
||||
const expectedEnd = rate > 0 ? (s.images_expected - 1) / rate : (s.expected_collection_s ?? 0);
|
||||
// While collecting, the axis spans at least the set-up length, so it does not rescale as images arrive
|
||||
const floor = s.expected_collection_s === undefined ? 10 : collecting ? s.expected_collection_s : 0;
|
||||
const deadline = running && lastImage !== undefined && deadline_s > 0 ? lastImage + deadline_s : undefined;
|
||||
const span = Math.max(s.elapsed_s, expectedEnd, deadline ?? 0, floor, 1) * 1.04;
|
||||
// The collection as set up, as the rate measures it, or as it was (an older broker sends no set-up length)
|
||||
const collection = Math.max(expectedEnd, lastImage ?? 0, s.expected_collection_s ?? 10);
|
||||
const deadline = lastImage !== undefined && deadline_s > 0 ? lastImage + deadline_s : undefined;
|
||||
const span = Math.max(s.elapsed_s, collection + deadline_s, 1) * 1.04;
|
||||
const pct = (t: number) => 100 * Math.min(Math.max(t, 0), span) / span;
|
||||
const tick = niceStep(span);
|
||||
const ticks = Array.from({length: Math.floor(span / tick) + 1}, (_, i) => i * tick);
|
||||
@@ -124,9 +126,9 @@ function RugnuxProgress({s, deadline_s}: { s: rugnux_live_status, deadline_s: nu
|
||||
kinds.push({tag: tags[i], titles: [st.title], seconds: duration, open});
|
||||
});
|
||||
|
||||
// On a phone the details go under the bars, which take the whole width
|
||||
// Below a wide window the details go under the bars, which take the whole width
|
||||
return (
|
||||
<Box sx={{display: "grid", gridTemplateColumns: {xs: "72px minmax(0, 1fr)", sm: "72px minmax(0, 1fr) auto"}, columnGap: 2, alignItems: "start"}}>
|
||||
<Box sx={{display: "grid", gridTemplateColumns: {xs: "72px minmax(0, 1fr)", lg: "72px minmax(0, 1fr) auto"}, columnGap: 2, alignItems: "start"}}>
|
||||
{/* captions */}
|
||||
<Box sx={{display: "grid", rowGap: `${GAP}px`}}>
|
||||
<Typography sx={{...LABEL_SX, color: pal.collecting}}>Detector</Typography>
|
||||
@@ -187,7 +189,7 @@ function RugnuxProgress({s, deadline_s}: { s: rugnux_live_status, deadline_s: nu
|
||||
</Box>
|
||||
|
||||
{/* details */}
|
||||
<Box sx={{display: "grid", rowGap: `${GAP}px`, textAlign: "right", gridColumn: {xs: "1 / 3", sm: "auto"}}}>
|
||||
<Box sx={{display: "grid", rowGap: `${GAP}px`, textAlign: "right", gridColumn: {xs: "1 / 3", lg: "auto"}}}>
|
||||
<Typography noWrap sx={{fontSize: "0.85rem", lineHeight: `${BAR}px`, color: "text.secondary", fontVariantNumeric: "tabular-nums"}}>
|
||||
{detectorDetail}
|
||||
</Typography>
|
||||
@@ -198,7 +200,7 @@ function RugnuxProgress({s, deadline_s}: { s: rugnux_live_status, deadline_s: nu
|
||||
|
||||
{/* the kinds of step, each with its time */}
|
||||
{kinds.length > 0 &&
|
||||
<Box sx={{gridColumn: {xs: "1 / 3", sm: "2 / 4"}, display: "flex", flexWrap: "wrap", gap: 0.75, mt: 0.25}}>
|
||||
<Box sx={{gridColumn: {xs: "1 / 3", lg: "2 / 4"}, display: "flex", flexWrap: "wrap", gap: 0.75, mt: 0.25}}>
|
||||
{kinds.map((k, i) => (
|
||||
<Tooltip key={i} arrow title={k.titles.join(" · ")}>
|
||||
<Box sx={{display: "inline-flex", alignItems: "center", gap: 0.75, px: 1, height: 22, borderRadius: "11px",
|
||||
|
||||
@@ -1,90 +1,116 @@
|
||||
import {useEffect, useRef, useState} from "react";
|
||||
import {Box, Typography, useTheme} from "@mui/material";
|
||||
import {rugnux_live_shell} from "../client";
|
||||
import Plot from "./Plot";
|
||||
import {livePalette} from "../livePalette";
|
||||
|
||||
// Merging statistics by resolution shell, the shell table of rugnux's _report.txt. Each shell is drawn at
|
||||
// 1/d^2 of its d_min (the label of its row in the report), with the axis labelled in d. A quantity the run
|
||||
// did not measure (R_meas on serial data, R_split on rotation, CCref without reference data, R-free
|
||||
// without a model) has no line.
|
||||
// Completeness and CC1/2 by resolution shell, the two columns of rugnux's shell table read first, one panel each,
|
||||
// one under the other on one axis: labelled once, under the lower panel. Each shell is drawn at 1/d^2 of its
|
||||
// d_min, the axis labelled in d at round values - as many as the panel's width holds - and the resolution of the
|
||||
// merge is a dashed line, named once, on the upper panel: where the CC1/2 fall-off is fitted, which the written
|
||||
// range (the end of the axis) deliberately reaches a shell beyond; without a fit, the written limit itself.
|
||||
// Drawn like the plots of the data collection (MultiLinePlotWrapper): Plotly's own colours and font, a faint grid.
|
||||
|
||||
type Series = { name: string, value: (sh: rugnux_live_shell) => number | undefined };
|
||||
|
||||
// R-factors rise to the fine end, so their legend goes to the left
|
||||
const PANELS: { title: string, percent: boolean, legendLeft?: boolean, series: Series[] }[] = [
|
||||
{title: "Multiplicity", percent: false, series: [{name: "Multiplicity", value: sh => sh.multiplicity}]},
|
||||
{title: "<I/σ>", percent: false, series: [{name: "<I/σ>", value: sh => sh.i_over_sigma}]},
|
||||
{title: "Correlation [%]", percent: true, series: [
|
||||
{name: "CC1/2", value: sh => sh.cc_half},
|
||||
{name: "CCref", value: sh => sh.cc_ref},
|
||||
]},
|
||||
{title: "R-factor [%]", percent: true, legendLeft: true, series: [
|
||||
{name: "R_meas", value: sh => sh.r_meas},
|
||||
{name: "R_split", value: sh => sh.r_split},
|
||||
{name: "R-free", value: sh => sh.r_free},
|
||||
]},
|
||||
const PANELS: { title: string, value: (sh: rugnux_live_shell) => number | undefined, colour: string }[] = [
|
||||
{title: "Completeness [%]", value: sh => sh.completeness, colour: "#1f77b4"},
|
||||
{title: "CC\u00bd [%]", value: sh => sh.cc_half, colour: "#ff7f0e"},
|
||||
];
|
||||
|
||||
// height: of each panel in px. The plots take the colours of the enclosing MUI theme, so they read the
|
||||
// same on the light dashboard card and on the dark live page.
|
||||
function RugnuxShellPlots({shells, merge, height = 300}: { shells: rugnux_live_shell[], merge?: string, height?: number }) {
|
||||
// The d values the axis may be labelled at
|
||||
const D_TICKS = [0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 2, 2.2, 2.5, 3, 3.5, 4, 5, 6, 8, 10, 20];
|
||||
const MARGIN = {t: 36, b: 22, l: 44, r: 12};
|
||||
const AXIS_TITLE = 18;
|
||||
const TICK_SPACING_PX = 44;
|
||||
|
||||
// Width of an element in px, kept up to date as the page resizes: how many labels the axis can hold.
|
||||
function useWidth() {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const [width, setWidth] = useState(0);
|
||||
useEffect(() => {
|
||||
if (!ref.current)
|
||||
return;
|
||||
const observer = new ResizeObserver(entries => setWidth(entries[0].contentRect.width));
|
||||
observer.observe(ref.current);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
return [ref, width] as const;
|
||||
}
|
||||
|
||||
// The round d values in [x0, x1] (as 1/d^2), from the fine end, each at least TICK_SPACING_PX from the one before
|
||||
function dTicks(x0: number, x1: number, widthPx: number) {
|
||||
const px = (d: number) => (1 / (d * d) - x0) / (x1 - x0) * widthPx;
|
||||
const ticks: number[] = [];
|
||||
for (const d of D_TICKS) {
|
||||
if (px(d) < 0 || px(d) > widthPx)
|
||||
continue;
|
||||
if (ticks.length === 0 || px(ticks[ticks.length - 1]) - px(d) >= TICK_SPACING_PX)
|
||||
ticks.push(d);
|
||||
}
|
||||
return ticks;
|
||||
}
|
||||
|
||||
// height: of each panel in px; d_min: the written limit of the merge; fit: where its CC1/2 fall-off is fitted
|
||||
function RugnuxShellPlots({shells, d_min, fit, merge, height = 300}:
|
||||
{ shells: rugnux_live_shell[], d_min?: number, fit?: number, merge?: string, height?: number }) {
|
||||
const theme = useTheme();
|
||||
const pal = livePalette(theme.palette.mode);
|
||||
const grid = pal.grid;
|
||||
// type that grows with the panel, so a 4k screen does not get 11 px labels
|
||||
const font = Math.round(Math.min(17, Math.max(11, height / 24)));
|
||||
const grid = theme.palette.mode === "dark" ? "rgba(255,255,255,.12)" : "#eee";
|
||||
const [ref, width] = useWidth();
|
||||
const x = shells.map(sh => 1 / (sh.d_min * sh.d_min));
|
||||
// At most six d labels (four on a small panel), the finest shell always among them
|
||||
const step = Math.ceil(shells.length / (height < 320 ? 4 : 6));
|
||||
const ticks = shells.filter((_, i) => (shells.length - 1 - i) % step === 0);
|
||||
const limit = fit ?? d_min;
|
||||
const cut = limit !== undefined ? 1 / (limit * limit) : undefined;
|
||||
const x0 = 0;
|
||||
const x1 = 1.03 * Math.max(x[x.length - 1], d_min !== undefined ? 1 / (d_min * d_min) : 0, cut ?? 0);
|
||||
const ticks = dTicks(x0, x1, Math.max(width - MARGIN.l - MARGIN.r, 100));
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Box ref={ref}>
|
||||
{merge && <Typography color="text.secondary" sx={{mb: 1}}>Merge of {merge}</Typography>}
|
||||
<Box sx={{display: "grid", gridTemplateColumns: {xs: "1fr", md: "1fr 1fr"}, gap: 2}}>
|
||||
{PANELS.map(panel => {
|
||||
const data = panel.series
|
||||
.filter(s => shells.some(sh => s.value(sh) !== undefined))
|
||||
.map((s, i) => ({
|
||||
x: x,
|
||||
y: shells.map(sh => {
|
||||
const v = s.value(sh);
|
||||
return v === undefined ? null : panel.percent ? 100 * v : v;
|
||||
}),
|
||||
type: "scatter" as const,
|
||||
mode: "lines+markers" as const,
|
||||
name: s.name,
|
||||
line: {color: pal.traces[i % pal.traces.length]},
|
||||
marker: {color: pal.traces[i % pal.traces.length], size: 5},
|
||||
}));
|
||||
if (data.length === 0)
|
||||
return null;
|
||||
return (
|
||||
<Plot key={panel.title}
|
||||
style={{width: "100%", height}}
|
||||
data={data}
|
||||
layout={{
|
||||
title: {text: panel.title, font: {size: font + 3}},
|
||||
height,
|
||||
margin: {t: 32, b: 40, l: 50, r: 12},
|
||||
paper_bgcolor: "rgba(0,0,0,0)",
|
||||
plot_bgcolor: "rgba(0,0,0,0)",
|
||||
font: {color: theme.palette.text.secondary, size: font},
|
||||
showlegend: data.length > 1,
|
||||
legend: panel.legendLeft ? {x: 0, xanchor: "left", y: 1} : {x: 1, xanchor: "right", y: 1},
|
||||
xaxis: {
|
||||
title: {text: "d [Å]", standoff: 4}, tickangle: 0,
|
||||
gridcolor: grid, zerolinecolor: grid,
|
||||
tickvals: ticks.map(sh => 1 / (sh.d_min * sh.d_min)),
|
||||
ticktext: ticks.map(sh => sh.d_min.toFixed(2)),
|
||||
},
|
||||
yaxis: {rangemode: "tozero", gridcolor: grid, zerolinecolor: grid},
|
||||
uirevision: "shells",
|
||||
}}
|
||||
config={{responsive: true, displayModeBar: false}}/>
|
||||
);
|
||||
})}
|
||||
</Box>
|
||||
{PANELS.map((panel, i) => {
|
||||
if (!shells.some(sh => panel.value(sh) !== undefined))
|
||||
return null;
|
||||
const lower = i === PANELS.length - 1;
|
||||
const panelHeight = lower ? height + AXIS_TITLE : height;
|
||||
return (
|
||||
<Plot key={panel.title}
|
||||
style={{width: "100%", height: panelHeight}}
|
||||
data={[{
|
||||
x: x,
|
||||
y: shells.map(sh => {
|
||||
const v = panel.value(sh);
|
||||
return v === undefined ? null : 100 * v;
|
||||
}),
|
||||
text: shells.map(sh => `${sh.d_max.toFixed(2)}-${sh.d_min.toFixed(2)} Å`),
|
||||
type: "scatter" as const,
|
||||
mode: "lines" as const,
|
||||
line: {color: panel.colour, width: 2},
|
||||
hovertemplate: "%{text}: %{y:.1f} %<extra></extra>",
|
||||
}]}
|
||||
layout={{
|
||||
title: {text: panel.title, font: {size: 14}},
|
||||
height: panelHeight,
|
||||
margin: lower ? {...MARGIN, b: MARGIN.b + AXIS_TITLE} : MARGIN,
|
||||
paper_bgcolor: "rgba(0,0,0,0)",
|
||||
plot_bgcolor: "rgba(0,0,0,0)",
|
||||
font: {color: theme.palette.text.secondary},
|
||||
showlegend: false,
|
||||
xaxis: {
|
||||
title: lower ? {text: "Resolution [Å]", standoff: 4} : undefined, tickangle: 0,
|
||||
range: [x0, x1], gridcolor: grid, zerolinecolor: grid,
|
||||
tickvals: ticks.map(d => 1 / (d * d)),
|
||||
ticktext: ticks.map(d => String(d)),
|
||||
},
|
||||
yaxis: {range: [0, 105], tickvals: [0, 25, 50, 75, 100], gridcolor: grid, zerolinecolor: grid},
|
||||
shapes: cut !== undefined ? [{type: "line" as const, xref: "x" as const, yref: "paper" as const,
|
||||
x0: cut, x1: cut, y0: 0, y1: 1,
|
||||
line: {color: theme.palette.text.secondary, width: 1.5, dash: "dash" as const}}] : [],
|
||||
annotations: cut !== undefined && i === 0 ? [{x: cut, y: 0.04, xref: "x" as const, yref: "paper" as const,
|
||||
xanchor: "right" as const, yanchor: "bottom" as const, showarrow: false,
|
||||
text: `${fit !== undefined ? "CC½ fit" : "limit"} ${limit!.toFixed(2)} Å `,
|
||||
font: {size: 12, color: theme.palette.text.secondary}}] : [],
|
||||
uirevision: "shells",
|
||||
}}
|
||||
config={{responsive: true, displayModeBar: false}}/>
|
||||
);
|
||||
})}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -49,6 +49,21 @@ namespace {
|
||||
}
|
||||
};
|
||||
|
||||
// The headline numbers and the shell table of the merge: the summary's Space group, Resolution and Signal rows,
|
||||
// with the R-free of the model by shell where one was validated (and refined) on it
|
||||
void PublishMerge(RugnuxLiveStatus &status, const ProcessResult &result, const MergeStatistics &statistics,
|
||||
const ModelValidationResult *validation = nullptr, const RefinementResult *refinement = nullptr) {
|
||||
std::optional<double> d_min, isa;
|
||||
if (std::isfinite(statistics.overall.d_min))
|
||||
d_min = statistics.overall.d_min;
|
||||
if (!statistics.stills && result.error_model_isa_resolved && result.error_model_isa > 0.0)
|
||||
isa = result.error_model_isa;
|
||||
// the fit the report quotes: on the plain CC1/2 where there is one (rotation), else the applied one
|
||||
const auto fit = result.resolution_fit_plain_A ? result.resolution_fit_plain_A : result.resolution_fit_A;
|
||||
status.Headline(result.space_group ? result.space_group->xhm() : "", d_min, isa, fit);
|
||||
status.Shells("the collection", LiveShells(statistics, validation), LiveOverall(statistics, validation, refinement));
|
||||
}
|
||||
|
||||
// Per-image results of rugnux's canonical pass to the plots and scan result, its steps to the live status. The
|
||||
// pass runs behind the images, mostly after the last one: the image buffer is told, so that the viewer reads
|
||||
// the plots again.
|
||||
@@ -80,6 +95,10 @@ namespace {
|
||||
if (text.starts_with("lattice "))
|
||||
status.Lattice("lattice on the sweep: " + text.substr(8));
|
||||
}
|
||||
// The merge is made: its numbers go out now, not after the model work; the end publishes them again
|
||||
void OnMerge(const ProcessResult &result, const MergeStatistics &statistics) override {
|
||||
PublishMerge(status, result, statistics);
|
||||
}
|
||||
};
|
||||
|
||||
std::string StateName(RugnuxLiveState state) {
|
||||
@@ -305,21 +324,13 @@ void JFJochReceiverRugnuxRotation::RugnuxThread() {
|
||||
live_status.Triage(triage);
|
||||
if (const auto live_model = LiveModel(result))
|
||||
live_status.Model(*live_model);
|
||||
// The numbers the summary's Space group, Resolution and Signal rows give
|
||||
std::optional<double> d_min, isa;
|
||||
if (result.has_merge_statistics)
|
||||
if (std::isfinite(result.merge_statistics.overall.d_min))
|
||||
d_min = result.merge_statistics.overall.d_min;
|
||||
if (!result.merge_statistics.stills && result.error_model_isa_resolved && result.error_model_isa > 0.0)
|
||||
isa = result.error_model_isa;
|
||||
live_status.Headline(result.space_group ? result.space_group->xhm() : "", d_min, isa);
|
||||
if (result.has_merge_statistics) {
|
||||
const ModelValidationResult *validation = result.model_validation ? &*result.model_validation : nullptr;
|
||||
const RefinementResult *refinement = result.refinement ? &*result.refinement : nullptr;
|
||||
live_status.Shells("the collection", LiveShells(result.merge_statistics, validation),
|
||||
LiveOverall(result.merge_statistics, validation, refinement));
|
||||
PublishMerge(live_status, result, result.merge_statistics,
|
||||
result.model_validation ? &*result.model_validation : nullptr,
|
||||
result.refinement ? &*result.refinement : nullptr);
|
||||
live_status.Frames(result.end_message.image_scale_factor, LiveFrameRanges(result.merge_statistics.sweep_quality));
|
||||
}
|
||||
} else
|
||||
live_status.Headline(result.space_group ? result.space_group->xhm() : "", std::nullopt, std::nullopt);
|
||||
// For the broker's viewer routes; a copy of the map coefficients, as the end message takes the originals
|
||||
if (result.outputs && result.outputs->placed_model) {
|
||||
const RugnuxOutputs &outputs = *result.outputs;
|
||||
|
||||
@@ -184,10 +184,11 @@ void RugnuxLiveStatus::Model(const RugnuxLiveModel &model) {
|
||||
}
|
||||
|
||||
void RugnuxLiveStatus::Headline(const std::string &space_group, std::optional<double> d_min,
|
||||
std::optional<double> isa) {
|
||||
std::optional<double> isa, std::optional<double> resolution_fit) {
|
||||
std::unique_lock ul(status_mutex);
|
||||
snapshot.space_group = space_group;
|
||||
snapshot.d_min = d_min;
|
||||
snapshot.resolution_fit = resolution_fit;
|
||||
snapshot.isa = isa;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,8 @@ struct RugnuxLiveSnapshot {
|
||||
std::optional<RugnuxLiveModel> model; // where a model was given
|
||||
// The headline numbers of the result, once the run is over
|
||||
std::string space_group;
|
||||
std::optional<double> d_min; // of the merge
|
||||
std::optional<double> d_min; // of the merge: the written range
|
||||
std::optional<double> resolution_fit; // where the CC1/2 fall-off is fitted, the resolution to quote; none without a fit
|
||||
std::optional<double> isa; // where the error model determined it
|
||||
// The placed and refined models and their maps, for the viewer routes
|
||||
std::shared_ptr<const RugnuxStructure> structure;
|
||||
@@ -204,7 +205,8 @@ public:
|
||||
const std::vector<std::string> &warnings, bool anomalous_signal = false);
|
||||
void Triage(const std::vector<RugnuxLiveTriage> &triage);
|
||||
void Model(const RugnuxLiveModel &model);
|
||||
void Headline(const std::string &space_group, std::optional<double> d_min, std::optional<double> isa);
|
||||
void Headline(const std::string &space_group, std::optional<double> d_min, std::optional<double> isa,
|
||||
std::optional<double> resolution_fit = std::nullopt);
|
||||
void Latency(double last_image_to_written_s);
|
||||
// The collection is over: last_image_s is set, and the last image's time is returned (none if no image came).
|
||||
std::optional<std::chrono::steady_clock::time_point> LastImage();
|
||||
|
||||
@@ -1222,6 +1222,10 @@ public:
|
||||
virtual void OnImagePass(bool canonical) {}
|
||||
virtual void OnStep(const std::string &title) {}
|
||||
virtual void OnNote(const std::string &text) {}
|
||||
// The merge of the result is made: its group, axes and resolution are those the data decide (a placed model
|
||||
// can still change the hand), the analyses and the model work are still to come. Called with the merge's
|
||||
// statistics, before the "Analyses" step; on the main thread, from the passes that make the result.
|
||||
virtual void OnMerge(const ProcessResult &result, const MergeStatistics &statistics) {}
|
||||
};
|
||||
|
||||
class Rugnux {
|
||||
|
||||
@@ -4172,6 +4172,8 @@ bool Rugnux::ScaleMergeAndSymmetry(PipelineLocals &p) {
|
||||
result.resolution_fit_A
|
||||
? fmt::format(" (CC1/2 fall-off at {:.2f} A)", *result.resolution_fit_A)
|
||||
: std::string()));
|
||||
if (steps_)
|
||||
steps_->OnMerge(result, sm.statistics);
|
||||
Step("Analyses");
|
||||
}
|
||||
adoption_mark.Stop();
|
||||
|
||||
@@ -181,17 +181,20 @@ TEST_CASE("RugnuxLiveStatus_Headline", "[RugnuxLive]") {
|
||||
CHECK(!j.contains("space_group"));
|
||||
CHECK(!j.contains("d_min"));
|
||||
CHECK(!j.contains("isa"));
|
||||
CHECK(!j.contains("resolution_fit"));
|
||||
|
||||
status.Headline("P 1 21 1", 1.25, 24.2);
|
||||
status.Headline("P 1 21 1", 1.25, 24.2, 1.31);
|
||||
j = Convert(status.Get());
|
||||
CHECK(j["space_group"] == "P 1 21 1");
|
||||
CHECK(j["d_min"].get<double>() == Catch::Approx(1.25));
|
||||
CHECK(j["isa"].get<double>() == Catch::Approx(24.2));
|
||||
CHECK(j["resolution_fit"].get<double>() == Catch::Approx(1.31));
|
||||
|
||||
// ISa undetermined
|
||||
// ISa undetermined, no fit
|
||||
status.Headline("P 1 21 1", 1.25, std::nullopt);
|
||||
j = Convert(status.Get());
|
||||
CHECK(!j.contains("isa"));
|
||||
CHECK(!j.contains("resolution_fit"));
|
||||
|
||||
status.Clear();
|
||||
CHECK(status.Get().space_group.empty());
|
||||
|
||||
Reference in new issue
Block a user