gine

Submodules

Package Contents

Classes

HelloWorld

An example widget.

NetlistGraph

Widget element that contains the javascript interactive netlist.

Functions

convert_gdsfactory_netlist(gdsfactory_netlist)

Converts between gdsfactory inherent netlist to gine-compatible netlists.

gine_widget

interactive_netlist_graph(gdsfactory_netlist)

This function converts a GDSFactory netlist into a gine netlist, and then returns an interactive netlist widget.

_jupyter_labextension_paths()

Called by Jupyter Lab Server to detect if it is a valid labextension and

_jupyter_nbextension_paths()

Called by Jupyter Notebook Server to detect if it is a valid nbextension and

Attributes

__version__

NPM_PACKAGE_RANGE

__version__ = '0.0.9'
NPM_PACKAGE_RANGE = '0.0.9'
class HelloWorld(**kwargs)[source]

Bases: ipywidgets.DOMWidget

An example widget.

_view_name
_model_name
_view_module
_model_module
_view_module_version
_model_module_version
value
class NetlistGraph(**kwargs)[source]

Bases: ipywidgets.DOMWidget

Widget element that contains the javascript interactive netlist.

_view_name
_model_name
_view_module
_model_module
_view_module_version
_model_module_version
netlist_graph_data
value
convert_gdsfactory_netlist(gdsfactory_netlist: dict)[source]

Converts between gdsfactory inherent netlist to gine-compatible netlists.

GDSFactory netlist format:

netlist={
    "instances": {
        "lft": coupler,
        "top": waveguide,
        "rgt": coupler,
    },
    "connections": {
        "lft,out0": "rgt,in0",
        "lft,out1": "top,in0",
        "top,out0": "rgt,in1",
    },
    "ports": {
        "in0": "lft,in0",
        "in1": "lft,in1",
        "out0": "rgt,out0",
        "out1": "rgt,out1",
    },
}

gine netlist format:

netlist = {
    nodes: [
        {id: "heyhey", someproperty: "beer"},
        {id: "oioi", someproperty: "ale"},
    ],
    links: [
        {"source": "heyhey", "target": "oioi", "value": 1},
    ],
}

Part of the objective is to retain information of the ports, but I am trying to see how to do this in a force-graph implementation. Personally I am less interested in ports but it would be good for future compatibility. The problem is that I would have to make each port an element. I can save it as a property for now.

gine_widget(center: ipywidgets.Widget = None, footer: ipywidgets.Widget | None = None, header: ipywidgets.Widget | None = None, left_sidebar: ipywidgets.Widget | None = None, right_sidebar: ipywidgets.Widget | None = None)[source]

This widget provides interactive control and layout control for netlist visualisation.

It includes all the buttons, layout window resizer, and visualising tools in which the netlist graph is shown.

interactive_netlist_graph(gdsfactory_netlist: dict)[source]

This function converts a GDSFactory netlist into a gine netlist, and then returns an interactive netlist widget.

_jupyter_labextension_paths()[source]

Called by Jupyter Lab Server to detect if it is a valid labextension and to install the widget

Returns:

  • src (Source directory name to copy files from. Webpack outputs generated files) – into this directory and Jupyter Lab copies from this directory during widget installation

  • dest (Destination directory name to install widget files to. Jupyter Lab copies) – from src directory into <jupyter path>/labextensions/<dest> directory during widget installation

_jupyter_nbextension_paths()[source]

Called by Jupyter Notebook Server to detect if it is a valid nbextension and to install the widget

Returns:

  • section (The section of the Jupyter Notebook Server to change.) – Must be ‘notebook’ for widget extensions

  • src (Source directory name to copy files from. Webpack outputs generated files) – into this directory and Jupyter Notebook copies from this directory during widget installation

  • dest (Destination directory name to install widget files to. Jupyter Notebook copies) – from src directory into <jupyter path>/nbextensions/<dest> directory during widget installation

  • require (Path to importable AMD Javascript module inside the) – <jupyter path>/nbextensions/<dest> directory