PixelRefine: Improvements to accept more reasonable count of reflections
Build Packages / build:rpm (rocky8_nocuda) (push) Successful in 21m4s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Successful in 17m57s
Build Packages / build:rpm (rocky9_nocuda) (push) Successful in 20m42s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Successful in 17m29s
Build Packages / build:rpm (rocky8_sls9) (push) Successful in 19m56s
Build Packages / build:rpm (rocky9_sls9) (push) Successful in 23m29s
Build Packages / build:rpm (rocky8) (push) Successful in 20m41s
Build Packages / build:rpm (ubuntu2204) (push) Successful in 20m30s
Build Packages / build:rpm (rocky9) (push) Successful in 24m48s
Build Packages / Generate python client (push) Successful in 29s
Build Packages / Build documentation (push) Successful in 1m27s
Build Packages / Create release (push) Skipped
Build Packages / build:rpm (ubuntu2404) (push) Successful in 20m52s
Build Packages / XDS test (durin plugin) (push) Successful in 17m17s
Build Packages / XDS test (JFJoch plugin) (push) Successful in 16m57s
Build Packages / XDS test (neggia plugin) (push) Successful in 14m40s
Build Packages / DIALS test (push) Successful in 27m3s
Build Packages / Unit tests (push) Successful in 2h20m37s

This commit is contained in:
2026-06-12 10:12:23 +02:00
parent c8db50ab41
commit 47dc19dd03
2 changed files with 39 additions and 18 deletions
+32 -18
View File
@@ -551,6 +551,35 @@ void PixelRefine::BuildParameterBlocks(const PixelRefineData &data,
}
}
BraggPredictionSettings PixelRefine::BuildPredictionSettings(const PixelRefineData &data) const {
// Radial Ewald-acceptance band: predict exactly the reflections the merge's
// partiality floor would still keep, and no tighter. A reflection's partiality
// is exp(-s^2 / R0_eff^2) (s = excitation error), so it survives min_partiality
// when |s| <= R0 * sqrt(-ln(min_partiality)). Using that as the cutoff keeps
// prediction and the partiality cut consistent. The struct default (0.0005) is
// far narrower than R0 (~0.005), so previously most keepable reflections were
// never predicted and per-reflection multiplicity collapsed ~4x.
const double min_part = std::clamp(experiment.GetScalingSettings().GetMinPartiality(), 1e-6, 0.999);
const double r0 = std::max(data.R[0], 1e-4);
const double cutoff = r0 * std::sqrt(-std::log(min_part));
// Relative bandwidth (sigma of dlambda/lambda): the explicit PixelRefine model
// value if set, else the experiment's nominal bandwidth (FWHM -> sigma). >0
// thickens the band radially at high resolution (the 1/d^2 pink-beam smear),
// matching the integrator and preventing the outer shells from being clipped.
float bw_sigma = static_cast<float>(data.bandwidth);
if (bw_sigma <= 0.0f)
bw_sigma = experiment.GetBandwidthFWHM().value_or(0.0f) / 2.3548f;
return BraggPredictionSettings{
.high_res_A = experiment.GetBraggIntegrationSettings().GetDMinLimit_A(),
.ewald_dist_cutoff = static_cast<float>(cutoff),
.max_hkl = 100,
.centering = data.centering,
.bandwidth_sigma = bw_sigma
};
}
template<class T>
void PixelRefine::Run(const T *image,
BraggPrediction &prediction,
@@ -561,12 +590,7 @@ void PixelRefine::Run(const T *image,
const double lambda = data.geom.GetWavelength_A();
const double pixel_size = data.geom.GetPixelSize_mm();
const BraggPredictionSettings settings_prediction{
.high_res_A = experiment.GetBraggIntegrationSettings().GetDMinLimit_A(),
.max_hkl = 100,
.centering = data.centering,
.bandwidth_sigma = static_cast<float>(data.bandwidth) // relative Δλ/λ sigma
};
const BraggPredictionSettings settings_prediction = BuildPredictionSettings(data);
const int radius = data.shoebox_radius;
const int bkg_outer_radius = std::max(radius + 1, data.bkg_outer_radius);
@@ -1045,12 +1069,7 @@ std::vector<float> PixelRefine::PredictImage(const T *image,
.PoniRot1_rad(data.geom.GetPoniRot1_rad())
.PoniRot2_rad(data.geom.GetPoniRot2_rad());
const BraggPredictionSettings settings_prediction{
.high_res_A = experiment.GetBraggIntegrationSettings().GetDMinLimit_A(),
.max_hkl = 100,
.centering = data.centering,
.bandwidth_sigma = static_cast<float>(data.bandwidth) // relative Δλ/λ sigma
};
const BraggPredictionSettings settings_prediction = BuildPredictionSettings(data);
const int nrefl = prediction.Calc(exp_iter, data.latt, settings_prediction);
const auto &predicted = prediction.GetReflections();
const auto spot_mask = BuildSpotMask(predicted, nrefl, xpixel, ypixel, radius);
@@ -1139,12 +1158,7 @@ std::vector<float> PixelRefine::ChiSquaredImage(const T *image,
.PoniRot1_rad(data.geom.GetPoniRot1_rad())
.PoniRot2_rad(data.geom.GetPoniRot2_rad());
const BraggPredictionSettings settings_prediction{
.high_res_A = experiment.GetBraggIntegrationSettings().GetDMinLimit_A(),
.max_hkl = 100,
.centering = data.centering,
.bandwidth_sigma = static_cast<float>(data.bandwidth)
};
const BraggPredictionSettings settings_prediction = BuildPredictionSettings(data);
const int nrefl = prediction.Calc(exp_iter, data.latt, settings_prediction);
const auto &predicted = prediction.GetReflections();
const auto spot_mask = BuildSpotMask(predicted, nrefl, xpixel, ypixel, radius);