position

Functions for manipulating and updating scanning positions.

tike.ptycho.position.check_allowed_positions(scan, psi, probe)[source]

Check that all positions are within the field of view.

The field of view must have 1 pixel buffer around the edge. i.e. positions must be >= 1 and < the object shape - 1 - probe.shape. This padding is to allow approximating gradients and to provide better interpolation near the edges of the field of view.

tike.ptycho.position.get_padded_object(scan, probe)[source]

Return a ones-initialized object and shifted scan positions.

An complex object array is initialized with shape such that the area covered by the probe is padded on each edge by a full probe width. The scan positions are shifted to be centered in this newly initialized object array.

tike.ptycho.position.update_positions_pd(operator, data, psi, probe, scan, dx=- 1, step=0.05)[source]

Update scan positions using the gradient of intensity method.

Uses the finite difference method to compute the gradient of the farfield intensity with respect to position movement in horizontal and vertical directions. Then a least squares solver is used to find the position shift that will minimize the intensity error for each of the detector pixels.

Parameters
  • farplane (array-like complex64) – The current farplane estimate from psi, probe, scan

  • dx (float) – The step size used to estimate the gradient

References

Dwivedi, Priya, A.P. Konijnenberg, S.F. Pereira, and H.P. Urbach. 2018. “Lateral Position Correction in Ptychography Using the Gradient of Intensity Patterns.” Ultramicroscopy 192 (September): 29–36. https://doi.org/10.1016/j.ultramic.2018.04.004.