Public Documentation

Documentation for TouchstoneParser.jl public interface.

Contents

Index

Public Interface

TouchstoneParser.write_touchstoneFunction
write_touchstone(filename, F, A, z0; kwargs...)

Write a Touchstone file named “filename” using the format specified in the name or in the keyword version.

Arguments

  • filename: name of the file.
  • F: Vector of frequencies.
  • A: Data to write on the Touchstone. Can be a Vector{Matrix{ComplexF64}} or a Array{ComplexF64, 3}
  • z0: Number of Vector of numbers of length equal to the number of ports.

Keywords

  • version: Default to "". Must be a string like "1.0", "1.1", "2.0" or "2.1".
  • default_comments: Default to true. Write the comment ! Touchstone file created with TouchstoneParser.jl
  • default_date: Default to true. Add the Date to the file as a comment.
  • funit: Default to :GHz. Must be a Symbol.
  • ptype: Default to :S. Must be a Symbol.
  • matrixformat: Default to :FULL. Can also be :UPPER or :LOWER.
  • twoportorder: Default to "12_21. The other option is "21_12".
  • noise_f: Default to nothing. Should be a Vector for each noise data.
  • noise_data: Default to nothing. Should be the noise data.
  • mixedmodeorder: Default to "".
source
TouchstoneParser.TSParserType
TSParser

Struct containing the data of the parsed Touchstone file.

File name

filename::String

Settings

version::String
n_ports::Int

Option line field

type::Symbol
format::Symbol
resistance::Vector{Float64}
units::Symbol

Keyword Options

n_freqs::Int
n_noisefreqs::Int
references::Vector{Float64}
twoport_order::String
mixed_mode_order::String
matrixformat::Symbol
info::Vector{String}

Data

frequency::Vector{Float64}
data::Array{ComplexF64, 3}
noise_frequency::Vector{Float64}
noise_data::Vector{NoiseData}
z0::Matrix{ComplexF64}

HFSS version: This section uses # https://github.com/scikit-rf/scikit-rf/blob/master/skrf/io/ts.py as reference.

hfss_data_type::Symbol
hfss_gamma::Vector{ComplexF64}
hfss_impedance::Vector{ComplexF64}
gamma::Matrix{ComplexF64}

Comments

comments::Vector{Tuple{Int,String}}

debug and utils

port_names::Vector{String}
pstate::TouchstoneParser.ParserState
source
TouchstoneParser.simvariablesFunction
simvariables(ts::TSParser) -> Dict{String,String}

Parse simulation variables from the comment section of a Touchstone file.

This function is able to extract parameter definitions from the comment styles used by softwares:

  • Sonnet style:
"""
!< p1 = 1.00
!< p2 = 2.00
!< p3 = 3
!< p4 = 4.0 um
!< ...
"""
  • HFSS style:
"""
! p1 = 1units
! p2 = 2.0units
! p3 = 3.0units
! ...
"""
  • CST style:
"""
! Parameters = {p1 = 1.0; p2 = 2.0, p3 = 3.0, ...}
"""

Arguments

  • ts::TSParser

Notes

  • For HFSS and Sonnet variables with units. Because of this, the function returns a Dict{String, String}.

Examples

using TouchstoneParser: read_touchstone

ts = TouchstoneParser.read_touchstone(path)
v = simvariables(ts)
source
TouchstoneParser.s2hFunction
s2h(H)

Converts hybrid S parameters to impedance H parameters.

Arguments

  • H::Matrix{ComplexF64}: 2×2 S parameter matrix
  • Z0::Number or Vector: Reference characteristic impedance(s).

Returns

  • Matrix{ComplexF64}: 2×2 impedance parameter matrix
source
TouchstoneParser.s2gFunction
s2g(H)

Converts S parameters to G parameters.

Arguments

  • H::Matrix{Complex}: 2×2 hybrid parameter matrix.
  • Z0::Number or Vector: Reference characteristic impedance(s).

Returns

  • Matrix{ComplexF64}: 2×2 S parameter matrix
source
TouchstoneParser.h2sFunction
s2h(H)

Converts hybrid H parameters to impedance S parameters.

Arguments

  • H::Matrix{ComplexF64}: 2×2 hybrid parameter matrix
  • Z0::Number or Vector: Reference characteristic impedance(s).

Returns

  • Matrix{ComplexF64}: 2×2 matrix
source
TouchstoneParser.g2sFunction
s2h(H)

Converts hybrid G parameters to impedance S parameters.

Arguments

  • H::Matrix{ComplexF64}: 2×2 hybrid parameter matrix
  • Z0::Number or Vector: Reference characteristic impedance(s).

Returns

  • Matrix{ComplexF64}: 2×2 S parameter matrix
source
TouchstoneParser.s2yFunction
s2y(S, Z0)

Converts scattering parameters S to admittance parameters Y in a numerically stable way.

Arguments

  • S::Matrix{Complex}: n×n scattering parameter matrix.
  • Z0::Number or Vector: Reference characteristic impedance(s).

Formula

$Y = Z_0^{-1/2} ((I + S) \ (I - S)) Z_0^{-1/2}$

source
TouchstoneParser.y2sFunction
y2s(Y, Z0)

Converts admittance parameters Y to scattering parameters S in a numerically stable way.

Arguments

  • Y::Matrix{Complex}: n×n admittance parameter matrix.
  • Z0::Number or Vector: Reference characteristic impedance(s).

Formula

$S = \left( I + \sqrt{Z_0} Y \sqrt{Z_0} \right)^{-1} \left( I - \sqrt{Z_0} Y \sqrt{Z_0} \right)$

source
TouchstoneParser.s2zFunction
s2z(S, Z0)

Converts scattering parameters S to impedance parameters Z in a numerically stable way.

Arguments

  • S::Matrix{Complex}: n×n scattering parameter matrix.
  • Z0::Number or Vector: Reference characteristic impedance(s).

Formula

$Z = Z_0^{1/2} ((I - S) \ (I + S)) Z_0^{1/2}$

source
TouchstoneParser.z2sFunction
z2s(Z, Z0)

Converts impedance parameters Z to scattering parameters S.

Arguments

  • Z::Matrix{Complex}: n×n impedance parameter matrix.
  • Z0::Number or Vector: Reference characteristic impedance(s).

Formula

$S = \left( Z Z_0^{-1/2} + Z_0^{1/2} \right)^{-1} \left( Z Z_0^{-1/2} - Z_0^{1/2} \right)$

source
TouchstoneParser.y2s_alternativeFunction
y2s_alternative(Y, Z0)

Alternative version of y_to_s using diagonal scaling factors.

Arguments

  • Y::Matrix{Complex}: n×n admittance parameter matrix.
  • Z0::Number or Vector: Reference characteristic impedance(s).

Formula

$S = \left( Z_0^{-1/2} + Y Z_0^{1/2} \right)^{-1} \left( Z_0^{-1/2} - Y Z_0^{1/2} \right)$

source
TouchstoneParser.s2z_alternativeFunction
s2z_alternative(S, Z0)

Conversion from S to Z.

Arguments

  • S::Matrix{Complex}: n×n scattering parameter matrix.
  • Z0::Number or Vector: Reference characteristic impedance(s).

Formula

$Z = Z_0^{1/2} (I + S) / (I - S) Z_0^{1/2}$

Better stability than the direct version:

$Z = Z_0^{1/2} (I + S) * inv(I - S) Z_0^{1/2}$

source