From 9b96906150192f3f99585db331ef8574097f99fa Mon Sep 17 00:00:00 2001 From: Filip Leonarski Date: Sat, 5 Sep 2026 11:07:17 +0200 Subject: [PATCH] integration: the parallax variance takes its attenuation length from the tables, not from lambda^3 The radial parallax broadening is the variance of the depth at which a photon converts, so it scales with the attenuation length. That length was approximated as photoelectric-dominated and scaled by lambda^3 from a single 13 keV reference per material. For silicon above 10 keV that is within 0.2%, but for CdTe it overstates the attenuation length by up to a factor of two, and by six above the cadmium K edge - which made this variance term 1.9x too large on 750 um CdTe data. Take the length from the same tabulated coefficients the efficiency correction uses. Silicon data is unaffected to within the approximation's own error; CdTe data gets a spot-width variance that matches the sensor it was recorded on. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01EFEJG6WBQv8th4UJFNe53N --- docs/CHANGELOG.md | 1 + .../bragg_integration/BraggIntegrationEngine.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index cdfdf9501..49176581a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,7 @@ ### 1.0.0-rc.166 * `rugnux` corrects each reflection for the sensor's quantum efficiency at the angle the diffracted beam meets the detector. +* `rugnux` takes the sensor attenuation length from tabulated coefficients rather than a wavelength-cubed approximation, which corrects the parallax term of the spot-width variance on CdTe sensors. * `rugnux --model` treats the model as a hypothesis: it decides the enantiomorph and the indexing only where its R-work beats that of the same model in random orientations, and a model the data reject is still scored, placed and mapped, but leaves the reflection files byte for byte what a run with no model writes. * `rugnux --model` places the model against the data as a rigid body before scoring it, writes sigma_A-weighted 2mFo-DFc and mFo-DFc maps in place of the unweighted 2Fo-Fc and Fo-Fc, and writes the model as it was placed - `_model.cif`, and `_model.pdb` where the PDB format can express the cell - in the cell and space group of the reflection files beside it. * `rugnux` and `jfjoch_viewer` read PILATUS miniCBF sweeps natively, and open masters written at other facilities, including Eiger 1.x and third-party NXmx. diff --git a/image_analysis/bragg_integration/BraggIntegrationEngine.cpp b/image_analysis/bragg_integration/BraggIntegrationEngine.cpp index c45df8fcf..9120dacb2 100644 --- a/image_analysis/bragg_integration/BraggIntegrationEngine.cpp +++ b/image_analysis/bragg_integration/BraggIntegrationEngine.cpp @@ -12,20 +12,23 @@ #include #include "../../common/JFJochMath.h" // PI (M_PI is not standard, and MSVC does not define it) +#include "../SensorAbsorption.h" namespace { // Radial parallax broadening as the coefficient of tan^2(2theta), i.e. Var(z)/pixel^2 [px^2]. // Copied verbatim from ProfileIntegrate2D: a photon converts at a random depth z (exponential, // attenuation length L, truncated at the sensor thickness), shifting the recorded spot radially by -// z*tan(2theta). L is photoelectric-dominated (~lambda^3), so a per-material reference (13 keV) is -// scaled by lambda^3; Si and CdTe are the sensors in use. +// z*tan(2theta). L comes from the tabulated NIST attenuation coefficients (SensorAbsorption.h); the +// lambda^3 approximation this used before is within 0.2% for silicon above 10 keV but overstates +// the attenuation length of CdTe by up to a factor of two, and by six above the Cd K edge, which +// made this variance 1.9x too large on 750 um CdTe data. double parallax_var_px2(const std::string &material, double thickness_um, double lambda_A, double pixel_um) { if (!(thickness_um > 0.0) || !(pixel_um > 0.0) || !(lambda_A > 0.0)) return 0.0; - const double L_ref = material == "CdTe" ? 42.6 : 273.0; // attenuation length [um] at 0.953 A - const double s = lambda_A / 0.953; - const double L = L_ref / (s * s * s); + const double L = sensor_absorption::AttenuationLength_um(material, lambda_A); + if (!(L > 0.0)) + return 0.0; const double a = thickness_um / L, e = std::exp(-a); if (1.0 - e <= 0.0) return 0.0;