plotting.plot_scattering_matrix

plotting.plot_scattering_matrix(
    matrices,
    freqs,
    *,
    edges=None,
    partition=None,
    labels=None,
    row_labels=None,
    col_labels=None,
    mag_range=_PRESET,
    **kwargs,
)

Plot a perturbation scattering matrix versus frequency (magnitude over phase).

Preset over :func:plot_complex_matrix for an incoming → outgoing wave matrix. Unlike a transfer matrix, the rows and columns of a scattering matrix belong to different stations (a reflection sits at one face, a transmission crosses to the other), so the labels need the wave partition, not just the station pair: pass edges=(a, b) together with partition=(incoming, outgoing) and each entry is titled by its own station-subscripted waves (e.g. f₁ → g₁ for a reflection at edge 1).

This is a display helper only – it does not change the variables the matrix is written in. labels names the wave symbols (default: (f, g, h)); set it to match whatever variables the matrix was built in.

Parameters

Name Type Description Default
matrices array or list of arrays One (n_freq, N, N) complex scattering-matrix stack, or several to overlay. required
freqs array or list of arrays Matching frequency axis (or one shared axis) for the x-axis. required
edges tuple of (a, b) The two station edge ids; station "a"a, "b"b. Used with partition to build the station-subscripted labels. None
partition tuple of (incoming, outgoing) The wave partition from :meth:nefes.perturbation.PerturbationResponse.scattering_labels: two lists of (station, char_index) tags ordering the matrix columns (incoming) and rows (outgoing). None
labels sequence of str Per-wave symbols indexed by characteristic (default: (f, g, h)). Used to build the partition labels, or as the shared axis symbols when no partition/edges are given. None
row_labels sequence of str Explicit axis labels (outgoing rows / incoming columns), overriding everything above. None
col_labels sequence of str Explicit axis labels (outgoing rows / incoming columns), overriding everything above. None
mag_range tuple of (lo, hi) Fixed magnitude y-range. By default the preset rule applies: (0, 1) when no entry exceeds unity (the natural band for reflection / transmission coefficients), otherwise (0, max \|entry\|). _PRESET
**kwargs Forwarded to :func:plot_complex_matrix. {}

Returns

Name Type Description
plotly.graph_objects.Figure

See Also

nefes.perturbation.PerturbationResponse.plot_scattering_matrix : Method that fills in edges and partition automatically.

Examples

>>> S = resp.scattering_matrix(1, 2)
>>> plot_scattering_matrix(S, resp.freqs, edges=(1, 2),
...                        partition=resp.scattering_labels(1, 2)).show()
Back to top