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)
Ports: o1;o2
Minimum radius of curvature: 8.07
Length: 15.71
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)
Ports: o1;o2
Minimum radius of curvature: 0.13
Length: 16.62
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)
Ports: o1;o4
Minimum radius of curvature: 7.63
Length: 40.37
Ports: o2;o3
Minimum radius of curvature: 7.34
Length: 40.37
length=10.186 min_bend_radius=11.857