prysm.x.psi#

Phase Shifting Interferometry.

class prysm.x.psi.Scheme(shifts, s, c)#

Bases: tuple

Create new instance of Scheme(shifts, s, c)

c#

Alias for field number 2

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

s#

Alias for field number 1

shifts#

Alias for field number 0

prysm.x.psi.psi_accumulate(gs, scheme)#

Accumulate the numerator and denominator for PSI reconstruction.

The numerator is the sine of the complex wave, and the denominator the cosine.

Parameters:
  • gs (iterable) – sequence of images

  • scheme (Scheme) – a PSI scheme, or any other object with .s and .c attributes, which are the sines and cosines of a sequence of phase shifts

Returns:

numerator (sine) and denominator (cosine)

Return type:

ndarray, ndarray

prysm.x.psi.degroot_formalism_psi(gs, scheme)#

Peter de Groot’s formalism for Phase Shifting Interferometry algorithms.

Parameters:
  • gs (iterable) – sequence of images

  • scheme (Scheme) – a PSI scheme, or any other object with .s and .c attributes, which are the sines and cosines of a sequence of phase shifts

Returns:

wrapped phase estimate

Return type:

ndarray

Notes

Ref “Measurement of transparent plates with wavelength-tuned phase-shifting interferometry”

Peter de Groot, Appl. Opt, 39, 2658-2663 (2000) https://doi.org/10.1364/AO.39.002658

prysm.x.psi.design_scheme(N, stepsize=None, window=None)#

Design a new PSI scheme.

A scheme is simply the cosine or sine of the phase shifts, each multiplied by a window whose job is to reduce spectral leakage and improve robustness to imperfect phase shifts and other data acquisition errors. The window is often rounded or made non-ideal, in order for the s and c coefficients generated to be integers. There is no inherent benefit to integer coefficients except that they are easier to write down and more sympathetic to an implementation of psi_accumulate() on an FPGA or microprocessor with reduced floating point performance.

Parameters:
  • N (int) – number of steps in the scheme; odd numbers are typically preferrable

  • stepsize (float) – stepsize, in the sense of 2pi = a full phase shift. stepsize = 2pi/(N-1) if stepsize is not given

  • window (None or ndarray or str) – if None, no window (equivalent to a window of ones) is used. if an ndarray, used as-is if a str, a member of scipy.signal.window; note that sym=False will be passed

Returns:

a complete PSI scheme

Return type:

Scheme

prysm.x.psi.unwrap_phase(wrapped, mask)#

Unwrap an array containing phase warpped at pi.

Parameters:
  • wrapped (ndarray) – 2D array of phase data, wrapped

  • mask (ndarray) – boolean mask array

Returns:

unwrapped phase

Return type:

ndarray

Notes

currently just a wrapper for scikit-image