Skip to content

odak.wave.prism_phase_function

A definition to generate 2D phase function that represents a prism. See Goodman's Introduction to Fourier Optics book for more.

Parameters:

Name Type Description Default
nx int

Size of the output along X.

required
ny int

Size of the output along Y.

required
k odak.wave.wavenumber

See odak.wave.wavenumber for more.

required
angle float

Tilt angle of the prism in degrees.

required
dx float

Pixel pitch.

0.001
axis str

Axis of the prism.

'x'

Returns:

Type Description
ndarray

Generated phase function for a prism.

Source code in odak/wave/lens.py
def prism_phase_function(nx, ny, k, angle, dx=0.001, axis='x'):
    """
    A definition to generate 2D phase function that represents a prism. See Goodman's Introduction to Fourier Optics book for more.

    Parameters
    ----------
    nx         : int
                 Size of the output along X.
    ny         : int
                 Size of the output along Y.
    k          : odak.wave.wavenumber
                 See odak.wave.wavenumber for more.
    angle      : float
                 Tilt angle of the prism in degrees.
    dx         : float
                 Pixel pitch.
    axis       : str
                 Axis of the prism.

    Returns
    -------
    prism      : ndarray
                 Generated phase function for a prism.
    """
    angle = np.radians(angle)
    size = [ny, nx]
    x = np.linspace(-size[0]*dx/2, size[0]*dx/2, size[0])
    y = np.linspace(-size[1]*dx/2, size[1]*dx/2, size[1])
    X, Y = np.meshgrid(x, y)
    if axis == 'y':
        prism = np.exp(-1j*k*np.sin(angle)*Y)
    elif axis == 'x':
        prism = np.exp(-1j*k*np.sin(angle)*X)
    return prism

See also