kicad2ems.core.touchstone

Touchstone files: v1 when all reference impedances are equal, v2.0 with
[Reference] otherwise. kicad2ems names the ports in a comment, `! ports: 1=P1,
2=P2d, ...` (port_names reads it back).
kicad2ems.core.touchstone.band_unit(freq)[source]
(Hz per unit, its name) to read a band's frequencies in: GHz from 1 GHz
up, MHz from 1 MHz, else kHz.
kicad2ems.core.touchstone.log_spaced(freq)[source]
The frequencies are evenly spaced on a log scale (a run's sweep = log),
not linearly.
kicad2ems.core.touchstone.port_names(path)[source]
The port names of the `! ports:` comment kicad2ems writes, or None
(another program's file, or none).
kicad2ems.core.touchstone.read_matrix(path)[source]
The file's matrices as written: (f Hz, X (nf, n, n), its parameter 'S',
'Y', 'Z', 'H' or 'G', the reference impedances (n,), v2: True for a v2
file). ValueError when the numbers end inside a frequency.
kicad2ems.core.touchstone.read_touchstone(path, with_zref=False)[source]
Touchstone v1 / v2 (RI / MA / DB; S, Y, Z, H or G) as S-parameters at the
file's own reference: f (Hz), S (nf, n, n), and with with_zref its reference
impedances (n,). Y and Z (and a two-port's H and G) are converted to S at
`R` (v1) or [Reference] (v2); a noise block (v1: a frequency not above the
last; v2: [Noise Data]) ends the network data; v2's [Number of Ports] and
[Matrix Format] Lower / Upper are honoured. (It had taken any file as S,
ignored R, read the port count from the extension only, and failed on a
noise block.)
kicad2ems.core.touchstone.to_s(X, param, zref, normalised=False)[source]
S at the reference impedances zref from S, Y, Z (any number of ports) or
a two-port's H or G: normalised to the reference (a v1 file's, to R) or in
ohms and siemens (v2).
kicad2ems.core.touchstone.write_touchstone(path, f, S, zref, comment='', names=None, program='kicad2ems')[source]
Touchstone v1 when all reference impedances are equal, v2.0 (per-port
[Reference]) otherwise. zref: one per port, or one for all.