prtools.radial_avg#

radial_avg(a, center=None)[source]#

Compute the average radial profile of the input

Parameters:
  • a (array_like) – Input array

  • center ((2,) array_like or None) – Coordinates of center of a given as (row, col). If None (default), the center coordinates are computed as the centroid of a.

Return type:

ndarray

References

[1] https://stackoverflow.com/a/21242776

Examples

>>> amp = prtools.circle(shape=(256,256), radius=100)
>>> psf = prtools.calcpsf(amp, 0, 500e-9, 1e-9, (64,64), 3)
>>> psf /= np.max(psf)
>>> ra = prtools.radial_avg(psf**0.1)
>>> fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=(5,2))
>>> ax1.set_title('a')
>>> ax1.imshow(psf**0.1)
>>> ax2.set_title('radial_avg(a)')
>>> ax2.plot(np.arange(ra.size), ra)
>>> ax2.grid('on')
../_images/prtools-radial_avg-1.png