SubsetAndChangePortAssignment

30 views
Skip to first unread message

Ulrich Kiefner

unread,
Jun 30, 2025, 8:44:32 AMJun 30
to VNA Tools
Hi,

I want to use the script.SubsetAndChangePortAssignment method in Python. The programming reference tells to exclude ports by assigning the number -1 in the "ports" argument. 

When I use '-1' for the port that I want to remove, the function throws the error 
"Exception: VNA port description '-1' is not valid"

In a simple example I want to extract S11 from a two-port network:
script.SubsetAndChangePortAssignment('test.s2p', '1,-1', 'test_S11.s1p')

Am I doing something wrong?

Kind regards,
Uli

Michael Wollensack METAS

unread,
Jul 3, 2025, 2:39:57 AMJul 3
to VNA Tools
Hi,

this is a bug which was introduced in V2.2.0 when I added support for mixed-mode S-parameters in 2018.
This will be fixed in the upcoming V2.9.x.

In the mean time you can use the following workaround:

# script.SubsetAndChangePortAssignment('test.s2p', '1,-1', 'test_S11.s1p')
script.Subset('test.s2p', '1', 'test_S11.sdatb')

# script.SubsetAndChangePortAssignment('test.s2p', '-1,1', 'test_S22_at_S11.sdatb')
script.Subset('test.s2p', '2', 'test_S22.sdatb')
script.ChangePortAssignment('test_S22.sdatb', '1', 'test_S22_at_S11.sdatb')

see

The results are stored as sdatb-files and not Touchstone files. If you want to convert them see https://groups.google.com/g/vnatools/c/aNVqApM_nuI/m/9ou_bYMyAgAJ.

Regards
Michael

Reply all
Reply to author
Forward
0 new messages