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>
87 lines
3.2 KiB
C++
87 lines
3.2 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#pragma once
|
|
|
|
#include <optional>
|
|
#include "JFJochException.h"
|
|
|
|
enum class PartialityModel { Fixed, Rotation, Unity };
|
|
enum class IntensityFormat { Text, mmCIF, MTZ};
|
|
|
|
class ScalingSettings {
|
|
std::optional<PartialityModel> partiality_mode;
|
|
|
|
bool refine_b = false;
|
|
double max_b = 200.0;
|
|
double min_b = -50.0;
|
|
|
|
bool refine_wedge = false;
|
|
|
|
bool merge_friedel = true;
|
|
std::optional<double> high_resolution_limit_A;
|
|
std::optional<double> wedge_for_scaling;
|
|
double min_partiality = 0.02;
|
|
double min_cc_for_image = 0.0;
|
|
double outlier_reject_nsigma = 0.0; // per-observation merge outlier rejection (XDS/DIALS-style); 0 = off, e.g. 6 enables
|
|
|
|
// The "-P rot3d" 3D combine: scale per-frame as Rotation, then weight-sum each reflection's
|
|
// per-frame partials into one counting-limited full before merging (orthogonal to the partiality
|
|
// model, which stays Rotation - see Combine3D).
|
|
bool combine_3d = false;
|
|
|
|
// Scale fulls: after the rot3d combine, refit a per-frame scale on the combined fulls (XDS
|
|
// order). A no-op without rot3d.
|
|
bool scale_fulls = false;
|
|
|
|
double rfree_fraction = 0.05;
|
|
IntensityFormat intensity_format = IntensityFormat::MTZ;
|
|
|
|
bool scaling_regularize = false;
|
|
public:
|
|
ScalingSettings& SetPartialityModel(PartialityModel mode);
|
|
ScalingSettings& RefineB(bool input);
|
|
ScalingSettings& RefineRotationWedge(bool input);
|
|
ScalingSettings& RotationWedgeForScaling(std::optional<double> input);
|
|
ScalingSettings& MergeFriedel(bool input);
|
|
ScalingSettings& HighResolutionLimit_A(double limit);
|
|
ScalingSettings& MinPartiality(double min_partiality);
|
|
ScalingSettings& MinCCForImage(double min_cc_for_image);
|
|
ScalingSettings& OutlierRejectNsigma(double input);
|
|
ScalingSettings& Combine3D(bool input);
|
|
ScalingSettings& ScaleFulls(bool input);
|
|
|
|
ScalingSettings& RfreeFraction(double input);
|
|
ScalingSettings& FileFormat(IntensityFormat input);
|
|
ScalingSettings& ScalingRegularize(bool input);
|
|
|
|
[[nodiscard]] bool GetRefineB() const;
|
|
[[nodiscard]] bool GetRefineWedge() const;
|
|
|
|
[[nodiscard]] double GetMinB() const;
|
|
[[nodiscard]] double GetMaxB() const;
|
|
|
|
[[nodiscard]] double GetMinMosaicity() const;
|
|
[[nodiscard]] double GetDefaultMosaicity() const;
|
|
[[nodiscard]] double GetMaxMosaicity() const;
|
|
|
|
[[nodiscard]] double GetMinWedge() const;
|
|
[[nodiscard]] std::optional<double> GetRotationWedgeForScaling() const;
|
|
[[nodiscard]] double GetMaxWedge() const;
|
|
|
|
[[nodiscard]] bool GetMergeFriedel() const;
|
|
|
|
[[nodiscard]] std::optional<PartialityModel> GetPartialityModel() const;
|
|
[[nodiscard]] std::optional<double> GetHighResolutionLimit_A() const;
|
|
|
|
[[nodiscard]] double GetMinPartiality() const;
|
|
[[nodiscard]] double GetMinCCForImage() const;
|
|
[[nodiscard]] double GetOutlierRejectNsigma() const;
|
|
[[nodiscard]] bool GetCombine3D() const;
|
|
[[nodiscard]] bool GetScaleFulls() const;
|
|
|
|
[[nodiscard]] double GetRfreeFraction() const;
|
|
[[nodiscard]] IntensityFormat GetFileFormat() const;
|
|
[[nodiscard]] bool GetScalingRegularize() const;
|
|
};
|