8 to 9¶
Due to the recent release of KFactory v1.0.0, we have had to make some small changes to the API of the following classes:
- Component
- Port
- ComponentReference
- ComponentReferences
GDSFactory v9 is not a big change but it makes ports and instance units consistent with each other.
Main changes¶
Note the migration changes:
port.danglehas been renamed toport.orientationport.anglerepresents the angle 90 degrees multiples.port.orientationrepresents the angle in degrees.
CHECK_INSTANCEShas been renamed toCheckInstances- Most often used in the
@celldecorator.
- Most often used in the
Port(..., layer: tuple[int, int])has been replaced withPort(..., layer: int)layernow represents the layer index in the KLayout layer stack.- To update your code you can do
Port(..., layer=gf.kcl.layout.layer(*layer)) - We also recommend just using Component.add_port, with which you can specify the layer as tuple.
- Most of the
dprefix attributes and functions can now be used without thedprefix. ComponentReference.parenthas been removed, you should useComponentReference.cellinstead.ComponentReference.infohas been removed, you should useComponentReference.cell.infoinstead.
import gdsfactory as gf
c = gf.components.straight(length=10)
c.pprint_ports()Loading...
print('port orientation in degrees', c.ports['o2'].orientation)
print('port x in um', c.ports['o2'].x)
print('port dx in um (decimal)', c.ports['o2'].dx)
print('port ix in integer (database units)', c.ports['o2'].ix)port orientation in degrees 0.0
port x in um 10.0
port dx in um (decimal) 10.0
port ix in integer (database units) 10000
c = gf.Component()
ref = c << gf.c.straight()ref.xmin = 10print('reference x in um', ref.x)
print('reference dx in um (decimal)', ref.dx)
print('reference ix in integer (database units)', ref.ix)reference x in um 15.0
reference dx in um (decimal) 15.0
reference ix in integer (database units) 15000
c