render_peaks#
- anri.fwd.render_peaks(entry, hkl_idx, branch, entries, hkls, F2, geom, row, window, det_shape, origins=None)[source]#
Render a fixed-size batch of peaks into sparse contributions for one dty row.
The peak is a Gaussian in (sc, fc, omega) with the propagated covariance. Its mass in each (frame, slow, fast) cell of the window is approximated by conditioning: the omega marginal over the frame, then slow given omega within the frame, then fast given slow within the row, with omega integrated out within the frame. Each step conditions on the within-cell (truncated) mean and variance. This keeps the slow-fast and detector-omega correlations, and the centroid of peaks narrower than a frame or pixel.
- Parameters:
entry (
Array) – [B] int indices of the peaks: map entry, row ofhkls, and 0 / 1 for etasign +1 / -1hkl_idx (
Array) – [B] int indices of the peaks: map entry, row ofhkls, and 0 / 1 for etasign +1 / -1branch (
Array) – [B] int indices of the peaks: map entry, row ofhkls, and 0 / 1 for etasign +1 / -1entries (
dict) – Dict with “ubi” [N, 3, 3], “pos” [N, 3] and “density” [N]; optionally “sig_rot” [N], seerender_row()hkls (
Array) – [Nh, 3] hkls and [Nh] structure factors squaredF2 (
Array) – [Nh, 3] hkls and [Nh] structure factors squaredgeom (
dict) – Seerender_row()row (
dict) – Seerender_row()window (
tuple[int,int,int]) – Static (n_frames, n_slow, n_fast) window size, each odddet_shape (
tuple[int,int]) – Static (n_slow, n_fast) detector shapeorigins (
tuple|None, default:None) – Optional window origins, as fromwindow_origins(): the first frame [B] (sorted-omega order) and each frame’s first slow and fast pixel [B, n_frames]. By default each peak’s window is centred on it, so the cells it covers jump as it moves; fixed origins keep the values smooth in the parameters (for a refiner)
- Returns:
frame (
jax.Array) – [B, W] int32 frame index within the row (in file order), -1 where unusedpixel (
jax.Array) – [B, W] int32 pixel index slow * n_fast + fastvalue (
jax.Array) – [B, W] intensity, 0 where unusedcaptured (
jax.Array) – [B] fraction of each peak’s Gaussian that fell inside its window (before the dty weight)