skued.autocenter

skued.autocenter(im, mask=None)

Find the center of a diffraction pattern automatically.

New in version 2.1.1.

Parameters:
  • im (ndarray, shape (N, M)) – Diffraction pattern.

  • mask (ndarray, shape (N,M), dtype bool, optional) – Mask that evaluates to True on pixels that should be used to determine the center.

Returns:

r, c – Indices of the center, such that im[r, c] is the intensity value at the center of the pattern.

Return type:

2-tupe of ints

Notes

The procedure in this routine is an extension of the one in the reference below. It has been adapted for both single-crystal and polycrystalline diffraction patterns The continuous inversion symmetry is encoded as the coordinate transformation \((r, \theta) \to (-r, \theta)\). The shift between the image and inverted image determines the correction to the approximate center found by calculating the intensity center-of-mass.

References

Liu, Lai Chung. Chemistry in Action: Making Molecular Movies with Ultrafast Electron Diffraction and Data Science, Chapter 2. Springer Nature, 2020.