- Fixed a bug in displaying bands that started before the sweep

- Style updates to marker displays
pull/42/head
Rune B. Broberg 2019-09-29 08:33:03 +02:00
rodzic 65b1340a30
commit 3c76336a03
3 zmienionych plików z 37 dodań i 23 usunięć

Wyświetl plik

@ -332,7 +332,7 @@ class FrequencyChart(Chart):
elif fstart < end < fstop:
# Only the end of the band is within the chart
x_end = self.getXPosition(Datapoint(end, 0, 0))
qp.drawRect(self.leftMargin + 1, 30, x_end - (self.leftmargin + 1), self.chartHeight - 10)
qp.drawRect(self.leftMargin + 1, 30, x_end - (self.leftMargin + 1), self.chartHeight - 10)
elif start < fstart < fstop < end:
# All the chart is in a band, we won't show it(?)
pass

Wyświetl plik

@ -179,7 +179,7 @@ class Marker(QtCore.QObject):
im50str = " -j" + str(-1 * im50)
else:
im50str = " +j" + str(im50)
im50str += "\N{OHM SIGN}"
im50str += " \N{OHM SIGN}"
if xp < 0:
xpstr = NanoVNASaver.capacitanceEquivalent(xp, s11data[self.location].freq)
@ -188,7 +188,7 @@ class Marker(QtCore.QObject):
self.frequency_label.setText(NanoVNASaver.formatFrequency(s11data[self.location].freq))
self.impedance_label.setText(str(re50) + im50str)
self.parallel_r_label.setText(str(rp) + "\N{OHM SIGN}")
self.parallel_r_label.setText(str(rp) + " \N{OHM SIGN}")
self.parallel_x_label.setText(xpstr)
self.returnloss_label.setText(str(round(20 * math.log10((vswr - 1) / (vswr + 1)), 3)) + " dB")
capacitance = NanoVNASaver.capacitanceEquivalent(im50, s11data[self.location].freq)

Wyświetl plik

@ -793,14 +793,28 @@ class NanoVNASaver(QtWidgets.QWidget):
if im50 == 0 or freq == 0:
return "- pF"
capacitance = 10**12/(freq * 2 * math.pi * im50)
return str(round(-capacitance, 3)) + " pF"
if abs(capacitance) > 10000:
return str(round(-capacitance/1000, 2)) + " nF"
elif abs(capacitance) > 1000:
return str(round(-capacitance/1000, 3)) + " nF"
elif abs(capacitance) > 10:
return str(round(-capacitance, 2)) + " pF"
else:
return str(round(-capacitance, 3)) + " pF"
@staticmethod
def inductanceEquivalent(im50, freq) -> str:
if freq == 0:
return "- nH"
inductance = im50 / (freq * 2 * math.pi)
return str(round(inductance * 1000000000, 3)) + " nH"
inductance = im50 * 1000000000/ (freq * 2 * math.pi)
if abs(inductance) > 10000:
return str(round(inductance / 1000, 2)) + " μH"
elif abs(inductance) > 1000:
return str(round(inductance/1000, 3)) + " μH"
elif abs(inductance) > 10:
return str(round(inductance, 2)) + " nH"
else:
return str(round(inductance, 3)) + " nH"
@staticmethod
def gain(data: Datapoint):
@ -1607,23 +1621,23 @@ class BandsModel(QtCore.QAbstractTableModel):
color = QtGui.QColor(128, 128, 128, 48)
# These bands correspond broadly to the Danish Amateur Radio allocation
default_bands = ["2200m;135700;137800",
"630m;472000;479000",
"160m;1800000;2000000",
"80m;3500000;3800000",
"60m;5250000;5450000",
"40m;7000000;7200000",
"30m;10100000;10150000",
"20m;14000000;14350000",
"17m;18068000;18168000",
"15m;21000000;21450000",
"12m;24890000;24990000",
"10m;28000000;29700000",
"6m;50000000;52000000",
"4m;69887500;70512500",
"2m;144000000;146000000",
"70cm;432000000;438000000",
"23cm;1240000000;1300000000"]
default_bands = ["2200 m;135700;137800",
"630 m;472000;479000",
"160 m;1800000;2000000",
"80 m;3500000;3800000",
"60 m;5250000;5450000",
"40 m;7000000;7200000",
"30 m;10100000;10150000",
"20 m;14000000;14350000",
"17 m;18068000;18168000",
"15 m;21000000;21450000",
"12 m;24890000;24990000",
"10 m;28000000;29700000",
"6 m;50000000;52000000",
"4 m;69887500;70512500",
"2 m;144000000;146000000",
"70 cm;432000000;438000000",
"23 cm;1240000000;1300000000"]
def __init__(self):
super().__init__()