Skip to content

flex_rf.tidy3d.Geometry

Type: class Base(s): Tidy3dBaseModel, ABC

Abstract base class, defines where something exists in space.

add_ax_labels_and_title(ax: Ax, x: float | None = None, y: float | None = None, z: float | None = None, plot_length_units: LengthUnit = None)

Sets the axis labels, tick labels, and title based on axis and an optional plot_length_units argument.

add_ax_lims(axis: Axis, ax: Ax, buffer: float = PLOT_BUFFER)

Sets the x,y limits based on self.bounds.

array(offsets: ArrayLike | None = None, transforms: ArrayLike | None = None)

Return an array of copies of this geometry with optional offsets and/or linear transforms.

bounding_box()

Returns Box representation of the bounding box of a Geometry.

bounds()

Returns bounding box min and max coordinates.

bounds_intersection(bounds1: Bound, bounds2: Bound)

Return the bounds that are the intersection of two bounds.

bounds_union(bounds1: Bound, bounds2: Bound)

Return the bounds that are the union of two bounds.

car_2_sph(x: float, y: float, z: float)

Convert Cartesian to spherical coordinates.

car_2_sph_field(f_x: float, f_y: float, f_z: float, theta: float, phi: float)

Convert vector field components in cartesian coordinates to spherical.

contains(other: Geometry, strict_inequality: tuple[bool, bool, bool] = [False, False, False])

Returns True if the .bounds of other are contained within the .bounds of self.

evaluate_inf_shape(shape: Shapely)

Returns a copy of shape with inf vertices replaced by large numbers if polygon.

from_gds(gds_cell: Cell, axis: Axis, slab_bounds: tuple[float, float], gds_layer: int, gds_dtype: int | None = None, gds_scale: PositiveFloat = 1.0, dilation: float = 0.0, sidewall_angle: float = 0, reference_plane: PlanePosition = 'middle')

Import a gdstk.Cell and extrude it into a GeometryGroup.

from_shapely(shape: Shapely, axis: Axis, slab_bounds: tuple[float, float], dilation: float = 0.0, sidewall_angle: float = 0, reference_plane: PlanePosition = 'middle')

Convert a shapely primitive into a geometry instance by extrusion.

inside(x: NDArray[float], y: NDArray[float], z: NDArray[float])

For input arrays x, y, z of arbitrary but identical shape, return an array with the same shape which is True for every point in zip(x, y, z) that is inside the volume of the Geometry, and False otherwise.

inside_meshgrid(x: NDArray[float], y: NDArray[float], z: NDArray[float])

Perform self.inside on a set of sorted 1D coordinates. Applies meshgrid to the supplied coordinates before checking inside.

intersections_2dbox(plane: Box)

Returns list of shapely geometries representing the intersections of the geometry with a 2D box.

intersections_plane(x: float | None = None, y: float | None = None, z: float | None = None, cleanup: bool = True, quad_segs: int | None = None, section_tolerance_2d: bool = False)

Returns list of shapely geometries at plane specified by one non-None value of x,y,z.

intersections_tilted_plane(normal: Coordinate, origin: Coordinate, to_2D: MatrixReal4x4, cleanup: bool = True, quad_segs: int | None = None, section_tolerance_2d: bool = False)

Return a list of shapely geometries at the plane specified by normal and origin.

intersects(other: Geometry, strict_inequality: tuple[bool, bool, bool] = [False, False, False])

Returns True if two Geometry have intersecting .bounds.

intersects_axis_position(axis: int, position: float, section_tolerance_2d: bool = False)

Whether self intersects plane specified by a given position along a normal axis.

intersects_plane(x: float | None = None, y: float | None = None, z: float | None = None)

Whether self intersects plane specified by one non-None value of x,y,z.

kspace_2_sph(ux: float, uy: float, axis: Axis)

Convert normalized k-space coordinates to angles.

load_gds_vertices_gdstk(gds_cell: Cell, gds_layer: int, gds_dtype: int | None = None, gds_scale: PositiveFloat = 1.0)

Load polygon vertices from a gdstk.Cell.

make_shapely_box(minx: float, miny: float, maxx: float, maxy: float)

Make a shapely box ensuring everything untraced.

make_shapely_point(minx: float, miny: float)

Make a shapely Point ensuring everything untraced.

parse_two_xyz_kwargs(**xyz: Any)

Turns x,y,z kwargs into indices of axes and the position along each axis.

parse_xyz_kwargs(**xyz: Any)

Turns x,y,z kwargs into index of the normal axis and position along that axis.

plot(x: float | None = None, y: float | None = None, z: float | None = None, ax: Ax = None, plot_length_units: LengthUnit = None, viz_spec: VisualizationSpec = None, **patch_kwargs: Any)

Plot geometry cross section at single (x,y,z) coordinate.

plot_params()

Default parameters for plotting a Geometry object.

plot_shape(shape: Shapely, plot_params: PlotParams, ax: Ax)

Defines how a shape is plotted on a matplotlib axes.

pop_axis(coord: tuple[Any, Any, Any], axis: int)

Separates coordinate at axis index from coordinates on the plane tangent to axis.

reflect_points(points: ArrayFloat3D, polar_axis: Axis, angle_theta: float, angle_phi: float)

Reflect a set of points in 3D at a plane passing through the coordinate origin defined and normal to a given axis defined in polar coordinates (theta, phi) w.r.t. the polar_axis which can be 0, 1, or 2.

reflected(normal: Coordinate)

Return a reflected copy of this geometry.

rotate_points(points: ArrayFloat3D, axis: Coordinate, angle: float)

Rotate a set of points in 3D.

rotated(angle: float, axis: Axis | Coordinate)

Return a rotated copy of this geometry.

scaled(x: float = 1.0, y: float = 1.0, z: float = 1.0)

Return a scaled copy of this geometry.

sph_2_car(r: float, theta: float, phi: float)

Convert spherical to Cartesian coordinates.

sph_2_car_field(f_r: float, f_theta: float, f_phi: float, theta: float, phi: float)

Convert vector field components in spherical coordinates to cartesian.

surface_area(bounds: Bound = None)

Returns object’s surface area with optional bounds.

to_gds(cell: Cell, x: float | None = None, y: float | None = None, z: float | None = None, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0)

Append a Geometry object’s planar slice to a .gds cell.

to_gds_file(fname: PathLike, x: float | None = None, y: float | None = None, z: float | None = None, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0, gds_cell_name: str = 'MAIN')

Export a Geometry object’s planar slice to a .gds file.

to_gdstk(x: float | None = None, y: float | None = None, z: float | None = None, gds_layer: NonNegativeInt = 0, gds_dtype: NonNegativeInt = 0)

Convert a Geometry object’s planar slice to a .gds type polygon.

translated(x: float, y: float, z: float)

Return a translated copy of this geometry.

unpop_axis(ax_coord: Any, plane_coords: tuple[Any, Any], axis: int)

Combine coordinate along axis with coordinates on the plane tangent to the axis.

volume(bounds: Bound = None)

Returns object’s volume with optional bounds.

zero_dims()

A list of axes along which the Geometry is zero-sized based on its bounds.