zero.liso.output module¶
LISO output file parser
-
class
zero.liso.output.
LisoOutputParser
(*args, **kwargs)[source]¶ Bases:
zero.liso.base.LisoParser
LISO output file parser
This implements a lexer to identify appropriate definitions in a LISO output file, and a parser to build a solution and circuit from what is found.
The parsing of the LISO output file is more complicated than that for the input file. The data is first parsed. For this, the lexer is initially in its default state and it simply looks for numbers matching a certain pattern (DATUM tokens). In the parser, these are combined together in a list until a NEWLINE token is identified, at which point the list representing a line of the data file is added to the list representing the whole data set.
With the data parsed, the next step is to parse the circuit definition which is included in the output file. This is not only necessary in order to simulate the circuit again, natively, but also for understanding the meaning of the data columns identified in the last step. The parsing of this metadata is handled by identifying in turn the sections in the commented block below the data that correspond to the various parts of the circuit definition. As these have different formats, the lexer enters into different states once it identifies each section, with special lexing rules. The identified tokens are passed to the parser, which pieces them together in set patterns. Once a particular line is parsed (or lines, in the case of op-amps), the particular combination of tokens used to create the line is used to create the circuit.
-
OPAMP_IGNORE_STRINGS
= ['*OVR*', 's***DEFAULT', '***DEFAULT']¶
-
property
n_capacitors
¶
-
property
n_current_outputs
¶
-
property
n_inductors
¶
-
property
n_mutual_inductances
¶
-
property
n_nodes
¶
-
property
n_noise
¶
-
property
n_noise_sources
¶
-
property
n_noisy
¶
-
property
n_opamps
¶
-
property
n_resistors
¶
-
property
n_voltage_outputs
¶
-
p_metadata_line
(p)[source]¶ metadata_line : resistor | capacitor | inductor | mutual_inductance | opamp | node | voltage_output_node | current_output_component | noise_outputs | noisy_sources
-
p_opamp
(p)[source]¶ opamp : OPAMP_CHUNK_1 NEWLINE OPAMP_CHUNK_2 NEWLINE OPAMP_CHUNK_3 NEWLINE OPAMP_CHUNK_4 NEWLINE | OPAMP_CHUNK_1 NEWLINE OPAMP_CHUNK_2 NEWLINE OPAMP_CHUNK_3 NEWLINE
-
property
source_sum_index
¶
-
states
= (('resistors', 'inclusive'), ('capacitors', 'inclusive'), ('inductors', 'inclusive'), ('mutualinductances', 'inclusive'), ('opamps', 'inclusive'), ('nodes', 'inclusive'), ('voltageoutputnodes', 'inclusive'), ('currentoutputcomponents', 'inclusive'), ('noisevoltageoutputs', 'inclusive'), ('noisecurrentoutputs', 'inclusive'), ('noisysources', 'inclusive'), ('gnuplotoptions', 'inclusive'))¶
-
t_ANY_currentinput
(t)[source]¶ #Currentsinputsintosnodes(?P<node>.+),simpedances(?P<impedance>.+)Ohm
-
t_ANY_floatingvoltageinput
(t)[source]¶ #Floatingsvoltagesinputsbetweensnodess(?P<node_p>.+)sands(?P<node_n>.+),simpedances(?P<impedance>.+)Ohm
-
t_ANY_noisysources
(t)[source]¶ #Noisesisscomputeds(?P<ntype>atsnode|throughscomponent)s(?:.+:)?(?P<element>.+)sfors(nnoise=(?P<nnoise>d+),snnoisy=(?P<nnoisy>d+))s:
-
t_DATUM
= '-?(inf|(\\d+\\.\\d*|\\d*\\.\\d+|\\d+)([eE]-?\\d*\\.?\\d*)?)'¶
-
t_ignore
= ' \t'¶
-
t_ignore_COMMENT
= '\\#.*'¶
-
tokens
= ['DATUM', 'NEWLINE', 'RESISTOR', 'CAPACITOR', 'INDUCTOR', 'MUTUAL_INDUCTANCE', 'OPAMP_CHUNK_1', 'OPAMP_CHUNK_2', 'OPAMP_CHUNK_3', 'OPAMP_CHUNK_4', 'NODE', 'VOLTAGE_OUTPUT_NODE', 'CURRENT_OUTPUT_COMPONENT', 'NOISE_OUTPUTS', 'NOISY_SOURCES']¶
-