8
\$\begingroup\$

I'm having a hard time reading s2p files.

For an example say that I am measuring the parameters of a 2-port network (port 1 and port 2). What do each columns represent? I can tell that the first column represents the frequency, but what about the other columns?

Here is an example of one row from the .s2p file:

5.050000000000000E8    -2.558448512169542E1  -1.431102329159351E2  -9.961776146321423  -9.887263195538942E1  -9.965578328110700  -9.877563761786192E1  -2.571534263692556E1  -1.414368175364255E2
\$\endgroup\$
1

3 Answers 3

17
\$\begingroup\$

S2P files are also called "Touchstone" files, and different versions of the specification can be found here and here.

Just before the data section of an S2P file, there should be a line that looks like this:

# Hz S RI R 50

This tells you

  • The frequency column is given in Hz (KHz, MHz or GHz are also possible)
  • The measurements are S-parameters (rather than Y or Z parameters)
  • The values are given in real/imaginary format (real in the first column, imaginary in the second).
  • The characteristic impedance is 50 ohms

Instead of "RI" for real/imaginary, you might see "MA" for magnitude/angle, or "DB" for decibel/angle. Angles are measured in degrees (Ref).

If no header line is given, the default format is frequency in GHz, S-parameters, and magnitude/angle format.

\$\endgroup\$
2
  • \$\begingroup\$ Excellent answer, covers most of the questions I had about parsing an S2P file I'm looking at. Only thing that's not completely clear to me is, for MA or DB options, are the angles in radians (that would have been my assumption) or degrees? Thanks. \$\endgroup\$
    – SSilk
    Mar 14, 2019 at 20:31
  • \$\begingroup\$ @SSilk, per the Touchstone File Format Specification, Version 2.0, page 4, "All angles are measured in degrees." \$\endgroup\$
    – The Photon
    Mar 14, 2019 at 21:41
5
\$\begingroup\$

I just found the answer to this question, after spending an hour looking it up before this question was posted.

The format for .s2p files are:

*.s2p Files Each record contains 1 stimulus value and 4 S-parameters (total of 9 values)

Stim, Real (S11), Imag(S11), Real(S21), Imag(S21), Real(S12), Imag(S12), Real(S22), Imag(S22)

Here is the link for explanations of the format of various SnP files.

\$\endgroup\$
0
1
\$\begingroup\$

See @ThePhoton's answer too, with this addition that you would find hiding in the spec. Your question asks about 2-port networks, but in case someone looking up this answer is trying to find details on >2-port representation, note that >2-port networks differ:

The values are real/complex values in column-major order if ports <=2 and row-major (matrix) order for ports >2. (See page 5 and 6 for column- vs row-ordered data : https://ibis.org/connector/touchstone_spec11.pdf)

Independent of row/column-major ordering, where $a and $b are the first and second of each numeric pair, the data formats can be converted to a complex value ($complex) as follows:

  • For RI: $complex = $a + $b j
  • For MA: $complex = cos($b*pi()/180) + $a*sin($b*pi()/180) j
  • For DB: let $mag = 10**($a/20), such that:
    • $complex = $mag*cos($b*pi()/180) + $mag*sin($b*pi()/180) j

Update

I've been working on an RF module in Perl that helps with S2P parsing and related calculations (ESR, L, C, transforms, etc.). Here they are, probably in order of usefulness:

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.