prtools.waffle#

waffle(shape, cycles, shift=(0, 0), angle=0, indexing='ij')[source]#

Generate a 2D waffle function.

The waffle function is the sum of two orthogonal sine functions.

Parameters:
  • shape (array_like) – Size of output in pixels (nrows, ncols)

  • cycles (float) – Number of cycles represented across the shape.

  • shift ((2,) array_like, optional) – Shape translation from center of containing array. Default is (0, 0)

  • angle (float, optional) – Rotation in degrees from horizontal. Default is 0.

  • indexing ({'ij', 'xy'}, optional) – Matrix (‘ij’, default) or cartesian (‘xy’) indexing of output.

Return type:

ndarray

Examples

>>> waffle = prtools.waffle(shape=(256,256), cycles=10)
>>> plt.imshow(waffle, cmap='gray')
../_images/prtools-waffle-1.png