Build Packages / Create release (push) Successful in 24s
Build Packages / build:viewer:macos-arm64:nocuda (push) Successful in 3m29s
Build Packages / build:rugnux:macos-arm64:nocuda (push) Successful in 2m43s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 8m27s
Build Packages / build:rugnux:linux-x86_64:cuda (push) Successful in 9m53s
Build Packages / build:viewer:linux-x86_64:nocuda (push) Successful in 9m58s
Build Packages / build:viewer:linux-x86_64:cuda (push) Successful in 11m22s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 13m39s
Build Packages / build:viewer:windows-x86_64:nocuda (push) Successful in 18m37s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 16m32s
Build Packages / build:viewer:windows-x86_64:cuda (push) Successful in 24m11s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m30s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 19m3s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 20m23s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 19m41s
Build Packages / Generate python client (push) Successful in 50s
Build Packages / Build documentation (push) Successful in 1m16s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 21m0s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 18m38s
Build Packages / build:rugnux:windows-x86_64:cuda (push) Successful in 14m33s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 17m55s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 20m50s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 18m38s
Build Packages / Unit tests (push) Successful in 1h46m14s
* jfjoch_broker: Optional per-dataset authentication - statistics, images and plots can require a bearer token, which jfjoch_viewer supports. * jfjoch_viewer: Dark mode and a theme-matched colour scheme, a magnifier panel, and simpler contrast and background controls. * Rugnux: Multiple performance improvements on GPU and CPU (CPU-only processing up to 40% faster, faster image decoding on ARM), with unchanged results. * Rugnux: `--model` rigid-body refinement runs on the GPU, and the model-validation check is faster and more reliable. * Rugnux: Improved scaling and merging - error model, outlier rejection, absorption correction and French-Wilson amplitudes now agree more closely with XDS and ctruncate. * Rugnux: Improved integration - radial background on powder and ice rings, crowded rotation data keep their reflections, and CPU-only builds integrate large unit cells as GPU builds do. * Rugnux: More robust detector geometry - measured beam centre, X-ray bandwidth and goniometer rate, and geometry refinement accepted only on significant evidence. * Rugnux: Merged files are written in the standard setting, or in the setting of a reference MTZ, structure-factor mmCIF or model, with its free-R flags. * Rugnux: Richer report - ice and powder rings, further lattices, superstructure candidates and mosaicity, with warnings worded as prompts to check. * Rugnux: Clear error messages when a data set needs more GPU or host memory than is available. Reviewed-on: #83 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
124 lines
4.8 KiB
C++
124 lines
4.8 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "JFJochViewerReflectionListWindow.h"
|
|
|
|
#include <QVBoxLayout>
|
|
#include <QHeaderView>
|
|
|
|
JFJochViewerReflectionListWindow::JFJochViewerReflectionListWindow(QWidget* parent)
|
|
: JFJochHelperWindow(parent) {
|
|
QWidget* centralWidget = new QWidget(this);
|
|
setCentralWidget(centralWidget);
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(centralWidget);
|
|
|
|
tableView = new QTableView(this);
|
|
|
|
tableModel = new QStandardItemModel(this);
|
|
setupTableModel();
|
|
|
|
proxyModel = new QSortFilterProxyModel(this);
|
|
proxyModel->setSourceModel(tableModel);
|
|
proxyModel->setSortRole(Qt::UserRole); // numeric sort on underlying values
|
|
|
|
tableView->setModel(proxyModel);
|
|
tableView->sortByColumn(6, Qt::DescendingOrder); // default: I (Intensity) desc
|
|
tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
|
tableView->setSortingEnabled(true);
|
|
tableView->verticalHeader()->setVisible(false);
|
|
tableView->horizontalHeader()->setSectionsClickable(true);
|
|
tableView->horizontalHeader()->setSortIndicatorShown(true);
|
|
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
|
|
|
|
tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
|
|
|
layout->addWidget(tableView);
|
|
|
|
setWindowTitle("Reflections");
|
|
resize(900, 600);
|
|
|
|
connect(tableView, &QTableView::doubleClicked,
|
|
this, &JFJochViewerReflectionListWindow::onTableRowDoubleClicked);
|
|
}
|
|
|
|
void JFJochViewerReflectionListWindow::setupTableModel() {
|
|
tableModel->setColumnCount(11);
|
|
tableModel->setHeaderData(0, Qt::Horizontal, "h");
|
|
tableModel->setHeaderData(1, Qt::Horizontal, "k");
|
|
tableModel->setHeaderData(2, Qt::Horizontal, "l");
|
|
tableModel->setHeaderData(3, Qt::Horizontal, "Pred. x");
|
|
tableModel->setHeaderData(4, Qt::Horizontal, "Pred. y");
|
|
tableModel->setHeaderData(5, Qt::Horizontal, "d [Å]");
|
|
tableModel->setHeaderData(6, Qt::Horizontal, "I");
|
|
tableModel->setHeaderData(7, Qt::Horizontal, "Sigma");
|
|
tableModel->setHeaderData(8, Qt::Horizontal, "Bkg");
|
|
tableModel->setHeaderData(9, Qt::Horizontal, "Part.");
|
|
tableModel->setHeaderData(10, Qt::Horizontal, "LP^-1");
|
|
}
|
|
|
|
static QStandardItem* mkNumItem(const QVariant& userValue, const QString& displayText = QString()) {
|
|
auto* it = new QStandardItem();
|
|
if (displayText.isEmpty()) {
|
|
it->setData(userValue, Qt::DisplayRole);
|
|
} else {
|
|
it->setData(displayText, Qt::DisplayRole);
|
|
}
|
|
it->setData(userValue, Qt::UserRole);
|
|
it->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
|
return it;
|
|
}
|
|
|
|
void JFJochViewerReflectionListWindow::addReflectionRow(int index, const Reflection& r) {
|
|
QList<QStandardItem*> row;
|
|
|
|
row.append(mkNumItem(static_cast<qlonglong>(r.h)));
|
|
row.append(mkNumItem(static_cast<qlonglong>(r.k)));
|
|
row.append(mkNumItem(static_cast<qlonglong>(r.l)));
|
|
row.append(mkNumItem(static_cast<double>(r.predicted_x),
|
|
QString::number(r.predicted_x, 'f', 2)));
|
|
row.append(mkNumItem(static_cast<double>(r.predicted_y),
|
|
QString::number(r.predicted_y, 'f', 2)));
|
|
row.append(mkNumItem(static_cast<double>(r.d),
|
|
QString::number(r.d, 'f', 3)));
|
|
row.append(mkNumItem(static_cast<double>(r.I),
|
|
QString::number(r.I, 'f', 1)));
|
|
row.append(mkNumItem(static_cast<double>(r.sigma),
|
|
QString::number(r.sigma, 'f', 2)));
|
|
row.append(mkNumItem(static_cast<double>(r.bkg),
|
|
QString::number(r.bkg, 'f', 1)));
|
|
|
|
row.append(mkNumItem(r.partiality, QString::number(r.partiality, 'f', 2)));
|
|
row.append(mkNumItem(r.prescaling_corr, QString::number(r.prescaling_corr, 'f', 3)));
|
|
tableModel->appendRow(row);
|
|
}
|
|
|
|
void JFJochViewerReflectionListWindow::onTableRowDoubleClicked(const QModelIndex& index) {
|
|
if (!index.isValid())
|
|
return;
|
|
|
|
QModelIndex src = proxyModel->mapToSource(index);
|
|
int reflIndex = src.row();
|
|
|
|
if (!image)
|
|
return;
|
|
if (reflIndex >= 0 && reflIndex < image->ImageData().reflections.size())
|
|
emit zoom(QPointF(image->ImageData().reflections[reflIndex].predicted_x,
|
|
image->ImageData().reflections[reflIndex].predicted_y));
|
|
}
|
|
|
|
void JFJochViewerReflectionListWindow::datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset) {
|
|
image = {};
|
|
tableModel->removeRows(0, tableModel->rowCount());
|
|
}
|
|
|
|
void JFJochViewerReflectionListWindow::imageLoaded(std::shared_ptr<const JFJochReaderImage> in_image) {
|
|
tableModel->removeRows(0, tableModel->rowCount());
|
|
image = in_image;
|
|
if (image) {
|
|
for (int i = 0; i < image->ImageData().reflections.size(); ++i)
|
|
addReflectionRow(i, image->ImageData().reflections[i]);
|
|
}
|
|
}
|