nanovna-saver/NanoVNASaver/Analysis/AntennaAnalysis.py

55 wiersze
1.7 KiB
Python
Czysty Zwykły widok Historia

2020-07-01 18:47:15 +00:00
'''
Created on 30 giu 2020
@author: mauro
'''
2020-07-07 18:57:53 +00:00
from PyQt5 import QtWidgets
2020-07-01 18:47:15 +00:00
import logging
from NanoVNASaver.Analysis.VSWRAnalysis import VSWRAnalysis
logger = logging.getLogger(__name__)
class MagLoopAnalysis(VSWRAnalysis):
2020-07-07 18:57:53 +00:00
'''
Find min vswr and change sweep to zoom.
Useful for tuning magloop.
'''
2020-07-01 18:47:15 +00:00
max_dips_shown = 1
vswr_limit_value = 2.56
2020-07-07 18:57:53 +00:00
bandwith = 250000
2020-07-01 18:47:15 +00:00
def runAnalysis(self):
super().runAnalysis()
2020-07-07 18:57:53 +00:00
if len(self.minimums) > 1:
self.layout.addRow("", QtWidgets.QLabel(
"Not magloop or try to lower VSWR limit"))
for m in self.minimums[:1]:
# only one time
start, lowest, end = m
if start != end:
Q = self.app.data[lowest].freq / \
(self.app.data[end].freq - self.app.data[start].freq)
self.layout.addRow(
"Q", QtWidgets.QLabel("{}".format(int(Q))))
self.app.sweepStartInput.setText(self.app.data[start].freq)
self.app.sweepStartInput.textEdited.emit(
self.app.sweepStartInput.text())
self.app.sweepEndInput.setText(self.app.data[end].freq)
self.app.sweepEndInput.textEdited.emit(
self.app.sweepEndInput.text())
else:
self.app.sweepStartInput.setText(
self.app.data[start].freq - self.bandwith)
self.app.sweepStartInput.textEdited.emit(
self.app.sweepStartInput.text())
self.app.sweepEndInput.setText(
self.app.data[end].freq + self.bandwith)
self.app.sweepEndInput.textEdited.emit(
self.app.sweepEndInput.text())