pyoptics.ifta

Module that implements IFTA-style algorithms.

All algorithms share common properties:

1. They need a transform from “here” to “there”. “Here” will be called object space, “there” will be called image space. 2. For each space, a method that enforces constraints needs to be given. 3. An error condition needs to be supplied.

Both the constraint enforcers and the error condition will be given these arguments:

curr_obj, curr_img, num_iter.

References

R. W. Gerchberg and W. O. Saxton, “A practical algorithm for the determination of phase from image and diffraction plane pictures”, Optik 35, 237-246 (1972).

J. R. Fienup, “Phase retrieval algorithms: a comparison”, Appl. Opt. 21, 2758-2769 (1982).

F. Wyrowski and O. Bryngdahl, “Iterative Fourier-transform algorithm applied to computer holography”, J. Opt. Soc. Am. A 5, 1058-1065 (1988).

O. Ripoll, V. Kettunen and H. P. Herzig, “Review of iterative Fourier-transform algorithms for beam shaping applications”, Opt. Eng. 43, 2549-2556 (2004).

Classes

GS

Simple Gerchberg-Saxton.

IFTABase

Base class for IFTA-style algorithms.

IFTA_HOO

IFTA_OverCompensation

Functions

digitize_phase

Quantize the phase of a field to a given number of levels.

img_E

norm_to_E

class pyoptics.ifta.IFTABase(to_image_space, to_object_space, image_space_constrainer, object_space_constrainer, stopping_condition)[source]

Bases: object

Base class for IFTA-style algorithms.

Derived class take everything it needs to construct a forward and a backward transform as the constructor’s argument, build the transforms, the constraint enforcing routines and the error estimate and finally pass those routines up to the IFTA base class, which implements the iteration itself.

This approach allows easy and quick implementation of the Gerchberg-Saxton algorithm as well as Fienup-style Hybrid-Input-Output algorithms. In principle, it should also be possible to devise classes that handle e.g. near-field beam shaping elements.

class pyoptics.ifta.GS(obj_I, img_I, N_max)[source]

Bases: IFTABase

Simple Gerchberg-Saxton.

class pyoptics.ifta.IFTA_HOO(obj_I, img_I, N_max)[source]

Bases: IFTABase

class pyoptics.ifta.IFTA_OverCompensation(obj_I, img_I, N_max)[source]

Bases: IFTABase

pyoptics.ifta.digitize_phase(field, levels)[source]

Quantize the phase of a field to a given number of levels.

Useful for e.g. multi-level beam shaping elements; each phase in a bin of (-pi, pi] is replaced by the bin center.

Parameters:
fieldarray

Complex field.

levelsint

Number of phase levels.

Returns:
fieldarray

Field with the original amplitude and the quantized phase.