Skip to content

Respect scattering-wave definitions in physical two-port conversions - #1470

Merged
jhillairet merged 2 commits into
scikit-rf:masterfrom
davrens101:bug/wave-conventions-round10
Nov 13, 2026
Merged

jhillairet merged 2 commits into
scikit-rf:masterfrom
davrens101:bug/wave-conventions-round10

Conversation

@davrens101

@davrens101 davrens101 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem and change

Physical ABCD, h and g matrices must not depend on how S waves are defined. Propagate a trailing defaulted s_def argument through a2s/s2a/h2s/s2h/g2s/s2g and the corresponding Network properties. The existing default power formulas and real-reference fast paths remain; nonpower ABCD converts at the power-wave boundary so ideal-through support does not depend on a finite impedance matrix.

Also fixes real-valued direct S input losing complex coefficients in s2s: promote S to complex only after no-op returns, before zeros_like allocations.

Adds a direct analytic-through regression plus nonreciprocal complex-z0 voltage/current and ideal-through checks; updates existing API docstrings.

Validation

  • pytest -q skrf/tests/test_network.py skrf/tests/test_circuit.py skrf/calibration/tests/test_deembedding.py: 233 passed, 9 skipped, 4 xfailed.
  • Ruff 0.15.12 checks pass on both changed Python files.
  • Nine-frequency independent port voltage/current dense-algebra oracle for all three definitions: getters/setters and all six standalone functions pass; maximum absolute conversion error 3.31e-13.
  • Direct real-S through checks now have ABCD identity error below 2.5e-15 and real/complex conversion discrepancy 0; no ComplexWarning appears.

AI-assisted implementation; verified locally on upstream master (rebased onto b0de1b4). I supervised and checked the work as it progressed.

@github-actions github-actions Bot added the Network skrf.network label Nov 12, 2026

@jhillairet jhillairet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Minor suggestions to ease future reading

Comment thread skrf/network.py Resolved
Comment thread skrf/network.py Resolved
@davrens101

Copy link
Copy Markdown
Contributor Author

Switched both s2s calls to keyword arguments as suggested (c456034); test_network passes.

@jhillairet
jhillairet merged commit 1e7d426 into scikit-rf:master Nov 13, 2026
13 of 14 checks passed
@jhillairet jhillairet mentioned this pull request Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Network skrf.network

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants