Skip to content

Fix: Noise Analysis showing ngspice internal constants.#18

Open
ImranFarhat01 wants to merge 3 commits into
FOSSEE:developfrom
ImranFarhat01:fix/noise-analysis-clean
Open

Fix: Noise Analysis showing ngspice internal constants.#18
ImranFarhat01 wants to merge 3 commits into
FOSSEE:developfrom
ImranFarhat01:fix/noise-analysis-clean

Conversation

@ImranFarhat01

Copy link
Copy Markdown

Problem

Noise Analysis output showed ngspice internal constants like V(false),
V(true), V(boltz), V(pi) etc. mixed into the results. The control block
also used the wrong vector names and wrong plot switching, causing
incorrect/failed output.

Fix

  • Change noise control block to use setplot noise1/setplot noise2
    (via the existing noiseMode toggle) then print all
  • ngspice 31 outputs noise data correctly when print all is used
    after setplot, going through the graph parser correctly
  • Add NGSPICE_INTERNAL_VARS filter in parse.py as an additional
    safeguard against internal variable leakage
  • Use noiseMode in the control block so the "Show Noise Spectrum"
    toggle correctly switches between:
    • noise1: inoise_spectrum/onoise_spectrum (frequency-domain)
    • noise2: inoise_total/onoise_total (integrated totals)

Testing

  • Ran Noise Analysis with "Show Noise Spectrum" checked: returns
    frequency, inoise_spectrum, onoise_spectrum columns correctly
  • Ran with "Show Noise Spectrum" unchecked: returns inoise_total,
    onoise_total correctly in the output table
  • No ngspice internal variables appear in either mode
  • Simulation completes without "no such plot named noise1" error

Problem:
- Noise Analysis output showed V(false), V(true), V(boltz), V(pi) etc.
- Control block used wrong vector names and wrong plot switching

Fix:
- Changed noise control block to use setplot noise1 then print all
- ngspice 31 outputs noise data in tabular format when print all is used
  after setplot noise1 - this goes through the graph parser correctly
- Added NGSPICE_INTERNAL_VARS filter in parse.py as additional safeguard
- Noise Analysis now correctly shows inoise_spectrum and onoise_spectrum
  with graph output
After rebasing onto updated develop, the noiseMode variable
(setplot noise1 vs noise2 based on outputSpectrum toggle) was
introduced but not used in the control block, which was hardcoded
to setplot noise1.

Use noiseMode so the toggle correctly switches between:
- noise1: inoise_spectrum/onoise_spectrum (frequency-domain)
- noise2: inoise_total/onoise_total (integrated totals)

Both modes verified working with correct vector names and no
ngspice internal variable pollution.
This change was a carry-over fix for a different bug (Ctrl+S null
crash) that doesn't belong in this PR. Keeping this branch scoped
to only the noise analysis fix (Bug 2).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant