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

10 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# # Grid Layout Sample 

13# 

14# This sample demonstrates how to arrange multiple components in a grid layout. 

15 

16# %% 

17import gdsfactory as gf 

18 

19# %% [markdown] 

20# ## Sample Function 

21# 

22# Creates a component with numbered text elements arranged in a 2x3 grid. 

23 

24 

25# %% 

26@gf.cell 

27def sample3_grid(): 

28 """Returns a component with a grid of text elements.""" 

29 t1 = gf.components.text("1", layer="M1_DRAW") 

30 t2 = gf.components.text("2", layer="M1_DRAW") 

31 t3 = gf.components.text("3", layer="M1_DRAW") 

32 t4 = gf.components.text("4", layer="M1_DRAW") 

33 t5 = gf.components.text("5", layer="M1_DRAW") 

34 t6 = gf.components.text("6", layer="M1_DRAW") 

35 

36 return gf.grid([t1, t2, t3, t4, t5, t6], shape=(2, 3), spacing=(10, 10))