merge viewer-x11-perf: composite dataset plot, per-kind plot choices, spot-count band
Build Packages / Create release (push) Successful in 29s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 7m44s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 9m4s
Build Packages / build:viewer-tgz:cpu (push) Successful in 9m32s
Build Packages / build:viewer-tgz:cuda (push) Successful in 10m52s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m37s
Build Packages / build:windows:nocuda (push) Successful in 16m29s
Build Packages / build:windows:cuda (push) Successful in 19m2s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 21m46s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 16m7s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 17m55s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 16m38s
Build Packages / build:rugnux:windows (push) Successful in 10m30s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 16m18s
Build Packages / Generate python client (push) Successful in 14s
Build Packages / Build documentation (push) Successful in 1m29s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 16m13s
Build Packages / build:rpm (rocky8) (push) Successful in 14m23s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 13m39s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 13m43s
Build Packages / build:rpm (rocky9) (push) Successful in 14m42s
Build Packages / Unit tests (push) Successful in 1h12m43s
Build Packages / Create release (push) Successful in 29s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 7m44s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 9m4s
Build Packages / build:viewer-tgz:cpu (push) Successful in 9m32s
Build Packages / build:viewer-tgz:cuda (push) Successful in 10m52s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 12m37s
Build Packages / build:windows:nocuda (push) Successful in 16m29s
Build Packages / build:windows:cuda (push) Successful in 19m2s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 21m46s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 16m7s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 17m55s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 16m38s
Build Packages / build:rugnux:windows (push) Successful in 10m30s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 16m18s
Build Packages / Generate python client (push) Successful in 14s
Build Packages / Build documentation (push) Successful in 1m29s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 16m13s
Build Packages / build:rpm (rocky8) (push) Successful in 14m23s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 13m39s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 13m43s
Build Packages / build:rpm (rocky9) (push) Successful in 14m42s
Build Packages / Unit tests (push) Successful in 1h12m43s
This commit is contained in:
commit
f4a838afb9
13 files changed
+173
-37
No files matched your search
@@ -13,12 +13,17 @@
|
||||
* The viewer's file manager lists CBF frames beside HDF5 datasets.
|
||||
* The viewer's image statistics state the collection time, detector distance, beam centre and wavelength as entries of their own rather than in a tooltip, and no longer report a B-factor.
|
||||
* The viewer plots spot count and background together on one plot, which is what a connection to a live source now shows by default.
|
||||
* The viewer's combined spots + background plot scales each quantity on its own axis - background on the left, spot count on the right, each axis coloured like its curve - and keeps the two curves in separate halves of the plot.
|
||||
* The viewer's per-image plot selector no longer offers the X-ray fluorescence spectrum.
|
||||
* The viewer's reprocessing panel is called Processing, and the jobs panel it shared that name with is called Jobs.
|
||||
* Expanding the viewer's powder-calibration section no longer widens the left-hand panel past the space it has, which used to push half of it out of sight.
|
||||
* No section of the viewer's processing panel asks for more width than the panel has: geometry, unit cell, goniometer, spot finding and indexing all used to widen it when opened.
|
||||
* The viewer states the angle of a rotation axis that does not turn as a single number, instead of adding a zero wedge to it.
|
||||
* The viewer's image statistics show the sample-head chi and phi angles of a dataset that records them (an SLS Smargon), and nothing for one that does not.
|
||||
* Switching the viewer's plot between per-dataset and per-image no longer leaves the other mode's quantities in the selector, and each mode remembers what was last shown in it.
|
||||
* The viewer's dataset-info plot remembers its choice - the selected quantity and the Grid and Per-image toggles - across restarts, with grid scans and standard scans each keeping their own.
|
||||
* The viewer's View menu gains "Reset all settings to defaults", which clears every saved viewer setting after confirmation and returns the running viewer - layout, window size, display settings, plot choices, file manager root - to its defaults.
|
||||
* Quitting the viewer through the File menu now saves the persistent settings, as closing the window always did.
|
||||
* Re-initialising the broker after a DECTRIS run that never started no longer freezes it with no way to cancel.
|
||||
* Re-initialising the broker disconnects the previous run's stream reader, so a DECTRIS collection no longer starts and then stays empty because half its stream - the start message included - went to a reader nobody was listening to.
|
||||
* Cancelling a dark-mask calibration abandons it instead of adopting the partial mask and reporting the calibration as done.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
#include <QColor>
|
||||
#include <QSettings>
|
||||
|
||||
#include "JFJochViewerDatasetInfo.h"
|
||||
|
||||
@@ -11,6 +12,12 @@ namespace {
|
||||
// Combo data value of the combined spots + background plot.
|
||||
constexpr int SPOTS_PLUS_BACKGROUND = 16;
|
||||
|
||||
// Grid scans and standard scans keep separate saved favourites.
|
||||
QString FavouriteGroup(bool grid_scan) {
|
||||
return grid_scan ? QStringLiteral("datasetInfoPlot/gridScan")
|
||||
: QStringLiteral("datasetInfoPlot/standard");
|
||||
}
|
||||
|
||||
// Stable colour per run by its position in the run list (Original is index 0 -> blue), so a
|
||||
// run keeps its colour whether it is the active (primary) line or an overlay.
|
||||
QColor RunColor(int index) {
|
||||
@@ -81,8 +88,12 @@ JFJochViewerDatasetInfo::JFJochViewerDatasetInfo(QWidget *parent) : QWidget(pare
|
||||
connect(combo_box, &QComboBox::currentIndexChanged,
|
||||
this, &JFJochViewerDatasetInfo::comboBoxSelected);
|
||||
// activated (not currentIndexChanged) fires only on a user pick, which is exactly when the
|
||||
// live default must stop overriding the selection.
|
||||
connect(combo_box, &QComboBox::activated, this, [this](int) { user_picked_ = true; });
|
||||
// live default must stop overriding the selection - and when the saved favourite follows it.
|
||||
connect(combo_box, &QComboBox::activated, this, [this](int) {
|
||||
user_picked_ = true;
|
||||
(combo_is_image_mode_ ? last_image_selection : last_selection) = combo_box->currentData().toInt();
|
||||
SaveFavourite();
|
||||
});
|
||||
|
||||
connect(grid_scan_image, &JFJochGridScanImage::imageSelected,
|
||||
this, &JFJochViewerDatasetInfo::imageSelectedInChart);
|
||||
@@ -102,12 +113,14 @@ JFJochViewerDatasetInfo::JFJochViewerDatasetInfo(QWidget *parent) : QWidget(pare
|
||||
if (grid_button->isChecked())
|
||||
image_button->setChecked(false); // leaves per-image mode: the combo must follow
|
||||
ModeChanged();
|
||||
SaveFavourite();
|
||||
});
|
||||
connect(image_button, &QPushButton::clicked,
|
||||
[this]() {
|
||||
if (image_button->isChecked())
|
||||
grid_button->setChecked(false);
|
||||
ModeChanged();
|
||||
SaveFavourite();
|
||||
});
|
||||
connect(image_chart, &JFJochViewerSidePanelChart::writeStatusBar,
|
||||
[this](QString s, int t) { emit writeStatusBar(s, t); });
|
||||
@@ -123,10 +136,54 @@ void JFJochViewerDatasetInfo::RestoreSelection() {
|
||||
combo_box->setCurrentIndex(live_default);
|
||||
return;
|
||||
}
|
||||
// Each mode remembers its own selection: the two lists are unrelated, so carrying an index
|
||||
// across would land on whatever metric happens to sit at that position in the other list.
|
||||
const int sel = combo_is_image_mode_ ? last_image_selection : last_selection;
|
||||
combo_box->setCurrentIndex(sel < combo_box->count() ? sel : 0);
|
||||
// Each mode remembers its own selection by the item's data code: the two lists are unrelated,
|
||||
// and a code survives the combo being rebuilt with a different item set - one that is no
|
||||
// longer offered simply isn't found and the first item applies.
|
||||
const int index = combo_box->findData(combo_is_image_mode_ ? last_image_selection : last_selection);
|
||||
combo_box->setCurrentIndex(index >= 0 ? index : 0);
|
||||
}
|
||||
|
||||
void JFJochViewerDatasetInfo::SaveFavourite() {
|
||||
if (!dataset)
|
||||
return;
|
||||
QSettings settings("PSI", "jfjoch_viewer");
|
||||
settings.beginGroup(FavouriteGroup(dataset->experiment.GetGridScan().has_value()));
|
||||
settings.setValue("metric", last_selection);
|
||||
settings.setValue("imagePlot", last_image_selection);
|
||||
settings.setValue("perImage", image_button->isChecked());
|
||||
settings.setValue("grid", grid_button->isChecked());
|
||||
}
|
||||
|
||||
void JFJochViewerDatasetInfo::resetPlotDefaults() {
|
||||
user_picked_ = false;
|
||||
image_button->setChecked(false);
|
||||
// A grid scan starts on its 2D map, like a first load with nothing saved.
|
||||
grid_button->setChecked(dataset && dataset->experiment.GetGridScan().has_value());
|
||||
UpdateLabels(); // rebuild the combo for per-dataset mode
|
||||
last_selection = 0; // default selections, after UpdateLabels captured the old ones
|
||||
last_image_selection = 0;
|
||||
RestoreSelection();
|
||||
UpdatePlot();
|
||||
UpdateView();
|
||||
}
|
||||
|
||||
void JFJochViewerDatasetInfo::ApplyFavourite(bool grid_scan) {
|
||||
QSettings settings("PSI", "jfjoch_viewer");
|
||||
settings.beginGroup(FavouriteGroup(grid_scan));
|
||||
image_button->setChecked(settings.value("perImage", false).toBool());
|
||||
// With nothing saved, a grid scan starts on its 2D map.
|
||||
grid_button->setChecked(settings.value("grid", grid_scan).toBool());
|
||||
// ModeChanged's sequence, with the saved codes injected after UpdateLabels has captured the
|
||||
// outgoing selection - the other way round the capture would overwrite them.
|
||||
UpdateLabels();
|
||||
last_selection = settings.value("metric", last_selection).toInt();
|
||||
last_image_selection = settings.value("imagePlot", last_image_selection).toInt();
|
||||
RestoreSelection();
|
||||
if (combo_is_image_mode_)
|
||||
comboBoxSelected(combo_box->currentIndex());
|
||||
else
|
||||
UpdatePlot();
|
||||
UpdateView();
|
||||
}
|
||||
|
||||
void JFJochViewerDatasetInfo::ModeChanged() {
|
||||
@@ -151,7 +208,7 @@ void JFJochViewerDatasetInfo::UpdateLabels() {
|
||||
QSignalBlocker bl(combo_box);
|
||||
|
||||
if (combo_box->count() > 0)
|
||||
(combo_is_image_mode_ ? last_image_selection : last_selection) = combo_box->currentIndex();
|
||||
(combo_is_image_mode_ ? last_image_selection : last_selection) = combo_box->currentData().toInt();
|
||||
|
||||
combo_box->clear();
|
||||
combo_is_image_mode_ = image_button && image_button->isChecked();
|
||||
@@ -218,6 +275,16 @@ void JFJochViewerDatasetInfo::UpdateLabels() {
|
||||
|
||||
void JFJochViewerDatasetInfo::datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset) {
|
||||
this->dataset = dataset;
|
||||
// The first dataset of a kind (grid scan / standard) starts from the saved favourite for that
|
||||
// kind - the user's last explicit plot choice and toggle states on such a dataset.
|
||||
if (dataset) {
|
||||
const bool grid_scan = dataset->experiment.GetGridScan().has_value();
|
||||
if (favourite_kind_ != grid_scan) {
|
||||
favourite_kind_ = grid_scan;
|
||||
ApplyFavourite(grid_scan); // rebuilds the combo for the favourite's mode and re-plots
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Per-image mode: the combo holds plot types and the chart follows the displayed image, so a
|
||||
// new dataset must not repopulate the combo or run the per-dataset plot.
|
||||
if (image_button && image_button->isChecked()) {
|
||||
@@ -329,7 +396,8 @@ void JFJochViewerDatasetInfo::UpdatePlot() {
|
||||
RunColor(static_cast<int>(runs_.size())), XForRun(*live_run_)});
|
||||
}
|
||||
|
||||
// "Spots + background": one plot, two quantities, the background on its own right-hand axis.
|
||||
// "Spots + background": one plot, two quantities — the background on its own left-hand axis,
|
||||
// the spot count on the right.
|
||||
std::optional<JFJochDatasetInfoChartView::NamedSeries> secondary;
|
||||
if (val == SPOTS_PLUS_BACKGROUND) {
|
||||
secondary = JFJochDatasetInfoChartView::NamedSeries{
|
||||
@@ -354,8 +422,6 @@ void JFJochViewerDatasetInfo::UpdatePlot() {
|
||||
if (dataset->experiment.GetGridScan()) {
|
||||
grid_scan_image->loadData(data, dataset->experiment.GetGridScan().value(), one_over_d2);
|
||||
grid_button->setEnabled(true);
|
||||
if (!image_button->isChecked())
|
||||
grid_button->setChecked(true);
|
||||
} else {
|
||||
grid_scan_image->clear();
|
||||
grid_button->setEnabled(false);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <QStackedWidget>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "charts/JFJochDatasetInfoChartView.h"
|
||||
#include "../reader/JFJochReader.h"
|
||||
#include "image_viewer/JFJochGridScanImage.h"
|
||||
@@ -34,9 +36,14 @@ class JFJochViewerDatasetInfo : public QWidget {
|
||||
QPushButton *grid_button = nullptr;
|
||||
QPushButton *image_button = nullptr; // toggle: show per-image profiles instead of the metric
|
||||
|
||||
int last_selection = 0; // last per-dataset metric, by combo index
|
||||
int last_image_selection = 0; // last per-image plot type, by combo index
|
||||
int last_selection = 0; // last per-dataset metric, by combo data code
|
||||
int last_image_selection = 0; // last per-image plot type, by combo data code
|
||||
bool combo_is_image_mode_ = false; // which of the two the combo currently lists
|
||||
// Dataset kind (grid scan or not) whose saved favourite is applied; grid scans and standard
|
||||
// scans each remember their own plot choice and toggle states across viewer restarts.
|
||||
std::optional<bool> favourite_kind_;
|
||||
void SaveFavourite(); // persist the current choice for the loaded dataset's kind
|
||||
void ApplyFavourite(bool grid_scan); // apply the saved choice for that kind and re-plot
|
||||
void UpdatePlot();
|
||||
// Rebuild the combo for whichever mode the toggles now select and re-plot. Every mode switch
|
||||
// must go through this.
|
||||
@@ -70,6 +77,8 @@ public slots:
|
||||
void liveRunUpdated(std::shared_ptr<const JFJochReaderDataset> dataset);
|
||||
// Connected to / disconnected from a live (HTTP) source.
|
||||
void setHttpConnection(bool connected, QString addr = QString());
|
||||
// "Reset all settings to defaults": back to the state a first load of this dataset would show.
|
||||
void resetPlotDefaults();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -78,6 +78,8 @@ JFJochViewerMenu::JFJochViewerMenu(QWidget *parent) : QMenuBar(parent) {
|
||||
viewMenu->addSeparator();
|
||||
const QAction *resetLayout = viewMenu->addAction("Reset layout");
|
||||
connect(resetLayout, &QAction::triggered, this, &JFJochViewerMenu::resetLayoutSelected);
|
||||
const QAction *resetSettings = viewMenu->addAction("Reset all settings to defaults");
|
||||
connect(resetSettings, &QAction::triggered, this, &JFJochViewerMenu::resetSettingsSelected);
|
||||
viewMenu->addSeparator();
|
||||
// Auto-detected from the session (ssh -X and the like); this toggle is the manual override.
|
||||
QAction *remoteMode = viewMenu->addAction("Remote display mode (limit repaints)");
|
||||
@@ -202,7 +204,9 @@ void JFJochViewerMenu::closeSelected() {
|
||||
}
|
||||
|
||||
void JFJochViewerMenu::quitSelected() {
|
||||
QApplication::quit();
|
||||
// Through close(), not QApplication::quit(): closeEvent is where the persistent settings
|
||||
// are saved, and quit() would bypass it.
|
||||
window()->close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ signals:
|
||||
void imageLayoutSelected();
|
||||
void processingLayoutSelected();
|
||||
void resetLayoutSelected();
|
||||
void resetSettingsSelected();
|
||||
|
||||
private slots:
|
||||
void aboutSelected();
|
||||
|
||||
@@ -120,7 +120,7 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString
|
||||
|
||||
// Central area: the diffraction image. Everything else (inspector, plots, processing) is a
|
||||
// dock, so the layout can be rearranged, saved, and switched between perspectives.
|
||||
auto viewer = new JFJochDiffractionImage(this);
|
||||
viewer = new JFJochDiffractionImage(this);
|
||||
viewer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setCentralWidget(viewer);
|
||||
|
||||
@@ -406,7 +406,7 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString
|
||||
// --- Magnifier ---
|
||||
// The magnifier shows the frame the main view has already rendered - the same pixels with
|
||||
// its own zoom and centre - so it neither converts nor colours anything itself.
|
||||
connect(viewer, &JFJochImage::frameRendered, magnifierWindow, [viewer, magnifierWindow] {
|
||||
connect(viewer, &JFJochImage::frameRendered, magnifierWindow, [this, magnifierWindow] {
|
||||
magnifierWindow->setFrame(viewer->Frame());
|
||||
});
|
||||
|
||||
@@ -569,6 +569,7 @@ JFJochViewerWindow::JFJochViewerWindow(QWidget *parent, bool dbus, const QString
|
||||
[this] { ApplyPerspective(Perspective::Processing); });
|
||||
connect(menuBar, &JFJochViewerMenu::resetLayoutSelected, this,
|
||||
[this] { if (!defaultLayoutState.isEmpty()) restoreState(defaultLayoutState, kLayoutVersion); });
|
||||
connect(menuBar, &JFJochViewerMenu::resetSettingsSelected, this, &JFJochViewerWindow::ResetAllSettings);
|
||||
|
||||
// Tear-off floating is disabled for all docks: a floated QDockWidget is unreliable across platforms
|
||||
// (on WSLg it becomes an off-screen, override-redirect window that can't be focused or recovered, so
|
||||
@@ -621,6 +622,36 @@ void JFJochViewerWindow::ApplyPerspective(Perspective p) {
|
||||
d->setVisible(processing);
|
||||
}
|
||||
|
||||
void JFJochViewerWindow::ResetAllSettings() {
|
||||
const auto reply = QMessageBox::question(
|
||||
this, "Reset all settings",
|
||||
"Reset all viewer settings to defaults - window layout, display settings, plot choices "
|
||||
"and the file manager root?",
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
if (reply != QMessageBox::Yes)
|
||||
return;
|
||||
QSettings("PSI", "jfjoch_viewer").clear();
|
||||
|
||||
// Bring the running session to the state a first start builds, so normal saving on close is
|
||||
// correct again afterwards. Same calls as the constructor, in the same order.
|
||||
if (!defaultLayoutState.isEmpty())
|
||||
restoreState(defaultLayoutState, kLayoutVersion);
|
||||
showNormal();
|
||||
const QRect avail = QGuiApplication::primaryScreen()->availableGeometry();
|
||||
resize(qMin(1200, avail.width() - 100), qMin(1100, avail.height() - 100));
|
||||
|
||||
viewer->setColorMap(static_cast<int>(ColorScaleEnum::Indigo));
|
||||
toolBarDisplay->updateColorMap(static_cast<int>(ColorScaleEnum::Indigo));
|
||||
viewer->setAutoForeground(false); // emits autoForegroundChanged -> toolbar button state
|
||||
viewer->setHDRMode(false);
|
||||
toolBarDisplay->updateHDRMode(false);
|
||||
|
||||
for (auto *info : findChildren<JFJochViewerDatasetInfo *>())
|
||||
info->resetPlotDefaults();
|
||||
for (auto *browser : findChildren<JFJochViewerFileBrowser *>())
|
||||
browser->ResetToDefaultRoot();
|
||||
}
|
||||
|
||||
void JFJochViewerWindow::closeEvent(QCloseEvent *event) {
|
||||
// Persist the dock/toolbar arrangement and window geometry so the next launch resumes it.
|
||||
QSettings settings("PSI", "jfjoch_viewer");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "toolbar/JFJochViewerToolbarDisplay.h"
|
||||
|
||||
class JFJochProcessingJobsWindow;
|
||||
class JFJochDiffractionImage;
|
||||
class QDockWidget;
|
||||
|
||||
class JFJochViewerWindow : public QMainWindow {
|
||||
@@ -29,6 +30,7 @@ public:
|
||||
private:
|
||||
JFJochViewerMenu *menuBar;
|
||||
JFJochImageReadingWorker *reading_worker;
|
||||
JFJochDiffractionImage *viewer; // central diffraction image
|
||||
JFJochViewerToolbarDisplay *toolBarDisplay;
|
||||
JFJochViewerStatusBar *statusbar;
|
||||
JFJochProcessingJobsWindow *processingJobsWindow;
|
||||
@@ -55,6 +57,8 @@ private:
|
||||
QByteArray defaultLayoutState; // captured after construction, for "Reset layout"
|
||||
int datasetInfoCounter = 0; // gives each dataset-info dock a unique objectName
|
||||
|
||||
void ResetAllSettings();
|
||||
|
||||
QThread *reading_thread;
|
||||
|
||||
// Named layouts. Image = just the image + inspector; Processing = also the plots + jobs panel.
|
||||
|
||||
@@ -431,9 +431,10 @@ void JFJochDatasetInfoChartView::buildTimeDomainChart() {
|
||||
chart()->setMargins(m);
|
||||
}
|
||||
} else {
|
||||
// Normal numeric labels, axis on the LEFT
|
||||
// Normal numeric labels, axis on the LEFT — unless a secondary quantity takes the
|
||||
// left side, in which case the primary reads on the RIGHT.
|
||||
chart()->removeAxis(axisY);
|
||||
chart()->addAxis(axisY, Qt::AlignLeft);
|
||||
chart()->addAxis(axisY, secondary_.has_value() ? Qt::AlignRight : Qt::AlignLeft);
|
||||
series->attachAxis(axisY);
|
||||
currentSeries->attachAxis(axisY);
|
||||
|
||||
@@ -450,9 +451,14 @@ void JFJochDatasetInfoChartView::buildTimeDomainChart() {
|
||||
line->attachAxis(ax);
|
||||
}
|
||||
|
||||
// Secondary quantity: same x, its own Y axis on the right, so a small background value is
|
||||
// not flattened by a spot count three orders of magnitude larger. The 1/d^2 layout already
|
||||
// owns the right-hand side, so the two never combine.
|
||||
// Secondary quantity: same x, its own Y axis on the LEFT (the primary then reads on the
|
||||
// RIGHT), so a small background value is not flattened by a spot count three orders of
|
||||
// magnitude larger. Each axis is ranged from its own series alone; on top of that the
|
||||
// primary's max and the secondary's min are each inflated by that series' own span, so the
|
||||
// primary (spot count) curve occupies the lower half of the plot and the secondary the
|
||||
// upper half. That way it is the background axis whose floor gets pushed down - a spot
|
||||
// count below zero is nonsense, a background below zero is at least conceivable. A
|
||||
// secondary never combines with the 1/d^2 layout.
|
||||
if (secondary_.has_value() && !m_yOneOverD) {
|
||||
auto *line = new QLineSeries(this);
|
||||
line->setName(secondary_->name);
|
||||
@@ -466,18 +472,27 @@ void JFJochDatasetInfoChartView::buildTimeDomainChart() {
|
||||
auto *axisY2 = new QValueAxis();
|
||||
if (std::isfinite(secMin) && std::isfinite(secMax)) {
|
||||
const double lo = m_minYZeroEnabled ? 0.0 : secMin;
|
||||
axisY2->setRange(lo, (secMax > lo) ? secMax : (lo + 1.0));
|
||||
const double hi = (secMax > lo) ? secMax : (lo + 1.0);
|
||||
axisY2->setRange(hi - 2.0 * (hi - lo), hi); // upper half
|
||||
}
|
||||
if (secondary_->color.isValid())
|
||||
axisY2->setLabelsColor(secondary_->color);
|
||||
chart()->addAxis(axisY2, Qt::AlignRight);
|
||||
chart()->addAxis(axisY2, Qt::AlignLeft);
|
||||
line->attachAxis(axisY2);
|
||||
for (auto *ax: finalAxes)
|
||||
if (ax->orientation() == Qt::Horizontal)
|
||||
line->attachAxis(ax);
|
||||
// Colour the left labels to match the primary, so it is clear which axis reads which.
|
||||
if (axisY && primary_color_.isValid())
|
||||
if (axisY)
|
||||
axisY->setRange(axisY->min(),
|
||||
axisY->min() + 2.0 * (axisY->max() - axisY->min())); // lower half
|
||||
// Each axis carries its series' colour on labels and axis line, so it is clear at a
|
||||
// glance which axis reads which curve.
|
||||
if (secondary_->color.isValid()) {
|
||||
axisY2->setLabelsColor(secondary_->color);
|
||||
axisY2->setLinePenColor(secondary_->color);
|
||||
}
|
||||
if (axisY && primary_color_.isValid()) {
|
||||
axisY->setLabelsColor(primary_color_);
|
||||
axisY->setLinePenColor(primary_color_);
|
||||
}
|
||||
}
|
||||
|
||||
// The current-image marker is not a run - keep it out of the legend.
|
||||
|
||||
@@ -53,8 +53,9 @@ public:
|
||||
struct NamedSeries { QString name; std::vector<float> values; QColor color; std::vector<float> x; };
|
||||
private:
|
||||
std::vector<NamedSeries> overlays_;
|
||||
// A second quantity plotted against the same x but on its own right-hand Y axis, for a metric
|
||||
// pair whose units are unrelated (spot count vs background per pixel). Never 1/d^2-transformed.
|
||||
// A second quantity plotted against the same x but on its own left-hand Y axis (the primary
|
||||
// then moves to the right), for a metric pair whose units are unrelated (spot count vs
|
||||
// background per pixel). Never 1/d^2-transformed.
|
||||
std::optional<NamedSeries> secondary_;
|
||||
QColor primary_color_; // colour of the active (primary) run, if assigned
|
||||
std::vector<float> primary_x_; // x (image numbers) for the primary series; empty => index
|
||||
|
||||
@@ -113,6 +113,10 @@ void JFJochViewerFileBrowser::SetRoot(const QString &path) {
|
||||
QSettings("PSI", "jfjoch_viewer").setValue(kSettingsKey, canonical);
|
||||
}
|
||||
|
||||
void JFJochViewerFileBrowser::ResetToDefaultRoot() {
|
||||
SetRoot(DefaultRoot());
|
||||
}
|
||||
|
||||
void JFJochViewerFileBrowser::onBrowseClicked() {
|
||||
const QString dir = QFileDialog::getExistingDirectory(this, "Select data root", root_edit_->text());
|
||||
if (!dir.isEmpty())
|
||||
|
||||
@@ -29,6 +29,10 @@ class JFJochViewerFileBrowser : public QWidget {
|
||||
void SetRoot(const QString &path);
|
||||
[[nodiscard]] static QString DefaultRoot();
|
||||
|
||||
public slots:
|
||||
// "Reset all settings to defaults": back to the root a fresh start would pick.
|
||||
void ResetToDefaultRoot();
|
||||
|
||||
private slots:
|
||||
void onBrowseClicked();
|
||||
void onRootEditingFinished();
|
||||
|
||||
@@ -23,7 +23,6 @@ QList<QPair<QString, int>> JFJochViewerSidePanelChart::PlotTypes() {
|
||||
{"I/sigma", 2},
|
||||
{"Spots (count)", 5},
|
||||
{"Spots (intensity)", 6},
|
||||
{"X-ray fluorescence spectrum", 4},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -53,13 +52,6 @@ void JFJochViewerSidePanelChart::redrawPlot() {
|
||||
y = image->ImageData().integration_Isigma;
|
||||
azint_plot->UpdateData(x, y, "d [Å]", "I/sigma", true);
|
||||
break;
|
||||
case 4:
|
||||
x = image->Dataset().experiment.GetFluorescenceSpectrum().GetEnergy_eV();
|
||||
y = image->Dataset().experiment.GetFluorescenceSpectrum().GetData();
|
||||
for (auto &iter: x)
|
||||
iter /= 1000.0; // Convert eV to keV
|
||||
azint_plot->UpdateData(x, y, "E [keV]", "", false);
|
||||
break;
|
||||
case 5:
|
||||
x = image->ImageData().spot_plot_one_over_d_square;
|
||||
y = image->ImageData().spot_plot_count;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "../../reader/JFJochReaderImage.h"
|
||||
#include "../charts/JFJochSimpleChartView.h"
|
||||
|
||||
// Per-image profile plot (azimuthal 1D, Wilson, I/sigma, spots, fluorescence). It has no selector
|
||||
// Per-image profile plot (azimuthal 1D, Wilson, I/sigma, spots). It has no selector
|
||||
// of its own — the host (dataset-info dock) drives the plot type via setPlotType, reusing its one
|
||||
// combo box.
|
||||
class JFJochViewerSidePanelChart : public QWidget {
|
||||
|
||||
Reference in new issue
Block a user