Remove the global (joint) scaling path

Profiling showed the joint Ceres solve took ~120 s versus ~3.5 s for the
alternating per-image scaling loop (~35x) for no quality gain (HEWL
anomalous 0.54x vs 0.53x), so it is not worth keeping. Drop
GlobalScale.{h,cpp}, the jfjoch_process --global-scale flag, and
ScalingSettings::GlobalScaling.

While here, in the same scaling/process area: fold scale_fulls into
ScalingSettings (alongside combine_3d) so the CLI and experiment carry it
uniformly, add per-substep [timing] logging to the scaling/merge post-pass
(including the serial MergeAll vs parallel ScaleAllImages split), and carry
structured MergeStatistics + ISa in ProcessResult.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-25 20:43:04 +02:00
co-authored by Claude Opus 4.8
parent a37613690e
commit c84d581d3e
8 changed files with 71 additions and 641 deletions
+1 -10
View File
@@ -49,7 +49,6 @@ void print_usage() {
std::cout << " Scaling and merging" << std::endl;
std::cout << " -M, --scale-merge Scale and merge (refine mosaicity) and write scaled.hkl + image.dat" << std::endl;
std::cout << " --global-scale Joint global scaling (all images + Itrue in one fit) instead of the alternating loop; implies -M" << std::endl;
std::cout << " --scale-fulls After -P rot3d combine, refit a per-frame scale on the fulls (XDS order, Unity model); implies -M" << 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;
@@ -94,7 +93,6 @@ enum {
OPT_REFERENCE_COLUMN,
OPT_DUMP_OBSERVATIONS,
OPT_INTEGRATOR,
OPT_GLOBAL_SCALE,
OPT_SCALE_FULLS
};
@@ -116,7 +114,6 @@ static option long_options[] = {
{"refine-bfactor", no_argument, nullptr, 'B'},
{"wedge", optional_argument, nullptr, 'w'},
{"scale-merge", no_argument, nullptr, 'M'},
{"global-scale", no_argument, nullptr, OPT_GLOBAL_SCALE},
{"scale-fulls", no_argument, nullptr, OPT_SCALE_FULLS},
{"refine", required_argument, nullptr, 'r'},
@@ -277,7 +274,6 @@ int main(int argc, char **argv) {
int rotation_indexing_image_count = 100;
std::optional<float> rotation_indexing_range;
bool run_scaling = false;
bool global_scaling = false;
bool scale_fulls = false;
bool anomalous_mode = false;
std::optional<int64_t> space_group_number;
@@ -508,10 +504,6 @@ int main(int argc, char **argv) {
case 'M':
run_scaling = true;
break;
case OPT_GLOBAL_SCALE:
run_scaling = true;
global_scaling = true;
break;
case OPT_SCALE_FULLS:
run_scaling = true;
scale_fulls = true;
@@ -722,6 +714,7 @@ int main(int argc, char **argv) {
ScalingSettings scaling_settings;
scaling_settings.SetPartialityModel(partiality_model);
scaling_settings.Combine3D(combine_3d);
scaling_settings.ScaleFulls(scale_fulls);
if (d_min_scale_merge)
scaling_settings.HighResolutionLimit_A(d_min_scale_merge.value());
scaling_settings.MergeFriedel(!anomalous_mode);
@@ -798,8 +791,6 @@ int main(int argc, char **argv) {
config.rotation_indexing_image_count = rotation_indexing_image_count;
config.forced_rotation_lattice = forced_rotation_lattice;
config.run_scaling = run_scaling;
config.global_scaling = global_scaling;
config.scale_fulls = scale_fulls;
config.scaling_iter = scaling_iter;
config.reference_data = reference_data;
config.observation_dump_path = dump_observations;