longitudinal_deriv module

Generate longitudinal derivatives through stack of intensity values.

This file contains routines for generating the longitudinal derivative through a stack of images by fitting a quadratic polynomial to the intensity values for each (y,x) pixel.

Author: Arthur McCray, ANL, May 2020.

longitudinal_deriv.polyfit_deriv(stack, defvals, v=1)[source]

Calculates a longitudinal derivative of intensity values taken at different defocus values. Expects the first image to be most underfocused, and last to be most overfocused.

Prints progress every 5 seconds, though for reasonable sized datasets (7 x 4096 x 4096) it only takes ~ 7 seconds.

Parameters:
  • stack (3D array) – NumPy array (L x M x N). There are L individual (M x N) images.
  • defvals (1D array) – Array of length L. The defocus values of the images.
  • v (int) – Verbosity. Set v=0 to suppress all print statements.
Returns:

Numpy array (M x N) of derivative values.

Return type:

ndarray