From e601584c243b03f35e89f78d37a8f12295b8c91f Mon Sep 17 00:00:00 2001 From: flaport Date: Mon, 23 Jun 2025 06:00:53 +0200 Subject: [PATCH] bump sax --- pyproject.toml | 2 +- src/meow/eme/propagate.py | 10 +++++----- src/meow/eme/sax.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3a568df7..99bc955e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/src/meow/eme/propagate.py b/src/meow/eme/propagate.py index ddf77e14..429466f4 100644 --- a/src/meow/eme/propagate.py +++ b/src/meow/eme/propagate.py @@ -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, @@ -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) diff --git a/src/meow/eme/sax.py b/src/meow/eme/sax.py index b2b650a4..fb55ec66 100644 --- a/src/meow/eme/sax.py +++ b/src/meow/eme/sax.py @@ -67,7 +67,7 @@ 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, @@ -75,7 +75,7 @@ def compute_s_matrix_sax( **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 ) @@ -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"])