Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
"orjson>=3.0.0",
"pydantic>=2.10.0",
"pyyaml>=6.0.2",
"sax>=0.15.0",
"sax>=0.15.4",
"shapely>=2.1.0",
"tidy3d>=2.8.0,<2.9.0",
"tqdm>=4.67.0",
Expand Down
10 changes: 5 additions & 5 deletions src/meow/eme/propagate.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ def propagate_modes(
ex_r: ComplexArray1D,
y: float,
z: FloatArray1D,
sax_backend: sax.BackendOrDefault = "default",
sax_backend: sax.BackendLike = "default",
) -> tuple[ComplexArray2D, FloatArray1D]:
"""Propagate the modes through the cells."""
sax_backend = sax.validate_circuit_backend(sax_backend)
actual_sax_backend = sax.into[sax.Backend](sax_backend)
propagations = compute_propagation_s_matrices(modes, cells)
interfaces = compute_interface_s_matrices(
modes,
Expand All @@ -210,9 +210,9 @@ def propagate_modes(
enforce_reciprocity=False,
)

pairs = pi_pairs(propagations, interfaces, sax_backend)
l2rs = l2r_matrices(pairs, identity, sax_backend)
r2ls = r2l_matrices(pairs, sax_backend)
pairs = pi_pairs(propagations, interfaces, actual_sax_backend)
l2rs = l2r_matrices(pairs, identity, actual_sax_backend)
r2ls = r2l_matrices(pairs, actual_sax_backend)

forwards, backwards = propagate(l2rs, r2ls, ex_l, ex_r)
return plot_fields(modes, cells, forwards, backwards, y, z)
6 changes: 3 additions & 3 deletions src/meow/eme/sax.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ def compute_s_matrix_sax(
modes: list[list[Mode]],
cells: list[Cell] | None = None,
cell_lengths: list[float] | None = None,
sax_backend: sax.BackendOrDefault = "default",
sax_backend: sax.BackendLike = "default",
*,
conjugate: bool = DEFAULT_CONJUGATE,
enforce_reciprocity: bool = DEFAULT_ENFORCE_RECIPROCITY,
enforce_lossy_unitarity: bool = DEFAULT_ENFORCE_LOSSY_UNITARITY,
**kwargs: Any,
) -> sax.SDenseMM:
"""Calculate the S-matrix for given sets of modes."""
sax_backend = sax.validate_circuit_backend(sax_backend)
actual_sax_backend = sax.into[sax.Backend](sax_backend)
_compute_propagation_s_matrices = kwargs.pop(
"compute_propagation_s_matrices", compute_propagation_s_matrices
)
Expand All @@ -95,7 +95,7 @@ def compute_s_matrix_sax(

# TODO: fix SAX Multimode to reduce this ad-hoc SAX-hacking.
net = _get_netlist(propagations, interfaces)
_, analyze_circuit, evaluate_circuit = circuit_backends[sax_backend]
_, analyze_circuit, evaluate_circuit = circuit_backends[actual_sax_backend]
# TODO: use analyze_instances instead of manually converting to scoo ?
net["instances"] = {k: sax.scoo(v) for k, v in net["instances"].items()}
analyzed = analyze_circuit(net["instances"], net["connections"], net["ports"])
Expand Down
Loading