Skip to content

Commit 6fed9f4

Browse files
authored
Merge pull request #220 from angelPappas/bend_bug
Bend_circular bug fix
2 parents c1bf8cf + 19dbe94 commit 6fed9f4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

qpdk/cells/waveguides.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ def bend_circular(
252252
) -> gf.Component:
253253
"""Returns circular bend.
254254
255+
Cross-sections have a minimum value of allowed bend radius, which is half their total width.
256+
If the user-specified radius is smaller than this value, it is adjusted to the minimum acceptable one.
257+
255258
Args:
256259
angle: Angle of the bend in degrees.
257260
radius: Radius of the bend in μm.
@@ -261,6 +264,12 @@ def bend_circular(
261264
allow_min_radius_violation: Allow radius smaller than cross-section radius.
262265
**kwargs: Additional arguments passed to gf.c.bend_circular (e.g., angular_step).
263266
"""
267+
radius_min = gf.get_cross_section(cross_section).radius_min
268+
if radius_min is not None and radius < radius_min:
269+
radius = radius_min
270+
print(
271+
f"Bend radius needs to be >= {radius_min} for this cross-section. Setting it to the minimum acceptable value."
272+
)
264273
return gf.c.bend_circular(
265274
angle=angle,
266275
radius=radius,

qpdk/tech.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ def coplanar_waveguide(
287287
),
288288
gf.Section(width=width, layer=LAYER.WG, name="waveguide"),
289289
),
290+
radius_min=(width + 2 * gap) / 2,
290291
)
291292

292293

0 commit comments

Comments
 (0)