From 782a2653ede77262310ac50d04d15470766c1a2f Mon Sep 17 00:00:00 2001 From: "Rune B. Broberg" Date: Sun, 8 Sep 2019 09:36:30 +0200 Subject: [PATCH] - Fix for wrongly displayed capacitance values - Allow gain in S21 readings --- NanoVNASaver/NanoVNASaver.py | 9 +++++---- NanoVNASaver/SweepWorker.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/NanoVNASaver/NanoVNASaver.py b/NanoVNASaver/NanoVNASaver.py index 128a5d7..1899797 100644 --- a/NanoVNASaver/NanoVNASaver.py +++ b/NanoVNASaver/NanoVNASaver.py @@ -832,11 +832,12 @@ class NanoVNASaver(QtWidgets.QWidget): @staticmethod def reactanceEquivalent(im50, freq) -> str: - reactance = im50 / (freq * 2 * math.pi) - if reactance < 0: - return str(round(-reactance * 1000000000, 3)) + " nF" + capacitance = 10**12/(freq * 2 * math.pi * im50) + inductance = im50 / (freq * 2 * math.pi) + if im50 < 0: + return str(round(-capacitance, 3)) + " pF" else: - return str(round(reactance * 1000000000, 3)) + " nH" + return str(round(inductance * 1000000000, 3)) + " nH" @staticmethod def gain(data: Datapoint): diff --git a/NanoVNASaver/SweepWorker.py b/NanoVNASaver/SweepWorker.py index f6b8650..23e2651 100644 --- a/NanoVNASaver/SweepWorker.py +++ b/NanoVNASaver/SweepWorker.py @@ -130,10 +130,10 @@ class SweepWorker(QtCore.QRunnable): for d in tmpdata: a, b = d.split(" ") try: - if float(a) < -1.5 or float(a) > 1.5: + if float(a) < -2.5 or float(a) > 2.5: print("Warning: Got a non-float data value: " + d + " (" + a + ")") done = False - if float(b) < -1.5 or float(b) > 1.5: + if float(b) < -2.5 or float(b) > 2.5: print("Warning: Got a non-float data value: " + d + " (" + b + ")") done = False except Exception: