https://github.com/kpobrien/touchstone.jl
Save and load network parameters in the Touchstone file format
https://github.com/kpobrien/touchstone.jl
microwave-engineering network-parameters s-parameters scattering-parameters touchstone touchstone-file
Last synced: 5 months ago
JSON representation
Save and load network parameters in the Touchstone file format
- Host: GitHub
- URL: https://github.com/kpobrien/touchstone.jl
- Owner: kpobrien
- License: mit
- Created: 2025-06-07T15:44:28.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-10T18:14:05.000Z (about 1 year ago)
- Last Synced: 2025-11-03T04:21:20.685Z (8 months ago)
- Topics: microwave-engineering, network-parameters, s-parameters, scattering-parameters, touchstone, touchstone-file
- Language: Julia
- Homepage:
- Size: 255 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Touchstone.jl
[](https://codecov.io/gh/kpobrien/Touchstone.jl)
[](https://github.com/kpobrien/Touchstone.jl/actions?query=workflow) [](https://kpobrien.github.io/Touchstone.jl/dev/reference/)
Save and load network parameters in the Touchstone® file format. Touchstone® is a registered trademark of Agilent Technologies, Inc.
# Installation:
To install the latest release of the package, install Julia using [Juliaup](https://github.com/JuliaLang/juliaup), start Julia, and enter the following command:
```
using Pkg
Pkg.add("Touchstone")
```
To install the development version, start Julia and enter the command:
```
using Pkg
Pkg.add(name="Touchstone",rev="main")
```
If you get errors when running the examples, please try installing the latest version of Julia and updating to the latest version of Touchstone.jl by running:
```
Pkg.update()
```
Then check that you are running the latest version of the package with:
```
Pkg.status()
```
# Examples:
## Load and save a Touchstone file
Version 1
```julia
julia> using Touchstone
julia> open("example1.s1p","w") do file
write(file,
"!Example 1:
!1-port S-parameter file, single frequency point
# MHz S MA R 50
!freq magS11 angS11
2.000 0.894 -12.136")
end
julia> example1 = touchstone_load("example1.s1p")
Touchstone.TouchstoneFile([2.0e6], ComplexF64[0.874020294860635 - 0.18794819544685323im;;;], "mhz", "s", "ma", 50.0, 1.0, 1, "12_21", 1, 0, [50.0], String[], "Full", Tuple{Char, Vector{Int64}}[], ["Example 1:", "1-port S-parameter file, single frequency point", "freq magS11 angS11"], [2.0, 0.894, -12.136], Float64[])
julia> touchstone_save("example1_saved.s1p", example1.f, example1.N, version=1.0)
```
Version 2
```julia
julia> using Touchstone
julia> open("example2.ts","w") do file
write(file,
"!Example 1:
!1-port S-parameter file, single frequency point
[Version] 2.0
# Hz S RI R 50.0
[Number of Ports] 1
[Number of Frequencies] 1
[Reference] 50.0
[Network Data]
! freq ReS11 ImS11
2.0e6 0.874020294860635 -0.18794819544685323
[End]")
end
julia> example2 = touchstone_load("example2.ts")
Touchstone.TouchstoneFile([2.0e6], ComplexF64[0.874020294860635 - 0.18794819544685323im;;;], "mhz", "s", "ma", 50.0, 1.0, 1, "12_21", 1, 0, [50.0], String[], "Full", Tuple{Char, Vector{Int64}}[], ["Example 1:", "1-port S-parameter file, single frequency point", "freq magS11 angS11"], [2.0, 0.894, -12.136], Float64[])
julia> touchstone_save("example2_saved.ts", example2.f, example2.N, version=2.0)
```
# Contributing:
We welcome contributions in the form of issues/bug reports or pull requests. This project uses the [MIT open source license](https://opensource.org/license/MIT). You retain the copyright to any code you contribute.
# References:
1. [Touchstone v1.1](http://www.ibis.org/connector/touchstone_spec11.pdf)
2. [Touchstone v2.0](http://www.ibis.org/touchstone_ver2.0/touchstone_ver2_0.pdf)
3. [Touchstone v2.1](https://ibis.org/touchstone_ver2.1/touchstone_ver2_1.pdf)