Comments (Touchstone)
Understanding Touchstone Comments
Touchstone files are the universal exchange format for measured and simulated S-parameter data in RF engineering. Every vector network analyzer exports Touchstone, every simulation tool imports it, and component manufacturers distribute device models as .s2p files. The comment system provides a standardized way to embed documentation directly in the data file, ensuring that critical measurement metadata travels with the data rather than being lost in separate documentation.
A well-commented Touchstone file is self-documenting: an engineer receiving the file years later can immediately understand what was measured, how it was measured, and under what conditions. This is particularly important for transistor S-parameters, where the data is completely different at different bias points, and for connector/cable measurements where the calibration reference plane determines what the data represents. Without comments, an unlabeled .s2p file with 201 frequency points is essentially meaningless, as there is no way to determine whether it represents a filter, an amplifier, a transmission line, or noise.
Touchstone File Structure
! Any text after exclamation mark is ignored by parsers
! Device: BFP740 SiGe HBT, Lot 2024-Q3
! Bias: Vce=2.0V, Ic=10mA
Option Line (NOT a comment):
# GHz S MA R 50
(frequency unit, parameter type, format, reference Z)
Data Lines:
freq |S11| ∠S11 |S21| ∠S21 |S12| ∠S12 |S22| ∠S22
The # option line defines: frequency unit (Hz/kHz/MHz/GHz), parameter type (S/Y/Z/H/G), format (MA=mag-angle, DB=dB-angle, RI=real-imaginary), and reference impedance. All data after the option line is numerical S-parameter data. Comments can appear before, between, or after data lines.
Touchstone Version Comparison
| Feature | Touchstone 1.0 | Touchstone 2.0 (IEEE 370) |
|---|---|---|
| Comment character | ! (exclamation) | ! (exclamation) |
| Structured keywords | None | [Version], [Number of Ports], etc. |
| Max ports | Unlimited (convention) | Formally defined for N ports |
| Mixed-mode S-params | Not supported | [Mixed-Mode Order] keyword |
| Noise data | After S-data block | [Noise Data] keyword |
| File extension | .s1p, .s2p, .snp | .ts (recommended), .snp (compatible) |
| Reference impedance | Single value (R 50) | Per-port [Reference] keyword |
Frequently Asked Questions
What is the comment syntax in Touchstone files?
Any line beginning with ! is a comment, ignored by parsers. In Touchstone 2.0, comments can appear between structured keywords. The # option line is NOT a comment; it defines frequency unit, parameter type, format, and reference impedance. Place comments on separate lines for maximum tool compatibility.
What information should be included in Touchstone comments?
Best practice: device ID (part number, serial, lot), VNA model and firmware, calibration type (SOLT/TRL), frequency range and point count, port assignments, DC bias (Vds/Ids or Vce/Ic for active devices), temperature, date, operator, and any de-embedding or port extension applied. Different bias conditions produce entirely different datasets.
Are Touchstone comments compatible across all RF tools?
The ! syntax is universally supported by ADS, AWR, HFSS, CST, Sonnet, Qucs, and scikit-rf. Limitations: some older parsers require comments on separate lines, some limit line length to 80 to 256 characters, and legacy tools may not handle inline comments after data. Touchstone 2.0 adds structured keywords for machine-readable metadata.