PlaceRelative

class ipkiss3.all.PlaceRelative

(deprecated) Specifies that an instance (inst1) or a port (inst1:port) should be placed relative to another instance (inst2) or a port (inst2:port) with a given offset (x, y) and an angle (optional).

Note

PlaceRelative will be removed in a future version of IPKISS. Please use i3.Place with the relative_to argument instead.

If angle is not specified (i.e. angle=None), then the instance will keep its original transformations.

If angle is specified, the original transformations will be overridden and the instance will be rotated.

If you specify an angle and choose to place a port that has an angle, then the instance is rotated such that the port’s angle will equal this desired angle.

If you place a port with an undefined port angle (angle=None), and you specify an angle in Place, then the port’s angle will stay ‘None’ but its instance will be rotated.

Examples

>>> # Place 'inst1' relative to 'inst2' with an offset (10, 15). Original transformations are kept.
>>> i3.PlaceRelative('inst1', 'inst2', (10, 15))
>>>
>>> # Place 'inst1' relative to 'inst2' with an offset (10, 15). Rotation of 'inst1' is 45.
>>> i3.PlaceRelative('inst1', 'inst2', (10, 15), angle=45)
>>>
>>> # Place port 'out' of 'inst1' (with port angle 180 degrees)
>>> # relative to port 'in' from 'inst2' with an offset (10, 0).
>>> i3.PlaceRelative('inst1:out', 'inst2:in', (10, 0), angle=180)
>>>
>>> # Place port 'out' of 'inst1' (with a rotation of 180 degrees if the original port angle is None)
>>> # relative to port 'in' from 'inst2' with an offset (10, 0).
>>> i3.PlaceRelative('inst1:out', 'inst2:in', (10, 0), angle=180)
>>>
>>> # Place port 'out' of 'inst1' relative to port 'in' from 'inst2' with an offset (-10, -10).
>>> # Original transformations are kept.
>>> i3.PlaceRelative('inst1:out', 'inst2:in', (-10, -10))
import si_fab.all as pdk
import ipkiss3.all as i3
import matplotlib.pyplot as plt

# the second grating coupler will be shifted by (20, 40) with respect to the first one
placerelative_spec = i3.PlaceRelative("gc2", "gc1", (20, 40))

gc = pdk.FC_TE_1550()
circuit = i3.Circuit(
    insts={"gc1": gc, "gc2": gc},
    specs=[i3.Place("gc1:out", (0, 0)), placerelative_spec],
)
circuit.Layout().visualize()
../../../../_images/ipkiss3-all-PlaceRelative-1.png