Display negative reactive components correctly ("-j rather than +j-")

Correctly set the full span of the nanovna after sweeping
pull/6/head
Rune B. Broberg 2019-09-01 21:07:39 +02:00
rodzic b0d0684b68
commit 2a69c3fe60
2 zmienionych plików z 12 dodań i 3 usunięć

Wyświetl plik

@ -459,11 +459,19 @@ class NanoVNASaver(QtWidgets.QWidget):
# TODO: Make a neater solution for showing data for markers
if self.markers[0].location != -1:
im50, re50, vswr = self.vswr(self.data[self.markers[0].location])
self.marker1label.setText(str(round(re50, 3)) + " + j" + str(round(im50, 3)) + " VSWR: 1:" + str(round(vswr, 3)))
if (im50 < 0):
im50str = "- j" + str(round(-1*im50, 3))
else:
im50str = "+ j" + str(round(im50, 3))
self.marker1label.setText(str(round(re50, 3)) + im50str + " VSWR: 1:" + str(round(vswr, 3)))
if self.markers[1].location != -1:
im50, re50, vswr = self.vswr(self.data[self.markers[1].location])
self.marker2label.setText(str(round(re50, 3)) + " + j" + str(round(im50, 3)) + " VSWR: 1:" + str(round(vswr, 3)))
if (im50 < 0):
im50str = "- j" + str(round(im50, 3))
else:
im50str = "+ j" + str(round(im50, 3))
self.marker2label.setText(str(round(re50, 3)) + im50str + " VSWR: 1:" + str(round(vswr, 3)))
self.smithChart.setData(self.data)
self.s21SmithChart.setData(self.data21)

Wyświetl plik

@ -82,7 +82,7 @@ class SweepWorker(QtCore.QRunnable):
self.saveData(frequencies, values, values12)
# Reset the device to show the full range
self.app.setSweep(self.app.sweepStartInput.text(), self.app.sweepEndInput.text())
self.app.setSweep(NanoVNASaver.parseFrequency(self.app.sweepStartInput.text()), NanoVNASaver.parseFrequency(self.app.sweepEndInput.text()))
else:
self.app.setSweep(sweepFrom, sweepTo)
sleep(0.8)
@ -113,6 +113,7 @@ class SweepWorker(QtCore.QRunnable):
def readData(self, data):
done = False
tmpdata = []
while not done:
done = True
tmpdata = self.app.readValues(data)