ipkiss3.all.Join

class ipkiss3.all.Join(attachments, *args)

Join instances together. Either two strings (‘inst1:port1’, ‘inst2:port2’), or a list of tuples of the form [(‘inst1:port1’, ‘inst2:port2’), (…, …)].

Instance name and port names are string-based.

Examples

>>> i3.Join('grating:out', 'waveguide:in')
>>> i3.Join([('grating:out', 'waveguide:in'),
>>>                 ('waveguide:out', 'grating2:out')])
import ipkiss3.all as i3

wg_bend90 = i3.RoundedWaveguide().Layout(shape=[
  (0, 0),
  (10, 0),
  (10, 10),
])


insts = i3.place_insts({
  'wg1': wg_bend90,
  'wg2': wg_bend90,
  'wg3': wg_bend90,
  'wg4': wg_bend90
}, [
  # concatenating 4 90deg bends creates a ring
  i3.Join([
    ('wg1:out', 'wg2:in'),
    ('wg2:out', 'wg3:in'),
    ('wg3:out', 'wg4:in'),
    ('wg4:out', 'wg1:in'), # this one is redundant
])])

i3.LayoutCell().Layout(instances=insts).visualize(annotate=True)
../../../_images/ipkiss3-all-Join-1.png

Note that only declaring Join specifications doesn’t fully specify what your layout will look like. There can be ambiguity. This is illustrated in the following example.

wg = i3.RoundedWaveguide().Layout(shape=[
  (0, 0),
  (10, 0)
])

insts = i3.place_insts({
  'wg1': wg_bend90,
  'wg2': wg,
}, [
  i3.Join([
    ('wg1:out', 'wg2:in'),
])])

i3.LayoutCell().Layout(instances=insts).visualize(annotate=True)

# If we change the order within the Join spec, the resulting layout will change:
insts = i3.place_insts({
  'wg1': wg_bend90,
  'wg2': wg,
}, [
  i3.Join([
    ('wg2:in', 'wg1:out'),
])])

i3.LayoutCell().Layout(instances=insts).visualize(annotate=True)
../../../_images/ipkiss3-all-Join-2_00.png
../../../_images/ipkiss3-all-Join-2_01.png

But when we now add a Place spec, the order is not important anymore, there’s only 1 possible layout:

insts = i3.place_insts({
  'wg1': wg_bend90,
  'wg2': wg,
}, [
  i3.Place('wg1:in', (0, 0)),
  i3.Join([
    ('wg1:out', 'wg2:in'),
])])

i3.LayoutCell().Layout(instances=insts).visualize(annotate=True)

insts = i3.place_insts({
  'wg1': wg_bend90,
  'wg2': wg,
}, [
  i3.Place('wg1:in', (0, 0)),
  i3.Join([
    ('wg2:in', 'wg1:out'),
])])

i3.LayoutCell().Layout(instances=insts).visualize(annotate=True)
../../../_images/ipkiss3-all-Join-3_00.png
../../../_images/ipkiss3-all-Join-3_01.png