kicad2ems.core.analyses

The analyses: tools that work on the same board as a run but are not
S-parameter solvers (the crosstalk between traces, a rail's DC drop and
impedance, a converter's near field, a circuit on the board's copper, the
board's temperature). Each is an Analysis subclass, listed in ANALYSES by its
module and class: the crosstalk (kicad2ems.core.si), the line parameters
(kicad2ems.core.rlgc), pcbqs's five (kicad2ems.pcbqs.analyses: with the
conducted emission), the Elmer and Palace tools (kicad2ems.fem.analyses).
A front end lists what the registry holds, builds each one's settings from its
options, starts it as the command it gives and shows what its result folder
holds.

    from kicad2ems.core.analyses import registry, analysis_of
    [a.label for a in registry().values()]
    analysis_of('out/board_pdn_3V3_20261111_120000')
        # ('pdn', False): whose result, and whether a preview

An analysis declares (class attributes)
  name, label, tool       'pdn', 'Power integrity', 'kicad2ems.pcbqs.pdn' (what
                          runs it, as lists show it); name is also its config
                          table [analysis.pdn] and the tag of its run folders
  about                   one line: what it gives
  order                   its place in lists and in a run of several: lowest
                          first, then by name
  previewed               True: it has a preview (the model and its mesh, no
                          solve)
  needs                   the analyses it cannot run without the results of (a
                          front end runs those first)
  uses                    the analyses whose latest result it can start from,
                          when there is one (the temperature from a circuit's
                          losses): not required, as `needs` are
  result, preview_result  the file a finished run (a preview) leaves in its
                          folder ('pdn.json'): owns' default
  paths                   the options whose values are paths: relative to the
                          config file they are read from
  page                    False: its settings and its results are all a front
                          end needs to show; True: it has an editor of its own
                          in the GUI (the circuit's schematic)
  provides                the questions it answers (kicad2ems.core.study:
                          QUESTIONS: 'dc', 'pdn', 'thermal' ...), from one run:
                          (); then it is one question of its own name
  engine                  the program's name as a list shows it beside a
                          question ('pcbqs', 'Elmer'); '': its label
  questions               study.Question objects of its own, for what kicad2ems
                          has no question for
  several                 what a study may hold several settings of it by, each
                          a run of its own, as a front end names them ('rail':
                          a board's rails; a config's [[analysis.<name>]]
                          tables, read_sets); '': one. A run's tag(values)
                          tells them apart
  several_keys            the options that differ from one of them to the next
                          (a rail's net, its voltage, its loads): a front end
                          shows them as a table, a row a run, the others shared
  fields                  the bool option that makes it write field dumps too
                          ('fields'); '': none
  env                     environment variables its command runs with (a thread
                          cap), or {}
  variants                its engines, when it is several to choose from beside
                          a question: ((suffix, label, {option: value}), ...),
                          each an engine of the name <name>_<suffix> (suffix
                          '': <name>) that runs it with those settings (the
                          crosstalk's line model alone, or with a full-wave
                          solver: crosstalk_gfdtd); the settings it fixes are
                          not in its options. (): one engine, itself
and implements
  check()                 (usable, one line): its version and origin, or what is
                          missing and how to get it
  options()               its settings, [Option] (kicad2ems.core.options), as
                          the solvers' are: its kind one of KINDS, 'bool' a
                          switch, 'list' repeatable; its level 'basic': one of
                          the few a run is set up with; its pick: what it names
                          on the board, for a front end to pick there
                          (kicad2ems.core.layout): 'net', 'part', or 'nets',
                          'parts' where it takes several (None: typed)
  tag(values)             a short name for a run of these settings (the rail,
                          the converter): its folder's
  command(values, board, out, preview=False, results=None)
                          the command line that runs it, [program, argument
                          ...], writing into folder `out`; values: {option key:
                          text, bool or list}; board: the study's board file or
                          None; results: {analysis: the folder of its latest
                          result on this board}, for an analysis that can start
                          from another's (the temperature from a circuit's
                          losses). ValueError says what is missing ("name the
                          rail")
  missing(values, board, results=None)
                          what a run still needs, [dict(text, key)]: the default
                          is what command() raises
  for_questions(values, asked)
                          its settings for a run that is asked only some of its
                          questions (the rail's drop without its impedance): the
                          values, changed where that matters
  answers(values)         the questions a run of these settings answers (one
                          started with none asked, from its settings alone);
                          the default is all it provides
  status(line)            the progress a line of its output states, or None
                          (most lines)
  finds, discover(values, board), choices(text) what the board can propose
                          settings for ('converters': a front end's "Find
                          converters"), the command that lists them ([program,
                          argument ...]) and its output as [(label, {option key:
                          value})] to pick from; finds '': none
  owns(folder, preview)   whether the folder holds its result (its preview): by
                          default, that its result file is there. An engine
                          whose file another engine also writes looks inside
                          it. Asked of a folder whose mark does not say how
                          its run ended (made before marks kept that)
  report(folder)          what a result holds, to read: dict(title, summary,
                          sections=[dict(title, text, table= dict(columns=[...],
                          rows=[[...]], formats=[...]), notes=[...])], notes,
                          images, footer), or None; a cell is a number or a
                          string, formats give a number's format per column
                          ('.3g'; None: '.4g'). It may say where a viewer
                          starts: show=dict(field, run) (the dump of that field,
                          and run, with the largest values) and mesh (the plan's
                          mesh)
  curves(folder)          what a result holds, to plot: [dict(title, xlabel,
                          ylabel, logx, logy, info, curves= [dict(name, x, y,
                          role='data' | 'reference' | 'limit', unit)])], or []
  figures(folder)         the figures of its answer by name, [dict(name, value,
                          unit)], for a table of engines against figures: two
                          engines that answer one question give the same
                          quantity the same name (the question says which:
                          study.Question.figures), and may add their own
  suggest(folder)         settings a result proposes for other analyses:
                          [dict(to, label, values, note, need)] (a converter's
                          input rail, for the power-integrity analysis; the
                          converter as a model, for the circuit's), or []; need:
                          the options it could not give a value, to set before a
                          run. A front end offers each on the result, and asks
                          the other's questions with it
  examples()              the examples it ships: [dict(name, config, group,
                          title, files)] (kicad2ems.examples)

The fields of a result (the maps a Viewer turns and cuts) need nothing here: an
analysis writes them as field dumps (kicad2ems.core.fields.dumps: Dump,
write_info, write_npz) under <out>/<name>/exc_<what>/ with its board as
<out>/<name>_board.json, and every front end that shows a run's dumps shows
them.
class kicad2ems.core.analyses.Analysis[source]
An analysis. A subclass sets the declarations (class attributes:
the module docstring lists them) and overrides what it does differently; a
front end calls check, options and examples when it starts, tag and command
to run it, status while it runs, and report, curves and suggest on a folder
that holds its result.
answers(values)[source]
The questions a run of these settings answers, of those it provides
(a run started with no question asked: its mark's); default all.
check()[source]
(usable, one line): its version and origin, or what is missing and
how to get it.
check_with(sets)[source]
(usable, one line) of one of its variants (the settings `sets`
fixes): its own check.
choices(text)[source]
discover's output as [(label, {option key: value})].
command(values, board, out, preview=False, results=None)[source]
[program, argument ...] that runs it into folder `out`; ValueError:
what is missing.
curves(folder)[source]
What the result in `folder` holds, to plot: a list of curve sets.
discover(values, board)[source]
A command that proposes settings from the board, or None: it has
none.
examples()[source]
The examples it ships: [dict(name, config, group, title, files)].
figures(folder)[source]
The figures of the answer in `folder`, by name: [dict(name, value,
unit)], or [].
for_questions(values, asked)[source]
The settings for a run asked only the questions `asked` of those it
provides.
missing(values, board, results=None)[source]
What a run of these settings still needs, before it is started:
[dict(text, key)], key the option it is set by (None: not one option). A
front end lists them and does not start the run. The default is
what command() raises; an analysis that can tell more from the board (a
load with no pad on ground) adds it here, cheaply: it is asked on every
change. results: as command's, and None for an analysis that is asked
with this one and has no result yet: what one of `uses` will give is not
missing.
options()[source]
Its settings, [Option].
owns(folder, preview=False)[source]
Whether the folder holds its result (preview: its preview).
report(folder)[source]
What the result in `folder` holds, to read (the module docstring has
the form), or None.
status(line)[source]
The progress a line of its output states, or None.
suggest(folder)[source]
Settings the result in `folder` proposes for other analyses.
tag(values)[source]
A short name for a run of these settings (its folder's).
kicad2ems.core.analyses.analysis_of(folder)[source]
(name, preview) of the analysis whose finished result (or preview) the
folder holds, or None: what its mark says (runs.info: the engine that made
it, a variant's being the analysis it runs, and how it ended).
kicad2ems.core.analyses.check_lines()[source]
--check's lines about the analyses: each one's check.
kicad2ems.core.analyses.get(name)[source]
The analysis of a name.
kicad2ems.core.analyses.read_config(path)[source]
The analyses' tables of a TOML config, {name: {option key: value}} (an
analysis given several, read_sets: its first):

    [analysis.circuit]
    model = "buck.json"           # its options, by key; a path
                                  # (Analysis.paths) relative to the file
kicad2ems.core.analyses.read_sets(path)[source]
Every table of each analysis of a config: {name: [{option key: value},
...]}, in the order written. An analysis may be given several, each a run
of its own in a study (a board's rails, one after the other), as an array
of tables:

    [[analysis.pdn]]
    rail = "+5V"
    volts = 5
    [[analysis.pdn]]
    rail = "+3V3"
    volts = 3.3

One table ([analysis.pdn]) is a list of one. Its options by key; a path
(Analysis.paths) relative to the file. A table of an analysis the registry
does not list is kept as it is (so a front end can write it back); its
paths are not known, and stay as written.
kicad2ems.core.analyses.registry()[source]
{name: Analysis}: every analysis of ANALYSES, by its `order` (then its
name).