Coverage for qpdk / samples / sample5.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-14 10:27 +0000

1# --- 

2# jupyter: 

3# jupytext: 

4# text_representation: 

5# extension: .py 

6# format_name: percent 

7# format_version: '1.3' 

8# jupytext_version: 1.17.3 

9# --- 

10 

11# %% [markdown] 

12# # Path Creation Sample 

13# 

14# This sample demonstrates creating complex curved paths using gdsfactory's path functionality. 

15 

16# %% 

17import gdsfactory as gf 

18 

19# %% [markdown] 

20# ## Sample Function 

21# 

22# Creates a component with a path made of different segments including arcs, straight lines, and euler bends. 

23 

24 

25# %% 

26@gf.cell 

27def sample5_path(): 

28 """Returns a component with a path made of different segments.""" 

29 p = gf.Path() 

30 p += gf.path.arc(radius=10, angle=90) # Circular arc 

31 p += gf.path.straight(length=10) # Straight section 

32 p += gf.path.euler(radius=3, angle=-90) # Euler bend (aka "racetrack" curve) 

33 p += gf.path.straight(length=40) 

34 p += gf.path.arc(radius=8, angle=-45) 

35 p += gf.path.straight(length=10) 

36 p += gf.path.arc(radius=8, angle=45) 

37 p += gf.path.straight(length=10) 

38 return p.extrude(layer=(3, 0), width=1.5)