Command line
antennaknobs has a command-line interface for batch work. The subcommands:
python -m antennaknobs {draw,sweep,optimize,pattern,compare_patterns,params,export,list}| Command | What it does |
|---|---|
list | List available designs (built-in and user) |
draw | Draw the antenna geometry |
sweep | Sweep a parameter or frequency |
pattern | Plot the far-field pattern |
compare_patterns | Overlay the patterns of several antennas / engines |
optimize | Optimize an antenna’s parameters |
params | Print a design’s knob values as paste-ready Python |
export | Export the design to a NEC-2 .nec card deck |
Naming a design
Section titled “Naming a design”Designs are addressed as family.name (the same names list prints):
python -m antennaknobs list # arrays.bowtiearray, beams.yagi, loops.delta_loop, ...Patterns
Section titled “Patterns”# Far-field pattern of a Yagi, solved with momwire's triangular basispython -m antennaknobs pattern --builder beams.yagi --engine momwire:triangularUseful pattern flags: --fn out.png (write to a file instead of the screen),
--ground free|pec|finite|finite:<eps_r>,<sigma>, --wireframe, and
--elevation_angle.
Choosing an engine
Section titled “Choosing an engine”The --engine flag selects the solver:
--engine momwire # momwire (default), default (triangular) basis--engine momwire:triangular # piecewise-linear (tent) basis--engine momwire:sinusoidal # NEC-2-style three-term basis--engine momwire:bspline # B-spline Galerkin basis--engine momwire:hmatrix # B-spline + hierarchical-matrix (ACA) acceleration--engine momwire:arrayblock # element-aware block solver for arrays--engine pynec # the NEC-2 reference backend (needs pynec-accel)momwire is the default so a plain install works without the optional
pynec-accel package. See The solver & accuracy for which
engine to reach for — including when the accelerated hmatrix / arrayblock
solvers pay off.
Comparing engines
Section titled “Comparing engines”Solve the same design two ways and overlay the patterns — the built-in cross-validation:
python -m antennaknobs compare_patterns \ --builders beams.moxon beams.moxon \ --engines pynec momwire:bspline --fn check.pngAlongside the overlaid plot, compare_patterns prints a metrics table — peak
gain (dBi), takeoff angle, front-to-back, and −3 dB azimuth/elevation
beamwidths — one row per antenna, so the comparison comes with numbers, not just
shapes:
design peak dBi takeoff° F/B dB az bw° el bw°----------------------------------------------------------------dipoles.invvee 1.93 1 0.0 85 89beams.yagi 8.89 1 8.2 60 42Copying params back to code
Section titled “Copying params back to code”After tuning — in the workbench or with optimize — turn the knob values back
into source you can paste into a design file. params prints a design’s (or a
name:variant’s) current values as a default_params = {...} block:
python -m antennaknobs params --builder beams.yagipython -m antennaknobs params --builder specialty.hentenna:z100 --wrap mappingproxyUseful flags: --name <var> (name the emitted block), --no-ui (knob values
only, drop the ui_params block), and --wrap mappingproxy (match the
catalog’s frozen-params style). An optimize run ends by printing the same
paste-ready block for its result, so the tuned values go straight into code.
Exporting to NEC
Section titled “Exporting to NEC”python -m antennaknobs export --builder beams.yagi --fn yagi.necThe deck is validated against nec2c, so designs round-trip into other NEC
tools.