Made the number of digits of impedance display automatic

pull/17/head
Rune B. Broberg 2019-09-12 15:41:56 +02:00
rodzic 3f57b5ff75
commit 0c046a4133
2 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -99,7 +99,7 @@ class Chart(QtWidgets.QWidget):
return 0
def getPosition(self, d: Datapoint) -> (int, int):
return (self.getXPosition(d), self.getYPosition(d))
return self.getXPosition(d), self.getYPosition(d)
def setDrawLines(self, drawLines):
self.drawLines = drawLines

Wyświetl plik

@ -157,10 +157,13 @@ class Marker(QtCore.QObject):
from NanoVNASaver.NanoVNASaver import NanoVNASaver
if self.location != -1:
im50, re50, vswr = NanoVNASaver.vswr(s11data[self.location])
re50 = round(re50, 4 - math.floor(math.log10(abs(re50))))
im50 = round(im50, 4 - math.floor(math.log10(abs(im50))))
if im50 < 0:
im50str = " -j" + str(round(-1 * im50, 3))
im50str = " -j" + str(-1 * im50)
else:
im50str = " +j" + str(round(im50, 3))
im50str = " +j" + str(im50)
self.frequency_label.setText(NanoVNASaver.formatFrequency(s11data[self.location].freq))
self.impedance_label.setText(str(round(re50, 3)) + im50str)
self.returnloss_label.setText(str(round(20 * math.log10((vswr - 1) / (vswr + 1)), 3)) + " dB")