Skip to content

kpobrien/Touchstone.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Touchstone.jl

Code coverage Build Status Dev docs

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, 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> 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> 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. You retain the copyright to any code you contribute.

References:

  1. Touchstone v1.1
  2. Touchstone v2.0
  3. Touchstone v2.1

About

Save and load network parameters in the Touchstone file format

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages