kicad2ems.dfsynth.calibrate

Band-edge measurement, the targets of a spec, and the calibration of a design's
kf / kb on its microstrip line model.

The edges are measured at -3 dB (on a lossy response: 3 dB below the pass-band
peak), so the targets are the -3 dB edges of the ideal response: for a Chebyshev
prototype those lie outside the ripple band edge, at Omega_3 = cosh(acosh(1 /
eps) / n).
kicad2ems.dfsynth.calibrate.band(spec)[source]
(kind, f0, fbw) as realised: a high-pass is a wide stub band-pass.
kicad2ems.dfsynth.calibrate.calibrate(spec, sub, kf=1.0, kb=1.0, iters=12, tol=0.0001, log=None, refine_lp=True, refine_time=10.0)[source]
Iterate kf / kb until the lossless line model's -3 dB edges match the
targets; then, for the low-pass, band-stop and interdigital designs, refine
the trims (for at most refine_time seconds).
kicad2ems.dfsynth.calibrate.edges(spec, f, s21db, relative=False)[source]
Measured -3 dB edges ({'fc'} or {'f1', 'f2'}) of a response; relative: 3
dB below the pass-band peak instead of -3 dB. Missing edges are None.
kicad2ems.dfsynth.calibrate.errors(spec, meas)[source]
(centre ratio, bandwidth ratio) measured / target (bandwidth None for a
low-pass).
kicad2ems.dfsynth.calibrate.passband_rl(design, f, sub=None)[source]
Worst return loss (dB) of the lossless line model outside the -3 dB edges
of the spec's stop band, with a tenth of the band's width as a guard
(band-stop).
kicad2ems.dfsynth.calibrate.refine(spec, sub, kf, kb=1.0, log=None, iters=400, seconds=10.0)[source]
Low-pass only: trim the sections' electrical lengths (symmetrically) so
the lossless line model follows the prototype's response up to 1.3 x the
cut-off: the distributed sections' departures from lumped L and C (the
pass-band ripple growing, the edge softening) are taken out. Sets
spec.trim.
kicad2ems.dfsynth.calibrate.refine_bandstop(spec, sub, kf, kb, log=None, iters=3000, seconds=10.0)[source]
Band-stop only: the connecting lines are unit elements, not just spacers.
Sets the stub and line impedances (symmetric factors on the synthesis,
within what the substrate can make) so the lossless line model follows the
Chebyshev response in Richards' variable, |S21|^2 = 1 / (1 + eps^2 T_n^2(tan
theta / tan theta1)): the narrow-band synthesis's pass-band mismatch, which
grows with the bandwidth, is taken out. Kept only if the pass-band return
loss improves. Sets spec.trim.
kicad2ems.dfsynth.calibrate.refine_coupled(spec, sub, kf, kb, log=None, iters=3000, seconds=10.0)[source]
Coupled-resonator band-pass (interdigital): the closed-form couplings and
taps assume synchronous, nearest-neighbour resonators; on the multiconductor
model the end rods (one neighbour, a tap) and the inner ones (two
neighbours, and the next-but-one) are neither. Sets the gaps, the taps and
each rod's length (symmetric factors) for the prototype's match over the
band (|S11| no higher than its ripple allows) with the band edges on target.
Not a fit to the whole prototype response: the couplings past the neighbours
give the skirts a shape no trim takes out (slower below the band, a
transmission zero above it). Kept only if the pass-band return loss
improves.
kicad2ems.dfsynth.calibrate.refine_gaps(spec, sub, kf, kb, log=None, seconds=10.0)[source]
Edge-coupled and hairpin band-pass (R-E18: only their band edges had been
calibrated; the hairpin's match was 5.5 dB on its own lossless model): the n
+ 1 coupling gaps and a hairpin's n bars (symmetric factors, spec.trim) for
the prototype's match over the band, the edges kept on target (calibrate
runs again after). A least-squares fit, stopped at `seconds` with the best
so far. Kept only if the pass-band return loss improves.
kicad2ems.dfsynth.calibrate.space_map(target, current, sub, kf, kb, f, s21, s11, log=None)[source]
One aggressive space-mapping step for a design with free trims
(interdigital): the trims (and a reference-plane shift, the solver's port
planes against the model's) with which the zero-thickness line model
reproduces the complex S21 and S11 of a field-solver run of `current` are
extracted; the trims of `current` then move by what separates them from
those of `target` (the design the line model put on the spec), so the next
board behaves as `target` does on the model. Fitting the complex response
(not |S|) tells a gap's error from a tap's, which magnitudes alone leave
free to trade. Returns the new spec, or None if the fit does not reproduce
the run.
kicad2ems.dfsynth.calibrate.targets(spec)[source]
Target -3 dB edges: {'fc': ...} (low-pass) or {'f1': ..., 'f2': ...}.