diff --git a/NanoVNASaver/Analysis.py b/NanoVNASaver/Analysis.py index 57e045c..0b453e7 100644 --- a/NanoVNASaver/Analysis.py +++ b/NanoVNASaver/Analysis.py @@ -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) diff --git a/NanoVNASaver/Chart.py b/NanoVNASaver/Chart.py index 8dbe6a8..9d195e0 100644 --- a/NanoVNASaver/Chart.py +++ b/NanoVNASaver/Chart.py @@ -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 diff --git a/NanoVNASaver/Marker.py b/NanoVNASaver/Marker.py index db3e773..b10da54 100644 --- a/NanoVNASaver/Marker.py +++ b/NanoVNASaver/Marker.py @@ -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))))) diff --git a/NanoVNASaver/NanoVNASaver.py b/NanoVNASaver/NanoVNASaver.py index c928bdc..771cfc5 100644 --- a/NanoVNASaver/NanoVNASaver.py +++ b/NanoVNASaver/NanoVNASaver.py @@ -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 diff --git a/NanoVNASaver/RFTools.py b/NanoVNASaver/RFTools.py index 8a2ecc8..c0606dd 100644 --- a/NanoVNASaver/RFTools.py +++ b/NanoVNASaver/RFTools.py @@ -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