fix(py): make subthreshold_swing fail loudly, and state its units - #10
Open
reneotten wants to merge 1 commit into
Open
fix(py): make subthreshold_swing fail loudly, and state its units#10reneotten wants to merge 1 commit into
reneotten wants to merge 1 commit into
Conversation
Two problems, both about the same function. 1. Silent NaN. `Device()` defaults to `v_ds = 0`, where the Landauer integrand vanishes and every swept current is exactly zero. The `log10(I)` fit then produced `-inf`, and `1/-inf` returned `nan` with only a numpy RuntimeWarning. `Device().sweep_v_g(0, 0.5, 0.05).subthreshold_swing()` quietly handed back `nan` instead of explaining that a drain bias is needed. Non-positive currents, empty fit windows and degenerate slopes now raise `ValueError` naming the likely cause. 2. Contradictory units. `sweep.rs` described the result as "mV/decade equivalent, in the original's V/decade units", which asserts two different units in one clause, and the Python docstring gave none at all. The value is volts/decade; the only place that was resolved was a `* 1000` in a notebook cell. Both doc comments now say V/decade and give the 300 K thermal limit (0.0596 V/decade) as a sanity anchor. Verified against the model: the default device gives 65.8 mV/decade at 300 K and 43.8 mV/decade at 200 K, each just above the corresponding ln(10)kT/e limit, which is the expected behaviour for a thermally-limited barrier.
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.
fix(py): make subthreshold_swing fail loudly, and state its units
Two problems, both about the same function.
Silent NaN.
Device()defaults tov_ds = 0, where the Landauerintegrand vanishes and every swept current is exactly zero. The
log10(I)fit then produced-inf, and1/-infreturnednanwith onlya numpy RuntimeWarning.
Device().sweep_v_g(0, 0.5, 0.05).subthreshold_swing()quietly handed back
naninstead of explaining that a drain bias isneeded. Non-positive currents, empty fit windows and degenerate slopes now
raise
ValueErrornaming the likely cause.Contradictory units.
sweep.rsdescribed the result as "mV/decadeequivalent, in the original's V/decade units", which asserts two different
units in one clause, and the Python docstring gave none at all. The value
is volts/decade; the only place that was resolved was a
* 1000in anotebook cell.
Both doc comments now say V/decade and give the 300 K thermal limit
(0.0596 V/decade) as a sanity anchor. Verified against the model: the
default device gives 65.8 mV/decade at 300 K and 43.8 mV/decade at 200 K,
each just above the corresponding ln(10)kT/e limit, which is the expected
behaviour for a thermally-limited barrier.