#parser #plotter #file-path #directory-path #s2p

bin+lib touchstone

Touchstone (s2p, etc.) file parser, plotter, and more

26 releases (10 breaking)

0.10.4 Nov 28, 2025
0.9.0 Nov 27, 2025
0.2.0 Mar 25, 2025

#79 in Visualization

Download history 2/week @ 2025-11-21 38/week @ 2025-12-05 18/week @ 2025-12-12

58 downloads per month
Used in gainlineup

MIT license

5.5MB
5.5K SLoC

JavaScript 3K SLoC // 0.1% comments Rust 2.5K SLoC // 0.1% comments

touchstone

Touchstone (S2P) parser for RF Engineering

Installation

cargo install touchstone

This installs an executable in your .cargo/bin directory (.cargo/bin/touchstone).

Usage

The touchstone executable can be run with a file path as an argument or a directory path as an argument.

Help

touchstone --help

Outputs:

📡 Touchstone (s2p, etc.) file parser, plotter, and more - https://github.com/iancleary/touchstone

VERSION:
    0.10.2

USAGE:
     touchstone <FILE_PATH>
     touchstone <DIRECTORY_PATH>
     touchstone cascade <FILE_1> <FILE_2> ... [--name <OUTPUT_NAME>]

     FILE_PATH: path to a s2p file
     DIRECTORY_PATH: path to a directory containing s2p files

     The s2p file(s) are parsed and an interactive plot (html file and js/ folder)
     is created next to the source file(s).

OPTIONS:
      -v, --version    Print version information
      -h, --help       Print help information

EXAMPLES:
     # Single file (Relative path)
     touchstone files/measurements.s2p

     # Directory (Plot all files in folder)
     touchstone files/data_folder

     # Cascade two networks
     touchstone cascade ntwk1.s2p ntwk2.s2p

     # Cascade with custom output name
     touchstone cascade ntwk1.s2p ntwk2.s2p --name result.s2p

     # Bare filename
     touchstone measurement.s2p

     # Windows absolute path
     touchstone C:\Users\data\measurements.s2p

     # Windows UNC path (network path)
     touchstone \\server\mount\folder\measurement.s2p

     # Unix absolute path
     touchstone /home/user/measurements.s2p

File Path

touchstone files/ntwk3.s2p

which outputs:

============================
Single file detected. Plotting.
In file: files/ntwk3.s2p
'files/ntwk3.s2p' is a Relative path with separators (nested).
Plot HTML generated at files/ntwk3.s2p.html
You can open the plot in your browser at:
file:///Users/iancleary/Development/touchstone/files/ntwk3.s2p.html
Attempting to open plot in your default browser...
Success! Opening: file:///Users/iancleary/Development/touchstone/files/ntwk3.s2p.html

This works on Windows, MacOS, and Linux file systems!

  • MacOS: file:///Users/iancleary/touchstone/files/ntwk3.s2p.html
  • Windows: file:///C:/Users/iancleary/touchstone/files/ntwk3.s2p.html
  • Linux: file:///home/iancleary/touchstone/files/ntwk3.s2p.html

This command created an html file that is interactive, and designed to not have any network dependence.

HTML file created for ntwk3.s2p by running touchstone files/ntwk3.s2p in the root of this directory

You can view the HTML source file itself here directly: examples/ntwk3.s2p.html.

Note that the crate's execution templates in the data parsed from the touchstone file's network object. So this example will only match for the files/ntwk3.s2p data.

Directory Path

touchstone files/

which outputs:

============================
In directory: files/
Directory detected. Plotting all valid network files in directory.
Found network file: "files/ntwk1.s2p"
Found network file: "files/ntwk2.s2p"
Found network file: "files/ntwk3.s2p"
Plot HTML generated at files/combined_plot.html
You can open the plot in your browser at:
file:///Users/iancleary/Development/touchstone/files/combined_plot.html
Attempting to open plot in your default browser...
Success! Opening: file:///Users/iancleary/Development/touchstone/files/combined_plot.html

This command created an html file that is interactive, and designed to not have any network dependence.

HTML file created for the files directory by running touchstone files/ in the root of this directory

You can view the HTML source file itself here directly: examples/combined_plot.html.

Note that the crate's execution templates in the data parsed from the touchstone file's network object. So this example will only match for the files/ntwk1.s2p, files/ntwk2.s2p, and files/ntwk3.s2p data.

References

Dependencies