|
1 | 1 | """Photonic component library."""
|
| 2 | + |
| 3 | + |
| 4 | +import gdsfactory as gf |
| 5 | +from gdsfactory import cell, get_component |
| 6 | + |
| 7 | + |
| 8 | +@cell |
| 9 | +def _dbr_cell( |
| 10 | + w1: float = 0.5, |
| 11 | + w2: float = 0.65, |
| 12 | + l1: float = 0.288, |
| 13 | + l2: float = 0.288, |
| 14 | + straight: gf.types.ComponentSpec = gf.components.straight, |
| 15 | +) -> gf.Component: |
| 16 | + """Distributed Bragg Reflector unit cell. |
| 17 | +
|
| 18 | + Args: |
| 19 | + w1: thin width in um. |
| 20 | + l1: thin length in um. |
| 21 | + w2: thick width in um. |
| 22 | + l2: thick length in um. |
| 23 | + n: number of periods. |
| 24 | + straight: spec in um. |
| 25 | +
|
| 26 | + .. code:: |
| 27 | +
|
| 28 | + l1 l2 |
| 29 | + <-----><--------> |
| 30 | + _________ |
| 31 | + _______| |
| 32 | +
|
| 33 | + w1 w2 |
| 34 | + _______ |
| 35 | + |_________ |
| 36 | + """ |
| 37 | + l1 = gf.snap.snap_to_grid(l1) |
| 38 | + l2 = gf.snap.snap_to_grid(l2) |
| 39 | + w1 = gf.snap.snap_to_grid(w1, 2) |
| 40 | + w2 = gf.snap.snap_to_grid(w2, 2) |
| 41 | + c = gf.Component() |
| 42 | + c1 = c << get_component(straight, length=l1, width=w1, cross_section="nitride") |
| 43 | + c2 = c << get_component(straight, length=l2, width=w2, cross_section="strip") |
| 44 | + c2.connect(port="o1", destination=c1.ports["o2"]) |
| 45 | + c.add_port("o1", port=c1.ports["o1"]) |
| 46 | + c.add_port("o2", port=c2.ports["o2"]) |
| 47 | + return c |
| 48 | + |
| 49 | + |
| 50 | +@gf.cell |
| 51 | +def dbr() -> gf.Component: |
| 52 | + """Distributed Bragg Reflector. |
| 53 | +
|
| 54 | + .. code:: |
| 55 | +
|
| 56 | + 0.288um 0.288um |
| 57 | + <-------><------> |
| 58 | + ________ _______ |
| 59 | + | |_______| |
| 60 | + | | | |
| 61 | + | 0.5um | 0.65um| ... 10 times |
| 62 | + | |_______| |
| 63 | + |_______| |_______ |
| 64 | + """ |
| 65 | + c = gf.Component() |
| 66 | + l1 = gf.snap.snap_to_grid(0.288) |
| 67 | + l2 = gf.snap.snap_to_grid(0.288) |
| 68 | + cell = _dbr_cell() |
| 69 | + c.add_array(cell, columns=10, rows=1, spacing=(l1 + l2, 100)) |
| 70 | + starting_rect = c << gf.get_component( |
| 71 | + "straight", length=l2, width=0.65, cross_section="strip" |
| 72 | + ) |
| 73 | + starting_rect.move(starting_rect.center, (-0.144, 0)) |
| 74 | + c.add_port("o1", port=starting_rect.ports["o1"]) |
| 75 | + p1 = c.add_port("o2", port=cell.ports["o2"]) |
| 76 | + p1.center = [(l1 + l2) * 10, 0] |
| 77 | + return c |
| 78 | + |
| 79 | + |
| 80 | +if __name__ == "__main__": |
| 81 | + import gdsfactory as gf |
| 82 | + |
| 83 | + c = dbr() |
| 84 | + c.show() |
| 85 | + print(c.to_yaml()) |
0 commit comments