Products > Software > IAPACK
IAPACK
The interferogram analysis
package uses Python script language. This package contains a set of
scripts that can be used for interferogram capture and analysis. It
extends Python with C control and mathematical modules to provide a
fast image capture and short calculation time. Scripts are very
flexible and designed for easy integration into a laboratory or workshop
automatic optical measuring systems.
dtmath
C Python extension package for interferogram analysis
implements basic calculation algorithms.
Functions
roundmask
( r,
w,
h
)
Make round mask.
Parameters:
r - normalized mask radius, flat in range from 0. to 1.
w - width, positive integer
h - height, positive integer
Return values:
mask - mask, numpy bool array
make_mask
( data,
level
)
Make mask from double array.
Parameters:
data - reference data, numpy 2D double array
level - threshold level, double
Return values:
mask - mask, numpy bool array
zernike_surface
( z,
mask
)
Generate surface using Zernike coefficients.
Surface shape is equal to mask shape
Parameters:
z - Zernuke coefficients, numpy double array
mask - mask, numpy bool array
Return values:
surface - surface, numpy double array
zernike_matrix
( mask,
n
)
Generate matrix of Zernike surfaces.
Surface shape is equal to mask shape
Parameters:
mask - mask, numpy bool array
n - number of Zernike polynomials, positive integer
Return values:
matrix - matrix of Zernike surfaces, numpy double array
interferogram
( sc,
phase,
max,
mask,
surface
)
Generate interferogram for given surface.
Image shape is equal to mask and surface shapes
Parameters:
sc - scale coefficient, float
phase - phase shift, float
max - maximal value in result array, positive integer
mask - mask, numpy bool array
surface - surface, numpy double array
Return values:
frame - image, numpy uint16 array
phase ( images )
Calculate phase map from images.
Phase map shape is equal to shapes of images
Parameters:
images - images, list of uint16 arrays (must have 4, 5 or 7 elements)
Return values:
phase - phase map, numpy double array
phase5 ( images )
Calculate phase map from 5 images.
Phase map shape is equal to shapes of images
Parameters:
images - images, list of uint16 arrays (must have 5 elements)
Return values:
phase - phase map, numpy double array
unwrap
( mask,
phase,
level
)
Unwrap phase map.
Surface shape is equal to phase map
Parameters:
mask - mask, numpy bool array
phase - phase map, numpy double array
level - threshold level
Return values:
surface - surface, numpy double array
wrap( surface,
level
)
Create phase map from surface.
Phase map shape is equal to surface shape
Parameters:
surface - surface, numpy double array
level - threshold level
Return values:
phase - phase map, numpy double array
binning
( data,
bc
)
Make array binning.
Parameters:
data - numpy double array
phase - binning coefficient, positive integer
Return values:
result - numpy double array
calibrate
Python extension package
for interferogram analysis implements PZT calibration.
Functions
calibrate
( port,
umax,
p,
n,
verb = False,
sve = False
)
This function implements PZT calibration. FFT is used as phase detection algorithm. The calibration refers to vertical interference fringes of flat surface.
Parameters:
port - dtcam object
umax - normalized maximal PZT voltage, float in fange from 0. to 1.
p - number of acquired points, positive integer
n - number of measurements, positive integer
verb - verbose output, boolean
sve - save intermediate results, boolean
Return values:
res - result of operation, True if success
list - normalized calibrated PZT voltages, list of floats in fange from 0. to 1.
phase
Python extension package for interferogram analysis, implements functions to get images and phase maps from DTI interferometers.
Functions
get_frame
( port,
shift,
verb = False
)
This function captures one frame with desired phase shifting
Parameters:
port - dtcam object
shift - normalized PZT voltage, float in fange from 0. to 1.
verb - verbose output, boolean
Return values:
frame - image, numpy uint16 array
get_phase
( port,
ref,
verb = False,
sve = False
)
This function captures frames and calculates phase map
Parameters:
port - dtcam object
ref - reference points for phase shifting, list of floats in range from 0. to 1.
verb - verbose output, boolean
sve - save intermediate results, boolean
Return values:
phase - phase map, numpy float array
get_phase_dev
( port,
ref,
verb = False,
sve = False
)
This function gets phase map using device build-in phase calculation algorithm
Parameters:
port - dtcam object
ref - reference points for phase shifting, list of floats in range from 0. to 1.
verb - verbose output, boolean
sve - save intermediate results, boolean
Return values:
phase - phase map, numpy float array
zernike
Python extension package
for interferogram analysis implements Zernike coefficients calculation algorithms.
Functions
fast_zernike_coefficients( m,
s,
n,
verb = False
)
This function tries first to reduce data size and then it calculates Zernike coefficients.
Parameters:
m - mask, numpy bool array
s - surface (opd), numpy float array
n - number of polynomials, positive integer
verb - verbose output, boolean
Return values:
z - Zernike coefficients, numpy bool array
zernike_coefficients( m,
s,
n
)
This function calculates Zernike coefficients for a given surface
Parameters:
m - mask, numpy bool array
s - surface (opd), numpy float array
n - number of polynomials, positive integer
Return values:
z - Zernike coefficients, numpy bool array
dti
dti.py is a command line script and usage example of interferogram analysis package.
It provides basic acquisition and calculation operations.
Usage
dti <command> [options...]
command frame|calibrate|phase|phasedev|opd
common options
-h, --help print this message
--device device name
--save-prefix save file prefix
--save-data save data (npy and pgm file formats)
--save-error save error (text file format)
--save-all save all intermediate results
-n repeat command
-v verbose output
commsnd-dependent options
-a make data averaging
--pzt-max normalized maximal PZT voltage in range from 0. to 1.
-pzt-ref load normalized calibrated PZT voltages from file
(use .npy file extension)
--mask load mask from file (use .npy file extension)
--zernike calculate Zernike polynomial coefficients
capture frame
command frame
options -a, <common options>
calibrate PZT
command calibrate
options --pzt-max, <common options>
capture frames and calculate phase map
command phase
options --pzt-ref, <common options>
get phase map from device (DTI build-in algorithm)
command phasedev
options --pzt-ref, <common options>
calculate opd (surface reconstruction)
command opd
options -a, --pzt-ref, --mask, --zernike, <common options>
generate report from saved opd
command report
options none
Examples
Capture frame from device and save result.
dti.py frame --save-data
Calibrate PZT (normalized maximal PZT voltage 0.85) and save reference values
dti.py calibrate --pzt-max=0.85 -a5 --save-data
Get phase map using device build-in algorithm.
dti.py phasedev --pzt-ref=test_calibrate_0.npy --save-data
Get 4 phase maps, calculate OPD and Zernike polynomials coefficients.
dti.py opd --pzt-ref=test_calibrate_0.npy --zernike=16 --save-data --save-error -a4
Stability test. Calculate and save rms deviation of 20 sequential measured OPDs
dti.py opd --pzt-ref=test_calibrate_0.npy -n20 --save-error
Create pdf report
dti.py report test_opd_0.npy test_opd_0.pdf
Installation
Installation for Linux (Debian)
- Download IAPACK
- Extract it with root permission. For example: sudo tar -C / -xvf iapack-0.3.linux-i686-py2.7.tar.gz
Requirements
Python 2.7 programming language (Python 2.6 for old versions)
Numpy 1.5.1 (fundamental package needed for scientific computing with Python)
Links
Python (programming language) http://www.python.org
Numpy (fundamental package needed for scientific computing with Python) http://numpy.scipy.org