Files
Jungfraujoch/viewer/JFJochViewerDatasetInfo.h
T
leonarski_f 9aae0c2ba7
Build Packages / Create release (push) Successful in 21s
Build Packages / build:rugnux-tgz (x86_64) (push) Successful in 9m40s
Build Packages / build:rugnux:aarch64 (cross) (push) Successful in 9m49s
Build Packages / build:viewer-tgz:cpu (push) Successful in 11m37s
Build Packages / build:viewer-tgz:cuda (push) Successful in 12m40s
Build Packages / build:windows:nocuda (push) Successful in 17m44s
Build Packages / build:windows:cuda (push) Successful in 20m13s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 14m41s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m59s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 15m5s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 14m35s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 15m53s
Build Packages / build:rugnux:windows (push) Successful in 11m29s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 18m51s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 18m43s
Build Packages / Generate python client (push) Successful in 51s
Build Packages / build:rpm (rocky8) (push) Successful in 18m51s
Build Packages / Build documentation (push) Successful in 1m21s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 18m38s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 18m24s
Build Packages / build:rpm (rocky9) (push) Successful in 19m19s
Build Packages / Unit tests (push) Successful in 1h37m15s
v1.0.0-rc.169 (#79)
* Building Jungfraujoch no longer needs zlib or Eigen installed on the machine, and the dependencies the build fetches are pinned and updated to current releases.
* rugnux: improvements in indexing, lattice selection and geometry post-refinement, which index crystals that previously returned no lattice and keep the better of the two geometries a run measures.
* rugnux: improvements in beam-centre measurement, beam-stop detection and space-group determination.
* rugnux: the unit cell reported with a determined space group now obeys that group - a cell whose symmetry was confirmed from the intensities is re-refined under it, and a cell the group cannot describe is reported with a warning rather than as it stands.
* rugnux drops the stretches of a rotation sweep whose removal measurably improves the merged intensities and reports what became of every frame, and decides the resolution cut on the crystal's own diffraction rather than on its ice rings.
* The rugnux results report is machine-readable - every line that is not `KEY= value` data starts with `#` - and states the build it was written by, its authorship and its terms of use (`REPORT_VERSION= 8`).
* `jfjoch_viewer`: improvements in the file manager (CBF frames beside HDF5 datasets, a remembered root), the dataset plots, the inspector and the image statistics, plus a settable font size, a view of the rugnux results report, usable performance over a remote display (`ssh -X`) and a reset of all settings to defaults; the reciprocal-space window is removed.
* Broker fixes around DECTRIS collections and dark-mask calibration: re-initialising after a run that never started no longer freezes the broker, a cancelled calibration is abandoned instead of reported as done, and a collection whose start message never arrives ends by itself.

Reviewed-on: #79
Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
2026-09-15 17:09:31 +02:00

96 lines
4.6 KiB
C++

// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <QComboBox>
#include <QStackedWidget>
#include <QPushButton>
#include <optional>
#include "charts/JFJochDatasetInfoChartView.h"
#include "../reader/JFJochReader.h"
#include "image_viewer/JFJochGridScanImage.h"
#include "widgets/JFJochViewerSidePanelChart.h"
#include "RunData.h"
class JFJochViewerDatasetInfo : public QWidget {
Q_OBJECT
QComboBox *combo_box;
JFJochDatasetInfoChartView *chart_view;
// Second half-height plot under the first, shown only for "Spots + background": the spot
// count and the background each get their own compact plot instead of sharing twin axes.
JFJochDatasetInfoChartView *chart_view2;
QWidget *charts_holder; // the two stacked chart views, as one stack page
const std::vector<float> *GetDataset();
std::shared_ptr<const JFJochReaderDataset> dataset; // the active (primary) run
std::shared_ptr<const JFJochReaderImage> image;
JFJochGridScanImage *grid_scan_image = nullptr;
JFJochViewerSidePanelChart *image_chart = nullptr; // per-image profiles (azimuthal, Wilson, ...)
QVector<RunData> runs_; // all runs, for overlay lines
QString active_id_; // which run is primary
std::shared_ptr<const JFJochReaderDataset> live_run_; // in-progress reprocessing, if any
bool http_connected_ = false; // live source: default the plot to spots + background
bool user_picked_ = false; // ... unless the user has picked a metric themselves
QStackedWidget *stack = nullptr;
QPushButton *reset_button = nullptr;
QPushButton *grid_button = nullptr;
QPushButton *image_button = nullptr; // toggle: show per-image profiles instead of the metric
QPushButton *add_plot_button = nullptr;
// The button row is sized in character widths, so it follows the font zoom.
void UpdateButtonWidths();
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.
void ModeChanged();
void UpdateView(); // pick the stack page from the grid / per-image toggles
// Pull the metric selected by combo value `val` out of one run's dataset.
std::vector<float> ExtractMetric(const JFJochReaderDataset &ds, int val, bool &one_over_d2) const;
void changeEvent(QEvent *event) override;
void UpdateLabels();
// Restores the combo selection after UpdateLabels() repopulated it, without firing
// currentIndexChanged: the callers run UpdatePlot() themselves straight afterwards.
void RestoreSelection();
signals:
void imageSelected(int64_t number, int64_t summation);
void writeStatusBar(QString string, int timeout_ms = 0);
void addPlot(); // request another dataset-info plot dock
public:
explicit JFJochViewerDatasetInfo(QWidget *parent = nullptr);
private slots:
void imageSelectedInChart(int64_t number);
void comboBoxSelected(int val);
void resetZoomButtonPressed();
public slots:
void datasetLoaded(std::shared_ptr<const JFJochReaderDataset> dataset);
void imageLoaded(std::shared_ptr<const JFJochReaderImage> image);
void setColorMap(int color_map);
// All runs (original + reprocessing snapshots) and which one is active/primary.
void runsChanged(QVector<RunData> runs, QString active_id);
// Live results of the in-progress reprocessing run (updated as it goes), or nullptr to clear.
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();
};