fit_occupancy#

anri.index.fit_occupancy(H, pred, ring_j, pos, scan, dims, k=64, n_iter=10, coarse=1, block_bytes=1000000000.0, qc=16, log=<built-in function print>, return_model=False, censor=0.0, accel=False)[source]#

Fit sparse occupancies: candidates per voxel, then MLEM.

With coarse = G > 1 the full candidate pass runs on voxels G times larger (the histogram’s rows summed in groups of G), and each voxel then scores only the 2k orientations its 3 x 3 coarse neighbourhood occupied most: about G^2 times cheaper for large maps, at the risk of missing a grain the coarse fit missed.

Parameters:
  • H (Array | ndarray | bool | number | bool | int | float | complex) – [n_cells] histogram, rows last

  • pred (tuple) – (eta, om, use, w), each [Nq, Nj] with Nq a multiple of qc

  • ring_j (Array | ndarray | bool | number | bool | int | float | complex) – [Nj] ring of each prediction

  • pos (Array | ndarray | bool | number | bool | int | float | complex) – [Nv, 3] voxel positions

  • scan (dict) – Rows and (b_e, b_o, n_e, n_o) of the histogram, plus n_beam for a beam profile (system(), beam_rows())

  • dims (tuple) – Rows and (b_e, b_o, n_e, n_o) of the histogram, plus n_beam for a beam profile (system(), beam_rows())

  • k (int, default: 64) – Candidates per voxel

  • n_iter (int, default: 10) – MLEM iterations

  • coarse (int, default: 1) – Coarse-to-fine factor (1: off)

  • block_bytes (float, default: 1000000000.0) – Memory for one block of voxels’ system entries

  • qc (int, default: 16) – Orientations per chunk in passes over every orientation

  • return_model (bool, default: False) – Also return the fitted histogram A f, e.g. to compare with the data row by row

  • censor (float, default: 0.0) – Empty bins censored above this many counts per bin in the MLEM (censored_ratio()); 0: plain MLEM

  • accel (bool, default: False) – SQUAREM-accelerated MLEM (mlem())

  • log (Callable, default: <built-in function print>) – Progress messages

Returns:

  • f, cand (np.ndarray) – [Nv, k] occupancies and orientation indices

  • model (np.ndarray) – [n_cells] the fitted histogram, if return_model