torchref.refinement.targets.adp.scaler_log_scale module

class torchref.refinement.targets.adp.scaler_log_scale.ScalerLogScaleTrendTarget(scaler, n_reflections, verbose=0)[source]

Bases: Target

Pin out the Debye-Waller-like trend in the per-bin log_scale.

Per-bin scales exist to absorb localized data-quality issues — an outlier bin, a slightly mis-merged shell. They are not supposed to absorb the global resolution-dependent attenuation envelope; that is what atomic B-factors are for. A log_scale[i] a + b·s²[i] structure with nonzero b is exactly a B-factor masquerading as a per-bin scale: it shifts B_eff = B_atom 4·b, letting atoms drift broader or sharper while the overall F_scaled amplitudes stay unchanged.

The target fits the least-squares slope of log_scale against the bin-mean |s|² and penalizes slope². The intercept a (the overall scale) is free. Residuals off the fit line are also free — those encode the outlier absorption the scales are supposed to do.

Penalty slope² · N_ref / nbins — the / nbins matches how xray gradient on a single log_scale[i] scales; the N_ref factor brings the total into xray’s order of magnitude.

name: str = 'adp/scaler_log_scale'
__init__(scaler, n_reflections, verbose=0)[source]

Initialize target.

Parameters:

verbose (int, optional) – Verbosity level. Default is 0.

forward()[source]

Compute and return the loss. Override in subclasses.

stats()[source]