prysm.objects

Objects for image simulation with.

prysm.objects.slit(x, y, width_x, width_y=None)

Rasterize a slit or pair of crossed slits.

Parameters
  • x (numpy.ndarray) – x coordinates, 1D or 2D

  • y (numpy.ndarray) – y coordinates, 1D or 2D

  • width_x (float) – the half-width of the slit in x, diameter will be 2x width_x. produces a line along the y axis, use None to not do so

  • width_y (float) – the half-height of the slit in y, diameter will be 2x width_y. produces a line along the y axis, use None to not do so

  • orientation (string, {‘Horizontal’, ‘Vertical’, ‘Crossed’, ‘Both’}) – the orientation of the slit; Crossed and Both produce the same results

Notes

Default of 0 samples allows quick creation for convolutions without generating the image; use samples > 0 for an actual image.

prysm.objects.slit_ft(width_x, width_y, fx, fy)

Analytic fourier transform of a slit.

Parameters
  • width_x (float) – x width of the slit, pass zero if the slit only has width in y

  • width_y (float) – y width of the slit, pass zero if the slit only has width in x

  • fx (numpy.ndarray) – sample points in x frequency axis

  • fy (numpy.ndarray) – sample points in y frequency axis

Returns

2D array containing the analytic fourier transform

Return type

numpy.ndarray

prysm.objects.pinhole(radius, rho)

Rasterize a pinhole.

Parameters
  • radius (float) – radius of the pinhole

  • rho (numpy.ndarray) – radial coordinates

Returns

2D array containing the pinhole

Return type

numpy.ndarray

prysm.objects.pinhole_ft(radius, fr)

Analytic fourier transform of a pinhole.

Parameters
  • radius (float) – radius of the pinhole

  • fr (numpy.ndarray) – radial spatial frequency

Returns

2D array containing the analytic fourier transform

Return type

numpy.ndarray

prysm.objects.siemensstar(r, t, spokes, oradius=0.9, iradius=0, background='black', contrast=0.9, sinusoidal=False)

Rasterize a Siemen’s Star.

Parameters
  • r (numpy.ndarray) – radial coordinates, 2D

  • t (numpy.ndarray) – azimuthal coordinates, 2D

  • spokes (int) – number of spokes in the star

  • oradius (float) – outer radius of the star

  • iradius (float) – inner radius of the star

  • background (str, optional, {‘black’, ‘white’}) – background color

  • contrast (float, optional) – contrast of the star, 1 = perfect black/white

  • sinusoidal (bool, optional) – if True, generates a sinusoidal Siemen’ star, else, generates a bar/block siemen’s star

Returns

2D array of the same shape as r, t which is in the range [0,1]

Return type

numpy.ndarray

prysm.objects.tiltedsquare(x, y, angle=4, radius=0.5, contrast=0.9, background='white')

Rasterize a tilted square.

Parameters
  • x (numpy.ndarray) – x coordinates, 2D

  • y (numpy.ndarray) – y coordinates, 2D

  • angle (float) – counter-clockwise angle of the square from x, degrees

  • radius (float) – radius of the square

  • contrast (float) – contrast of the square

  • background (str, optional, {‘white’, ‘black’}) – whether to paint a white square on a black background or vice-versa

Returns

ndarray containing the rasterized square

Return type

numpy.ndarray

prysm.objects.slantededge(x, y, angle=4, contrast=0.9, crossed=False)

Rasterize a slanted edge.

Parameters
  • x (numpy.ndarray) – x coordinates, 2D

  • y (numpy.ndarray) – y coordinates, 2D

  • angle (float) – angle of the edge to the cartesian y axis

  • contrast (float) – contrast of the edge

  • crossed (bool, optional) – if True, draw crossed edges instead of just one