Skip to content

Commit

Permalink
Merge pull request #929 from gdsfactory/630
Browse files Browse the repository at this point in the history
prepare 6.3.0 release
  • Loading branch information
joamatab committed Nov 29, 2022
2 parents 47ad784 + e395acd commit b85b6c3
Show file tree
Hide file tree
Showing 13 changed files with 310 additions and 49 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,14 @@
# [CHANGELOG](https://keepachangelog.com/en/1.0.0/)

## 6.3.0

- Schematic-Driven Layout flow [PR](https://github.com/gdsfactory/gdsfactory/pull/920)
- from __future__ import annotations to all files and makes the docs cleaner by rendering the type aliases rather than the expanded type [PR](https://github.com/gdsfactory/gdsfactory/pull/923)
- Add routes to gdsfactory klayout macro [PR](https://github.com/gdsfactory/gdsfactory/pull/918)
- fix missing conversion from rad (gdstk) to deg [PR](https://github.com/gdsfactory/gdsfactory/pull/927)
- better error message when failing to import missing gdscell [PR](https://github.com/gdsfactory/gdsfactory/pull/926)
- mzi lattice mmi [PR](https://github.com/gdsfactory/gdsfactory/pull/920)

## 6.2.6

- import_gds can import any cell (not only top_level cells) [PR](https://github.com/gdsfactory/gdsfactory/pull/917)
Expand Down
17 changes: 16 additions & 1 deletion docs/components.rst
Expand Up @@ -1820,6 +1820,21 @@ mzi_lattice



mzi_lattice_mmi
----------------------------------------------------

.. autofunction:: gdsfactory.components.mzi_lattice_mmi

.. plot::
:include-source:

import gdsfactory as gf

c = gf.components.mzi_lattice_mmi(coupler_widths=[None, None], coupler_widths_tapers=[1.0, 1.0], coupler_lengths_tapers=[10.0, 10.0], coupler_lengths_mmis=[5.5, 5.5], coupler_widths_mmis=[2.5, 2.5], coupler_gaps_mmis=[0.25, 0.25], taper_functions_mmis=[{'function': 'taper'}, {'function': 'taper'}], straight_functions_mmis=[{'function': 'straight'}, {'function': 'straight'}], cross_sections_mmis=['strip', 'strip'], delta_lengths=[10.0])
c.plot()



mzi_pads_center
----------------------------------------------------

Expand Down Expand Up @@ -3105,7 +3120,7 @@ version_stamp

import gdsfactory as gf

c = gf.components.version_stamp(labels=['demo_label'], with_qr_code=False, layer='WG', pixel_size=1, version='6.2.3', text_size=10)
c = gf.components.version_stamp(labels=['demo_label'], with_qr_code=False, layer='WG', pixel_size=1, version='6.2.6', text_size=10)
c.plot()


Expand Down
Expand Up @@ -5,9 +5,11 @@
"id": "9c666b41-91a4-4e70-827c-62998e49bb2b",
"metadata": {},
"source": [
"# Schematic Editor Demo\n",
"# Schematic Driven layout\n",
"\n",
"This is a proof-of-concept demo of a Schematic Editor using gdsfactory. It uses a schematic format similar to our `*.pic.yml` format which should make it easy to enable an SDL flow. The Jupyter interface allows us to get the best of both worlds of GUI and python based flows."
"The Schematic driven layout uses a schematic format similar to our `*.pic.yml`.\n",
"\n",
"The Jupyter notebook interface allows you to get the best of both worlds of GUI and python driven based flows."
]
},
{
Expand All @@ -32,9 +34,10 @@
"id": "186155e3-7021-4b4c-86f6-94f2ca3ca78f",
"metadata": {},
"source": [
"## Initialize the Schematic Editor session\n",
"\n",
"First we initialize a session of the schematic editor. The editor is synced to the file specified. If it does not exist, it will be created. If it does exist, it will load the schematic for editing. The schematic file is continuously auto-saved as we edit the schematic in our notebook, so I would recommend managing it with git if you wish to create checkpoints in between sessions."
"First you initialize a session of the schematic editor.\n",
"The editor is synced to a file.\n",
"If file exist, it loads the schematic for editing. If it does not exist, it creates it.\n",
"The schematic file is continuously auto-saved as you edit the schematic in your notebook, so you can track changes with GIT."
]
},
{
Expand All @@ -54,7 +57,12 @@
"source": [
"## Define instances\n",
"\n",
"The first step in setting up a schematic is to define which instances should be included. We do this through this grid-like editor. Note how the components are auto-populated from our PDK (by default, the active PDK is used)"
"First you need to define which instances to include. We do this through this grid-like editor.\n",
"Components are auto-populated from your active PDK.\n",
"\n",
"instance name | Component type\n",
"--------------| --------------\n",
"mmi1 | mmi1x2\n"
]
},
{
Expand Down Expand Up @@ -82,7 +90,8 @@
"id": "d957be8b-d3b6-4599-8263-6b9e79a68a72",
"metadata": {},
"source": [
"You may prefer to **add your instances through code**. That is perfectly acceptable as well, and since it is just a dictionary update, *the integrity of your schematic will be maintained, even after re-running the notebook* as-is. You can here specify a component either by name or as an actual component, using auto-completion to specify your settings as well."
"You can also **add your instances through code**, and since it is just a dictionary update, *the integrity of your schematic will be maintained, even after re-running the notebook* as-is.\n",
"You can here specify a component either by name or as an actual component, using auto-completion to specify your settings as well."
]
},
{
Expand Down Expand Up @@ -146,7 +155,7 @@
"source": [
"## Define nets\n",
"\n",
"Now, we define our logical connections between instances in our netlist. Each row in the grid represents one logical connection"
"Now, you define your logical connections between instances in your netlist. Each row in the grid represents one logical connection."
]
},
{
Expand All @@ -164,7 +173,9 @@
"id": "919ba6dc-5e2f-44a2-98c3-c2abd1a5c7c1",
"metadata": {},
"source": [
"Similarly, we can programmatically add nets, if we prefer. Adding a net which already exists will have no effect, such that the notebook can be rerun without consequence. However, trying to connect to a port which is already otherwise connected will throw an error."
"Similarly, you can programmatically add nets.\n",
"Adding a net which already exists will have no effect, such that the notebook can be rerun without consequence.\n",
"However, trying to connect to a port which is already otherwise connected will throw an error."
]
},
{
Expand All @@ -185,9 +196,11 @@
"metadata": {},
"source": [
"## Visualize\n",
"We can visualize our schematic down below. After you've initialized the plot below, you should see it live-update after every change we make above.\n",
"\n",
"Currently the *size of component symbols and location of ports are **layout-realistic***. This may be a nice default if you don't care to bother making symbols for your components. But it would be a nice improvement for the future to allow associating symbols with components, to make the schematic easier to read.\n",
"You can visualize your schematic down below. After you've initialized the plot below, you should see it live-update after every change we make above.\n",
"\n",
"Currently the *size of component symbols and location of ports are **layout-realistic***. This may be a nice default if you don't care to bother making symbols for your components.\n",
"But it would be a nice improvement for the future to allow associating symbols with components, to make the schematic easier to read.\n",
"\n",
"If you activate the `Point Draw Tool` in the plot, you should see that you are able to arrange components freely on the schematic, and changes are saved back to the `*.schem.yml` file in realtime."
]
Expand All @@ -207,8 +220,9 @@
"id": "e4036ae4-c35d-412e-9ef9-f86ea6d745b5",
"metadata": {},
"source": [
"## Layout generation\n",
"We can then use our schematic to generate a preliminary layout, and view in the notebook and/or klayout. Initial placements come from schematic placements. Routes are auto-generated from nets."
"## generate Layout\n",
"\n",
"You can use your schematic to generate a preliminary layout, and view in the notebook and/or klayout. Initial placements come from schematic placements and Routes are auto-generated from nets."
]
},
{
Expand Down Expand Up @@ -248,9 +262,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "rpdk",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "rpdk"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -262,7 +276,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
40 changes: 40 additions & 0 deletions docs/notebooks/sdl_demo.pic.yml
@@ -0,0 +1,40 @@
instances:
mmi1:
component: mmi1x2
settings: {gap_mmi: 1.0}
mmi2:
component: mmi2x2
settings: {gap_mmi: 0.7}
s1:
component: straight
settings: {length: 20}
s2:
component: straight
settings: {length: 40}
placements:
mmi1: {x: null, y: null, port: null, rotation: null, dx: -22.832156230736544, dy: -0.9358105716724547,
mirror: null}
mmi2: {x: null, y: null, port: null, rotation: null, dx: 130.94675850281985, dy: -0.39903161225107286,
mirror: null}
s1: {x: null, y: null, port: null, rotation: null, dx: 55.26042176045793, dy: 32.1189871057287,
mirror: null}
s2: {x: null, y: null, port: null, rotation: null, dx: 44.25454877902524, dy: -45.88086750118762,
mirror: null}
routes:
r0:
routing_strategy: get_bundle
settings: {cross_section: strip, separation: null}
links: {'mmi1,o2': 's1,o1'}
r1:
routing_strategy: get_bundle
settings: {cross_section: strip, separation: null}
links: {'mmi2,o2': 's1,o2'}
r2:
routing_strategy: get_bundle
settings: {cross_section: strip, separation: null}
links: {'mmi1,o3': 's2,o1'}
r3:
routing_strategy: get_bundle
settings: {cross_section: strip, separation: null}
links: {'mmi2,o1': 's2,o2'}
ports: {}
File renamed without changes.
10 changes: 10 additions & 0 deletions docs/sdl.rst
@@ -0,0 +1,10 @@
Schematic Driven Layout
===================================


.. toctree::
:maxdepth: 2
:titlesonly:
:caption: Contents:

notebooks/20_schematic_driven_layout
47 changes: 18 additions & 29 deletions gdsfactory/circuitviz.py
Expand Up @@ -46,7 +46,7 @@ def save_netlist(netlist, filename):
if kk in pv:
try:
pv[kk] = float(pv[kk])
except:
except Exception:
pass
else:
p.pop(pk)
Expand Down Expand Up @@ -125,7 +125,7 @@ def _get_sources(objs):
def _get_column_data_sources(srcs):
_srcs = {}
for k, src in srcs.items():
ds = bm.ColumnDataSource({kk: v for kk, v in src.items()})
ds = bm.ColumnDataSource(dict(src.items()))
_srcs[k] = ds
return _srcs

Expand Down Expand Up @@ -269,17 +269,18 @@ def cp_double_tap(event):
data["dss"]["Port"], glyph=bm.Circle(x="x", y="y", fill_color="fill_color")
)
del fig.tools[:]
draw_tool = bm.PointDrawTool(
renderers=[r for r in fig.renderers if isinstance(r.glyph, bm.Rect)],
empty_value="black",
)
hover_tool = bm.HoverTool(
renderers=[r for r in fig.renderers if isinstance(r.glyph, bm.Rect)],
)
# pan_tool = bm.PanTool()
tap_tool = bm.TapTool()
zoom = bm.WheelZoomTool()
fig.add_tools(
draw_tool := bm.PointDrawTool(
renderers=[r for r in fig.renderers if isinstance(r.glyph, bm.Rect)],
empty_value="black",
),
hover_tool := bm.HoverTool(
renderers=[r for r in fig.renderers if isinstance(r.glyph, bm.Rect)],
),
# pan_tool := bm.PanTool(),
tap_tool := bm.TapTool(),
zoom := bm.WheelZoomTool(),
draw_tool=draw_tool, hover_tool=hover_tool, tap_tool=tap_tool, zoom=zoom
)
fig.toolbar.active_scroll = zoom
fig.toolbar.active_tap = tap_tool
Expand Down Expand Up @@ -361,21 +362,10 @@ def viz_instance(
for p in ports:
# p.move((x, y))
p.tag = instance_name
if False: # hierarchical:
c = "#FF0000"
else:
c = "#000000"
c = "#000000"

r = Rect(tag=instance_name, x=x, y=y, w=w, h=h, c=c)
# input_ports = [
# LineSegment(instance_name, x, y + yi, x + pl, y + yi) for yi in y_inputs
# ]
# output_ports = [
# LineSegment(instance_name, x + w - pl, y + yi, x + w, y + yi)
# for yi in y_outputs
# ]
ret = [r, *ports]
return ret
return [r, *ports]


# export
Expand Down Expand Up @@ -470,10 +460,9 @@ def add_instance(name: str, component):


def get_deltas(netlist):
deltas = {}
for k, p in netlist.placements.items():
deltas[k] = {"dx": p.dx or 0, "dy": p.dy or 0}
return deltas
return {
k: {"dx": p.dx or 0, "dy": p.dy or 0} for k, p in netlist.placements.items()
}


def apply_deltas(netlist, deltas):
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/components/mzi_lattice.py
Expand Up @@ -153,7 +153,7 @@ def mzi_lattice_mmi(
taper_function,
),
straight_functions_mmis=(straight_function, straight_function),
cross_sections_mmis = ("strip", "strip"),
cross_sections_mmis=("strip", "strip"),
delta_lengths: Tuple[float, ...] = (10.0,),
mzi=mmi_coupler_function,
splitter=mmi_splitter_function,
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/klayout/macros/import_generic_pcells.lym
Expand Up @@ -96,7 +96,7 @@ class PCellFactory(pya.PCellDeclarationHelper):
description=name.replace("_", " "),
default=param.default,
)
)
)

def produce_impl(self):
"""Produce the PCell."""
Expand Down
2 changes: 1 addition & 1 deletion gdsfactory/port.py
Expand Up @@ -141,7 +141,7 @@ def to_yaml(self) -> str:
center=[float(self.center[0]), float(self.center[1])],
orientation=float(self.orientation)
if self.orientation
else self.orientation,
else float(self.orientation),
layer=self.layer,
port_type=self.port_type,
)
Expand Down

0 comments on commit b85b6c3

Please sign in to comment.