kicad2ems.gui.traces

S-parameter traces for the interactive plots (no Qt here: testable without a
display).

    traces = load_traces(files, compare=None)  # the run's Touchstone files
                                               # (openEMS, mom25d, line model,
                                               # compare)
    x, y = transform('dB', tr)                 # what a plot kind shows of a
                                               # trace
    x, y = difference('Δ|S| (dB)', tr, ref)    # a trace against the same S of
                                               # another solver
    value_at(kind, tr, f)                      # the value at a frequency
                                               # (cursor, markers)
    export_csv(path, traces, kind)
class kicad2ems.gui.traces.Trace(source, i, j, f, s, names=None, path=None)[source]
S(i+1, j+1) of one result file.
property param[source]
S21; for a file with differential pairs (P1d, P1c: kicad2ems's
mixed-mode ports) the modes and the pairs' numbers, Sdd21, Scd21, and s
for a single-ended port among them (Sds31).
property title[source]
S21 (P2 <- P1) with the port names, when the file has them.
kicad2ems.gui.traces.classify(path)[source]
The source of a Touchstone file of a run, from its name
(<name>_<solver>.sNp).
kicad2ems.gui.traces.counterpart(traces, tr, source)[source]
The trace of `source` with tr's S (the same i, j), or None.
kicad2ems.gui.traces.default_visible(tr)[source]
Shown at first: the first port's column (S11, S21, S31, ...: what a run
driving P1 computes).
kicad2ems.gui.traces.difference(kind, tr, ref)[source]
(x, y) of trace tr against ref (the same S of another solver), on tr's
frequencies (GHz): Δ|S| (dB), the difference of their magnitudes in dB, or
|ΔS| (dB), the magnitude of the complex difference (the error vector) in dB.
NaN outside ref's band.
kicad2ems.gui.traces.export_csv(path, trs, kind, reflections=())[source]
The traces as a kind shows them, plus Re / Im of the Smith chart's
reflections, on the frequency grid of the first trace (the others
interpolated; NaN outside their band).
kicad2ems.gui.traces.load_traces(files, compare=None)[source]
Traces of every Touchstone file in (label, path) files (a run's file
list), plus a compare file.
kicad2ems.gui.traces.modes(names)[source]
[(mode, port number)] per port of a file with differential pairs, or
None: a pair's ports are <name>d and <name>c (its differential and common
modes, as kicad2ems writes them), 'd' and 'c' at the pair's number; any
other port is single-ended, 's'. Ports are numbered in order of first
appearance, a pair once.
kicad2ems.gui.traces.nearest(trs, x, y)[source]
The trace and frequency index nearest to a point of the Smith chart.
kicad2ems.gui.traces.pattern_xy(angles_deg, gain, lo_db, range_db)[source]
A far-field cut on a polar plot: angle 0 at the top, clockwise; the
radius 0 at lo_db, 1 at lo_db + range_db. gain linear. Returns (x, y).
kicad2ems.gui.traces.polar_grid(rings=(0.25, 0.5, 0.75, 1.0), spokes=12, n=181)[source]
Polylines (x, y) of a polar grid: circles of the given radii and `spokes`
radial lines out to the largest.
kicad2ems.gui.traces.smith_grid(n=181)[source]
Polylines (x, y) of a Smith chart grid: constant-resistance circles and
constant-reactance arcs.
kicad2ems.gui.traces.transform(kind, tr)[source]
(x, y) a plot kind shows of a trace: frequency (GHz) and value, or Re /
Im for the Smith chart.
kicad2ems.gui.traces.value_at(kind, tr, f)[source]
The value of a trace at frequency f (Hz), interpolated; NaN outside its
band. Smith: complex S.