PYME.Analysis.PSFEst.fit_psf_zernikes module

Fits zernike polynomials to a PSF image (as an alternative to Gerchberg-Saxton pupil estimation)

works by using the PSF simulation functions to generate as PSF image with a given set of zernike coefficients and comparing to the measured PSF image.

class PYME.Analysis.PSFEst.fit_psf_zernikes.ZernikePSFFitter(psf, voxelsize_nm, wavelength=700.0, n=1.51, NA=1.4, **kwargs)

Bases: object

approximate_zernikes(num_zernike_orders, num_iterations=5, starting_zernikes={}, plot=True, **kwargs)

Approximate the zernike coefficients of a PSF image using a least squares fit

get_misfit_map(zernike_coeffs)

Get a map of the residuals between the measured and simulated PSFs as a 5x5 tiled image of z planes

get_zernike_psf(zernike_coeffs=None)

Generate a PSF image with a given set of zernike coefficients

Parameters
zernike_coeffsndarray

array of zernike coefficients

Returns
psfndarray

simulated PSF image

plot_results()

Plot the results of the zernike fitting

refine_zernike(zernike_coeffs, zernike_order, delta=2.0)

Refine a single zernike coefficient, assuming a quadratic dependence on the residuals

refine_zernikes(zernike_coeffs, delta)

Refine all zernike coefficients

zernike_residuals(zernike_coeffs)

Calculate the residuals between a measured PSF and a simulated PSF with a given set of zernike coefficients

Parameters
zernike_coeffsndarray

array of zernike coefficients

Returns
residualsndarray

array of residuals between the measured and simulated PSFs