Commit c07a754d authored by Sean Leavey's avatar Sean Leavey
Browse files

Support input noise in LISO output files

parent 6cafd09a
......@@ -19,3 +19,15 @@ Output coordinates
The parser assumes all outputs are in `db` and `degrees` (noise columns are
handled appropriately, however). This leads to incorrect results. This is
easily fixed but not yet implemented.
Differences in behaviour
------------------------
Input noise sinks
~~~~~~~~~~~~~~~~~
In LISO, input noise is always specified at the input `node`, and not the input `component`, even if
the circuit input is a current (i.e. ``iinput``). This makes no difference to the computed spectra,
but it does influence the labels used to plot the data. In |Zero| simulations, and in parsed LISO
output files, the input noise sink is always set to whatever the circuit input actually is - either
the input node in the case of ``uinput`` or the input component in the case of ``iinput``.
......@@ -87,7 +87,7 @@ class LisoParser(metaclass=abc.ABCMeta):
"input_node_n": None,
"input_impedance": None,
"output_type": None,
"input_refer": None,
"input_refer": False,
"noise_output_element": None,
"response_outputs": [],
# Displayed noise.
......
......@@ -322,8 +322,16 @@ class LisoOutputParser(LisoParser):
def _build_noise(self, data):
"""Build noise outputs"""
# The data sink is always the noise output element
sink = self.circuit[self.noise_output_element]
if self.input_refer:
if self.input_type == "voltage":
# The data sink is the circuit input node.
sink = self.input_node_p
else:
# The data sink is the circuit input component.
sink = self._input_component
else:
# The data sink is the noise output element.
sink = self.circuit[self.noise_output_element]
# Now that we have all the noise sources, create noise outputs.
for index, noisy_element in enumerate(self.noisy_elements):
......@@ -405,6 +413,10 @@ class LisoOutputParser(LisoParser):
self.n_nodes = t.lexer.lexmatch.group('n')
t.lexer.begin('nodes')
def t_ANY_inputrefer(self, t):
r'\#Noise\sis\sINPUT-REFERRED\sto\s(.*)\sinput\sat\snode\s(.*).'
self.input_refer = True
def t_ANY_noisysources(self, t):
# match start of noise source section
r'\#Noise\sis\scomputed\s(?P<ntype>at\snode|through\scomponent)\s(?:.+\:)?(?P<element>.+)\sfor\s\(nnoise=(?P<nnoise>\d+),\snnoisy=(?P<nnoisy>\d+)\)\s:'
......@@ -459,6 +471,10 @@ class LisoOutputParser(LisoParser):
self.n_noise_sources = t.lexer.lexmatch.group('nsource')
t.lexer.begin('noisecurrentoutputs')
def t_ANY_noiseinputreferred(self, t):
r'\#\sNoise\sis\sREFERRED\sTO\sTHE\sINPUT.'
pass
def t_ANY_gnuplotoptions(self, t):
# match start of gnuplot section
r'\#\d+\sGNUPLOT.*'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment