Skip to content

Add failing example circuit of an LC shunt#76

Draft
nikosavola wants to merge 2 commits intoflaport:mainfrom
nikosavola:add-lc-shunt-component-test
Draft

Add failing example circuit of an LC shunt#76
nikosavola wants to merge 2 commits intoflaport:mainfrom
nikosavola:add-lc-shunt-component-test

Conversation

@nikosavola
Copy link
Contributor

Hi @flaport,

I was trying to implement a one-port lc_shunt_component but I seem to get errors with Jax that I don't fully understand. Something to do with varying array size I think.

You may run the test here with:

uv run pytest -k "test_lc_shunt_component"

I tried without @jax.jit in the core RF models but then this fails at the point where the circuit is flattened (_flat_circuit), either in analyze_insts_fn or analyze_fn.

Do you know what might be the problem?

Traceback

src/tests/test_rf_models.py:166: in test_lc_shunt_component
    s = type(self).lc_shunt_component(
src/tests/test_rf_models.py:127: in lc_shunt_component
    circuit, _ = sax.circuit(
src/sax/circuits.py:165: in circuit
    current_models[model_name] = circuit = _flat_circuit(
src/sax/circuits.py:345: in _flat_circuit
    analyzed = analyze_fn(dummy_instances, connections, ports)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/sax/backends/klu.py:130: in analyze_circuit_klu
    CSi = jnp.broadcast_to(Ci[None, :], mask.shape)[mask]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.13/site-packages/jax/_src/numpy/array_methods.py:1141: in op
    return getattr(self.aval, f"_{name}")(self, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.13/site-packages/jax/_src/numpy/array_methods.py:678: in _getitem
    return indexing.rewriting_take(self, item)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.13/site-packages/jax/_src/numpy/indexing.py:655: in rewriting_take
    treedef, static_idx, dynamic_idx = split_index_for_jit(idx, arr.shape)
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.13/site-packages/jax/_src/numpy/indexing.py:755: in split_index_for_jit
    idx = _expand_bool_indices(idx, shape)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.13/site-packages/jax/_src/numpy/indexing.py:1092: in _expand_bool_indices
    raise errors.NonConcreteBooleanIndexError(abstract_i)
E   jax.errors.NonConcreteBooleanIndexError: Array boolean indices must be concrete; got bool[27,10]
E
E   See https://docs.jax.dev/en/latest/errors.html#jax.errors.NonConcreteBooleanIndexError
E   --------------------
E   For simplicity, JAX has removed its internal frames from the traceback of the following exception. Set JAX_TRACEBACK_FILTERING
=off to include these.

@nikosavola nikosavola changed the title Add failing example LC shunt model test Add failing example circuit of an LC shunt Nov 21, 2025
@joamatab
Copy link
Collaborator

joamatab commented Dec 1, 2025

@flaport can you take a look at this ?

this prevents hierarchical circuits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants