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 of hkls, and 0 / 1 for etasign +1 / -1

  • hkl_idx (Array) – [B] int indices of the peaks: map entry, row of hkls, and 0 / 1 for etasign +1 / -1

  • branch (Array) – [B] int indices of the peaks: map entry, row of hkls, and 0 / 1 for etasign +1 / -1

  • entries (dict) – Dict with “ubi” [N, 3, 3], “pos” [N, 3] and “density” [N]; optionally “sig_rot” [N], see render_row()

  • hkls (Array) – [Nh, 3] hkls and [Nh] structure factors squared

  • F2 (Array) – [Nh, 3] hkls and [Nh] structure factors squared

  • geom (dict) – See render_row()

  • row (dict) – See render_row()

  • window (tuple[int, int, int]) – Static (n_frames, n_slow, n_fast) window size, each odd

  • det_shape (tuple[int, int]) – Static (n_slow, n_fast) detector shape

  • origins (tuple | None, default: None) – Optional window origins, as from window_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 unused

  • pixel (jax.Array) – [B, W] int32 pixel index slow * n_fast + fast

  • value (jax.Array) – [B, W] intensity, 0 where unused

  • captured (jax.Array) – [B] fraction of each peak’s Gaussian that fell inside its window (before the dty weight)