2 KiB
inire
Use Inire to connect fixed ports on a photonic or RF layout with straight segments, 90-degree bends, and S-bends. Supply the device placement, keepouts, and allowed bend radii. The router checks the finished geometry for clearance and returns partial paths to help you diagnose unfinished nets.
Install
From a checkout with Python 3.11 or newer, run pip install .. For development, uv sync also installs the test and lint tools.
Route a net
from inire import NetSpec, Port, RoutingProblem, route
problem = RoutingProblem(
bounds=(0, 0, 1000, 1000),
nets=(NetSpec("input", Port(50, 100, 0), Port(250, 100, 0), width=2),),
clearance=2,
)
run = route(problem)
result = run.results_by_net["input"]
if result.is_valid:
print(result.report.total_length)
else:
print(result.outcome)
This example prints 200.0, the length in the layout's coordinate unit. The branch that prints outcome is where you can report an unfinished or colliding net. Interpret results and diagnose failures
Use a unit fine enough to preserve your port spacing on an integer grid. A heading of 0 points east. Both ports in the example have heading 0 because the waveguide travels east when it leaves the start and when it reaches the target. Describe a layout
Route your own layout
Place crossing devices before routing and describe their external legs as separate nets. Use the examples to try multi-net routing, locked paths, or custom bends, and the tuning guide to decide which settings to change.
Develop Inire
Run python -m pytest for the correctness suite. Use python -m pytest -m "not routing_corpus" for a shorter local run. Start with the architecture to find where a change belongs, then use the benchmark guide and diagnostics to check its effect.
License
GNU Affero General Public License v3. License text