¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Touchstone file format #consolecommands #docs


 

Hi,



When developing my nanovna mini-tools, I am unclear about the "Touchstone" file format regarding the storage of Z-parameters for a one-port (nanovna_snp.py). So far I follow rev 1.1, it says on page 7:

Example 2:
!1-port Z-parameter file, multiple frequency points
# MHz Z MA R 75
!freq magZ11 angZ11
100 0.99 -4
200 0.80 -22
300 0.707 -45
400 0.40 -62
500 0.01 -89
Note that in the above example Z11 (the input impedance) is normalized
to 75 ohms, as given by the reference impedance (R 75) in the option
line.

Unfortunately rev. 2.0 is not totally clear about the Z format, on the one hand it is not normalized (page 7):

For Version 2.0 files, the reference resistance defines the system reference for the S-parameter data if the
[Reference] keyword is not present. Network data for G-, H-, Y- and Z-parameters in Version 2.0 files is
not normalized. Therefore, the reference resistance and [Reference] keyword have no impact on G-, H-, Y-
, or Z-parameter data in Version 2.0 files. S-parameters are, by definition, normalized with respect to the
reference impedance(s) and in this respect there is no difference between the treatment of S-parameters in
Version 1.0 and Version 2.0 files.

On the other hand, normalization of Z is mentioned in this option line example on the next page 8:

Frequency in Hz, Z-parameters in magnitude-angle format, normalized to 10 ohms:
# Hz Z MA R 10

But I suspect that this information is not correct, because further back in the document on page 14 rev 1.1 and rev 2.0 are contrasted for Z-parameters:

Example 9 (Version 1.0):
!1-port Z-parameter file, multiple frequency points
# MHz Z MA R 75
!freq magZ11 angZ11
100 0.99 -4
200 0.80 -22
300 0.707 -45
400 0.40 -62
500 0.01 -89
Note that, in the above example, Z11 is normalized to 75 ohms, as given by the reference impedance (R 75)
in the option line.

Example 10 (Version 2.0):
!1-port Z-parameter file, multiple frequency points
[Version] 2.0
# MHz Z MA
[Number of Ports] 1
[Number of Frequencies] 5
[Reference] 20.0
[Network Data]
!freq magZ11 angZ11
100 74.25 -4
200 60 -22
300 53.025 -45
400 30 -62
500 0.75 -89

This example duplicates the data in Example 9, using Version 2.0 syntax. Note that normalization does not
apply.

Question to the specialists, should one stick with rev 1.1, as does nanovna-saver, or is rev 2.0 more widely used.

A quick test with scikit-rf shows that it writes also in 1.1 format, but creates only S-Parameter files, even if fed with Z-parameter:

!Created with skrf...
# Hz S RI R 50.0
!freq ReS11 ImS11
50000.0 0.98... -0.01...
...

Martin


F1AMM
 

When developing my nanovna mini-tools, I am unclear about the "Touchstone" file format
regarding the storage of Z-parameters for a one-port (nanovna_snp.py). So far I follow rev
1.1, it says on page 7:
In a .S1P file it is not an impedance that is described but S11

# HZ S RI R 50
6800000 0.4178235144152254 -0.6694732263322638

For each line you find in order:
Frequency in Hz
the real part of S11
the imaginary part of S11

If you want the impedances you have to recalculate them from S11
--
F1AMM (Fran?ois)

-----Message d'origine-----
De la part de Ho-Ro
mardi 26 juillet 2022 09:47


 

In a .S1P file it is not an impedance that is described but S11
If you want the impedances you have to recalculate them from S11
Did you see the example 9 and 10 from my posting below (out of touchstone rev 2.0 spec)?

Example 9 (Version 1.0):
!1-port Z-parameter file, multiple frequency points
Example 10 (Version 2.0):
!1-port Z-parameter file, multiple frequency points
You can for sure store also impedance in a s1p file if you calculate the Z-parameter from S-parameter - this is what my tool does, fetching S11-parameter, taking a line for line with S-parameter (freq S11.re S11.im) and creating lines of normalized Z-parameter (freq R/Z0 X/Z0) preceded by a header for Z-parameter (# HZ Z RI R 50).

Calculation:

if format_z:
# calculate normalized impedance as Rn + jXn = R/Z0 + jX/Z0 according to this doc
#
freq, Sr, Si = line[:-1].split( ' ' )
freq = float( freq )
Sr = float( Sr )
Si = float( Si )
Sr2 = Sr * Sr
Si2 = Si * Si
Sr_2 = ( 1 - Sr ) * ( 1 - Sr )
Rn = ( 1 - ( Si2 + Sr2 ) ) / ( Sr_2 + Si2 )
Xn = ( 2 * Si ) / ( Sr_2 + Si2 )
return f'{freq:10.0f} {Rn:15.9f} {Xn:15.9f}'


 

On Tue, Jul 26, 2022 at 09:46 AM, Ho-Ro wrote:


A quick test with scikit-rf shows that it writes also in 1.1 format, but
creates only S-Parameter files, even if fed with Z-parameter:
Sorry, checked the wrong input file, scikit-rf cannot read Z-Parameter (NotImplementedError: only s-parameters supported for now.):

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/skrf/network.py", line 423, in __init__
self.read_touchstone(filename)
File "/usr/lib/python3/dist-packages/skrf/network.py", line 1752, in read_touchstone
raise NotImplementedError('only s-parameters supported for now.')
NotImplementedError: only s-parameters supported for now.

As a consequence I will name my Z-parameter files *.z1p from now on - what's your opinion?

Martin


 

On 7/26/22 3:09 AM, Ho-Ro wrote:
In a .S1P file it is not an impedance that is described but S11
If you want the impedances you have to recalculate them from S11
Did you see the example 9 and 10 from my posting below (out of touchstone rev 2.0 spec)?

Example 9 (Version 1.0):
!1-port Z-parameter file, multiple frequency points
Example 10 (Version 2.0):
!1-port Z-parameter file, multiple frequency points
You can for sure store also impedance in a s1p file if you calculate the Z-parameter from S-parameter - this is what my tool does, fetching S11-parameter, taking a line for line with S-parameter (freq S11.re S11.im) and creating lines of normalized Z-parameter (freq R/Z0 X/Z0) preceded by a header for Z-parameter (# HZ Z RI R 50).
While the file format spec may define formats for things other than S parameters, they're not particularly common. Not to say that they don't exist, but every tool I've used only uses S parameters.

They are, after all, called SnP files <grin>