signal_integrity
¶
Mixed-mode and time-domain analysis for multi-port S-parameter networks.
The helpers in this module operate on :class:skrf.Network objects. They are
backend-neutral: any solver result that can be exported as a scikit-rf network
(Palace, Meep, or a measured Touchstone file) can use them.
The functions deliberately keep the conventions used by the signal-integrity tutorial:
- ports are ordered by name before the mixed-mode transformation;
- mixed-mode order is
(differential, differential, common, common)for a four-port network; - TDR adds a real DC sample by linear or constant extrapolation before taking the step response;
- all returned impedances and delays are in ohms and seconds.
scikit-rf is imported lazily so importing :mod:gsim.palace does not require
the optional rf-analysis dependencies.
Functions:
-
check_network–Validate a network before converting or transforming it.
-
complete_network–Convert a complete Palace
SParamsobject to an ordered network. -
differential_delay–Estimate one-way group delay from the differential transmission phase.
-
gap_arrival–Return the first fixed-gate half-peak arrival of a reflected-step change.
-
interpolate_complex–Interpolate every complex S entry onto
frequencies. -
line_network–Return the exact two-port network of an ideal uniform TEM line.
-
mixed_mode–Return port-ordered single-ended and mixed-mode four-port networks.
-
tdr–Transform a reflection coefficient into a reflected step and impedance.
check_network
¶
Validate a network before converting or transforming it.
Parameters:
-
net(Any) –scikit-rf network.
-
n_ports(int | None, default:None) –Required number of ports, or
Noneto accept any count.
Raises:
-
ValueError–When the network is incomplete, non-finite, non-monotonic in frequency, or has no unique port names.
complete_network
¶
Convert a complete Palace SParams object to an ordered network.
Missing entries are rejected before :meth:SParams.to_skrf can fill them
by reciprocity or leave unobserved entries at zero.
Parameters:
-
parameters(Any) –gsim.palace.SParams-like object withkeys()andto_skrf(). -
ports(Sequence[str]) –Expected port names in tutorial order.
-
z_se(float, default:50.0) –Declared single-ended reference impedance.
Returns:
-
Any–A four-port network ordered as
ports.
Raises:
-
ValueError–When entries are missing, the network is incomplete, or the solver reference impedance differs from
z_se.
differential_delay
¶
differential_delay(
mixed: Any,
*,
min_fraction: float = 0.1,
max_fraction: float = 0.6,
min_magnitude: float = 0.05,
min_samples: int = 5,
) -> float
Estimate one-way group delay from the differential transmission phase.
Parameters:
-
mixed(Any) –Mixed-mode four-port network;
S[:, 1, 0]is used. -
min_fraction(float, default:0.1) –Lower frequency bound as a fraction of the maximum.
-
max_fraction(float, default:0.6) –Upper frequency bound as a fraction of the maximum.
-
min_magnitude(float, default:0.05) –Minimum
|S21|used for the phase-slope estimate. -
min_samples(int, default:5) –Minimum number of samples in the fit window.
Returns:
-
float–Median one-way delay in seconds.
Raises:
-
ValueError–When too few usable samples exist or the delay is nonpositive.
gap_arrival
¶
gap_arrival(
baseline: Any,
disrupted: Any,
one_way_delay: float,
resolution_s: float,
threshold: float,
*,
zref: float | None = None,
) -> float
Return the first fixed-gate half-peak arrival of a reflected-step change.
The gate excludes the launches and the far-end reflection and is identical for both networks. It is never centred on the expected feature time.
Parameters:
-
baseline(Any) –Unperturbed mixed-mode network.
-
disrupted(Any) –Perturbed mixed-mode network on the same time grid.
-
one_way_delay(float) –One-way delay in seconds, used to set the far gate.
-
resolution_s(float) –Working time resolution in seconds.
-
threshold(float) –Minimum reflected-step difference to report an arrival.
-
zref(float | None, default:None) –Differential reference impedance. Defaults to the first reference of
baseline.
Returns:
interpolate_complex
¶
Interpolate every complex S entry onto frequencies.
Real and imaginary parts are interpolated separately. This is intended for comparing direct anchor solves with a dense sweep; it does not create data outside the source band.
Parameters:
Returns:
-
ndarray–Array with shape
(len(frequencies), n_ports, n_ports).
line_network
¶
mixed_mode
¶
mixed_mode(
net: Any, pairs: Sequence[tuple[str, str]] | None = None, z_se: float | None = None
) -> tuple[Any, Any]
Return port-ordered single-ended and mixed-mode four-port networks.
Parameters:
-
net(Any) –Four-port scikit-rf network with names on every port. Frequencies are expected in Hz and
net.z0must be a real, equal reference. -
pairs(Sequence[tuple[str, str]] | None, default:None) –Two ordered
(+, -)port-name pairs. Defaults to((p0, p1), (p2, p3))in the network's current port order. -
z_se(float | None, default:None) –Single-ended reference impedance. Defaults to the network's reference impedance.
Returns:
-
Any–(ordered, mixed)whereorderedfollows the pair order and -
Any–mixedhas portsd_near, d_far, c_near, c_far.
Raises:
-
ValueError–When the ports, pairs, or reference impedance do not match.
tdr
¶
tdr(
f: Sequence[float] | ndarray,
reflection: Sequence[complex] | ndarray,
zref: float,
*,
window: str = "hamming",
dc: str = "linear",
pad: int = 0,
) -> tuple[ndarray, ndarray, ndarray]
Transform a reflection coefficient into a reflected step and impedance.
Parameters:
-
f(Sequence[float] | ndarray) –Uniform, strictly increasing frequency grid in Hz.
-
reflection(Sequence[complex] | ndarray) –Reflection coefficient at
f. -
zref(float) –Reference impedance in ohms.
-
window(str, default:'hamming') –scikit-rf window name (for example
"hamming"or"hann"). -
dc(str, default:'linear') –DC extrapolation policy,
"linear"or"constant". -
pad(int, default:0) –Zero-padding passed to scikit-rf's step response.
Returns:
-
tuple[ndarray, ndarray, ndarray]–(t, rho, z)in seconds, reflected step / incident step, and ohms.
Raises:
-
ValueError–For a nonuniform grid, non-finite samples, invalid reference impedance, or an unsupported DC policy.