Flex Device Library
API Documentation
|
Creates a waveguide crossing with flexable crossing section. |
|
Creates a taper waveguide with varying widths. |
|
Creates a splitter where its main body consists of multiple sections of different widths. |
|
Creates a flexable 90 degrees bend where the bend body consists of multiple sections of different width |
|
Rotate a curve defined by x and y arrays by a given angle around a center point. |
- pyOptiShared.Designs.bezier_anchored_route(user_points: ndarray, anchor_length: float = 2.0, width: float = 0.5, stub_length: float = 0.5, resolution: int = 150, layer: int = 1, write: bool = False) Cell
Creates a waveguide route from an array of user-defined points, automatically injecting horizontal anchoring control points at the start and end to ensure perfectly straight port connections.
- Parameters:
user_points (np.ndarray) – An Nx2 array of (x,y) coordinates guiding the path. Minimum 2 points.
anchor_length (float, optional) – How strongly the path is forced to stay horizontal at the input/output before curving. Defaults to 2.0.
width (float, optional) – The constant width of the waveguide. Defaults to 0.5.
stub_length (float, optional) – Length of the straight input/output attachments. Defaults to 0.5.
resolution (int, optional) – Number of points used to smoothly render the curve. Defaults to 150.
layer (int, optional) – Defines the layer number where the bend resides. Defaults to 1.
write (bool, optional) – Write the created GDS file. Defaults to False.
- Returns:
a gdstk library cell that contains the routed device.
- Return type:
gdstk.Cell
- pyOptiShared.Designs.bezier_bend90(dr_in: ndarray, dr_out: ndarray, waveguide_width: float = 0.5, radius: float = 2.0, resolution: int = 100, layer: int = 1, write: bool = False) Cell
Creates a flexible 90-degree bend where the profile is defined by Bézier curves in polar coordinates.
- Parameters:
dr_in (np.ndarray) – An array that contains the variations in the radius of the inner section.
dr_out (np.ndarray) – An array that contains the variations in the radius of the outer section.
waveguide_width (float, optional) – Port width. Defaults to 0.5.
radius (float, optional) – Defines the base radius of the bend. Defaults to 2.
resolution (int, optional) – Number of points used to render the smooth curve. Defaults to 100.
layer (int, optional) – Defines the layer number where the bend resides. Defaults to 1.
write (bool, optional) – Write the created GDS file. Defaults to False.
- Returns:
a gdstk library cell that contains the device.
- Return type:
gdstk.Cell
- pyOptiShared.Designs.bezier_crossing(cross_dw: ndarray, width: float = 0.5, length: float = 1.0, dsep: float = 2.0, resolution: int = 50, layer: int = 1, write: bool = False) Cell
Creates a waveguide crossing with a flexible Bézier-defined central crossing section.
- Parameters:
cross_dw (np.ndarray) – Array of intermediate width variations for the crossing control points.
width (float, optional) – Input port width. Defaults to 0.5.
length (float, optional) – Length of each straight section connected to the crossing. Defaults to 1.
dsep (float, optional) – Separation of the straight sections (size of the central crossing). Defaults to 2.
resolution (int, optional) – Number of points used to smoothly render the Bézier curve. Defaults to 50.
layer (int, optional) – Defines the layer number of the device.
write (bool, optional) – Use to write the generated gds. Defaults to False.
- Returns:
gdstk cell containing the completed crossing.
- Return type:
gdstk.Cell
- pyOptiShared.Designs.bezier_path(path_points: ndarray, width: float = 0.5, stub_length: float = 0.5, resolution: int = 100, layer: int = 1, write: bool = False) Cell
Creates a waveguide bend where the centerline path is defined by an arbitrary N-point Bézier curve.
- Parameters:
path_points (np.ndarray) – An Nx2 array of (x,y) control points for the centerline.
width (float, optional) – The constant width of the waveguide. Defaults to 0.5.
stub_length (float, optional) – Length of the straight input/output attachments. Defaults to 0.5.
resolution (int, optional) – Number of points used to smoothly render the curve. Defaults to 100.
layer (int, optional) – Defines the layer number where the bend resides. Defaults to 1.
write (bool, optional) – Write the created GDS file. Defaults to False.
- Returns:
a gdstk library cell that contains the device.
- Return type:
gdstk.Cell
- pyOptiShared.Designs.bezier_sbend(input_location: tuple, length: float, offset: float, bezier_points: list, straight_length: float = 0.5, anchor_length: float = None, width: float = 0.5, overlap: float = 0.005, resolution: int = 150, layer: int = 1, write: bool = False) Cell
Creates an S-bend with straight rectangular input/output sections. The internal curve is guided by an N-length list of user points. The function automatically appends start, end, and horizontal anchor points to guarantee G1 continuity, and applies a slight overlap to prevent GDSII boundary gaps.
- Parameters:
input_location (tuple) – The (x, y) coordinates of the very start of the device.
length (float) – The X-axis distance of the curved section.
offset (float) – The Y-axis offset of the curved section.
user_points (list) – A list of N [x, y] coordinates to guide the internal path.
straight_length (float, optional) – Length of the straight rectangles. Defaults to 0.5.
anchor_length (float, optional) – X-distance the curve is forced to stay horizontal before turning. Defaults to 20% of the length.
width (float, optional) – The constant width of the waveguide. Defaults to 0.5.
overlap (float, optional) – Distance the rectangles extend into the curve to close gaps. Defaults to 0.001.
resolution (int, optional) – Number of points to render the curve. Defaults to 150.
layer (int, optional) – Defines the layer number. Defaults to 1.
write (bool, optional) – Write the created GDS file. Defaults to False.
- Returns:
a gdstk library cell that contains the routed device.
- Return type:
gdstk.Cell
- pyOptiShared.Designs.bezier_sbend2(start_point: tuple, end_point: tuple, n_points: int = 4, width: float = 0.5, stub_length: float = 0.5, resolution: int = 100, layer: int = 1, write: bool = False) Cell
Creates an S-bend routing waveguide where the internal Bézier control points are automatically generated and anchored to ensure horizontal input/output tangents.
- Parameters:
start_point (tuple) – The (x, y) coordinates of the input port.
end_point (tuple) – The (x, y) coordinates of the output port.
n_points (int, optional) – Total number of Bézier control points. Must be >= 4. Defaults to 4.
width (float, optional) – The constant width of the waveguide. Defaults to 0.5.
stub_length (float, optional) – Length of the straight input/output attachments. Defaults to 0.5.
resolution (int, optional) – Number of points used to smoothly render the curve. Defaults to 100.
layer (int, optional) – Defines the layer number where the bend resides. Defaults to 1.
write (bool, optional) – Write the created GDS file. Defaults to False.
- Returns:
a gdstk library cell that contains the S-bend device.
- Return type:
gdstk.Cell
- pyOptiShared.Designs.bezier_splitter(widths: ndarray, length: float, waveguide_input: float = 0.5, taper_length: float = 3.0, taper_input: float = 1.0, resolution: int = 50, layer: int = 1, write: bool = False) Library
Creates a splitter where its main body profile is defined by a Bézier curve.
- Parameters:
widths (np.ndarray) – Array of intermediate control widths pulling the body section.
length (float) – Total length of the splitter body.
waveguide_input (float, optional) – Input port width. Defaults to 0.5.
taper_length (float, optional) – Length of the taper section of the connected waveguides. Defaults to 3.0.
taper_input (float, optional) – The width of the taper connected to the splitter body. Defaults to 1.00.
resolution (int, optional) – Number of points used to smoothly render the Bézier curve. Defaults to 50.
layer (int, optional) – Defines the layer number of the device.
write (bool, optional) – Use to write the generated gds. Defaults to False.
- Returns:
A gdstk Library of the created device.
- Return type:
gdstk.Library
- pyOptiShared.Designs.bezier_taper(widths: ndarray, input_length: float = 0.3, taper_length: float = 1.0, in_width: float = 0.5, out_width: float = 2.0, resolution: int = 50, layer: int = 1, write: bool = False) Library
Creates a taper waveguide with a profile defined by a Bézier curve.
- Parameters:
widths (np.ndarray) – array of intermediate control point widths that pull the taper shape.
input_length (float, optional) – input waveguide length. Defaults to 0.3.
taper_length (float, optional) – taper length. Defaults to 1.0.
in_width (float, optional) – input waveguide width. Defaults to 0.5.
out_width (float, optional) – output waveguide width. Defaults to 2.0.
resolution (int, optional) – number of points used to render the smooth curve. Defaults to 50.
layer (int, optional) – Defines the layer number of the device.
write (bool, optional) – Use to write the generated gds. Defaults to False.
- Returns:
gdstk library that holds the created device.
- Return type:
gdstk.library
- pyOptiShared.Designs.cosine_taper(input_length: float = 0.3, in_width: float = 0.5, out_width: float = 2.0, max_width: float = 3, taper_length=1.0, resolution: int = 40, layer: int = 1, write: bool = False)
- pyOptiShared.Designs.cosine_waveguide_crossing(input_length: float = 0.3, in_width: float = 0.5, out_width: float = 2.0, max_width: float = 3, taper_length=1.0, resolution: int = 40, layer: int = 1, write: bool = False)
- pyOptiShared.Designs.flex_bend90(dr_in: ndarray, dr_out: ndarray, waveguide_width: float = 0.5, radius: float = 2, resolution: int = 40, layer: int = 1, write: bool = False) Cell
Creates a flexable 90 degrees bend where the bend body consists of multiple sections of different width
- Parameters:
dr_in (np.ndarray) – An array that contains the changes in the radius of the input section.
dr_out (np.ndarray) – An array that contains the changes in the radius of the output section.
waveguide_width (float, optional) – Port width. Defaults to 0.5.
radius (float, optional) – Defines the radius of the bend. Defaults to 2.
resolution (int, optional) – The order of the polynomial used to smooth the body section widths. Defaults to 40.
layer (int, optional) – Defines the layer number where the bend resides. Defaults to 1.
write (bool, optional) – Write the created GDS file. Defaults to False.
- Returns:
a gdstk library cell that contains the device.
- Return type:
gdstk.Cell
- pyOptiShared.Designs.flex_crossing(cross_dw: ndarray, width: float = 0.5, length: float = 1, dsep: float = 2, resolution=40, layer: int = 1, write: bool = False)
Creates a waveguide crossing with flexable crossing section.
- Parameters:
cross_dw (np.ndarray) – Array of widths variations
width (float, optional) – Input port width. Defaults to 0.5.
length (float, optional) – Length of each section in the crossing. Defaults to 1.
dsep (float, optional) – Separation of the straight. Defaults to 2.
layer (int, optional) – Defines the layer number of the device.
write (bool, optional) – Use to write the generated gds. Defaults to False.
- Returns:
gdstk cell
- Return type:
gdstk.Cell
- pyOptiShared.Designs.flex_splitter(widths: ndarray, length: float, waveguide_input: float = 0.5, taper_length: float = 3.0, taper_input: float = 1.0, resolution: int = 20, layer: int = 1, write: bool = False) Library
Creates a splitter where its main body consists of multiple sections of different widths.
- Parameters:
widths (np.ndarray) – Array of widths in the taper section.
length (float) – Total length of the splitter body
waveguide_input (float, optional) – Input port width. Defaults to 0.5.
taper_length (float, optional) – Length of the taper section of the connected waveguides. Defaults to 3.0.
taper_input (float, optional) – The width of the taper connected to the splitter body. Defaults to 1.00.
resolution (int, optional) – The order of the polynomial used to smooth the body section widths. Defaults to 20.
layer (int, optional) – Defines the layer number of the device.
write (bool, optional) – Use to write the generated gds. Defaults to False.
- Returns:
A gdstk Library of the created device.
- Return type:
gdstk.Library
- pyOptiShared.Designs.flex_taper(widths: ndarray, input_length: float = 0.3, taper_length: float = 1.0, in_width: float = 0.5, out_width: float = 2.0, resolution: int = 20, layer: int = 1, write: bool = False) Library
Creates a taper waveguide with varying widths.
- Parameters:
widths (np.ndarray) – array of widths that defines the taper section
input_length (float, optional) – input waveguide length. Defaults to 0.3.
taper_length (float, optional) – taper length. Defaults to 1.0.
in_width (float, optional) – input waveguide width. Defaults to 0.5.
out_width (float, optional) – output waveguide width. Defaults to 2.0.
resolution (int, optional) – the order of polynomial fit used to smooth the widths of the taper section. Defaults to 20.
layer (int, optional) – Defines the layer number of the device.
write (bool, optional) – Use to write the generated gds. Defaults to False.
- Returns:
gdstk library that holds the created device.
- Return type:
gdstk.library
- pyOptiShared.Designs.rotate_curve(x, y, angle_degrees, center=(0, 0))
Rotate a curve defined by x and y arrays by a given angle around a center point.
- Parameters:
- Returns:
Rotated x and y coordinates (numpy arrays)
- Return type:
x_rot, y_rot