Merge branch 'Development' into testing

pull/446/head
Holger Müller 2021-07-01 21:36:48 +02:00
commit bcc598b15a
84 zmienionych plików z 634 dodań i 178 usunięć

Wyświetl plik

@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
architecture: ${{ matrix.arch }}
- name: Install dependencies and pyinstall
run: |

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -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.10-pre04"
VERSION = "0.3.10-pre05"
VERSION_URL = (
"https://raw.githubusercontent.com/"
"NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py")

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,7 +1,7 @@
# NanoVNASaver
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -16,20 +16,19 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging
from PyQt5 import QtWidgets
import numpy as np
from NanoVNASaver.Analysis import Analysis, PeakSearchAnalysis
from NanoVNASaver.Formatting import format_frequency
from NanoVNASaver.Formatting import format_complex_imp
from NanoVNASaver.RFTools import reflection_coefficient
import os
import csv
import logging
from collections import OrderedDict
from NanoVNASaver.Formatting import format_frequency_short
from NanoVNASaver.Formatting import format_resistance
import numpy as np
from PyQt5 import QtWidgets
from NanoVNASaver.Analysis import Analysis, PeakSearchAnalysis
from NanoVNASaver.Formatting import (
format_frequency, format_complex_imp,
format_frequency_short, format_resistance)
from NanoVNASaver.RFTools import reflection_coefficient
logger = logging.getLogger(__name__)
@ -75,10 +74,9 @@ class VSWRAnalysis(Analysis):
def runAnalysis(self):
max_dips_shown = self.max_dips_shown
data = []
for d in self.app.data.s11:
data.append(d.vswr)
data = [d.vswr for d in self.app.data.s11]
# min_idx = np.argmin(data)
#
# logger.debug("Minimum at %d", min_idx)
@ -110,7 +108,7 @@ class VSWRAnalysis(Analysis):
dips.append(data[lowest])
best_dips = []
for i in range(max_dips_shown):
for _ in range(max_dips_shown):
min_idx = np.argmin(dips)
best_dips.append(minimums[min_idx])
dips.remove(dips[min_idx])
@ -137,11 +135,10 @@ class VSWRAnalysis(Analysis):
QtWidgets.QLabel(
format_frequency(self.app.data.s11[end].freq -
self.app.data.s11[start].freq)))
self.layout.addWidget(PeakSearchAnalysis.QHLine())
else:
self.layout.addRow("Low spot", QtWidgets.QLabel(
format_frequency(self.app.data.s11[lowest].freq)))
self.layout.addWidget(PeakSearchAnalysis.QHLine())
self.layout.addWidget(PeakSearchAnalysis.QHLine())
# Remove the final separator line
self.layout.removeRow(self.layout.rowCount() - 1)
else:
@ -199,13 +196,8 @@ class ResonanceAnalysis(Analysis):
return my_data
def _get_crossing(self):
data = []
for d in self.app.data.s11:
data.append(d.phase)
crossing = sorted(self.find_crossing_zero(data))
return crossing
data = [d.phase for d in self.app.data.s11]
return sorted(self.find_crossing_zero(data))
def runAnalysis(self):
self.reset()
@ -231,11 +223,9 @@ class ResonanceAnalysis(Analysis):
# if len(crossing) > max_dips_shown:
# self.layout.addRow(QtWidgets.QLabel("<b>More than " + str(max_dips_shown) +
# " dips found. Lowest shown.</b>"))
# self.crossing = crossing[:max_dips_shown]
extended_data = []
if len(crossing) > 0:
extended_data = []
for m in crossing:
start, lowest, end = m
my_data = self._get_data(lowest)
@ -398,16 +388,17 @@ class EFHWAnalysis(ResonanceAnalysis):
row = extended_data[index]
writer.writerow(row)
def compare(self, old, new, fields=[("freq", str), ]):
def compare(self, old, new, fields=None):
'''
Compare data to help changes
NB
must be same sweep
must be same sweep
( same index must be same frequence )
:param old:
:param new:
'''
fields = fields or [("freq", str), ]
def no_compare():
@ -451,7 +442,7 @@ class EFHWAnalysis(ResonanceAnalysis):
if delta_f > 0:
logger.debug("possible missing band, ")
if (len(old_idx) > (i + split + 1)):
if len(old_idx) > (i + split + 1):
if abs(new[k]["freq"] - old[old_idx[i + split + 1]]["freq"]) < max_delta_f:
logger.debug("new is missing band, compare next ")
split += 1

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -97,8 +97,7 @@ class CalDataSet:
return self.data[freq]
def items(self):
for item in self.data.items():
yield item
yield from self.data.items()
def values(self):
for freq in self.frequencies():
@ -212,14 +211,14 @@ class Calibration:
caldata["delta_e"] = - ((g1 * (gm2 - gm3) - g2 * gm2 + g3 *
gm3) * gm1 + (g2 * gm3 - g3 * gm3) *
gm2) / denominator
except ZeroDivisionError:
except ZeroDivisionError as exc:
self.isCalculated = False
logger.error(
"Division error - did you use the same measurement"
" for two of short, open and load?")
raise ValueError(
f"Two of short, open and load returned the same"
f" values at frequency {freq}Hz.")
f" values at frequency {freq}Hz.") from exc
if self.isValid2Port():
caldata["e30"] = caldata["isolation"].z
@ -354,12 +353,10 @@ class Calibration:
self.notes.append(note)
continue
if line.startswith("#"):
if not parsed_header:
# Check that this is a valid header
if line == (
"# Hz ShortR ShortI OpenR OpenI LoadR LoadI"
" ThroughR ThroughI IsolationR IsolationI"):
parsed_header = True
if not parsed_header and line == (
"# Hz ShortR ShortI OpenR OpenI LoadR LoadI"
" ThroughR ThroughI IsolationR IsolationI"):
parsed_header = True
continue
if not parsed_header:
logger.warning(
@ -372,11 +369,7 @@ class Calibration:
logger.warning("Illegal data in cal file. Line %i", i)
cal = m.groupdict()
if cal["throughr"]:
nr_cals = 5
else:
nr_cals = 3
nr_cals = 5 if cal["throughr"] else 3
for name in Calibration.CAL_NAMES[:nr_cals]:
self.dataset.insert(
name,

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from .Frequency import FrequencyChart

Wyświetl plik

@ -16,8 +16,14 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.SITools import Format, Value
from .Frequency import FrequencyChart
logger = logging.getLogger(__name__)
@ -26,10 +32,257 @@ logger = logging.getLogger(__name__)
class CapacitanceChart(FrequencyChart):
def __init__(self, name=""):
super().__init__(name)
self.name_unit = "F"
self.value_function = lambda x: x.capacitiveEquivalent()
self.leftMargin = 30
self.dim.width = 250
self.dim.height = 250
self.minDisplayValue = 0
self.maxDisplayValue = 100
self.minValue = -1
self.maxValue = 1
self.span = 1
self.setMinimumSize(self.dim.width + self.rightMargin + self.leftMargin,
self.dim.height + self.topMargin + self.bottomMargin)
self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding))
pal = QtGui.QPalette()
pal.setColor(QtGui.QPalette.Background, self.color.background)
self.setPalette(pal)
self.setAutoFillBackground(True)
def drawChart(self, qp: QtGui.QPainter):
qp.setPen(QtGui.QPen(self.color.text))
qp.drawText(3, 15, self.name + " (F)")
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin, 20, self.leftMargin, self.topMargin+self.dim.height+5)
qp.drawLine(self.leftMargin-5, self.topMargin+self.dim.height,
self.leftMargin+self.dim.width, self.topMargin + self.dim.height)
self.drawTitle(qp)
def drawValues(self, qp: QtGui.QPainter):
if len(self.data) == 0 and len(self.reference) == 0:
return
pen = QtGui.QPen(self.color.sweep)
pen.setWidth(self.dim.point)
line_pen = QtGui.QPen(self.color.sweep)
line_pen.setWidth(self.dim.line)
highlighter = QtGui.QPen(QtGui.QColor(20, 0, 255))
highlighter.setWidth(1)
if not self.fixedSpan:
if len(self.data) > 0:
fstart = self.data[0].freq
fstop = self.data[len(self.data)-1].freq
else:
fstart = self.reference[0].freq
fstop = self.reference[len(self.reference) - 1].freq
self.fstart = fstart
self.fstop = fstop
else:
fstart = self.fstart = self.minFrequency
fstop = self.fstop = self.maxFrequency
# Draw bands if required
if self.bands.enabled:
self.drawBands(qp, fstart, fstop)
if self.fixedValues:
maxValue = self.maxDisplayValue / 10e11
minValue = self.minDisplayValue / 10e11
self.maxValue = maxValue
self.minValue = minValue
else:
# Find scaling
minValue = 1
maxValue = -1
for d in self.data:
val = d.capacitiveEquivalent()
if val > maxValue:
maxValue = val
if val < minValue:
minValue = val
for d in self.reference: # Also check min/max for the reference sweep
if d.freq < self.fstart or d.freq > self.fstop:
continue
val = d.capacitiveEquivalent()
if val > maxValue:
maxValue = val
if val < minValue:
minValue = val
self.maxValue = maxValue
self.minValue = minValue
span = maxValue - minValue
if span == 0:
logger.info("Span is zero for CapacitanceChart, setting to a small value.")
span = 1e-15
self.span = span
target_ticks = math.floor(self.dim.height / 60)
fmt = Format(max_nr_digits=1)
for i in range(target_ticks):
val = minValue + (i / target_ticks) * span
y = self.topMargin + round((self.maxValue - val) / self.span * self.dim.height)
qp.setPen(self.color.text)
if val != minValue:
valstr = str(Value(val, fmt=fmt))
qp.drawText(3, y + 3, valstr)
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin - 5, y, self.leftMargin + self.dim.width, y)
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin - 5, self.topMargin,
self.leftMargin + self.dim.width, self.topMargin)
qp.setPen(self.color.text)
qp.drawText(3, self.topMargin + 4, str(Value(maxValue, fmt=fmt)))
qp.drawText(3, self.dim.height+self.topMargin, str(Value(minValue, fmt=fmt)))
self.drawFrequencyTicks(qp)
self.drawData(qp, self.data, self.color.sweep)
self.drawData(qp, self.reference, self.color.reference)
self.drawMarkers(qp)
def getYPosition(self, d: Datapoint) -> int:
return (
self.topMargin +
round((self.maxValue - d.capacitiveEquivalent()) /
self.span * self.dim.height))
def valueAtPosition(self, y) -> List[float]:
absy = y - self.topMargin
val = -1 * ((absy / self.dim.height * self.span) - self.maxValue)
return [val * 10e11]
def copy(self):
new_chart: CapacitanceChart = super().copy()
new_chart.span = self.span
return new_chart
class InductanceChart(FrequencyChart):
def __init__(self, name=""):
super().__init__(name)
self.leftMargin = 30
self.dim.width = 250
self.dim.height = 250
self.minDisplayValue = 0
self.maxDisplayValue = 100
self.minValue = -1
self.maxValue = 1
self.span = 1
self.setMinimumSize(self.dim.width + self.rightMargin + self.leftMargin,
self.dim.height + self.topMargin + self.bottomMargin)
self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding))
pal = QtGui.QPalette()
pal.setColor(QtGui.QPalette.Background, self.color.background)
self.setPalette(pal)
self.setAutoFillBackground(True)
def drawChart(self, qp: QtGui.QPainter):
qp.setPen(QtGui.QPen(self.color.text))
qp.drawText(3, 15, self.name + " (H)")
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin, 20, self.leftMargin, self.topMargin+self.dim.height+5)
qp.drawLine(self.leftMargin-5, self.topMargin+self.dim.height,
self.leftMargin+self.dim.width, self.topMargin + self.dim.height)
self.drawTitle(qp)
def drawValues(self, qp: QtGui.QPainter):
if len(self.data) == 0 and len(self.reference) == 0:
return
pen = QtGui.QPen(self.color.sweep)
pen.setWidth(self.dim.point)
line_pen = QtGui.QPen(self.color.sweep)
line_pen.setWidth(self.dim.line)
highlighter = QtGui.QPen(QtGui.QColor(20, 0, 255))
highlighter.setWidth(1)
if not self.fixedSpan:
if len(self.data) > 0:
fstart = self.data[0].freq
fstop = self.data[len(self.data)-1].freq
else:
fstart = self.reference[0].freq
fstop = self.reference[len(self.reference) - 1].freq
self.fstart = fstart
self.fstop = fstop
else:
fstart = self.fstart = self.minFrequency
fstop = self.fstop = self.maxFrequency
# Draw bands if required
if self.bands.enabled:
self.drawBands(qp, fstart, fstop)
if self.fixedValues:
maxValue = self.maxDisplayValue / 10e11
minValue = self.minDisplayValue / 10e11
self.maxValue = maxValue
self.minValue = minValue
else:
# Find scaling
minValue = 1
maxValue = -1
for d in self.data:
val = d.inductiveEquivalent()
if val > maxValue:
maxValue = val
if val < minValue:
minValue = val
for d in self.reference: # Also check min/max for the reference sweep
if d.freq < self.fstart or d.freq > self.fstop:
continue
val = d.inductiveEquivalent()
if val > maxValue:
maxValue = val
if val < minValue:
minValue = val
self.maxValue = maxValue
self.minValue = minValue
span = maxValue - minValue
if span == 0:
logger.info("Span is zero for CapacitanceChart, setting to a small value.")
span = 1e-15
self.span = span
target_ticks = math.floor(self.dim.height / 60)
fmt = Format(max_nr_digits=1)
for i in range(target_ticks):
val = minValue + (i / target_ticks) * span
y = self.topMargin + round((self.maxValue - val) / self.span * self.dim.height)
qp.setPen(self.color.text)
if val != minValue:
valstr = str(Value(val, fmt=fmt))
qp.drawText(3, y + 3, valstr)
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin - 5, y, self.leftMargin + self.dim.width, y)
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin - 5, self.topMargin,
self.leftMargin + self.dim.width, self.topMargin)
qp.setPen(self.color.text)
qp.drawText(3, self.topMargin + 4, str(Value(maxValue, fmt=fmt)))
qp.drawText(3, self.dim.height+self.topMargin, str(Value(minValue, fmt=fmt)))
self.drawFrequencyTicks(qp)
self.drawData(qp, self.data, self.color.sweep)
self.drawData(qp, self.reference, self.color.reference)
self.drawMarkers(qp)
def getYPosition(self, d: Datapoint) -> int:
return (self.topMargin +
round((self.maxValue - d.inductiveEquivalent()) /
self.span * self.dim.height))
def valueAtPosition(self, y) -> List[float]:
absy = y - self.topMargin
val = -1 * ((absy / self.dim.height * self.span) - self.maxValue)
return [val * 10e11]
def copy(self):
new_chart: InductanceChart = super().copy()
new_chart.span = self.span
return new_chart

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@ from typing import List
import numpy as np
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from .Frequency import FrequencyChart

Wyświetl plik

@ -16,7 +16,14 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.SITools import Format, Value
from .Frequency import FrequencyChart
logger = logging.getLogger(__name__)
@ -25,9 +32,127 @@ logger = logging.getLogger(__name__)
class InductanceChart(FrequencyChart):
def __init__(self, name=""):
super().__init__(name)
self.name_unit = "H"
self.value_function = lambda x: x.inductiveEquivalent()
self.leftMargin = 30
self.dim.width = 250
self.dim.height = 250
self.minDisplayValue = 0
self.maxDisplayValue = 100
self.minValue = -1
self.maxValue = 1
self.span = 1
self.setMinimumSize(self.dim.width + self.rightMargin + self.leftMargin,
self.dim.height + self.topMargin + self.bottomMargin)
self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding))
pal = QtGui.QPalette()
pal.setColor(QtGui.QPalette.Background, self.color.background)
self.setPalette(pal)
self.setAutoFillBackground(True)
def drawChart(self, qp: QtGui.QPainter):
qp.setPen(QtGui.QPen(self.color.text))
qp.drawText(3, 15, self.name + " (H)")
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin, 20, self.leftMargin, self.topMargin+self.dim.height+5)
qp.drawLine(self.leftMargin-5, self.topMargin+self.dim.height,
self.leftMargin+self.dim.width, self.topMargin + self.dim.height)
self.drawTitle(qp)
def drawValues(self, qp: QtGui.QPainter):
if len(self.data) == 0 and len(self.reference) == 0:
return
pen = QtGui.QPen(self.color.sweep)
pen.setWidth(self.dim.point)
line_pen = QtGui.QPen(self.color.sweep)
line_pen.setWidth(self.dim.line)
highlighter = QtGui.QPen(QtGui.QColor(20, 0, 255))
highlighter.setWidth(1)
if not self.fixedSpan:
if len(self.data) > 0:
fstart = self.data[0].freq
fstop = self.data[len(self.data)-1].freq
else:
fstart = self.reference[0].freq
fstop = self.reference[len(self.reference) - 1].freq
self.fstart = fstart
self.fstop = fstop
else:
fstart = self.fstart = self.minFrequency
fstop = self.fstop = self.maxFrequency
# Draw bands if required
if self.bands.enabled:
self.drawBands(qp, fstart, fstop)
if self.fixedValues:
maxValue = self.maxDisplayValue / 10e11
minValue = self.minDisplayValue / 10e11
self.maxValue = maxValue
self.minValue = minValue
else:
# Find scaling
minValue = 1
maxValue = -1
for d in self.data:
val = d.inductiveEquivalent()
if val > maxValue:
maxValue = val
if val < minValue:
minValue = val
for d in self.reference: # Also check min/max for the reference sweep
if d.freq < self.fstart or d.freq > self.fstop:
continue
val = d.inductiveEquivalent()
if val > maxValue:
maxValue = val
if val < minValue:
minValue = val
self.maxValue = maxValue
self.minValue = minValue
span = maxValue - minValue
if span == 0:
logger.info("Span is zero for CapacitanceChart, setting to a small value.")
span = 1e-15
self.span = span
target_ticks = math.floor(self.dim.height / 60)
fmt = Format(max_nr_digits=1)
for i in range(target_ticks):
val = minValue + (i / target_ticks) * span
y = self.topMargin + round((self.maxValue - val) / self.span * self.dim.height)
qp.setPen(self.color.text)
if val != minValue:
valstr = str(Value(val, fmt=fmt))
qp.drawText(3, y + 3, valstr)
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin - 5, y, self.leftMargin + self.dim.width, y)
qp.setPen(QtGui.QPen(self.color.foreground))
qp.drawLine(self.leftMargin - 5, self.topMargin,
self.leftMargin + self.dim.width, self.topMargin)
qp.setPen(self.color.text)
qp.drawText(3, self.topMargin + 4, str(Value(maxValue, fmt=fmt)))
qp.drawText(3, self.dim.height+self.topMargin, str(Value(minValue, fmt=fmt)))
self.drawFrequencyTicks(qp)
self.drawData(qp, self.data, self.color.sweep)
self.drawData(qp, self.reference, self.color.reference)
self.drawMarkers(qp)
def getYPosition(self, d: Datapoint) -> int:
return (self.topMargin +
round((self.maxValue - d.inductiveEquivalent()) /
self.span * self.dim.height))
def valueAtPosition(self, y) -> List[float]:
absy = y - self.topMargin
val = -1 * ((absy / self.dim.height * self.span) - self.maxValue)
return [val * 10e11]
def copy(self):
new_chart: InductanceChart = super().copy()
new_chart.span = self.span
return new_chart

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from .Frequency import FrequencyChart

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from .Frequency import FrequencyChart

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.SITools import Format, Value

Wyświetl plik

@ -3,7 +3,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -3,7 +3,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.Marker import Marker
from NanoVNASaver.RFTools import Datapoint

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from .Frequency import FrequencyChart

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from .Frequency import FrequencyChart

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ import math
import logging
from typing import List
from PyQt5 import QtWidgets, QtGui
from PyQt5 import QtGui
from NanoVNASaver.RFTools import Datapoint
from .Frequency import FrequencyChart

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -140,6 +140,8 @@ def detect_version(serial_port: serial.Serial) -> str:
# -H versions
if data.startswith("\r\nch> "):
return "vh"
if data.startswith("\r\n?\r\nch> "):
return "vh"
if data.startswith("2"):
return "v2"
logger.debug("Retry detection: %s", i + 1)

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,5 +1,23 @@
# NanoVNASaver
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging
from NanoVNASaver.Hardware.Serial import Interface
import serial
from PyQt5 import QtGui

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,7 +1,7 @@
# NanoVNASaver
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -202,6 +202,8 @@ class NanoVNA_V2(VNA):
ret = [str(x.real) + ' ' + str(x.imag) for x in ret]
return ret
return []
def resetSweep(self, start: int, stop: int):
self.setSweep(start, stop)

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -26,7 +26,6 @@ from PyQt5 import QtGui
from NanoVNASaver.Hardware.Serial import drain_serial, Interface
from NanoVNASaver.Hardware.VNA import VNA
from NanoVNASaver.Version import Version
logger = logging.getLogger(__name__)

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -87,7 +87,7 @@ class Marker(QtCore.QObject, Value):
self.name = f"Marker {Marker._instances}"
self.frequencyInput = FrequencyInput()
self.frequencyInput.setFixedHeight(20)
self.frequencyInput.setMinimumHeight(20)
self.frequencyInput.setAlignment(QtCore.Qt.AlignRight)
self.frequencyInput.editingFinished.connect(
lambda: self.setFrequency(
@ -108,7 +108,7 @@ class Marker(QtCore.QObject, Value):
###############################################################
self.btnColorPicker = QtWidgets.QPushButton("")
self.btnColorPicker.setFixedHeight(20)
self.btnColorPicker.setMinimumHeight(20)
self.btnColorPicker.setFixedWidth(20)
self.btnColorPicker.clicked.connect(
lambda: self.setColor(QtWidgets.QColorDialog.getColor(
@ -143,7 +143,9 @@ class Marker(QtCore.QObject, Value):
# line only if more then 3 selected
self.left_form = QtWidgets.QFormLayout()
self.left_form.setVerticalSpacing(0)
self.right_form = QtWidgets.QFormLayout()
self.right_form.setVerticalSpacing(0)
box_layout.addLayout(self.left_form)
box_layout.addWidget(line)
box_layout.addLayout(self.right_form)

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -23,7 +23,6 @@ from collections import OrderedDict
from time import sleep, strftime, localtime
from PyQt5 import QtWidgets, QtCore, QtGui
from numpy import exp
from .Windows import (
AboutWindow, AnalysisWindow, CalibrationWindow,
@ -192,6 +191,8 @@ class NanoVNASaver(QtWidgets.QWidget):
self.charts_layout = QtWidgets.QGridLayout()
QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Q"), self, self.close)
###############################################################
# Create main layout
###############################################################
@ -253,7 +254,7 @@ class NanoVNASaver(QtWidgets.QWidget):
self.marker_data_layout.addWidget(m.get_data_layout())
scroll2 = QtWidgets.QScrollArea()
scroll2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
#scroll2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
scroll2.setWidgetResizable(True)
scroll2.setVisible(True)
@ -275,6 +276,7 @@ class NanoVNASaver(QtWidgets.QWidget):
s11_control_box = QtWidgets.QGroupBox()
s11_control_box.setTitle("S11")
s11_control_layout = QtWidgets.QFormLayout()
s11_control_layout.setVerticalSpacing(0)
s11_control_box.setLayout(s11_control_layout)
self.s11_min_swr_label = QtWidgets.QLabel()
@ -287,6 +289,7 @@ class NanoVNASaver(QtWidgets.QWidget):
s21_control_box = QtWidgets.QGroupBox()
s21_control_box.setTitle("S21")
s21_control_layout = QtWidgets.QFormLayout()
s21_control_layout.setVerticalSpacing(0)
s21_control_box.setLayout(s21_control_layout)
self.s21_min_gain_label = QtWidgets.QLabel()
@ -301,7 +304,7 @@ class NanoVNASaver(QtWidgets.QWidget):
self.windows["analysis"] = AnalysisWindow(self)
btn_show_analysis = QtWidgets.QPushButton("Analysis ...")
btn_show_analysis.setFixedHeight(20)
btn_show_analysis.setMinimumHeight(20)
btn_show_analysis.clicked.connect(
lambda: self.display_window("analysis"))
self.marker_column.addWidget(btn_show_analysis)
@ -322,13 +325,13 @@ class NanoVNASaver(QtWidgets.QWidget):
tdr_control_box.setMaximumWidth(240)
self.tdr_result_label = QtWidgets.QLabel()
self.tdr_result_label.setFixedHeight(20)
self.tdr_result_label.setMinimumHeight(20)
tdr_control_layout.addRow(
"Estimated cable length:", self.tdr_result_label)
self.tdr_button = QtWidgets.QPushButton(
"Time Domain Reflectometry ...")
self.tdr_button.setFixedHeight(20)
self.tdr_button.setMinimumHeight(20)
self.tdr_button.clicked.connect(lambda: self.display_window("tdr"))
tdr_control_layout.addRow(self.tdr_button)
@ -353,10 +356,10 @@ class NanoVNASaver(QtWidgets.QWidget):
reference_control_layout = QtWidgets.QFormLayout(reference_control_box)
btn_set_reference = QtWidgets.QPushButton("Set current as reference")
btn_set_reference.setFixedHeight(20)
btn_set_reference.setMinimumHeight(20)
btn_set_reference.clicked.connect(self.setReference)
self.btnResetReference = QtWidgets.QPushButton("Reset reference")
self.btnResetReference.setFixedHeight(20)
self.btnResetReference.setMinimumHeight(20)
self.btnResetReference.clicked.connect(self.resetReference)
self.btnResetReference.setDisabled(True)
@ -374,11 +377,11 @@ class NanoVNASaver(QtWidgets.QWidget):
serial_control_box.setTitle("Serial port control")
serial_control_layout = QtWidgets.QFormLayout(serial_control_box)
self.serialPortInput = QtWidgets.QComboBox()
self.serialPortInput.setFixedHeight(20)
self.serialPortInput.setMinimumHeight(20)
self.rescanSerialPort()
self.serialPortInput.setEditable(True)
btn_rescan_serial_port = QtWidgets.QPushButton("Rescan")
btn_rescan_serial_port.setFixedHeight(20)
btn_rescan_serial_port.setMinimumHeight(20)
btn_rescan_serial_port.setFixedWidth(60)
btn_rescan_serial_port.clicked.connect(self.rescanSerialPort)
serial_port_input_layout = QtWidgets.QHBoxLayout()
@ -390,12 +393,12 @@ class NanoVNASaver(QtWidgets.QWidget):
serial_button_layout = QtWidgets.QHBoxLayout()
self.btnSerialToggle = QtWidgets.QPushButton("Connect to device")
self.btnSerialToggle.setFixedHeight(20)
self.btnSerialToggle.setMinimumHeight(20)
self.btnSerialToggle.clicked.connect(self.serialButtonClick)
serial_button_layout.addWidget(self.btnSerialToggle, stretch=1)
self.btnDeviceSettings = QtWidgets.QPushButton("Manage")
self.btnDeviceSettings.setFixedHeight(20)
self.btnDeviceSettings.setMinimumHeight(20)
self.btnDeviceSettings.setFixedWidth(60)
self.btnDeviceSettings.clicked.connect(
lambda: self.display_window("device_settings"))
@ -408,7 +411,7 @@ class NanoVNASaver(QtWidgets.QWidget):
###############################################################
btnOpenCalibrationWindow = QtWidgets.QPushButton("Calibration ...")
btnOpenCalibrationWindow.setFixedHeight(20)
btnOpenCalibrationWindow.setMinimumHeight(20)
self.calibrationWindow = CalibrationWindow(self)
btnOpenCalibrationWindow.clicked.connect(
lambda: self.display_window("calibration"))
@ -418,13 +421,13 @@ class NanoVNASaver(QtWidgets.QWidget):
###############################################################
btn_display_setup = QtWidgets.QPushButton("Display setup ...")
btn_display_setup.setFixedHeight(20)
btn_display_setup.setMinimumHeight(20)
btn_display_setup.setMaximumWidth(240)
btn_display_setup.clicked.connect(
lambda: self.display_window("setup"))
btn_about = QtWidgets.QPushButton("About ...")
btn_about.setFixedHeight(20)
btn_about.setMinimumHeight(20)
btn_about.setMaximumWidth(240)
btn_about.clicked.connect(
@ -432,7 +435,7 @@ class NanoVNASaver(QtWidgets.QWidget):
btn_open_file_window = QtWidgets.QPushButton("Files")
btn_open_file_window.setFixedHeight(20)
btn_open_file_window.setMinimumHeight(20)
btn_open_file_window.setMaximumWidth(240)
btn_open_file_window.clicked.connect(

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -103,8 +103,7 @@ def groupDelay(data: List[Datapoint], index: int) -> float:
delta_freq = data[idx1].freq - data[idx0].freq
if delta_freq == 0:
return 0
val = -delta_angle / math.tau / delta_freq
return val
return -delta_angle / math.tau / delta_freq
def impedance_to_capacitance(z: complex, freq: float) -> float:

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -158,8 +158,8 @@ class Value:
try:
self._value = (decimal.Decimal(value, context=Value.CTX)
* decimal.Decimal(factor, context=Value.CTX))
except decimal.InvalidOperation:
raise ValueError
except decimal.InvalidOperation as exc:
raise ValueError() from exc
self._value = clamp_value(
self._value, self.fmt.parse_clamp_min, self.fmt.parse_clamp_max)
return self

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -1,7 +1,7 @@
# NanoVNASaver
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -71,11 +71,13 @@ class CalibrationWindow(QtWidgets.QWidget):
self.cal_label[label_name] = QtWidgets.QLabel("Uncalibrated")
cal_btn[label_name] = QtWidgets.QPushButton(
label_name.capitalize())
cal_btn[label_name].setMinimumHeight(20)
cal_btn[label_name].clicked.connect(partial(self.manual_save, label_name))
calibration_control_layout.addRow(
cal_btn[label_name], self.cal_label[label_name])
self.input_offset_delay = QtWidgets.QDoubleSpinBox()
self.input_offset_delay.setMinimumHeight(20)
self.input_offset_delay.setValue(0)
self.input_offset_delay.setSuffix(" ps")
self.input_offset_delay.setAlignment(QtCore.Qt.AlignRight)
@ -86,15 +88,18 @@ class CalibrationWindow(QtWidgets.QWidget):
calibration_control_layout.addRow("Offset delay", self.input_offset_delay)
self.btn_automatic = QtWidgets.QPushButton("Calibration assistant")
self.btn_automatic.setMinimumHeight(20)
calibration_control_layout.addRow(self.btn_automatic)
self.btn_automatic.clicked.connect(self.automaticCalibration)
apply_reset_layout = QtWidgets.QHBoxLayout()
btn_apply = QtWidgets.QPushButton("Apply")
btn_apply.setMinimumHeight(20)
btn_apply.clicked.connect(self.calculate)
btn_reset = QtWidgets.QPushButton("Reset")
btn_reset.setMinimumHeight(20)
btn_reset.clicked.connect(self.reset)
apply_reset_layout.addWidget(btn_apply)
@ -114,8 +119,10 @@ class CalibrationWindow(QtWidgets.QWidget):
file_box = QtWidgets.QGroupBox("Files")
file_layout = QtWidgets.QFormLayout(file_box)
btn_save_file = QtWidgets.QPushButton("Save calibration")
btn_save_file.setMinimumHeight(20)
btn_save_file.clicked.connect(lambda: self.saveCalibration())
btn_load_file = QtWidgets.QPushButton("Load calibration")
btn_load_file.setMinimumHeight(20)
btn_load_file.clicked.connect(lambda: self.loadCalibration())
save_load_layout = QtWidgets.QHBoxLayout()
@ -137,10 +144,15 @@ class CalibrationWindow(QtWidgets.QWidget):
cal_short_form = QtWidgets.QFormLayout(self.cal_short_box)
self.cal_short_box.setDisabled(True)
self.short_l0_input = QtWidgets.QLineEdit("0")
self.short_l0_input.setMinimumHeight(20)
self.short_l1_input = QtWidgets.QLineEdit("0")
self.short_l1_input.setMinimumHeight(20)
self.short_l2_input = QtWidgets.QLineEdit("0")
self.short_l2_input.setMinimumHeight(20)
self.short_l3_input = QtWidgets.QLineEdit("0")
self.short_l3_input.setMinimumHeight(20)
self.short_length = QtWidgets.QLineEdit("0")
self.short_length.setMinimumHeight(20)
cal_short_form.addRow("L0 (H(e-12))", self.short_l0_input)
cal_short_form.addRow("L1 (H(e-24))", self.short_l1_input)
cal_short_form.addRow("L2 (H(e-33))", self.short_l2_input)
@ -151,10 +163,15 @@ class CalibrationWindow(QtWidgets.QWidget):
cal_open_form = QtWidgets.QFormLayout(self.cal_open_box)
self.cal_open_box.setDisabled(True)
self.open_c0_input = QtWidgets.QLineEdit("50")
self.open_c0_input.setMinimumHeight(20)
self.open_c1_input = QtWidgets.QLineEdit("0")
self.open_c1_input.setMinimumHeight(20)
self.open_c2_input = QtWidgets.QLineEdit("0")
self.open_c2_input.setMinimumHeight(20)
self.open_c3_input = QtWidgets.QLineEdit("0")
self.open_c3_input.setMinimumHeight(20)
self.open_length = QtWidgets.QLineEdit("0")
self.open_length.setMinimumHeight(20)
cal_open_form.addRow("C0 (F(e-15))", self.open_c0_input)
cal_open_form.addRow("C1 (F(e-27))", self.open_c1_input)
cal_open_form.addRow("C2 (F(e-36))", self.open_c2_input)
@ -165,10 +182,14 @@ class CalibrationWindow(QtWidgets.QWidget):
cal_load_form = QtWidgets.QFormLayout(self.cal_load_box)
self.cal_load_box.setDisabled(True)
self.load_resistance = QtWidgets.QLineEdit("50")
self.load_resistance.setMinimumHeight(20)
self.load_inductance = QtWidgets.QLineEdit("0")
self.load_inductance.setMinimumHeight(20)
# self.load_capacitance = QtWidgets.QLineEdit("0")
# self.load_capacitance.setMinimumHeight(20)
# self.load_capacitance.setDisabled(True) # Not yet implemented
self.load_length = QtWidgets.QLineEdit("0")
self.load_length.setMinimumHeight(20)
cal_load_form.addRow("Resistance (\N{OHM SIGN})", self.load_resistance)
cal_load_form.addRow("Inductance (H(e-12))", self.load_inductance)
# cal_load_form.addRow("Capacitance (F(e-12))", self.load_capacitance)
@ -178,6 +199,7 @@ class CalibrationWindow(QtWidgets.QWidget):
cal_through_form = QtWidgets.QFormLayout(self.cal_through_box)
self.cal_through_box.setDisabled(True)
self.through_length = QtWidgets.QLineEdit("0")
self.through_length.setMinimumHeight(20)
cal_through_form.addRow("Offset Delay (ps)", self.through_length)
cal_standard_layout.addWidget(self.cal_short_box)
@ -190,14 +212,18 @@ class CalibrationWindow(QtWidgets.QWidget):
self.cal_standard_save_box.setDisabled(True)
self.cal_standard_save_selector = QtWidgets.QComboBox()
self.cal_standard_save_selector.setMinimumHeight(20)
self.listCalibrationStandards()
cal_standard_save_layout.addWidget(self.cal_standard_save_selector)
cal_standard_save_button_layout = QtWidgets.QHBoxLayout()
btn_save_standard = QtWidgets.QPushButton("Save")
btn_save_standard.setMinimumHeight(20)
btn_save_standard.clicked.connect(self.saveCalibrationStandard)
btn_load_standard = QtWidgets.QPushButton("Load")
btn_load_standard.setMinimumHeight(20)
btn_load_standard.clicked.connect(self.loadCalibrationStandard)
btn_delete_standard = QtWidgets.QPushButton("Delete")
btn_delete_standard.setMinimumHeight(20)
btn_delete_standard.clicked.connect(self.deleteCalibrationStandard)
cal_standard_save_button_layout.addWidget(btn_load_standard)
cal_standard_save_button_layout.addWidget(btn_save_standard)

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -77,6 +77,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btnColorPicker = QtWidgets.QPushButton("")
self.btnColorPicker.setFixedWidth(20)
self.btnColorPicker.setMinimumHeight(20)
self.sweepColor = self.app.settings.value(
"SweepColor", defaultValue=QtGui.QColor(160, 140, 20, 128),
type=QtGui.QColor)
@ -89,6 +90,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btnSecondaryColorPicker = QtWidgets.QPushButton("")
self.btnSecondaryColorPicker.setFixedWidth(20)
self.btnSecondaryColorPicker.setMinimumHeight(20)
self.secondarySweepColor = self.app.settings.value("SecondarySweepColor",
defaultValue=QtGui.QColor(
20, 160, 140, 128),
@ -102,6 +104,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btnReferenceColorPicker = QtWidgets.QPushButton("")
self.btnReferenceColorPicker.setFixedWidth(20)
self.btnReferenceColorPicker.setMinimumHeight(20)
self.referenceColor = self.app.settings.value(
"ReferenceColor", defaultValue=QtGui.QColor(0, 0, 255, 48),
type=QtGui.QColor)
@ -114,6 +117,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btnSecondaryReferenceColorPicker = QtWidgets.QPushButton("")
self.btnSecondaryReferenceColorPicker.setFixedWidth(20)
self.btnSecondaryReferenceColorPicker.setMinimumHeight(20)
self.secondaryReferenceColor = self.app.settings.value(
"SecondaryReferenceColor",
defaultValue=QtGui.QColor(0, 0, 255, 48),
@ -130,6 +134,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btnSecondaryReferenceColorPicker)
self.pointSizeInput = QtWidgets.QSpinBox()
self.pointSizeInput.setMinimumHeight(20)
pointsize = self.app.settings.value("PointSize", 2, int)
self.pointSizeInput.setValue(pointsize)
self.changePointSize(pointsize)
@ -141,6 +146,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
display_options_layout.addRow("Point size", self.pointSizeInput)
self.lineThicknessInput = QtWidgets.QSpinBox()
self.lineThicknessInput.setMinimumHeight(20)
linethickness = self.app.settings.value("LineThickness", 1, int)
self.lineThicknessInput.setValue(linethickness)
self.changeLineThickness(linethickness)
@ -152,6 +158,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
display_options_layout.addRow("Line thickness", self.lineThicknessInput)
self.markerSizeInput = QtWidgets.QSpinBox()
self.markerSizeInput.setMinimumHeight(20)
markersize = self.app.settings.value("MarkerSize", 6, int)
self.markerSizeInput.setValue(markersize)
self.changeMarkerSize(markersize)
@ -200,6 +207,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btn_background_picker = QtWidgets.QPushButton("")
self.btn_background_picker.setFixedWidth(20)
self.btn_background_picker.setMinimumHeight(20)
self.btn_background_picker.clicked.connect(
lambda: self.setColor(
"background",
@ -212,6 +220,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btn_foreground_picker = QtWidgets.QPushButton("")
self.btn_foreground_picker.setFixedWidth(20)
self.btn_foreground_picker.setMinimumHeight(20)
self.btn_foreground_picker.clicked.connect(
lambda: self.setColor(
"foreground",
@ -223,6 +232,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btn_text_picker = QtWidgets.QPushButton("")
self.btn_text_picker.setFixedWidth(20)
self.btn_text_picker.setMinimumHeight(20)
self.btn_text_picker.clicked.connect(
lambda: self.setColor(
"text",
@ -238,6 +248,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
font_options_box = QtWidgets.QGroupBox("Font")
font_options_layout = QtWidgets.QFormLayout(font_options_box)
self.font_dropdown = QtWidgets.QComboBox()
self.font_dropdown.setMinimumHeight(20)
self.font_dropdown.addItems(["7", "8", "9", "10", "11", "12"])
font_size = self.app.settings.value("FontSize",
defaultValue="8",
@ -258,6 +269,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btn_bands_picker = QtWidgets.QPushButton("")
self.btn_bands_picker.setFixedWidth(20)
self.btn_bands_picker.setMinimumHeight(20)
self.btn_bands_picker.clicked.connect(
lambda: self.setColor(
"bands",
@ -268,6 +280,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
bands_layout.addRow("Chart bands", self.btn_bands_picker)
self.btn_manage_bands = QtWidgets.QPushButton("Manage bands")
self.btn_manage_bands.setMinimumHeight(20)
self.bandsWindow = BandsWindow(self.app)
self.btn_manage_bands.clicked.connect(self.displayBandsWindow)
@ -288,6 +301,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.btn_vswr_picker = QtWidgets.QPushButton("")
self.btn_vswr_picker.setFixedWidth(20)
self.btn_vswr_picker.setMinimumHeight(20)
self.btn_vswr_picker.clicked.connect(
lambda: self.setColor(
"vswr",
@ -298,6 +312,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
vswr_marker_layout.addRow("VSWR Markers", self.btn_vswr_picker)
self.vswr_marker_dropdown = QtWidgets.QComboBox()
self.vswr_marker_dropdown.setMinimumHeight(20)
vswr_marker_layout.addRow(self.vswr_marker_dropdown)
if len(self.vswrMarkers) == 0:
@ -310,7 +325,9 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.vswr_marker_dropdown.setCurrentIndex(0)
btn_add_vswr_marker = QtWidgets.QPushButton("Add ...")
btn_add_vswr_marker.setMinimumHeight(20)
btn_remove_vswr_marker = QtWidgets.QPushButton("Remove")
btn_remove_vswr_marker.setMinimumHeight(20)
vswr_marker_btn_layout = QtWidgets.QHBoxLayout()
vswr_marker_btn_layout.addWidget(btn_add_vswr_marker)
vswr_marker_btn_layout.addWidget(btn_remove_vswr_marker)
@ -323,10 +340,13 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
markers_layout = QtWidgets.QFormLayout(markers_box)
btn_add_marker = QtWidgets.QPushButton("Add")
btn_add_marker.setMinimumHeight(30)
btn_add_marker.clicked.connect(self.addMarker)
self.btn_remove_marker = QtWidgets.QPushButton("Remove")
self.btn_remove_marker.setMinimumHeight(30)
self.btn_remove_marker.clicked.connect(self.removeMarker)
btn_marker_settings = QtWidgets.QPushButton("Settings ...")
btn_marker_settings.setMinimumHeight(30)
btn_marker_settings.clicked.connect(self.displayMarkerWindow)
marker_btn_layout = QtWidgets.QHBoxLayout()
@ -355,6 +375,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
selections.append("None")
chart00_selection = QtWidgets.QComboBox()
chart00_selection.setMinimumHeight(30)
chart00_selection.addItems(selections)
chart00 = self.app.settings.value("Chart00", "S11 Smith Chart")
if chart00_selection.findText(chart00) > -1:
@ -366,6 +387,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
charts_layout.addWidget(chart00_selection, 0, 0)
chart01_selection = QtWidgets.QComboBox()
chart01_selection.setMinimumHeight(30)
chart01_selection.addItems(selections)
chart01 = self.app.settings.value("Chart01", "S11 Return Loss")
if chart01_selection.findText(chart01) > -1:
@ -377,6 +399,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
charts_layout.addWidget(chart01_selection, 0, 1)
chart02_selection = QtWidgets.QComboBox()
chart02_selection.setMinimumHeight(30)
chart02_selection.addItems(selections)
chart02 = self.app.settings.value("Chart02", "None")
if chart02_selection.findText(chart02) > -1:
@ -388,6 +411,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
charts_layout.addWidget(chart02_selection, 0, 2)
chart10_selection = QtWidgets.QComboBox()
chart10_selection.setMinimumHeight(30)
chart10_selection.addItems(selections)
chart10 = self.app.settings.value("Chart10", "S21 Polar Plot")
if chart10_selection.findText(chart10) > -1:
@ -399,6 +423,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
charts_layout.addWidget(chart10_selection, 1, 0)
chart11_selection = QtWidgets.QComboBox()
chart11_selection.setMinimumHeight(30)
chart11_selection.addItems(selections)
chart11 = self.app.settings.value("Chart11", "S21 Gain")
if chart11_selection.findText(chart11) > -1:
@ -410,6 +435,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
charts_layout.addWidget(chart11_selection, 1, 1)
chart12_selection = QtWidgets.QComboBox()
chart12_selection.setMinimumHeight(30)
chart12_selection.addItems(selections)
chart12 = self.app.settings.value("Chart12", "None")
if chart12_selection.findText(chart12) > -1:

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -56,6 +56,7 @@ class SweepSettingsWindow(QtWidgets.QWidget):
layout = QtWidgets.QFormLayout(box)
input_title = QtWidgets.QLineEdit(self.app.sweep.properties.name)
input_title.setMinimumHeight(20)
input_title.editingFinished.connect(
lambda: self.update_title(input_title.text()))
layout.addRow(input_title)
@ -66,26 +67,33 @@ class SweepSettingsWindow(QtWidgets.QWidget):
layout = QtWidgets.QFormLayout(box)
# Sweep Mode
sweep_btn_layout = QtWidgets.QHBoxLayout()
radio_button = QtWidgets.QRadioButton("Single sweep")
radio_button.setMinimumHeight(20)
radio_button.setChecked(
self.app.sweep.properties.mode == SweepMode.SINGLE)
radio_button.clicked.connect(
lambda: self.update_mode(SweepMode.SINGLE))
layout.addWidget(radio_button)
sweep_btn_layout.addWidget(radio_button)
radio_button = QtWidgets.QRadioButton("Continous sweep")
radio_button.setMinimumHeight(20)
radio_button.setChecked(
self.app.sweep.properties.mode == SweepMode.CONTINOUS)
radio_button.clicked.connect(
lambda: self.update_mode(SweepMode.CONTINOUS))
layout.addWidget(radio_button)
sweep_btn_layout.addWidget(radio_button)
radio_button = QtWidgets.QRadioButton("Averaged sweep")
radio_button.setMinimumHeight(20)
radio_button.setChecked(
self.app.sweep.properties.mode == SweepMode.AVERAGE)
radio_button.clicked.connect(
lambda: self.update_mode(SweepMode.AVERAGE))
layout.addWidget(radio_button)
sweep_btn_layout.addWidget(radio_button)
layout.addRow(sweep_btn_layout)
# Log sweep
label = QtWidgets.QLabel(
@ -94,23 +102,28 @@ class SweepSettingsWindow(QtWidgets.QWidget):
" amount of datapoints and many segments. Step display in"
" SweepControl cannot reflect this currently.")
label.setWordWrap(True)
label.setMinimumSize(600,70)
layout.addRow(label)
checkbox = QtWidgets.QCheckBox("Logarithmic sweep")
checkbox.setMinimumHeight(20)
checkbox.setCheckState(self.app.sweep.properties.logarithmic)
checkbox.toggled.connect(
lambda: self.update_logarithmic(checkbox.isChecked()))
layout.addWidget(checkbox)
layout.addRow(checkbox)
# Averaging
label = QtWidgets.QLabel(
"Averaging allows discarding outlying samples to get better"
" averages. Common values are 3/0, 5/2, 9/4 and 25/6.")
label.setWordWrap(True)
label.setMinimumHeight(50)
layout.addRow(label)
averages = QtWidgets.QLineEdit(
str(self.app.sweep.properties.averages[0]))
averages.setMinimumHeight(20)
truncates = QtWidgets.QLineEdit(
str(self.app.sweep.properties.averages[1]))
truncates.setMinimumHeight(20)
averages.editingFinished.connect(
lambda: self.update_averaging(averages, truncates))
truncates.editingFinished.connect(
@ -124,9 +137,11 @@ class SweepSettingsWindow(QtWidgets.QWidget):
" attenuator in line with the S21 input (CH1) here you can"
" specify it.")
label.setWordWrap(True)
label.setMinimumHeight(50)
layout.addRow(label)
input_att = QtWidgets.QLineEdit(str(self.app.s21att))
input_att.setMinimumHeight(20)
input_att.editingFinished.connect(
lambda: self.update_attenuator(input_att))
layout.addRow("Attenuator in port CH1 (s21) in dB", input_att)
@ -135,26 +150,29 @@ class SweepSettingsWindow(QtWidgets.QWidget):
def sweep_box(self) -> 'QtWidgets.QWidget':
box = QtWidgets.QGroupBox("Sweep band")
layout = QtWidgets.QFormLayout(box)
sweep_pad_layout = QtWidgets.QHBoxLayout()
self.band_list = QtWidgets.QComboBox()
self.band_list.setMinimumHeight(20)
self.band_list.setModel(self.app.bands)
# pylint: disable=unnecessary-lambda
self.band_list.currentIndexChanged.connect(lambda: self.update_band())
layout.addRow("Select band", self.band_list)
for raw_label, btn_label, value in (("Pad band limits", "None", 0),
("", "10%", 10),
("", "25%", 25),
("", "100%", 100),):
sweep_pad_layout.addWidget(QtWidgets.QLabel("Pad band limits:"))
for btn_label, value in (("None", 0), ("10%", 10), ("25%", 25), ("100%", 100),):
radio_button = QtWidgets.QRadioButton(btn_label)
radio_button.setMinimumHeight(20)
radio_button.setChecked(self.padding == value)
radio_button.clicked.connect(partial(self.update_padding, value))
layout.addRow(raw_label, radio_button)
sweep_pad_layout.addWidget(radio_button)
layout.addRow(sweep_pad_layout)
self.band_label = QtWidgets.QLabel()
layout.addRow(self.band_label)
btn_set_band_sweep = QtWidgets.QPushButton("Set band sweep")
btn_set_band_sweep.setMinimumHeight(20)
btn_set_band_sweep.clicked.connect(lambda: self.update_band(True))
layout.addRow(btn_set_band_sweep)
return box

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -4,7 +4,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -12,7 +12,7 @@ sweep frequency spans in segments to gain more than 101 data
points, and generally display and analyze the resulting data.
- Copyright 2019, 2020 Rune B. Broberg
- Copyright 2020 NanoVNA-Saver Authors
- Copyright 2020, 2021 NanoVNA-Saver Authors
Latest Changes
--------------

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -17,11 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import unittest
from math import inf
# Import targets to be tested
from NanoVNASaver.SITools import Format, Value
from decimal import Decimal
from math import inf
F_DEFAULT = Format()

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

Wyświetl plik

@ -2,7 +2,7 @@
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020 NanoVNA-Saver Authors
# Copyright (C) 2020,2021 NanoVNA-Saver Authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by