extract_terms
- ipkiss3.all.extract_terms(layout)
Extract the terms from a layout view (electrical + optical).
- Parameters:
- layout: LayoutView
a layout view.
- Returns:
- terms: TermDict
List of terms.
Examples
The MMI PCell below creates three optical ports in the layout view. In the Netlist view we then extract the equivalent terms.
import ipkiss3.all as i3 class MMI(i3.PCell): class Layout(i3.LayoutView): def _generate_ports(self, ports): ports += i3.OpticalPort(name='in', position=(-5, 0), angle=180) ports += i3.OpticalPort(name='out1', position=(5, -1), angle=0) ports += i3.OpticalPort(name='out2', position=(5, 1), angle=0) return ports class Netlist(i3.NetlistFromLayout): def _generate_netlist(self, netlist): netlist.terms = i3.extract_terms(self.layout_view) return netlist mmi = MMI() mmi_lay = mmi.Layout() mmi_nl = mmi.Netlist() print("MMI layout ports: ") print(mmi_lay.ports) print("MMI netlist terms: ") print(mmi_nl.terms)
This will print:
MMI layout ports: [<OpticalPort 'in': (-5.000000, 0.000000), a=180.000000, D=<DefaultWaveguideTemplate.Layout view 'DEFAULT_WG_TEMPLATE:layout'>>, <OpticalPort 'out1': (5.000000, -1.000000), a=0.000000, D=<DefaultWaveguideTemplate.Layout view 'DEFAULT_WG_TEMPLATE:layout'>>, <OpticalPort 'out2': (5.000000, 1.000000), a=0.000000, D=<DefaultWaveguideTemplate.Layout view 'DEFAULT_WG_TEMPLATE:layout'>>] MMI netlist terms: Terms {'in':<OpticalTerm 'in'>,'out1':<OpticalTerm 'out1'>,'out2':<OpticalTerm 'out2'>}