kicad2ems.core.overlay¶
The line model as an overlay for the GUI's viewer (no Qt here: testable without
a display). A preview or a run writes <name>_lines.json (LineModel.drawing):
every section's points (model mm, y up), its layer's height and its Z0, eeff,
length and delay; each path as the ids of its sections.
d = load_lines(out_dir) # the newest <name>_lines.json of a
# folder, or None
rgb = z0_colour(z0, ref, span) # blue below the port impedance, red
# above
i = nearest(d['elements'], x, y, tol) # the section under the mouse (model
# mm), or None
describe(e) # one line: label, Z0, eeff, length,
# delay
- kicad2ems.core.overlay.against_target(e, ref=50.0)[source]¶
(value, target ohm, what the value is) a section is judged by: against a differential target, Zdiff of the coupled legs (2 Z0 where they run apart); otherwise Z0, against its single-ended target or `ref`.
- kicad2ems.core.overlay.describe(e)[source]¶
One line about a section: what it is, Z0, eeff, length and delay.
- kicad2ems.core.overlay.deviation(e, ref=50.0)[source]¶
(value - target) / target of a section, or None (no impedance).
- kicad2ems.core.overlay.distance(e, x, y)[source]¶
Distance (mm) from a point to a section's centre line.
- kicad2ems.core.overlay.drawn(e)[source]¶
Is a section drawn (and picked)? Not a coupling, nor a trace of no length: a stub that lies wholly inside a pad (routers leave them, 0.01 mm long) is the pad's, and drawn over it, it hid it.
- kicad2ems.core.overlay.layers(d)[source]¶
The copper layers the sections are on, top first (by height).
- kicad2ems.core.overlay.load_lines(out_dir)[source]¶
The newest <name>_lines.json of a results folder (a preview writes it), or None.
- kicad2ems.core.overlay.nearest(elements, x, y, tol, layer=None)[source]¶
Id of the section whose centre line is nearest to (x, y), within tol mm plus its half width; None if none is. layer: only that layer's sections.
- kicad2ems.core.overlay.plan_segments(path, box, z)[source]¶
A solver's mesh (meshes.py file) seen from above on the copper plane at height z: its line segments (2 k, 2) in that plane, model mm. box: the board's (xmin, ymin, xmax, ymax, z0, z1).
- kicad2ems.core.overlay.reference(d)[source]¶
The impedance the colours are centred on: the ports' (usually 50 ohm).
- kicad2ems.core.overlay.relief(z0, lo, hi, floor=0.25)[source]¶
A section's height in the 3D view as a fraction of the full relief: `floor` at the lowest Z0 of the model (lo), 1 at the highest (hi), so a step in Z0 is a step in height; `floor` for a section without a Z0 (a part).
- kicad2ems.core.overlay.section_colour(e, d, ref, half)[source]¶
A section's colour: by its deviation from its target in a map with targets (d['relative']; half: a fraction), else by its Z0 against ref (half: ohm).
- kicad2ems.core.overlay.section_polygon(e)[source]¶
A section's copper as a shapely geometry (model mm): a pad its own outline; otherwise its centre line widened by its width (flat ends, mitred corners); a via or a pad without length a disc; a part without width a thin strip.
- kicad2ems.core.overlay.source_note(e)[source]¶
Where a section's Z0 came from, as text after the value: ' (formula)', ' (field solver, the board's cut; formula 48.2 Ω)'; '' for one that doesn't say.
- kicad2ems.core.overlay.span(d, ref=None)[source]¶
Half the colour range in ohm: the largest departure of a section from `ref`, at least 10 % of it. With d['robust'] (a whole board's map, where a few power shapes and big pads sit far off): the 95th percentile of the traces' departures, so that the traces use the colours (the outliers saturate).