prysm.segmented

Tools for working with segmented systems.

class prysm.segmented.Hex(q, r, s)

Bases: tuple

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

q

Alias for field number 0

r

Alias for field number 1

s

Alias for field number 2

prysm.segmented.add_hex(h1, h2)

Add two hex coordinates together.

prysm.segmented.sub_hex(h1, h2)

Subtract two hex coordinates.

prysm.segmented.mul_hex(h1, h2)

Multiply two hex coordinates.

prysm.segmented.hex_dir(i)

Hex direction associated with a given integer, wrapped at 6.

prysm.segmented.hex_neighbor(h, direction)

Neighboring hex in a given direction.

prysm.segmented.hex_to_xy(h, radius, rot=90)

Convert hexagon coordinate to (x,y), if all hexagons have a given radius and rotation.

prysm.segmented.scale_hex(h, k)

Scale a hex coordinate by some constant factor.

prysm.segmented.hex_ring(radius)

Compute all hex coordinates in a given ring.

class prysm.segmented.CompositeHexagonalAperture(x, y, rings, segment_diameter, segment_separation, segment_angle=90, exclude=())

Bases: object

An aperture composed of several hexagonal segments.

prepare_opd_bases(basis_func, orders, basis_func_kwargs=None, normalization_radius=None)

Prepare the polynomial bases for per-segment phase errors.

Parameters
  • basis_func (callable) – a function with signature basis_func(orders, [x, y or r, t], **kwargs) for example, zernike_nm_sequence from prysm.polyomials fits the bill

  • orders (iterable) – sequence of polynomial orders or indices. for example, zernike_nm_sequence may be combined with a monoindexing function as e.g. orders=[noll_to_nm(j) for j in range(3,12)]

  • basis_func_kwargs (dict) – any keyword arguments to pass to basis_func. The spatial coordinates will already be passed based on inspection of the function signature and should not be attempted to be included here

  • normalization_radius (float) – the normaliation radius to use to convert local surface coordinates to normalized coordinates for an orthogonal polynomial. if None, defaults to the half segment vertex to vertex distance, v to v is 2/sqrt(3) times the segment diameter given in the constructor if basis_func does not take arguments (r, t), the radius is assumed to be equal in X and Y

compose_opd(coefs, out=None)

Compose per-segment optical path errors using the basis from prepare_opd_bases

Parameters
  • coefs (iterable) – an iterable of coefficients for each segment present, i.e. excluding those in the exclude list from the constructor if an array, must be of shape (len(self.segment_ids), len(orders)) where orders comes from the proceeding call to prepare_opd_bases

  • out (numpy.ndarray) – array to insert OPD into, allocated if None

Returns

OPD map of real datatype

Return type

numpy.ndarray