Path length analysis

Path length analysis#

Extract pathlength and curvature from component#

import gdsfactory as gf

import gplugins.path_length_analysis.path_length_analysis_from_gds as pl
c = gf.components.bend_circular()
path_dict, ev_path_dict = pl.extract_paths(c, plot=True, under_sampling=1)
r_and_l_dict = pl.get_min_radius_and_length_path_dict(path_dict)
for ports, (min_radius, length) in r_and_l_dict.items():
    print(f"Ports: {ports}")
    print(f"Minimum radius of curvature: {min_radius:.2f}")
    print(f"Length: {length:.2f}")
    pl.plot_curvature(path_dict[ports])
print(c.info)
../_images/48dc27a18b91c401be237aef3a42b8961a1762b494367b1343437ad73fc178c7.png
Ports: o1;o2
Minimum radius of curvature: 8.07
Length: 15.71
../_images/d953a58f7691ad149b7b73e7226600fcdb5b66872b9a3ecd4982e946b06a0dcd.png
Info(length=15.708 dy=10.0 radius=10.0 width=0.5 route_info_type='strip' route_info_length=15.708 route_info_weight=15.708 route_info_strip_length=15.708 route_info_n_bend_90=1.0 route_info_min_bend_radius=10.0)
c = gf.components.bend_euler()
path_dict, ev_path_dict = pl.extract_paths(c, plot=True, under_sampling=1)
r_and_l_dict = pl.get_min_radius_and_length_path_dict(path_dict)
for ports, (min_radius, length) in r_and_l_dict.items():
    print(f"Ports: {ports}")
    print(f"Minimum radius of curvature: {min_radius:.2f}")
    print(f"Length: {length:.2f}")
    pl.plot_curvature(path_dict[ports])
print(c.info)
../_images/21a715f096172fb67bcefe2c26a6cab17cfd755c546482b9fea72f535bde4c32.png
Ports: o1;o2
Minimum radius of curvature: 0.13
Length: 16.62
../_images/6ae5c6d6f182faa7282649526cd12e3fd93ca83cdc31e0423da705388e3fa459.png
Info(length=16.637 dy=10.0 min_bend_radius=7.061 radius=10.0 width=0.5 route_info_type='strip' route_info_length=16.637 route_info_weight=16.637 route_info_strip_length=16.637 route_info_n_bend_90=1.0 route_info_min_bend_radius=7.061)
c = gf.components.coupler()
path_dict, ev_path_dict = pl.extract_paths(c, plot=True, under_sampling=1)
r_and_l_dict = pl.get_min_radius_and_length_path_dict(path_dict)
for ports, (min_radius, length) in r_and_l_dict.items():
    print(f"Ports: {ports}")
    print(f"Minimum radius of curvature: {min_radius:.2f}")
    print(f"Length: {length:.2f}")
    pl.plot_curvature(path_dict[ports])
print(c.info)
../_images/45f4c2bcc6a66aa91dbcfc23903b4ca672ae54d8d67d2cddfe1bcccba5bca1ef.png
Ports: o1;o4
Minimum radius of curvature: 0.01
Length: 11.18
/home/runner/work/gplugins/gplugins/gplugins/path_length_analysis/path_length_analysis_from_gds.py:583: RuntimeWarning: divide by zero encountered in divide
  radius = 1 / K
/home/runner/work/gplugins/gplugins/gplugins/path_length_analysis/path_length_analysis_from_gds.py:596: RuntimeWarning: divide by zero encountered in divide
  radius = 1 / K
../_images/992ebfaba65e8a52a8b63d281b095d3a06db884f99610857203d5414b2f645f8.png
Ports: o2;o3
Minimum radius of curvature: 0.01
Length: 11.18
../_images/992ebfaba65e8a52a8b63d281b095d3a06db884f99610857203d5414b2f645f8.png
Info(length=10.186 min_bend_radius=11.857)