pyoptools.wavefront.calc package

Submodules

Module contents

Collection of functions that calculate different things using fields.

pyoptools.wavefront.calc.asGS(z, target, estimate=None, iterations=20, error=None)

Angular spectrum Gerchberg - Saxton Algorithm

Calculates the phase distribution in a object plane (for a given amplitude constrain) to obtain an specific amplitude distribution in the target plane. It uses the Gerchberg - Saxton algorithm for the angular spectrum propagation.

ARGUMENTS:

z

Propagation distance. This is used to calculate the resolution needed in the object plane, for a given target resolution.

target

Field instance whose amplitude distribution is used to represent the amplitude constrain to be applied in the target plane. The phase of this field is not used.

estimate

Field instance used as initial estimate for the problem. The amplitude of this field is taken as the reference amplitude and the phase is obtained. It must have the same resolution as the target field.

If not given, a unitary amplitude wave, with random phase and the correct resolution, is used.

iterations

Maximum number of iterations

error

Expected error

Note

target and object must have the same wavelength

RETURN VALUE:

(holo,err)

holo

Field instance, containing the reference amplitude

information and the phase obtained from the iterative algorithm. The holo.res attribute contains the resolution of the calculated hologram for the given propagation distance. The holo.l attribute contains the wavelength used to calculate the hologram.

err

Final error obtained

pyoptools.wavefront.calc.ffGS(z, target, estimate=None, iterations=20, error=None)

Far field Gerchberg - Saxton Algorithm

Calculates the phase distribution in a object plane (for a given amplitude constrain) to obtain an specific amplitude distribution in the target plane. It uses the Gerchberg - Saxton algorithm for Fraunhoffer propagation. A FFT implementation of the Fraunhoffer Transform is used.

ARGUMENTS:

z

Propagation distance. This is used to calculate the resolution needed in the object plane, for a given target resolution.

target

Field instance whose amplitude distribution is used to represent the amplitude constrain to be applied in the target plane. The phase of this field is not used.

estimate

Field instance used as initial estimate for the problem. The amplitude of this field is taken as the reference amplitude and the phase is obtained. The resolution used to define this field must match the value needed to obtain the required target resolution when the FFT-Fraunhoffer transform is used. If the wrong value is given an exception is raised. If not given, a unitary amplitude wave, with random phase and the correct resolution, is used.

iterations

Maximum number of iterations

error

Expected error

Note

target and object must have the same wavelength

RETURN VALUE:

(holo,err)

holo

Field instance, containing the reference amplitude

information and the phase obtained from the iterative algorithm. The holo.res attribute contains the resolution of the calculated hologram for the given propagation distance. The holo.l attribute contains the wavelength used to calculate the hologram.

err

Final error obtained

pyoptools.wavefront.calc.fftGS(z, target, estimate=None, iterations=20, error=None, flagRand=True)

Far field Gerchberg - Saxton Algorithm

Calculates the phase distribution in a object plane (for a given amplitude constrain) to obtain an specific amplitude distribution in the target plane. It uses the Gerchberg - Saxton algorithm for far-field propagation, using a standard FFT.

ARGUMENTS:

z

Propagation distance. This is used to calculate the resolution needed in the object plane, for a given target resolution.

target

Field instance whose amplitude distribution is used to represent the amplitude constrain to be applied in the target plane. The phase of this field is not used.

estimate

Field instance used as initial estimate for the problem. The amplitude of this field is taken as the reference amplitude and the phase is obtained. The resolution used to define this field must match the value needed to obtain the required target resolution when the FFT-Fraunhoffer transform is used. If the wrong value is given an exception is raised. If not given, a unitary amplitude wave, with random phase and the correct resolution, is used.

iterations

Maximum number of iterations

error

Expected error

Note

target and object must have the same wavelength

RETURN VALUE:

(holo,err)

holo

Field instance, containing the reference amplitude

information and the phase obtained from the iterative algorithm. The holo.res attribute contains the resolution of the calculated hologram for the given propagation distance. The holo.l attribute contains the wavelength used to calculate the hologram.

err

Final error obtained

pyoptools.wavefront.calc.frGS(z, target, estimate=None, iterations=20, error=None)

Fresnel transform Gerchberg - Saxton Algorithm

Calculates the phase distribution in a object plane (for a given amplitude constrain) to obtain an specific amplitude distribution in the target plane.

A FFT implementation of the Fresnel Transform is used.

ARGUMENTS:

z

Propagation distance. This is used to calculate the resolution needed in the object plane, for a given target resolution.

target

Field instance whose amplitude distribution is used to represent the amplitude constrain to be applied in the target plane. The phase of this field is not used.

estimate

Field instance used as initial estimate for the problem. The amplitude of this field is taken as the reference amplitude and the phase is obtained. The resolution used to define this field must match the value needed to obtain the required target resolution when the FFT-Fresnel transform is used. If the wrong value is given an exception is raised. If not given, a unitary amplitude wave, with random phase and the correct resolution, is used.

iterations

Maximum number of iterations

error

Expected error

Note

target and object must have the same wavelength

RETURN VALUE:

(holo,err)

holo

Field instance, containing the reference amplitude

information and the phase obtained from the iterative algorithm. The holo.res attribute contains the resolution of the calculated hologram for the given propagation distance. The holo.l attribute contains the wavelength used to calculate the hologram.

err

Final error obtained