Files
Jungfraujoch/viewer/windows/JFJochMergeStatsWindow.h
T
leonarski_fandClaude Opus 5 8493095912 Viewer: ISa diagnostic plot, and the B-factors in the merge hero row
The error model says sigma -> b*I for strong reflections, so merged I/sigma
flattens off at 1/b - the number reported as ISa. Plotting I/sigma against I
with that asymptote drawn on it is what shows whether the reported ISa
describes the data or comes from a degenerate fit, which nothing in the window
could show before. A third page next to the per-shell plot and table.

The merge carries a few thousand strided (I, sigma) pairs to the viewer for it -
a shape, not a reflection list; the reflections themselves are in the .mtz/.cif.

The hero row gains the Wilson B and the radiation-damage Delta-B. Both were
already computed and already in MergeStatistics, so they only needed showing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 17:56:55 +02:00

55 lines
2.3 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <QWidget>
#include <cstdint>
#include <optional>
#include <utility>
#include <vector>
#include "../../image_analysis/scale_merge/Merge.h" // MergeStatistics
#include "../../image_analysis/scale_merge/TwinningAnalysis.h" // TwinningAnalysisResult
#include "../../image_analysis/scale_merge/SearchSpaceGroup.h" // SearchSpaceGroupResult
class QComboBox;
class QLabel;
class QStackedWidget;
class QTableWidget;
class JFJochSimpleChartView;
// Pop-up analysis window for a finished scaling/merging run: a row of eye-catching overall numbers
// (ISa, CC1/2, R-meas, completeness, multiplicity, the Wilson B and the radiation-damage Delta-B, and
// CCref when a reference was used) above a per-resolution-shell plot whose metric is chosen from a
// combo, a per-shell table, and an ISa diagnostic scatter. Opened automatically when a merge job
// finishes and on demand from the processing-jobs dock. Modeless; deletes on close.
class JFJochMergeStatsWindow : public QWidget {
Q_OBJECT
public:
JFJochMergeStatsWindow(const QString &title, const MergeStatistics &stats,
double isa, bool has_reference,
const TwinningAnalysisResult &twinning,
std::optional<int64_t> space_group_number,
const std::optional<SearchSpaceGroupResult> &space_group_search,
const std::vector<std::pair<float, float>> &merged_i_sigma,
QWidget *parent = nullptr);
private:
MergeStatistics stats_;
bool has_reference_;
QComboBox *metric_ = nullptr;
QLabel *metricLabel_ = nullptr; // "Metric:" — hidden in table view
QStackedWidget *stack_ = nullptr; // page 0: plot, page 1: table, page 2: ISa diagnostic
JFJochSimpleChartView *chart_ = nullptr;
QTableWidget *table_ = nullptr;
QWidget *isa_page_ = nullptr;
void updatePlot();
void buildTable();
// Merged I/sigma against I, with the reported ISa drawn as its asymptote. Returns nullptr when
// there is nothing to draw.
QWidget *buildIsaDiagnostic(const std::vector<std::pair<float, float>> &i_sigma, double isa);
};