physical_apertures.rotated#

Rotation of an existing physical aperture around a specified pivot.

Classes

RotatedAperture(aperture, angle[, center_x, ...])

Rotate an aperture counterclockwise about +z.

class RotatedAperture(aperture: BaseAperture, angle: float, center_x: float = 0.0, center_y: float = 0.0)[source]#

Rotate an aperture counterclockwise about +z.

Parameters:
  • aperture – The aperture to rotate.

  • angle – Rotation angle in radians.

  • center_x – Pivot x-coordinate, defaulting to the surface origin.

  • center_y – Pivot y-coordinate, defaulting to the surface origin.

Raises:

ValueError – If the angle or pivot coordinates are not finite.

clip(rays: RealRays)#

Clips the given rays based on the aperture’s shape.

Parameters:

rays (RealRays) – List of rays to be clipped.

Returns:

List of clipped rays.

Return type:

list

contains(x: BEArray, y: BEArray) → BEArray[source]#

Test points after inverse rotation into the child aperture’s frame.

property extent: tuple[float, float, float, float]#

Return an enclosing rotated bounding box, including unbounded shapes.

classmethod from_dict(data: dict[str, Any]) → RotatedAperture[source]#

Restore a rotation using the shared native aperture dispatch.

scale(scale_factor: float) → None[source]#

Scale the child aperture and pivot together, retaining the angle.

to_dict() → dict[str, Any][source]#

Persist the child definition, angle and pivot in native aperture data.

view(nx: int = 256, ny: int = 256, ax: Axes | None = None, buffer: float = 1.1, **kwargs) → tuple[Figure, Axes]#

Visualize the aperture.

Parameters:
  • nx (int) – The number of points in the x-direction.

  • ny (int) – The number of points in the y-direction.

  • ax (Axes) – The axes to plot on.

  • buffer (float) – The buffer around the aperture.

  • **kwargs – Additional keyword arguments to pass to the plot function.

Returns:

A tuple containing the figure and axes objects.

Return type:

tuple