orientation_mlem#
- anri.index.orientation_mlem(d, U, B, rings, geom, bins, etacut=0.2, n_iter=20, qc=256, log=<built-in function print>, censor=0.0, return_model=False)[source]#
Fit one occupancy per orientation to a row-summed histogram by MLEM, and score each orientation.
The predictions of each orientation are computed afresh in every pass, so memory stays at a chunk of qc orientations whatever the number of orientations.
- Parameters:
d (
Array|ndarray|bool|number|bool|int|float|complex) – [n_rings * n_e * n_o] histogram with the dty rows summed (e.g. the voxel fit’s histogram, summed over rows)U (
Array|ndarray|bool|number|bool|int|float|complex) – [Nq, 3, 3] orientations, e.g. the grid orientations above chance completenessB (
Array|ndarray|bool|number|bool|int|float|complex) – [3, 3] B matrixrings (
dict) – Fromanri.index.ring_table()(“hkls”, “ring_j” and, optionally, “F2”)geom (
dict) – Geometry dict, seeanri.index.predict()bins (
tuple) – (b_e, b_o, n_e, n_o, om0): the histogram’s eta and omega bin widths (degrees) and counts, and its first omega bin edgeetacut (
float, default:0.2) – Reflections with|sin eta|at or below this are not usedn_iter (
int, default:20) – MLEM iterationsqc (
int, default:256) – Orientations per chunklog (
Callable, default:<built-in function print>) – Progress messagescensor (
float, default:0.0) – Empty bins censored above this many counts per bin, in the fit and in the likelihood ratio (anri.index.censored_ratio()); 0: plain Poissonreturn_model (
bool, default:False) – Also return the fitted histogram, e.g. for its deviance (anri.index.deviance())
- Returns:
occupancy (
np.ndarray) – [Nq] global occupancy of each orientation (in the units of d over Lorentz x polarisation x F^2)likelihood_ratio (
np.ndarray) – [Nq] increase in the Poisson deviance if that orientation alone were removed, the others fixed:2 sum_b [d_b log(mu_b / (mu_b - g a_b)) - g a_b]over observed bins (empty bins: the change inmax(mu_b - censor, 0)). About chi-square with one degree of freedom for an orientation that is not there, so ~25 is 5 sigma.model (
np.ndarray) – [n_cells] the fitted histogram, if return_model