slmsuite.holography.toolbox#

Helper functions for manipulating phase patterns.

Submodules

phase

Repository of common analytic phase patterns.

Functions

assign_vectors

Assigns each vector in vectors to the closest counterpart assignment_options.

build_affine

Builds an affine transformation \(\vec{y} = M \cdot \vec{x} + \vec{b}\) mapping SLM Fourier space ("kxy") to camera pixels from a known effective focal length.

convert_blaze_radius

Alias for convert_radius() for backwards compatibility.

convert_blaze_vector

Alias for convert_vector() for backwards compatibility.

convert_radius

Helper function for scalar unit conversions.

convert_vector

Helper function for vector unit conversions in the \(k\)-space of the SLM.

fit_3pt

Fits three points to an affine transformation.

format_2vectors

Validates that an array of 2-dimensional vectors is a numpy.ndarray of shape (2, N).

format_shape

Helper function to format a shape tuple.

format_vectors

Validates that an array of M-dimensional vectors is a numpy.ndarray of shape (M, N).

imprint

Imprints a region (defined by window) of a matrix with a function in-place.

lloyds_algorithm

Implements Lloyd's Algorithm on a set of seed vectors to promote even vector spacing.

lloyds_points

Implements Lloyd's Algorithm without seed vectors; instead, autogenerates the seed vectors randomly.

pad

Helper function to pad data with zeros.

print_blaze_conversions

Helper function to understand unit conversions.

smallest_distance

Returns the smallest distance between pairs of points under a given metric.

transform_grid

Returns a copy of a coordinate basis grid with a given shift and transformation.

unpad

Helper function to unpad data.

voronoi_windows

Returns boolean array windows corresponding to the Voronoi cells for a set of vectors.

window_extent

Find a rectangle that covers the active region of the 2D boolean mask window.

window_slice

Parses the slices that describe the window's view into the larger 2D array.

Classes

Aperture

A region of a coordinate grid, used to scale, crop, and shift functions defined on a canonical unit disk (e.g. lenses, axicons, vortices, or Zernike polynomials) and to describe the illuminated region of an SLM.