-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
basic components and library structure
- Loading branch information
1 parent
9898d8a
commit 75c0004
Showing
6 changed files
with
188 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
"""qutegds module.""" | ||
|
||
import importlib.metadata as im | ||
import sys | ||
|
||
__version__ = im.version(__package__) | ||
|
||
import gdsfactory as gf | ||
from gdsfactory.generic_tech import get_generic_pdk | ||
from gdsfactory.get_factories import get_cells | ||
|
||
generic_pdk = get_generic_pdk() | ||
cells = get_cells(sys.modules[__name__]) | ||
qute_pdk = gf.Pdk( | ||
name="qute", | ||
cells=cells, | ||
base_pdk=generic_pdk, | ||
layers=generic_pdk.layers, | ||
layer_views=generic_pdk.layer_views, | ||
cross_sections=generic_pdk.cross_sections, | ||
) | ||
qute_pdk.activate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"""List of coplanar waveguide elements.""" | ||
|
||
from functools import partial | ||
|
||
import gdsfactory as gf | ||
from gdsfactory.typings import ComponentFactory, ComponentSpec | ||
|
||
from qutegds.geometry import subtract | ||
|
||
|
||
@gf.cell() | ||
def cpw(component_name: str, gap: float = 1, width=2, **kwargs): | ||
""" | ||
Return simple coplanar waveguide from single component. | ||
By default, returns negative mask of the CPW trace. | ||
Args: | ||
component_name (str): name of the component to be used | ||
width (float): width of the central CPW trace | ||
gap (float): space in um between the CPW trace and ground | ||
""" | ||
cpw = gf.Component() | ||
outer = gf.get_component(component_name, width=width + 2 * gap, **kwargs) | ||
inner = gf.get_component(component_name, width=width, **kwargs) | ||
_ = cpw << subtract(outer, inner) | ||
cpw.add_ports(outer.ports) | ||
return cpw | ||
|
||
|
||
straight = partial(cpw, component_name="straight") | ||
snake = partial(cpw, component_name="delay_snake") | ||
|
||
|
||
@gf.cell() | ||
def straight_taper( | ||
straight: ComponentSpec = gf.components.straight, | ||
taper: ComponentFactory = gf.components.taper, | ||
): | ||
"""Return straight section connected with taper.""" | ||
st = gf.get_component(straight) | ||
return gf.add_tapers( | ||
st, | ||
taper=taper, | ||
ports=[st["o1"]], | ||
) | ||
|
||
|
||
@gf.cell() | ||
def rf_port( | ||
width1: float = 2, | ||
width2: float = 4, | ||
gap1: float = 1, | ||
gap2: float = 2, | ||
len_taper: float = 4, | ||
len_rect: float = 4, | ||
**kwargs | ||
): | ||
"""Return rf port.""" | ||
cpw = gf.Component() | ||
straight = partial(gf.components.straight, length=len_rect, **kwargs) | ||
taper = partial(gf.components.taper, length=len_taper, **kwargs) | ||
|
||
outer = straight_taper( | ||
straight=partial(straight, width=width2 + 2 * gap2), | ||
taper=partial(taper, width1=width1 + 2 * gap1, width2=width2 + 2 * gap2), | ||
) | ||
inner = straight_taper( | ||
straight=partial(straight, width=width2), | ||
taper=partial(taper, width1=width1, width2=width2), | ||
) | ||
_ = cpw << subtract(outer, inner) | ||
cpw.add_ports(outer.ports) | ||
return cpw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"""Geometry related functions.""" | ||
from functools import partial | ||
|
||
import gdsfactory as gf | ||
|
||
subtract = partial(gf.geometry.boolean, operation="not") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""This code tests all your cells in the PDK | ||
it will test 3 things: | ||
1. difftest: will test the GDS geometry of a new GDS compared to a reference. Thanks to Klayout fast booleans.add() | ||
2. settings test: will compare the settings in YAML with a reference YAML file.add() | ||
3. ensure ports are on grid, to avoid port snapping errors that can create 1nm gaps later on when you build circuits. | ||
""" | ||
import pathlib | ||
|
||
import pytest | ||
from gdsfactory.component import Component | ||
from gdsfactory.difftest import difftest | ||
from pytest_regressions.data_regression import DataRegressionFixture | ||
|
||
from qutegds import cells | ||
|
||
skip_test = {"subtract"} | ||
cell_names = set(cells.keys()) - set(skip_test) | ||
dirpath = pathlib.Path(__file__).absolute().parent / "gds_ref" | ||
|
||
|
||
@pytest.fixture(params=cell_names, scope="function") | ||
def component(request) -> Component: | ||
return cells[request.param]() | ||
|
||
|
||
def test_pdk_gds(component: Component) -> None: | ||
"""Avoid regressions in GDS geometry shapes and layers.""" | ||
difftest(component, dirpath=dirpath) | ||
|
||
|
||
def test_pdk_settings( | ||
component: Component, data_regression: DataRegressionFixture | ||
) -> None: | ||
"""Avoid regressions when exporting settings.""" | ||
data_regression.check(component.to_dict()) | ||
|
||
|
||
def test_assert_ports_on_grid(component: Component): | ||
component.assert_ports_on_grid() |