Distribute

class ipkiss3.all.Distribute

Specifies that a sequence of instances (or their ports/anchors) is to be evenly distributed between two given instances (or their ports/anchors): start and end.

Parameters:
pos_selectors: Sequence[str]

The instances (or their ports/anchors) to be distributed.

start: str

The instance defining the start of the distribution.

end: str

The instance defining the end of the distribution.

Examples

import si_fab.all as pdk
import ipkiss3.all as i3

class MyCircuit(i3.Circuit):
    def _default_insts(self):
        gc = pdk.GratingCoupler()
        mmi = pdk.MMI1x2()

        return {
            "gc1": gc,
            "gc2": gc,
            "mmi1": mmi,
            "mmi2": mmi,
            "mmi3": mmi,
        }

    def _default_specs(self):
        return [
            i3.Place("gc1", (20, 30)),
            i3.Place("gc2", (250, 150)),
            i3.FlipH("gc2"),
            i3.Distribute(["mmi1@C", "mmi2@C", "mmi3@C"], "gc1:out", "gc2:out"),
        ]

MyCircuit().Layout().visualize()
../../../../_images/ipkiss3-all-Distribute-1.png
class X

Specifies that a sequence of instances (or their ports/anchors) is to be evenly distributed in x direction between two given instances (or their ports/anchors): start and end.

If include_margin is True (default), the spacing in x between the instances to be distributed will be equal to the spacing between the start instance and the first instance to be distributed (and to the spacing in x between the end instance and the last one to be distributed). Otherwise, the first distributed instance will coincide in x with the start instance (and the last distributed instance will coincide in x with the end one).

Parameters:
pos_selectors: Sequence[str]

The instances (or their ports/anchors) to be distributed along the x direction.

start: str

The instance defining the start of the distribution.

end: str

The instance defining the end of the distribution.

include_margin: bool, optional

Whether the horizontal spacing should also apply between the first distributed instance and the start instance (and between the last distributed instance and the end instance). Default is True.

Examples

import si_fab.all as pdk
import ipkiss3.all as i3

class MyCircuit(i3.Circuit):
    def _default_insts(self):
        gc = pdk.GratingCoupler()
        mmi = pdk.MMI1x2()

        return {
            "gc1": gc,
            "gc2": gc,
            "mmi1": mmi,
            "mmi2": mmi,
            "mmi3": mmi,
        }

    def _default_specs(self):
        distributed = ["mmi1@C", "mmi2@C", "mmi3@C"]
        specs = [
            i3.Place("gc1", (20, 30)),
            i3.Place("gc2", (250, 150)),
            i3.FlipH("gc2"),
            i3.Distribute.X(distributed, "gc1:out", "gc2:out", include_margin=False),
        ]

        # you can also specify the angles of distributed instances
        specs.extend([i3.Place.Angle(dist, 30) for dist in distributed])
        return specs

MyCircuit().Layout().visualize()
../../../../_images/ipkiss3-all-Distribute-2.png
class Y

Specifies that a sequence of instances (or their ports/anchors) is to be evenly distributed in y direction between two given instances (or their ports/anchors): start and end.

If include_margin is True (default), the spacing in y between the instances to be distributed will be equal to the spacing between the start instance and the first instance to be distributed (and to the spacing in y between the end instance and the last one to be distributed). Otherwise, the first distributed instance will coincide in y with the start instance (and the last distributed instance will coincide in y with the end one).

Parameters:
pos_selectors: Sequence[str]

The instances (or their ports/anchors) to be distributed along the y direction.

start: str

The instance defining the start of the distribution.

end: str

The instance defining the end of the distribution.

include_margin: bool, optional

Whether the vertical spacing should also apply between the first distributed instance and the start instance (and between the last distributed instance and the end instance). Default is True.

Examples

import si_fab.all as pdk
import ipkiss3.all as i3

class MyCircuit(i3.Circuit):
    def _default_insts(self):
        gc = pdk.GratingCoupler()
        mmi = pdk.MMI1x2()

        return {
            "gc1": gc,
            "gc2": gc,
            "mmi1": mmi,
            "mmi2": mmi,
            "mmi3": mmi,
        }

    def _default_specs(self):
        return [
            i3.Place("gc1", (20, 30)),
            i3.Place("gc2", (250, 150)),
            i3.FlipH("gc2"),
            i3.Distribute.Y(["mmi1@C", "mmi2@C", "mmi3@C"], "gc1:out", "gc2:out"),
        ]

MyCircuit().Layout().visualize()
../../../../_images/ipkiss3-all-Distribute-3.png