kicad2ems.core.config¶
Run settings: one typed Settings object, built once from the defaults, a TOML
file and the command line (in that order: the command line wins). Everything
downstream (pipeline, solvers, report, the GUI) reads Settings, never raw
strings.
The settings are declared once, as options (options.Option): CORE here, the
settings of every run, and each solver's own (solvers/: openEMS's mesh and time
stepping, mom25d's cells ...). Settings has a field for each; the command line,
the config keys and the GUI fields are made from the same lists.
A config's keys are the command-line options (dashes or underscores) at the top
level; a solver's options may also sit under its table, [solver.<name>], by
their short names (mom25d's mom_dmax is dmax there). Lists may be TOML arrays or
comma-separated strings:
board = "board.kicad_pcb" # then: kicad2ems board.toml
pos = "board-top.pos"
nets = ["RF", "GND"]
fmin = 1.0
fmax = 6.0
mask = false
solvers = ["openems", "mom25d"] # default: auto (Settings.solver_plan)
[solver.openems]
excite = ["P1"]
air = 5.0
[solver.mom25d]
dmax = 0.4
The older forms, an [openems] table (read like the top level, with a note) and
no_mask, are read where the settings are found: setting_keys.
Paths in the file (board, pos, compare, out, events, qucsator) are relative to
the file's folder; a path that only exists relative to the working directory
(older configs written for the repository root) is still used, with a note.
Unknown keys are reported (with the option they are probably a typo of) and
ignored.
- exception kicad2ems.core.config.ConfigError[source]¶
A setting that cannot be used (the message names it).
- class kicad2ems.core.config.Settings(solvers: list = None, mom: bool = False, fast: str = None, lines_field: str = 'auto', mode: str = 'sparams', drive: list = <factory>, grid: str = None, steer: list = None, aim: list = None, taper: str = None, board: str = None, pos: str = None, nets: list = None, region: object = None, ports: list = <factory>, shapes: str = None, cut_ports: bool = False, ground: str = None, fill_voids: str = 'off', mask: bool = False, parts: str = 'auto', part_ports: list = <factory>, vary: list = <factory>, part_value: list = <factory>, part_file: list = <factory>, edge_walls: list = <factory>, edge_keepout: float = 0.5, sigma: float = None, rough: float = None, finish: str = 'auto', fmin: float = 0.5, fmax: float = 10.0, points: int = 401, sweep: str = 'linear', compare: str = None, preview: bool = False, no_report: bool = False, lean: bool = False, deembed: list = <factory>, deembed_file: list = <factory>, no_reuse: bool = False, solver_jobs: int = 1, passive: bool = False, dump_animate: str = None, events: str = None, out: str = None, res: float = 20.0, fine: float = None, air: str = None, ratio: float = 1.4, mesh_zone: str = 'on', nz: int = 4, nz_mask: int = 1, z_sheet: float = 1.0, curve_res: float = 6.0, curves: str = 'extremes', vias: str = 'auto', via_snap: float = 0.2, thickness: str = 'off', converge: list = None, converge_tol: tuple = (0.1, 2.0), bc: str = 'auto', end_db: float = -40.0, end_on: str = 'ports', max_steps: int = 1000000, diel: str = 'fixed', diel_fref: float = 1.0, port_kind: str = 'lumped', excite: list = None, threads: int = 0, jobs: int = 1, openems_output: bool = False, ff_freq: list = <factory>, ff_step: float = 2.0, dump: list = <factory>, dump_port: list = None, mom_dmax: float = 0.3, mom_port: str = 'auto', mom_stack: str = 'auto', mom_quads: str = 'off', mom_quad_tol: float = 35.0, mom_cells: float = 30.0, mom_coarsen: float = 2.0, mom_edges: str = 'fine', mom_excite: list = <factory>, mom_zone: str = 'off', mom_planes: str = 'pec', mom_stitching_pads: str = 'drop', mom_thickness: str = 'sides', mom_stitching_vias: str = 'auto', mom_solves: int = 60, mom_converge: list = <factory>, mom_dump: list = <factory>, mom_near: list = <factory>, mom_near_volume: list = <factory>, gfdtd_backend: str = 'auto', gfdtd_gpus: str = '', gfdtd_timestep: str = 'auto', palace_order: int = 2, palace_tol: float = 0.001, palace_feature: float = 4.0, palace_wave: float = 8.0, palace_margin: float = None, palace_np: int = 0, palace_loss: bool = False, palace_amr: int = 0, palace_amr_tol: float = 0.01, palace_amr_max: int = 0, palace_abc: int = 1, palace_box: str = 'absorbing', palace_modes: int = 0, palace_fine_ground: bool = False, qs_dmax: float = None, qs_fine: float = None, qs_capacitance: str = 'auto', qs_thickness: bool = False, qucsator: str = None, notes: list = <factory>)¶
Every option of a run, typed. Frequencies in GHz, lengths in mm (as on the command line).
- kicad2ems.core.config.all_options(reg=None)[source]¶
CORE, then every solver's options: [(solver name or None, Option)]; a setting solvers share, under the first.
- kicad2ems.core.config.build_settings(cli=None, config=None)[source]¶
Settings from the defaults, a TOML file (path or None) and command-line values (a dict holding only the options that were typed). Raises ConfigError for anything that cannot be used.
- kicad2ems.core.config.default_out(board)[source]¶
The output folder when none is given: out next to the board file, or the folder of the <name>_board.json of an earlier run (whose folder is an output folder already).
- kicad2ems.core.config.read_toml(path)[source]¶
(values {option: raw value}, ignored keys, notes) of a TOML config; paths made absolute or working-directory relative (see resolve_path).
- kicad2ems.core.config.resolve_path(value, base, key, notes)[source]¶
A path from the TOML file at `base`: relative to base, or - if only that exists - to the working directory (configs written for the repository root), with a note.
- kicad2ems.core.config.setting_keys(cfg, ignored=None, notes=None)[source]¶
(table, key as written, option key, value) of each setting a config's tables hold: the top level's, [solver.<name>]'s (a solver's options by short name or key), [vary] (key None: the table) and, in the older forms, an [openems] table's (read like the top level) and no_mask (mask = not it). How a config is read, and how the GUI finds what to edit. ignored, notes (lists): the keys that are not settings, and what was read in an older form, added to them.