Touchstone files and port order¶
Touchstone is the usual on-disk format for S-parameters. CloudSprite parses .s1p–.s4p / .snp into traces. The filename extension is the port count: .s2p is two ports (four S-parameters), .s4p is four ports (sixteen).
Header and units¶
A typical header looks like:
# Hz S RI R 50
| Token | Meaning |
|---|---|
Hz / kHz / MHz / GHz |
Frequency unit of the first column |
S |
S-parameters (not Y or Z) |
RI / MA / DB |
Real/imag, mag/angle (degrees), or dB/angle |
R 50 |
Reference impedance, ohms |
Read the header. A file stored as DB is not the same array as one stored as RI. Convert to complex linear before mixed-mode math or correlation against a linear-magnitude sibling.
One-based vs zero-based¶
Engineers say S21 (port 2 ← port 1). In scikit-rf the same sample is network.s[f, 1, 0] — 0-based (to, from). Off-by-one here silently swaps transmission and reflection.
Port numbering on the bench¶
The file does not know which physical connector is “port 1.” That mapping lives in:
- How you cabled the VNA
- The cal kit / port extension
- Dataset parameters you record (
mixed_mode=p13, polarityPN, serial)
For four 2-port files of a differential DUT, filenames often encode both a port-pair number (p13) and a polarity pair (PN). Those two encodings must agree. If they contradict, stop — see Mixed-mode port mapping.
What to upload¶
Upload the Touchstone the instrument wrote. Do not transcribe magnitude/phase into a spreadsheet and call it an S2P. CSV is fine for non-S waveforms; it is a lossy stand-in for S-parameters (phase, port count, and Z0 usually vanish).