kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
Replaced RFTools.calculateVSWR by Datapoint method
rodzic
5a43b1b42a
commit
f6d614b247
|
@ -1030,10 +1030,7 @@ class SimplePeakSearchAnalysis(Analysis):
|
|||
suffix = ""
|
||||
data = []
|
||||
for d in self.app.data:
|
||||
vswr = RFTools.calculateVSWR(d)
|
||||
if vswr < 1:
|
||||
vswr = float('inf')
|
||||
data.append(vswr)
|
||||
data.append(d.as_vswr())
|
||||
elif self.rbtn_data_resistance.isChecked():
|
||||
suffix = " \N{OHM SIGN}"
|
||||
data = []
|
||||
|
@ -1137,7 +1134,7 @@ class PeakSearchAnalysis(Analysis):
|
|||
if self.rbtn_data_vswr.isChecked():
|
||||
data = []
|
||||
for d in self.app.data:
|
||||
data.append(RFTools.calculateVSWR(d))
|
||||
data.append(d.as_vswr())
|
||||
elif self.rbtn_data_s21_gain.isChecked():
|
||||
data = []
|
||||
for d in self.app.data21:
|
||||
|
@ -1228,10 +1225,7 @@ class VSWRAnalysis(Analysis):
|
|||
max_dips_shown = 3
|
||||
data = []
|
||||
for d in self.app.data:
|
||||
vswr = RFTools.calculateVSWR(d)
|
||||
if vswr < 1:
|
||||
vswr = float('inf')
|
||||
data.append(vswr)
|
||||
data.append(d.as_vswr())
|
||||
# min_idx = np.argmin(data)
|
||||
#
|
||||
# logger.debug("Minimum at %d", min_idx)
|
||||
|
|
|
@ -1054,7 +1054,7 @@ class VSWRChart(FrequencyChart):
|
|||
minVSWR = 1
|
||||
maxVSWR = 3
|
||||
for d in self.data:
|
||||
vswr = RFTools.calculateVSWR(d)
|
||||
vswr = d.as_vswr()
|
||||
if vswr > maxVSWR:
|
||||
maxVSWR = vswr
|
||||
maxVSWR = min(self.maxDisplayValue, math.ceil(maxVSWR))
|
||||
|
@ -1136,8 +1136,7 @@ class VSWRChart(FrequencyChart):
|
|||
return self.topMargin + round((self.maxVSWR - vswr) / self.span * self.chartHeight)
|
||||
|
||||
def getYPosition(self, d: Datapoint) -> int:
|
||||
vswr = RFTools.calculateVSWR(d)
|
||||
return self.getYPositionFromValue(vswr)
|
||||
return self.getYPositionFromValue(d.as_vswr())
|
||||
|
||||
def valueAtPosition(self, y) -> List[float]:
|
||||
absy = y - self.topMargin
|
||||
|
|
|
@ -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 = RFTools.calculateVSWR(s11data[self.location])
|
||||
vswr = s11data[self.location].as_vswr()
|
||||
if re50 > 0:
|
||||
rp = (re50 ** 2 + im50 ** 2) / re50
|
||||
rp = round(rp, 3 - max(0, math.floor(math.log10(abs(rp)))))
|
||||
|
|
|
@ -750,7 +750,7 @@ class NanoVNASaver(QtWidgets.QWidget):
|
|||
min_vswr = 100
|
||||
min_vswr_freq = -1
|
||||
for d in self.data:
|
||||
vswr = RFTools.calculateVSWR(d)
|
||||
vswr = d.as_vswr()
|
||||
if min_vswr > vswr > 0:
|
||||
min_vswr = vswr
|
||||
min_vswr_freq = d.freq
|
||||
|
|
|
@ -56,6 +56,8 @@ class Datapoint(NamedTuple):
|
|||
mag = abs(self.z)
|
||||
if mag == 1:
|
||||
return 1
|
||||
elif mag > 1:
|
||||
return math.inf
|
||||
return (1 + mag) / (1 - mag)
|
||||
|
||||
def to_impedance(self, ref_impedance: float = 50) -> complex:
|
||||
|
@ -98,10 +100,6 @@ class RFTools:
|
|||
def qualityFactor(data: Datapoint) -> float:
|
||||
return data.to_q_factor()
|
||||
|
||||
@staticmethod
|
||||
def calculateVSWR(data: Datapoint) -> float:
|
||||
return data.as_vswr()
|
||||
|
||||
@staticmethod
|
||||
def capacitanceEquivalent(im50, freq) -> str:
|
||||
if im50 == 0 or freq == 0:
|
||||
|
|
Ładowanie…
Reference in New Issue