Path length analysis

Path length analysis#

Extract pathlength and curvature from component#

import gplugins.path_length_analysis.path_length_analysis_from_gds as pl
import gdsfactory as gf
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/5338506fbbd2f3adb97fdf339b72a6d287a7685abfa3f603347cb3c12d21d3b4.png
Ports: o1;o2
Minimum radius of curvature: 8.07
Length: 15.71
../_images/84a0adb897686d73234c6574069bef7ac0cc69914bc10fb61e987a4f31d93e57.png
length=15.708 dy=10.0 radius=10.0 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/b1ac8f428dd8d3fb672fdb3b1c3a35c3e9df76f270f527f0f7b91c8e29c2ca04.png
Ports: o1;o2
Minimum radius of curvature: 0.13
Length: 16.62
../_images/df5805aed21a294955ce7bcec49f8ad800a83e806a24f10a9ee46ab985e55ecf.png
length=16.637 dy=10.0 min_bend_radius=7.061 radius=10.0 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/f5694d15f2fcac6076b2fda82ceaa9e4d9129792e6e0261e10257363db74cd97.png
Ports: o1;o4
Minimum radius of curvature: 7.63
Length: 40.37
../_images/84fbc487960856e6c5212486cd9cdce9919b48040feac3c5bf3df774f9fff48c.png
Ports: o2;o3
Minimum radius of curvature: 7.34
Length: 40.37
../_images/5cd253e874accb4d3cea8f4467e993cb887a1f6c470406ebbb49ba0bbb151a30.png
length=10.186 min_bend_radius=11.857