Repository navigation
Fix inverted TRRANDOM type codes for gaussian and exponential random sources - #410
Open
umutKaracelebi wants to merge 1 commit into
Open
umutKaracelebi wants to merge 1 commit into
umutKaracelebi wants to merge 1 commit into
Conversation
…sources RandomMixin.format_spice_parameters mapped 'exponential' to TRRANDOM type 2 and 'gaussian' to type 3, but ngspice defines type 2 as gaussian and type 3 as exponential (as documented in the class docstring). A RandomVoltageSource / RandomCurrentSource declared as 'gaussian' therefore emitted exponential strictly-positive variates, and vice versa. Swap the two codes and add a regression test covering all four random types.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RandomMixin.format_spice_parametersmappedrandom_type='gaussian'to ngspiceTRRANDOMtype 3 and'exponential'to type 2, but ngspice defines type 2 asgaussian and type 3 as exponential (see the class docstring and ngspice's
Monte_Carloexampletrrandom(2 ...) ; Gauss). A source declaredgaussiantherefore produced strictly-positive exponential variates, and vice versa.
This swaps the two codes so the emitted netlist matches the documented mapping.
Test:
pytest unit-test-> 29 passed, 2 skipped. The addedtest_random_source_type_codeschecks all four types and fails before the change.Fixes #363.