I put quite a lot of work on making the path length extraction logic more robust.
There are some important differences with respect to the previous implementation:
The code now requires a component to have ports, and the path lengths are computed between ports. I think this makes sense because the path length of a component is not well defined without knowing which ports we are talking about.
Instead of return a gf.Path, now the function extract_paths returns a dictionary with {port1},{port2} as the keys and the gf.Path as the value.
The code supports evanescent coupling between structures that are not connected. This is important for directional couplers.
I have tested the code with straights, s bends, euler bends, circular bends and directional couplers and it works.
🧙 Sourcery has finished reviewing your pull request!
Tips
- Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request.
- Continue your discussion with Sourcery by replying directly to review comments.
- You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai):
- Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
- Change the review language;
- You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
I put quite a lot of work on making the path length extraction logic more robust.
There are some important differences with respect to the previous implementation:
The code now requires a component to have ports, and the path lengths are computed between ports. I think this makes sense because the path length of a component is not well defined without knowing which ports we are talking about.
Instead of return a
gf.Path
, now the functionextract_paths
returns a dictionary with{port1},{port2}
as the keys and thegf.Path
as the value.The code supports evanescent coupling between structures that are not connected. This is important for directional couplers.
I have tested the code with straights, s bends, euler bends, circular bends and directional couplers and it works.
Some examples:
S bend:
MMI:
Directional coupler: