detector

airy_to_hex(s)[source]
circle(n, radius)[source]

It calculates a single binary mask with the shape of a circle.

Parameters:
  • n (int) – number of pixels of the simulation space, assumed squared.

  • radius (float) – Radius of the circle in pixel units.

Returns:

circle_pinhole – Image of the binary mask.

Return type:

np.ndarray (n x n)

custom_detector(grid, device)[source]

It calculates Nx x Nx x Nch array of binary masks, describing a detector array.

Parameters:

grid (GridParameters) – Object with array detector and simulation space parameters

Returns:

detector – Numpy array of binary masks. Each channel is a pinhole in a different position.

Return type:

np.ndarray (Nx x Nx x Nch)

det_coords(n, geometry)[source]

It calculates the coordinates of the pinhole centers from a given geometry.

Parameters:
  • n (int) – number of pixels of the simulation space, assumed squared.

  • geometry (str) – Detector geometry. Valid choices are ‘rect’ or ‘hex’.

Returns:

s – Array with coordinates of the pinhole centers.

Return type:

np.ndarray (2 x Nch)

hex_grid(n, x)[source]

It calculates the normalized coordinates of a hexagonal grid.

Parameters:
  • n (int) – number of pixels of the simulation space, assumed squared.

  • x (np.ndarray (N)) – array with normalized coordinates along a single axis.

Returns:

s – Array with hexagonal grid coordinates.

Return type:

np.ndarray (2 x N**2)

hex_to_airy(s)[source]
hexagon(n, radius)[source]

It calculates a single binary mask with the shape of a regular hexagon. The radius is the distance from the center to a vertex.

Parameters:
  • n (int) – number of pixels of the simulation space, assumed squared.

  • radius (float) – Distance from the center to a vertex of the hexagon in pixel units.

Returns:

hex_pinhole – Image of the binary mask.

Return type:

np.ndarray (n x n)

pinhole_array(s, nx, mag, pxsize, pxdim, pinhole_shape, device)[source]

It calculates Nx x Nx x Nch array of binary masks, describing a detector array.

Parameters:
  • s (np.ndarray (2 x Nch)) – Array with coordinates of the pinhole centers.

  • nx (int) – number of pixels of the simulation space, assumed squared.

  • mag (float) – Magnification of the microscope.

  • pxsize (float) – Size of the scan pixel.

  • pxdim (float) – Diameter of the individual pinhole of the detector array.

  • pinhole_shape (str) – Shape of the invidual pinhole. Valid choices are ‘square’, ‘cirle’, or ‘hexagon’.

Returns:

detector – Numpy array of binary masks. Each channel is a pinhole in a different position.

Return type:

np.ndarray (Nx x Nx x Nch)

rect_grid(n, x)[source]

It calculates the normalized coordinates of a rectangular grid.

Parameters:
  • n (int) – number of pixels of the simulation space, assumed squared.

  • x (np.ndarray (N)) – array with normalized coordinates along a single axis.

Returns:

s – Array with rectangular grid coordinates.

Return type:

np.ndarray (2 x N**2)

square(n, length)[source]

It calculates a single binary mask with the shape of a square.

Parameters:
  • n (int) – number of pixels of the simulation space, assumed squared.

  • length (float) – Length of the square in pixel units.

Returns:

square_pinhole – Image of the binary mask.

Return type:

np.ndarray (n x n)

transform_detector(gridPar, detector)[source]