Skip to content

Redundant parameters in RF models #99

@cdaunt

Description

@cdaunt

Many of the RF models have frequency in the signature when in fact, the sparam us frequency independent

SAX broadcasts in the background to ensure that the arrays end up the same shape so ensuring everything has the same length as the frequency adds additional complexity that is already handled

For example, the following code is independent of frequency but frequency only seems to be passed to ensure that the function returned value is the correct shape

@partial(jax.jit, inline=True, static_argnames=("n_ports"))
def gamma_0_load(
    *,
    f: sax.FloatArrayLike = DEFAULT_FREQUENCY,
    gamma_0: sax.Complex = 0,
    n_ports: int = 1,
) -> sax.SType:
    f = jnp.asarray(f)
    f_flat = f.ravel()
    sdict = {
        (f"o{i}", f"o{i}"): jnp.full(f_flat.shape[0], gamma_0)
        for i in range(1, n_ports + 1)
    }
    sdict |= {
        (f"o{i}", f"o{j}"): jnp.zeros(f_flat.shape[0], dtype=complex)
        for i in range(1, n_ports + 1)
        for j in range(i + 1, n_ports + 1)
    }
    return sax.reciprocal({k: v.reshape(*f.shape) for k, v in sdict.items()})

I can go through these (and probably add some more devices) but I wanted to be sure my understanding is correct before working on this

One of my motivations here is that the frequency independent components can be reused in circulax via sax_component

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions