Skip to content

Commit

Permalink
Merge pull request #3 from gdsfactory/add_path_length
Browse files Browse the repository at this point in the history
add path_length_analysis notebook
  • Loading branch information
joamatab committed Aug 3, 2023
2 parents ff69809 + 892308f commit 65a8d54
Show file tree
Hide file tree
Showing 7 changed files with 797 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _autosummary/
gplugins/path_length_analysis/test_pathlength_reporting/
docs/notebooks/rib_strip_pathlengths/
docs/notebooks/rib_strip_pathlengths/

Pipfile
Pipefile.lock

Expand Down
2 changes: 2 additions & 0 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ parts:
- file: notebooks/sax_03_variability_analysis
- file: notebooks/lumerical_2_interconnect
- file: notebooks/12_database
- file: notebooks/20_schematic_driven_layout
- file: notebooks/path_length_analysis.py
- caption: Workflows
chapters:
- file: workflow
Expand Down
2 changes: 0 additions & 2 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ Mode solver Plugins
MEOW




************************
FDTD Simulation Plugins
************************
Expand Down
81 changes: 81 additions & 0 deletions docs/notebooks/path_length_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# ---
# jupyter:
# jupytext:
# cell_metadata_filter: -all
# custom_cell_magics: kql
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.2
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---

# %% [markdown]
# # Path length analysis
#
# You can use the `report_pathlenghts` functionality to get a detailed CSV report and interactive visualization about the routes in your PIC.

# %%
import gdsfactory as gf

xs_top = [0, 10, 20, 40, 50, 80]
pitch = 127.0
N = len(xs_top)
xs_bottom = [(i - N / 2) * pitch for i in range(N)]
layer = (1, 0)

top_ports = [
gf.Port(f"top_{i}", center=(xs_top[i], 0), width=0.5, orientation=270, layer=layer)
for i in range(N)
]

bot_ports = [
gf.Port(
f"bot_{i}",
center=(xs_bottom[i], -300),
width=0.5,
orientation=90,
layer=layer,
)
for i in range(N)
]

c = gf.Component(name="connect_bundle_separation")
routes = gf.routing.get_bundle(
top_ports, bot_ports, separation=5.0, end_straight_length=100
)
for route in routes:
c.add(route.references)

c.plot()

# %% [markdown]
# Let's quickly demonstrate our new cross-sections and transition component.

# %%
from pathlib import Path

from gplugins.path_length_analysis.path_length_analysis import report_pathlengths

report_pathlengths(
pic=c,
result_dir=Path("rib_strip_pathlengths"),
visualize=True,
)

# %% [markdown]
# You should see an interactive webpage like the following appear, summarizing the paths in your PIC.
#
# To the left is a stick diagram, showing all the instances and paths in your circuit (with straight lines connecting ports for simplification).
# To the right is a table of the aggregate paths from all routing components in your circuit (those with `route_info` included in their `info` dictionary).
# You will see that there is also a CSV table in the results folder which has more in-depth statistics.
#
# ![](https://i.imgur.com/HbRC3R5.png)

# %% [markdown]
# Clicking any of the routes or checking any of the boxes should highlight the respective route in the color shown in the table to the right to help you better identify them. Hovering over any of the routes or ports will display additional information.
# ![pathlength report](images/pathlength_report_highlighted.png)
7 changes: 7 additions & 0 deletions gplugins/path_length_analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from gplugins.path_length_analysis.path_length_analysis import (
report_pathlengths,
)

__all__ = [
"report_pathlengths",
]

0 comments on commit 65a8d54

Please sign in to comment.