Skip to content

Commit

Permalink
make _evaluate_circuit an internal function
Browse files Browse the repository at this point in the history
  • Loading branch information
flaport committed May 16, 2021
1 parent c3753aa commit bf68458
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion sax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from . import constants
from . import _typing as typing

from .core import circuit, evaluate_circuit
from .core import circuit
from .utils import (
copy_params,
get_params,
Expand Down
27 changes: 2 additions & 25 deletions sax/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def circuit(**params):
sdicts = {
name: model(**params.get(name, {})) for name, model in instances.items()
}
return evaluate_circuit(
return _evaluate_circuit(
sdicts, connections, ports, auto_prune=auto_prune, keep=keep
)

Expand All @@ -98,7 +98,7 @@ def circuit(**params):
return modified_circuit


def evaluate_circuit(
def _evaluate_circuit(
instances: Dict[str, SDict],
connections: Dict[str, str],
ports: Dict[str, str],
Expand Down Expand Up @@ -127,29 +127,6 @@ def evaluate_circuit(
Returns:
the circuit model dictionary with the given port names.
Example:
The SDict for a very simple mzi can for example be evaluated as follows::
import sax
S_mzi = sax.evaluate_circuit(
instances = {
"lft": S_coupler,
"top": S_waveguide,
"rgt": S_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",
},
)
"""
connections = { # silently accept YAML netlist syntax
k.replace(",", ":"): v.replace(",", ":") for k, v in connections.items()
Expand Down

0 comments on commit bf68458

Please sign in to comment.