torchref.base.targets.xray_ls module

Least-squares X-ray loss math.

Caller is responsible for producing the post-XrayTarget.get_data tensors (F_obs, F_calc, sigma, mask).

torchref.base.targets.xray_ls.ls_xray_loss_math(F_obs, F_calc, sigma, mask, weighting='sigma')[source]

Weighted least-squares loss on already-scaled amplitudes.

Dispatches to torchref.base.targets.triton.xray_ls.ls_xray_loss_math_triton() on CUDA float32; falls back to the eager implementation otherwise.