gdsfactory / gplugins

gdsfactory plugins
https://gdsfactory.github.io/gplugins/
MIT License
37 stars 30 forks source link

Robust path length extraction #453

Closed mdecea closed 3 months ago

mdecea commented 3 months ago

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:

  1. 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.

  2. 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.

  3. 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: image

MMI: image

Directional coupler: image

sourcery-ai[bot] commented 3 months ago

🧙 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.
mdecea commented 3 months ago

@nikosavola @joamatab