Files
leonarski_f 54c667190f
Build Packages / Unit tests (push) Successful in 1h26m8s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 13m38s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 13m45s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 13m39s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 12m55s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 13m51s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 14m35s
Build Packages / build:rpm (rocky8) (push) Successful in 12m28s
Build Packages / build:rpm (rocky9) (push) Successful in 13m20s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 12m15s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 11m43s
Build Packages / DIALS test (push) Successful in 14m21s
Build Packages / XDS test (durin plugin) (push) Successful in 7m48s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 7m52s
Build Packages / XDS test (neggia plugin) (push) Successful in 7m31s
Build Packages / Generate python client (push) Successful in 15s
Build Packages / Build documentation (push) Successful in 53s
Build Packages / Create release (push) Skipped
v1.0.0-rc.155 (#65)
This is an UNSTABLE release. It includes many experimental features, as well as many AI generated fixes. We recommend using rc.152 for production use.

* jfjoch_process: Remove pixelrefine option (replaced with ProfileIntegrate2D)
* jfjoch_viewer: Some graphical improvements.
* jfjoch_viewer: Simplify und unify data analysis settings.
* jfjoch_writer: Add TCP keepalive to increase robustness if jfjoch_broker "dies" in the middle of data acquisition.

Reviewed-on: #65
2026-06-25 22:01:48 +02:00

56 lines
3.0 KiB
C++

// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include <optional>
#include <string>
#include <vector>
#include "../common/Reflection.h"
#include "../common/UnitCell.h"
// A column an MTZ offers as reference intensities/structure factors (type 'J' mean intensity or
// 'F' amplitude). Surfaced so the caller (CLI flag / viewer combo) can pick which one to scale
// against and report the choice, rather than the loader silently guessing.
struct ReferenceMtzColumn {
std::string label;
char type = '\0'; // 'J' = mean intensity, 'F' = structure-factor amplitude
};
// Reference reflections loaded from an MTZ, plus the metadata a user needs to judge whether the
// reference matches the data being scaled: which column was used, the cell / space group it was
// recorded in, its resolution range and reflection count.
struct ReferenceMtzData {
std::vector<MergedReflection> reflections; // h,k,l,I,d set (sigma stays NaN)
std::optional<UnitCell> cell;
std::optional<int> space_group_number;
std::string space_group_name; // Hermann-Mauguin short symbol, for display
std::string point_group; // point-group symbol, for the consistency check
std::string used_column;
char used_column_type = '\0';
bool squared = false; // an 'F' column was squared to an intensity
bool default_column = true; // column was auto-selected, not user-specified
std::vector<ReferenceMtzColumn> candidate_columns;
double d_min = 0.0;
double d_max = 0.0;
};
// Load reference reflections from an MTZ. With no column requested the smart default is used:
// a calculated structure factor F-model (squared to an intensity), else a merged/observed
// intensity column (IMEAN/I/IOBS/...), else any mean-intensity (J) column - this also lets
// reference-based scaling be self-seeded from the data's own previous merge. A requested column overrides
// the default (an 'F'-type column is squared, a 'J'-type used directly). Throws if the requested
// column is missing or no usable column exists.
ReferenceMtzData LoadReferenceMtz(const std::string& path,
const std::optional<std::string>& column = std::nullopt);
// Compare a loaded reference against the data it will scale. Returns an empty string when they are
// consistent (or when the data cell / space group is unknown, so nothing can be said); otherwise a
// one-line, human-readable description of the mismatch to warn the user about. Reference intensities
// keyed in a different point group or cell do not correspond to the data, so this is the check that
// makes reference-based scaling and CCref trustworthy.
std::string ReferenceConsistencyWarning(const ReferenceMtzData& reference,
const std::optional<UnitCell>& data_cell,
std::optional<int> data_space_group_number);