jfjoch_process: optional absorption surface for rot3d scaling (--absorption)
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 13m18s
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 14m31s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 14m57s
Build Packages / build:rpm (rocky8) (push) Successful in 14m6s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 15m15s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 15m23s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 15m34s
Build Packages / XDS test (neggia plugin) (push) Successful in 8m55s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 9m17s
Build Packages / XDS test (durin plugin) (push) Successful in 9m25s
Build Packages / Create release (push) Skipped
Build Packages / Generate python client (push) Successful in 28s
Build Packages / Build documentation (push) Successful in 57s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 11m31s
Build Packages / build:rpm (rocky9) (push) Successful in 12m45s
Build Packages / build:rpm (ubuntu2404) (push) Successful in 11m44s
Build Packages / DIALS test (push) Successful in 13m3s
Build Packages / Unit tests (push) Successful in 58m30s
Build Packages / build:windows:cuda (push) Successful in 20m21s
Build Packages / build:windows:nocuda (push) Successful in 10m30s

Adds an opt-in smooth absorption correction for rotation scaling. After the
rot3d fulls are scaled, --absorption[=num] fits a multiplicative surface
A(s1_crystal) - a degree<=4 monomial basis (real spherical harmonics up to l=4,
as XDS/DIALS) of the diffracted-beam direction in the crystal/goniometer frame,
by ridge-regularized log-linear least-squares of I_scaled/I_ref weighted by
(I/sigma)^2, over num iterations (default 3); the surface divides image_scale_corr
and the fulls are re-merged.

Off by default and a no-op without rot3d. On the test panel (~13 keV, thin
crystals) it is metric-neutral - fitted rms(log A) ~3-4%, ISa/CC1/2 unchanged -
because absorption is negligible there and the per-frame scale G(phi) already
absorbs the angular part. It is kept as a lever for low-energy data (e.g. 6 keV)
where absorption becomes significant. Stored as ScalingSettings::absorption_iter.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 15:23:01 +02:00
co-authored by Claude Opus 4.8
parent 77f1ed2566
commit e45a1577d6
4 changed files with 115 additions and 1 deletions
+10 -1
View File
@@ -52,6 +52,7 @@ void print_usage() {
std::cout << " --scale-fulls After -P rot3d combine, refit a per-frame scale on the fulls (XDS order, Unity model); implies -M. Default ON for rot3d" << std::endl;
std::cout << " --no-scale-fulls Disable the rot3d scale-fulls refit (it is on by default for rot3d)" << std::endl;
std::cout << " --write-process-h5 Also write the (large) _process.h5 when merging (default: only .mtz/.cif when merging)" << std::endl;
std::cout << " --absorption[=num] rot3d: fit a smooth absorption surface on the fulls over num iterations (default 3; off by default; matters at low energy)" << std::endl;
std::cout << " --smooth-g[=num] rot3d: smooth per-frame scale G over a num-frame window before the combine (default: 9 for rot3d; 0 = off)" << std::endl;
std::cout << " -P, --partiality <txt> Partiality model fixed|rot|rot3d|unity (default: fixed). rot3d = rot + 3D combine of per-frame partials" << std::endl;
std::cout << " -A, --anomalous Anomalous mode (don't merge Friedel pairs)" << std::endl;
@@ -103,7 +104,8 @@ enum {
OPT_SMOOTH_G,
OPT_RECIPROCAL_PROFILE,
OPT_NO_SCALE_FULLS,
OPT_WRITE_PROCESS_H5
OPT_WRITE_PROCESS_H5,
OPT_ABSORPTION
};
static option long_options[] = {
@@ -127,6 +129,7 @@ static option long_options[] = {
{"scale-fulls", no_argument, nullptr, OPT_SCALE_FULLS},
{"no-scale-fulls", no_argument, nullptr, OPT_NO_SCALE_FULLS},
{"write-process-h5", no_argument, nullptr, OPT_WRITE_PROCESS_H5},
{"absorption", optional_argument, nullptr, OPT_ABSORPTION},
{"smooth-g", optional_argument, nullptr, OPT_SMOOTH_G},
{"refine", required_argument, nullptr, 'r'},
@@ -291,6 +294,7 @@ int main(int argc, char **argv) {
bool run_scaling = false;
std::optional<bool> scale_fulls_arg; // --scale-fulls / --no-scale-fulls; default on for rot3d
bool write_process_h5_flag = false; // --write-process-h5; also write _process.h5 when merging
int absorption_iter = 0; // --absorption[=n]; rot3d absorption-surface iterations (0 = off)
std::optional<int> smooth_g_window_arg; // --smooth-g[=window]; default 9 for rot3d, 0 (off) otherwise
bool anomalous_mode = false;
std::optional<int64_t> space_group_number;
@@ -531,6 +535,10 @@ int main(int argc, char **argv) {
case OPT_WRITE_PROCESS_H5:
write_process_h5_flag = true;
break;
case OPT_ABSORPTION:
absorption_iter = optarg ? std::stoi(optarg) : 3;
run_scaling = true;
break;
case OPT_SMOOTH_G:
smooth_g_window_arg = optarg ? std::stoi(optarg) : 9;
break;
@@ -748,6 +756,7 @@ int main(int argc, char **argv) {
scaling_settings.SetPartialityModel(partiality_model);
scaling_settings.Combine3D(combine_3d);
scaling_settings.ScaleFulls(scale_fulls);
scaling_settings.AbsorptionIter(absorption_iter);
scaling_settings.SmoothGWindow(smooth_g_window_arg.value_or(combine_3d ? 9 : 0));
if (d_min_scale_merge)
scaling_settings.HighResolutionLimit_A(d_min_scale_merge.value());