Hello Matthias,
I have written a waveguide routing routine in Python using a path as input. I wanted it to be general, such that you can specify an arbitrary amount of layers, widths, and offsets from the WG center so implementing slot, ridge, or other more complex designs would be easier.
Because I wanted to define an arbitrary number of layers, I could not (to my knowledge) use a PCell to implement this, but I would still like to be able to resize the waveguide by modifying the underlying path it was made from using the "Partial" command. Is there a way to do this without using a PCell? I have stored the path as a property of the waveguide cell.
Thank you,
Brett
Comments
bruxillensis,
Perhaps you know but I'll point out that some of the functionality you require is built-in. Draw a path, then choose Edit > Selection > Convert to PCell > Basic.ROUND_PATH. To modify the path after that, choose the Partial tool and drag the path around. Of course you can't do arbitrary number of layers, width, slot, ridge, etc.
I haven't looked at it recently but Lukas Chrostowski made some super impressive photonics tools (link to PDK) including a waveguide routing tool. However, last I checked the generated waveguide weren't reconfigurable. So to re-route his waveguide you just delete the old one, move the original wire, then convert the wire to waveguide again.
One final option. A while ago I wrote a script that basically replicates the Basic.ROUND_PATH feature. It's very limited (can only do manhattan geometry, etc). But the resulting waveguide is reconfigurable so you can drag it around with the Partial tool. It did indeed use PCells, with the guiding shape (the one you drag) on the so-called "Guiding shapes layer" which is a special layer. Maybe you can use that as a starting point and combine it with Lukas's more in-depth code. I'll try to dig it up in the next couple of days, sorry I don't have it at this computer.
David
Here you go. I warn you the code is ugly and definitely not my best work...
I just realized that my code is ruby while you have been using python. Anyway I hope it's helpful.
Also you said you think you can't use PCell to implement an arbitrary number of layers -- you can. Just define another layer in the param(...) lines and draw it using a cell.shapes(other_layer_index).insert(path, other_width).
If it's not clear how to add another layer in to this code to make a rib waveguide for instance, let me know.
To use it: Either:
(A) Draw then select a path. Edit > Selection > Convert to PCell > WgLib:RoundedPath
or
(B) You can also just call this from python/ruby code like you're instantiating a regular PCell
Thank you for the code, Ruby totally is fine, I'll see what I can come up with based on this. To some of your points: what I am working on is an extension of Lukas' waveguide routing tool, but like his, is not reconfigurable after the path is converted. To the other part about using a PCell, I have implemented it so the user can decide the number of layers at run-time, here https://github.com/lukasc-ubc/SiEPIC_EBeam_PDK/issues/159 is our discussion of the project with some pictures. It's this sort of configurable option that I wasn't able to achieve with a PCell since the number of parameters are predefined. If you know of a way to do this, I would very much like to learn.
Brett
I see. You want to have an arbitrary number of layers. I was thinking you wanted to "bake", say, 3 layers in to the code. If you can bake 3-4 layers in to the code I'd recommend that because it's easier (just a few lines added to my code above would do that. If that's not obvious then let me know and I'll show you which lines to repeat to hard-bake more layers in to the code.
However if you really need "n" layers you can use the following workaround
Make one of the parameters be a list of widths, like this:
Then in the list you have pairs of widths. For example if you want the zeroth wire/waveguide to be a solid waveguide 1um wide you push 1.0 to the list then push 0.0 to the list. If you want the next waveguide to be a rib waveguide (i.e. drawn above and below, but nothing drawn in the waveguide center) that is 0.2um wide, and then drawn from +/- 0.1um until a total outer width 5um wide, you push 5.0 (the outer width) to the list and then 0.2 (the inner width). Continue pushing your outer width then your inner width. Anyway eventually your list is:
Now iterate through pairs of points. In the first loop iteration you have the 1.0 and 0.0 number for instance. You make a curved Path object for each. So, for the first two you make one curved path that is 1.0 wide and one curved path that is 0.0 wide. This is easy because the backbone xy points don't change, you just instantiate two paths instead of one. You don't place the paths, you just create the objects. Now let's call those two shapes you just created shape_outer and shape_inner. Then you do a boolean subtraction of the two.
In this case (the 1.0 and 0.0 case, in our first loop iteration), you just get a solid wire 1um wide because shape_inner is 0um wide wire so it can't subtract anything from the 1um wide wire. Next you place your resultant shape outer_minus_inner.
Then keep looping. On the next loop iteration you have a handle on the 5.0 and the 0.2 number. Again you create two curved path objects and do outer_minus_inner boolean operation on them, then place the resultant shape outer_minus_inner.
And so forth.
You now have an arbitrary number of layers of lightguides.
You could just put them on successive layers (so the first one goes on layer 0, the next one on layer 1, ...). Or, if you have certain layers you want them on, then just make another param call:
So you may feed it a list of integers like:
Now you can place your zeroth wire on GDS layer number 26, and your first wire on GDS layer number 54, and so on.
All this can be done and still maintaining the ability to drag wires around shown in the original code above.
Hopefully that helps. Please do tell us when you have finished, and post the code here or at least a link to it.
Thank you for the feedback. I wasn't able to find a TypeList definition in the documentation! I was searching for TypeArray, forgot I was using Python I guess. I will definitely post an update once complete, your answers have been very helpful!
Brett