Implementation of the extended Nijboer-Zernike (ENZ) theory for Python.
This toolbox can be used to compute the point-spread function (PSF) using the scalar ENZ theory, see [ENZ], [J2002], [B2008], and [H2010]. It also contains code to fit the phase and the generalised pupil function using real- and complex-valued Zernike polynomials, see [A2015].
- real- and complex-valued Zernike polynomials
- complex point-spread function computation
- multi-threaded computation of the Vnm terms (Eq.(2.48) in [B2008])
- routines to fit and evaluate the phase and the generalised pupil function
- load/save functions for each object
- numerous examples & documentation
- ENZPL algorithm example for phase retrieval
- Python 3
- pthreads (tested on Linux and Mac OS X Yosemite)
- Numpy
- h5py
- [optional] matplotlib
- [optional] PyQt5
- [optional] CVXOPT
Make sure you have installed the packages in Requirements.
$ git clone https://github.com/jacopoantonello/enzpy.git
$ cd enzpy
$ sudo python setup.py install
The easiest way to use this toolbox is to install Anaconda for Python 3, which includes all the necessary packages in Requirements, except for PyQt5 and CVXOPT. Once you have installed Anaconda, create an environment:
$ conda create -n py3 python=3 anaconda
$ source activate py3
and install `enzpy`:
$ git clone https://github.com/jacopoantonello/enzpy.git
$ cd enzpy
$ python setup.py install
PyQt5 is necessary to run the examples with a graphical interface: alpha_abs.py
and alpha_abs_qt.py
.
After installing enzpy, you can run the examples located in examples/ (some screenshots are here):
through_focus_intensity.py
is taken from [ENZ], and computes the intensity as a function of the radial coordinate and the defocus parameter.psf_plot.py
plots a diffraction-limited PSF at different defocus planes.phase_plot.py
plots the first 10 real-valued Zernike polynomials.fit_phase.py
estimates a vector of real-valued Zernike coefficients from a phase grid by taking inner products numerically.fit_gpf
estimates a vector of real-valued Zernike coefficients from a phase grid by taking inner products numerically. The coefficients can be used to approximate the generalised pupil function.beta_abs.py
andbeta_abs_qt.py
plot the point-spread function that corresponds to a given complex-valued Zernike analysis of the generalised pupil function. The coefficients can be adjusted using the command line (beta_abs.py
) or a Qt widget (beta_abs_qt.py
).alpha_abs.py
andalpha_abs_qt.py
plot the point-spread function that corresponds to a given real-valued Zernike analysis of the phase aberration function. The coefficients can be adjusted using the command line (alpha_abs.py
) or a Qt widget (alpha_abs_qt.py
).enzpl/run
contains an example of the ENZPL algorithm, which uses PhaseLift (see [C2013]) and the ENZ theory to correct a random aberration.
Alternatively, you can execute the consistency tests:
$ cd tests
$ nosetests -v -x --pdb *.py