Handle input noise projections
Handle LISO's inputnoise
command. On the surface, this is simple to do: compute a transfer function from output to input once the noise at the output has been calculated. This, however, requires a few changes to the structure of the analysis
classes that build the circuit matrix.
Currently, AcSignalAnalysis
and AcNoiseAnalysis
inherit directly from BaseAcAnalysis
which provides methods for constructing the circuit matrix. The individual analyses override certain base methods to customise the behaviour (for example, the noise analysis transposes the matrix). The solve
method of BaseAcAnalysis
is what iterates over the frequency vector, calculating the result by calling the child method, and this is probably the right place to keep this: future features like adaptive frequency steps can be implemented here to be available to all analyses. However, this also means that for inputnoise
the noise analysis cannot calculate a transfer function to project the output noise to the input without creating a new AcSignalAnalysis
. Since the analyses take many input parameters, some of which affect the behaviour of code elsewhere (for example, some test code requires that prescale
be turned off), the noise analysis would have to ensure that the new signal analysis object were instantiated with the same signature it was itself created with. This is liable to introduce bugs if the signature of either analysis were later changed.
A better idea would be to subclass the noise analysis from the signal analysis. In any case, the noise analysis shares a lot of code with the signal analysis, which was originally what motivated the common BaseAcAnalysis
parent. Instead, the signal analysis could provide all necessary code for the signal analysis (i.e. merge in the BaseAcAnalysis
methods), perhaps leaving an abstract solve
method in BaseAcAnalysis
. The noise analysis can override the relevant parts of the signal analysis, without changing any of the signal analysis parts. Then, for input noise calculations, it can simply call the signal analysis methods directly.
Loose list of code changes required:
-
Remove noise input type. This abstraction was short sighted, given that
inputnoise
analysis needs to know if the input is a current or voltage source (whereas other noise analyses didn't care). Remember to replace any uses of the noise input in examples, tests and documentation. -
Make noise analysis a subclass of signal analysis. Rename/move methods defined in
BaseAcAnalysis
, but keep it around to implementsolve
. -
Implement
inputnoise
behaviour. This might simply require callingsuper().solve()
or similar from within the overridden noise method. -
Update data classes: set noise spectrum legend label appropriately when noise is referred to some other point.
-
Implement
inputnoise
parsing inliso
subpackage and add tests.
Optional: allow projection to arbitrary nodes/components, not just input. Would require changing input component on-the-fly? Or just set the RHS vector?