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)

Ports: o1;o2
Minimum radius of curvature: 8.07
Length: 15.71

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)

Ports: o1;o2
Minimum radius of curvature: 0.13
Length: 16.62

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)

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

Ports: o2;o3
Minimum radius of curvature: 0.01
Length: 11.18

Info(length=10.186 min_bend_radius=11.857)