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/6e22247df6708c9d7e7e2c10000ecbe6799f44b01d3e53714a542df94bc1c869.png
Ports: o1;o2
Minimum radius of curvature: 8.07
Length: 15.71
../_images/5d65259e2a7c5a8cdb7c461ebcc4d2c116d6bed0538a151047464da3edc65501.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/8e7e8569a9b228a6d05d2d7ae22c6ba401d23660f10b517ddb9e83d3cd985c99.png
Ports: o1;o2
Minimum radius of curvature: 0.13
Length: 16.62
../_images/9a840dae3b40f4ac423dedaf954f39079f1ffe92a565d1d1b9528a15beeff5bb.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/e1cc9f5c0bb4bf254c49bbc2fb7c00df2e9839a0105c61a329d5c34965f0e754.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/77b2d71d31486a9a2bf0f36f4c6f934245bd3c8ff068344631a00520c52e7231.png
Ports: o2;o3
Minimum radius of curvature: 0.01
Length: 11.18
../_images/77b2d71d31486a9a2bf0f36f4c6f934245bd3c8ff068344631a00520c52e7231.png
Info(length=10.186 min_bend_radius=11.857)