Snippets
A snippet is a small file with a piece of a report: an equation, a table, a listing, a figure reference. The instruction file writes it when it runs, and the report includes it, so the report follows the design without copying. and compose the formatter call that writes one snippet and append it to the instruction file. The dialog is the same for both formats; it offers the methods the chosen formatter has, with the arguments its signature takes.
The Name is the file name of the snippet without extension and the
Python variable that holds it. LaTeX snippets are written to the project
tex/SLiCAPdata/ folder, RST snippets to sphinx/SLiCAPdata/. A LaTeX
document includes a snippet with \input{SLiCAPdata/<name>}, a Sphinx
document with .. include:: SLiCAPdata/<name>.rst.
The dialog creates four kinds of snippet.
Text output
A listing that SLiCAP prints as text: the poles and zeros of a result, the servo bandwidth, the phase margin, a state-space listing, or free text. The dialog emits two lines:
txt = sl.TXTformatter()
poles_txt = txt.pz(PZ1).save("poles")
poles = ltx.file(sl.ini.txt_path + "poles.txt").save("poles")
The first line writes the listing to txt/poles.txt with the text
formatter, which is the same for every output format. The second line wraps
that text file into a snippet of the chosen format, poles.tex here, in a
verbatim environment. Include the snippet as any other.
Snippet from a file
Any text file, or a netlist, included verbatim: the file name, and for LaTeX the listing language, for RST the first line number.
Snippet from an object
A formatter method applied to an object the instruction file defines. The
Result list offers the result variables of the file that fit the method:
a pole-zero table takes a result of doPoles(), doZeros() or
doPZ(), a noise table a result of doNoise(). The Circuit list
offers the circuit objects the file defines for the methods that describe a
circuit: the element data, the parameter definitions and the undefined
parameters. Both lists are picks, not text fields: a snippet is composed only
for an object that exists in the file. Equations and expressions take the
expression as text, seeded with the Laplace results of the file.
Specification table
A table of the specifications of one type in a specification CSV of the
project. The dialog loads the CSV once, into SPECS_<file stem>, and
emits the table call for the chosen type.