pyDigHolo
is a Python module to use Joel Carpenter's digHolo C++ library.
digHolo is a high-speed library for off-axis digital holography.
First, install digHolo C++ library.
Then, install pyDigHolo, using pip
pip install git+https://github.com/wavefrontshaping/pyDigHolo.git
or clone the repository and, in the module folder, install using
python setup.py install
This module more or less simply wraps the functions from the digHolo
C++ module,
please refer to the offocial digHolo repository for documentation.
from pyDigHolo import digHolo
You need the provide the file path to fetch the .dll
/.so
from digHolo
.
If you copied the .dll
into your working folder, simply use
dh = digHolo('digHolo.dll')
dh.ConfigOffAxis(
[frameWidth, frameHeight],
[nx, ny],
resolutionMode,
pixelSize,
lambda0,
maxMG,
polCount
)
Specify what you want the algorithm to automatically calibrate. For instance:
dh.ConfigSetAutoAlign(
enable_align_beam_centre=True,
enable_align_defocus=False,
enable_align_tilt=True,
enable_align_basis_waist=True,
enable_align_fourier_win_radius=False,
)
dh.SetBatch(frameCount, frames, dataType = 'Python')
dh.AutoAlign()
dh.SetRefCalibrationIntensity(ref)
dh.SaveConfig('config_pola1.npz')
Next time you want to use the off-axis procedure, if the system did not change, you can simply load a previous calibration file using:
dh.Loadonfig('config_pola1.npz')
It will treat the interferograms provided using SetBatch()
.
dh.ProcessBatch()
fields = dh.GetFields()
See the two jupyter notebook:
-
Example 1: Simulated data. Generate test interferograms using digHolo and recover the complex fields.
-
Example 2: Experimental data . Load experimentally measured with a non uniform reference intensity and recover the complex fields.