Build Packages / Create release (push) Successful in 26s
Build Packages / Build documentation (push) Successful in 1m43s
Build Packages / build:portable:macos-arm64:nocuda (push) Successful in 5m7s
Build Packages / build:portable:linux-x86_64:nocuda (push) Successful in 11m48s
Build Packages / build:rugnux:linux-aarch64:cuda (push) Successful in 7m22s
Build Packages / build:portable:linux-x86_64:cuda (push) Successful in 12m24s
Build Packages / HDF5 consumer tests (DIALS, XDS) (push) Successful in 25m30s
Build Packages / build:portable:windows-x86_64:nocuda (push) Successful in 25m29s
Build Packages / build:portable:windows-x86_64:cuda (push) Successful in 29m41s
Build Packages / build:jfjoch:ubuntu2204:nocuda (push) Successful in 21m44s
Build Packages / build:jfjoch:rocky8:nocuda (push) Successful in 24m41s
Build Packages / build:jfjoch:rocky9:nocuda (push) Successful in 26m9s
Build Packages / build:jfjoch:ubuntu2404:nocuda (push) Successful in 26m3s
Build Packages / build:jfjoch:rocky8:cuda-sls9 (push) Successful in 28m28s
Build Packages / Generate python client (push) Successful in 27s
Build Packages / build:jfjoch:rocky9:cuda-sls9 (push) Successful in 31m16s
Build Packages / build:jfjoch:ubuntu2204:cuda (push) Successful in 20m44s
Build Packages / build:jfjoch:rocky8:cuda (push) Successful in 26m27s
Build Packages / build:jfjoch:ubuntu2404:cuda (push) Successful in 22m52s
Build Packages / build:jfjoch:rocky9:cuda (push) Successful in 27m44s
Build Packages / Unit tests (push) Successful in 1h46m55s
Build Packages / Validation Battery (push) Successful in 52m50s
* Rugnux: Several rotation sweeps of one crystal are merged as one dataset (`rugnux a_master.h5 b_master.h5`), on a common indexing and cell, with a non-isomorphous sweep left out and reported; `--sweeps separate` processes each sweep on its own. Bruker `.sfrm` frames and imgCIF files with a full goniometer axis chain are read. * Rugnux: More robust rotation processing - a retry with a more sensitive spot finder when no lattice is found, a self-consistent detector distance, long axes and doubled cells tested as hypotheses, a `-C` supercell multiple stepped down, and each ice ring merged, down-weighted or rejected on its own. * Rugnux: Serial stills are merged with a partiality-aware error model, reported as `ERROR_MODEL_A/B/C` with no ISa or R_merge/R_meas/R_pim; runs without `-S` have an overall intensity scale about 0.86-0.88 times that of earlier versions, with unchanged statistics. A second crystal form is left out of the merge and reported, the indexing ambiguity is resolved more reliably, and `--model` no longer influences processing. * Rugnux: The reported CC1/2 is the standard unweighted one, which can be lower than before on sweeps with weak frames; ISa comes with a 95% interval (`ISA_LOW`/`ISA_HIGH`). * Rugnux: Model refinement adds anisotropic/TLS, local NCS and twin refinement where R-free supports them; building waters and relabelling ions is now off by default (`--refine-solvent` turns it on). * NXmx: A detector of several modules is written as `module_0` ... `module_N` only, so DIALS reads each module as its own panel. * Other: JPEG previews use a bundled encoder (libjpeg-turbo no longer needed), Rugnux prints how to cite it, and the release archives contain the HTML documentation. Reviewed-on: #92 Co-authored-by: Filip Leonarski <filip.leonarski@psi.ch>
117 lines
3.8 KiB
C++
117 lines
3.8 KiB
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include "JFJochAzIntImage.h"
|
|
#include <QVBoxLayout>
|
|
|
|
#include "../../common/JFJochException.h"
|
|
#include "../../common/JFJochMath.h"
|
|
|
|
JFJochAzIntImage::JFJochAzIntImage(QWidget *parent)
|
|
: JFJochImage(parent) {
|
|
}
|
|
|
|
void JFJochAzIntImage::Clear() {
|
|
W = 0;
|
|
H = 0;
|
|
image_fp.clear();
|
|
if (scene())
|
|
scene()->clear();
|
|
resetScenePointers();
|
|
}
|
|
|
|
void JFJochAzIntImage::imageLoaded(std::shared_ptr<const JFJochReaderImage> in_image) {
|
|
if (!in_image) {
|
|
Clear();
|
|
return;
|
|
}
|
|
|
|
const auto &profile = in_image->ImageData().az_int_profile;
|
|
const auto &ds = in_image->Dataset();
|
|
int az_bins = ds.azimuthal_bins;
|
|
int q_bins = ds.q_bins;
|
|
|
|
if (az_bins > 0 && q_bins > 0 && profile.size() == static_cast<size_t>(az_bins * q_bins)
|
|
&& ds.az_int_bin_to_phi.size() == profile.size() && ds.az_int_bin_to_q.size() == profile.size()) {
|
|
|
|
image = in_image;
|
|
float local_min = range_min, local_max = range_max;
|
|
if (auto_range) {
|
|
local_min = std::numeric_limits<float>::infinity();
|
|
local_max = -std::numeric_limits<float>::infinity();
|
|
for (float v : profile) {
|
|
if (std::isfinite(v)) {
|
|
if (v < local_min) local_min = v;
|
|
if (v > local_max) local_max = v;
|
|
}
|
|
}
|
|
if (!std::isfinite(local_min) || !std::isfinite(local_max) || local_max <= local_min) {
|
|
Clear();
|
|
return;
|
|
}
|
|
} else {
|
|
if (!(std::isfinite(local_min) && std::isfinite(local_max) && local_max > local_min)) {
|
|
Clear();
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Update base class members
|
|
W = q_bins;
|
|
H = az_bins;
|
|
image_fp = profile;
|
|
|
|
// Update foreground/background for color mapping
|
|
background = local_min;
|
|
foreground = local_max;
|
|
emit backgroundChanged(background);
|
|
emit foregroundChanged(foreground);
|
|
|
|
// Render the image and redraw using base class functionality
|
|
RenderImage();
|
|
Redraw();
|
|
} else {
|
|
Clear();
|
|
}
|
|
}
|
|
|
|
void JFJochAzIntImage::mouseHover(const QPointF &scenePos, Qt::KeyboardModifiers) {
|
|
if (!scene() || !image || W == 0 || H == 0) return;
|
|
|
|
int x = static_cast<int>(scenePos.x());
|
|
int y = static_cast<int>(scenePos.y());
|
|
|
|
if (x >= 0 && x < static_cast<int>(W) && y >= 0 && y < static_cast<int>(H)) {
|
|
size_t idx = y * W + x;
|
|
|
|
QString statusText = QString("Q: %1 Å^-1 phi: %2° value: %3")
|
|
.arg(QString::number(image->Dataset().az_int_bin_to_q[idx], 'f', 3))
|
|
.arg(QString::number(image->Dataset().az_int_bin_to_phi[idx], 'f', 3))
|
|
.arg(QString::number(image_fp[idx], 'f', 3));
|
|
|
|
emit writeStatusBar(statusText, 0);
|
|
}
|
|
}
|
|
|
|
void JFJochAzIntImage::mouseDoubleClickEvent(QMouseEvent *event) {
|
|
if (!scene() || !image || W == 0 || H == 0) return;
|
|
|
|
QPointF scenePos = mapToScene(event->pos());
|
|
int x = static_cast<int>(scenePos.x());
|
|
int y = static_cast<int>(scenePos.y());
|
|
|
|
if (x >= 0 && x < static_cast<int>(W) && y >= 0 && y < static_cast<int>(H)) {
|
|
size_t idx = y * W + x;
|
|
|
|
float q = image->Dataset().az_int_bin_to_q[idx];
|
|
float phi = image->Dataset().az_int_bin_to_phi[idx];
|
|
|
|
auto geom = image->Dataset().experiment.GetDiffractionGeometry();
|
|
try {
|
|
auto coord = geom.ResPhiToPxl(2 * PI / q, phi / 180.0 * PI);
|
|
emit zoomOnBin(QPointF(coord.first, coord.second));
|
|
} catch (const std::exception &) {
|
|
// a bin beyond 2 theta = 180 deg (manual High Q above 4 pi / lambda) is on no pixel
|
|
}
|
|
}
|
|
} |