slmsuite.holography.analysis.image_positions

image_positions(images, normalize=True, nansum=False)[source]

Computes the two first order moments, equivalent to spot position relative to image center, for a stack of images. Specifically, returns \(M_{10}\) and \(M_{01}\).

Parameters
  • images (numpy.ndarray) – A matrix in the style of the output of take(), with shape (image_count, h, w), where (h, w) is the width and height of the 2D images and image_count is the number of images. A single image is interpreted correctly as (1, h, w) even if (h, w) is passed.

  • normalize (bool) – Whether to normalize images. If False, normalization is assumed to have been precomputed.

  • nansum (bool) – Whether to use numpy.nansum() in place of numpy.sum().

Returns

Stack of \(M_{10}\), \(M_{01}\).

Return type

numpy.ndarray