gdsfactory / kfactory

gdsfactory with a klayout backend
https://gdsfactory.github.io/kfactory/
MIT License
31 stars 12 forks source link

Add `copy_polar` to `Port` #282

Closed sebastian-goeldi closed 6 months ago

sebastian-goeldi commented 6 months ago

Fixes #258

Usage:

kf.Port(name="a", trans=kf.kdb.Trans(), layer=kf.kcl.layer(1,0), width=1000).copy_polar(d=500)

d==0 is the flip

joamatab commented 6 months ago

what do you mean d=0 is the flip?

p.copy_polar(d=0)
sebastian-goeldi commented 6 months ago

what do you mean d=0 is the flip?

p.copy_polar()

This will give you a port which is rotated by 180 degrees. That's what you wanted, right?

If you want it inplace (i.e. not a copy):

port.dcplx_trans *= kf.kdb.DCplxTrans.R180