Make vswr a datapoint property

pull/97/head
Holger Mueller 2019-11-17 12:53:59 +01:00
rodzic f6d614b247
commit b52fa930a6
5 zmienionych plików z 10 dodań i 9 usunięć

Wyświetl plik

@ -1030,7 +1030,7 @@ class SimplePeakSearchAnalysis(Analysis):
suffix = ""
data = []
for d in self.app.data:
data.append(d.as_vswr())
data.append(d.vswr)
elif self.rbtn_data_resistance.isChecked():
suffix = " \N{OHM SIGN}"
data = []
@ -1134,7 +1134,7 @@ class PeakSearchAnalysis(Analysis):
if self.rbtn_data_vswr.isChecked():
data = []
for d in self.app.data:
data.append(d.as_vswr())
data.append(d.vswr)
elif self.rbtn_data_s21_gain.isChecked():
data = []
for d in self.app.data21:
@ -1225,7 +1225,7 @@ class VSWRAnalysis(Analysis):
max_dips_shown = 3
data = []
for d in self.app.data:
data.append(d.as_vswr())
data.append(d.vswr)
# min_idx = np.argmin(data)
#
# logger.debug("Minimum at %d", min_idx)

Wyświetl plik

@ -1054,7 +1054,7 @@ class VSWRChart(FrequencyChart):
minVSWR = 1
maxVSWR = 3
for d in self.data:
vswr = d.as_vswr()
vswr = d.vswr
if vswr > maxVSWR:
maxVSWR = vswr
maxVSWR = min(self.maxDisplayValue, math.ceil(maxVSWR))
@ -1136,7 +1136,7 @@ class VSWRChart(FrequencyChart):
return self.topMargin + round((self.maxVSWR - vswr) / self.span * self.chartHeight)
def getYPosition(self, d: Datapoint) -> int:
return self.getYPositionFromValue(d.as_vswr())
return self.getYPositionFromValue(d.vswr)
def valueAtPosition(self, y) -> List[float]:
absy = y - self.topMargin

Wyświetl plik

@ -307,7 +307,7 @@ class Marker(QtCore.QObject):
def updateLabels(self, s11data: List[Datapoint], s21data: List[Datapoint]):
if self.location != -1:
re50, im50 = RFTools.normalize50(s11data[self.location])
vswr = s11data[self.location].as_vswr()
vswr = s11data[self.location].vswr
if re50 > 0:
rp = (re50 ** 2 + im50 ** 2) / re50
rp = round(rp, 3 - max(0, math.floor(math.log10(abs(rp)))))

Wyświetl plik

@ -750,7 +750,7 @@ class NanoVNASaver(QtWidgets.QWidget):
min_vswr = 100
min_vswr_freq = -1
for d in self.data:
vswr = d.as_vswr()
vswr = d.vswr
if min_vswr > vswr > 0:
min_vswr = vswr
min_vswr_freq = d.freq

Wyświetl plik

@ -51,8 +51,9 @@ class Datapoint(NamedTuple):
if mag > 0:
return 20 * math.log10(mag)
return 0
def as_vswr(self) -> float:
@property
def vswr(self) -> float:
mag = abs(self.z)
if mag == 1:
return 1