skued.autocenter
- skued.autocenter(im, mask=None, normalize_bg=True)
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.
normalize_bg (bool, optional) –
If True (default), an attempt will be made to remove asymmetries in the background of im. This can sometimes provide worse results, so you may want to disable this feature.
New in version 2.1.16.
- 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.