slmsuite.holography.toolbox.shift_grid

shift_grid(grid, transform=None, shift=None)[source]

Returns a copy of a coordinate basis grid with a given shift and transformation. These can be the \(\vec{b}\) and \(M\) of a standard affine transformation as used elsewhere in the package. Such grids are used as arguments for phase patterns, such as those in slmsuite.holography.toolbox.phase.

Parameters
  • grid ((array_like, array_like) OR SLM) – Meshgrids of normalized \(\frac{x}{\lambda}\) coordinates corresponding to SLM pixels, in (x_grid, y_grid) form. These are precalculated and stored in any SLM, so such a class can be passed instead of the grids directly.

  • transform (float OR ((float, float), (float, float)) OR None) – If a scalar is passed, this is the angle to rotate the basis of the lens by. Defaults to zero if None. If a 2x2 matrix is passed, transforms the \(x\) and \(y\) grids according to \(x' = M_{00}x + M_{01}y\), \(y' = M_{10}y + M_{11}y\).

  • shift ((float, float) OR None) – Translational shift of the grid in normalized \(\frac{x}{\lambda}\) coordinates. Defaults to no shift if None.

Returns

grid – The shifted grid

Return type

(array_like, array_like)