Skip to content

Commit

Permalink
Removed old reference to a no mored existing button
Browse files Browse the repository at this point in the history
  • Loading branch information
zarath committed Jul 29, 2020
1 parent 2176919 commit 7205aba
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NanoVNASaver/About.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

VERSION = "0.3.7-pre09"
VERSION = "0.3.7-pre10"
VERSION_URL = (
"https://raw.githubusercontent.com/"
"NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py")
Expand Down
50 changes: 49 additions & 1 deletion NanoVNASaver/RFTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import math
import cmath
from typing import List, NamedTuple
from threading import Lock
from typing import Iterator, List, NamedTuple, Tuple

import numpy as np
from scipy.interpolate import interp1d

from NanoVNASaver.SITools import Format, clamp_value

FMT_FREQ = Format()
Expand Down Expand Up @@ -75,6 +80,49 @@ def inductiveEquivalent(self, ref_impedance: float = 50) -> float:
return impedance_to_inductance(self.impedance(ref_impedance), self.freq)


class DataSet():
def __init__(self, fields=("11", "21")):
self.fields = fields
self.data = {}
self.interp = []
self.inter_valid = False
self.lock = Lock()

def insert(self, datapoints: List['Datapoint']):
assert len(datapoints) == len(self.fields)
assert len(set([dp.freq for dp in datapoints])) == 1
frequency = datapoints[0].freq
self.data[frequency] = [dp.z for dp in datapoints]
self.inter_valid = False

def insert_complex(self, frequency: int, data: Tuple[complex]):
assert len(data) == len(self.fields)
self.data[frequency] = data
self.inter_valid = False

def items(self) -> Iterator[List['Datapoint']]:
for freq in sorted(self.data.keys()):
yield [Datapoint(freq, z.real, z.imag) for z in self.data[freq]]

def items_complex(self) -> Iterator[Tuple[int, List[complex]]]:
for freq in sorted(self.data.keys()):
yield (freq, self.data[freq])

def min_freq(self) -> int:
return min(self.data.keys())

def max_freq(self) -> int:
return max(self.data.keys())

def gen_interpolation(self):
self.interp = []
for i in range(self.fields):
d





def gamma_to_impedance(gamma: complex, ref_impedance: float = 50) -> complex:
"""Calculate impedance from gamma"""
try:
Expand Down
3 changes: 2 additions & 1 deletion NanoVNASaver/Windows/CalibrationSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from PyQt5 import QtWidgets, QtCore

from NanoVNASaver.Calibration import Calibration
from NanoVNASaver.Settings.Sweep import SweepMode

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -642,7 +643,7 @@ def automaticCalibration(self):
self.btn_automatic.setDisabled(False)
return

if self.app.windows["sweep_settings"].continuous_sweep_radiobutton.isChecked():
if self.app.sweep.properties.mode == SweepMode.CONTINOUS:
QtWidgets.QMessageBox(
QtWidgets.QMessageBox.Information,
"Continuous sweep enabled",
Expand Down

0 comments on commit 7205aba

Please sign in to comment.