Skip to content

Commit

Permalink
Merge pull request #452 from NanoVNA-Saver/testing
Browse files Browse the repository at this point in the history
Version 0.3.10
  • Loading branch information
zarath authored Jan 4, 2022
2 parents b0a21bc + 4a620a5 commit cbcf61a
Show file tree
Hide file tree
Showing 98 changed files with 7,536 additions and 2,404 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pythoncoverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, ]
# python-version: [3.7, 3.8]
python-version: [3.7, ]
python-version: [3.9, ]

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- v*
workflow_dispatch:

jobs:
release:
Expand All @@ -14,12 +15,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install dependencies and pyinstall
run: |
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt
pip install PyInstaller==4.0
pip install PyInstaller==4.5.1
- name: Build binary
run: |
pyinstaller --onefile -n nanovna-saver nanovna-saver.py
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- v*
workflow_dispatch:

jobs:
release:
Expand All @@ -14,12 +15,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.9
- name: Install dependencies and pyinstall
run: |
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt
pip install PyInstaller==4.0
pip install PyInstaller==4.5.1
- name: Build binary
run: |
pyinstaller --onefile -n nanovna-saver nanovna-saver.py
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- v*
workflow_dispatch:

jobs:
release:
Expand All @@ -17,13 +18,13 @@ 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: |
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt
pip install PyInstaller==4.3
pip install PyInstaller==4.7
- name: Build binary
run: |
pyinstaller --onefile -n nanovna-saver.exe nanovna-saver.py
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Changelog
=========

v0.3.10
------

- Default Band ranges for 5 and 9cm
- Layout should fit on smaller screens
- Fixed fixed axis settings
- Show VNA type in port selector
- Recognise tinySA (screenshot only)
- Some more cables in TDR
- Reference plane applied after calibration
- Calibration fixes by DiSlord

v0.3.9
------

Expand Down
6 changes: 3 additions & 3 deletions NanoVNASaver/About.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.9"
VERSION = "0.3.10"
VERSION_URL = (
"https://raw.githubusercontent.com/"
"NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py")
Expand All @@ -26,7 +26,7 @@
INFO = f"""NanoVNASaver {VERSION}
Copyright (C) 2019, 2020 Rune B. Broberg
Copyright (C) 2020 NanoVNA-Saver Authors
Copyright (C) 2020, 2021 NanoVNA-Saver Authors
This program comes with ABSOLUTELY NO WARRANTY
This program is licensed under the GNU General Public License version 3
Expand Down
17 changes: 7 additions & 10 deletions NanoVNASaver/Analysis/Analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,7 +19,6 @@
import logging
import math
import numpy as np
from scipy.signal import argrelextrema
from PyQt5 import QtWidgets
from scipy import signal

Expand All @@ -30,7 +29,7 @@ class Analysis:
_widget = None

@classmethod
def find_crossing_zero(cls, data, threshold=0):
def find_crossing_zero(cls, data):
'''
Find values crossing zero
Expand All @@ -45,7 +44,6 @@ def find_crossing_zero(cls, data, threshold=0):
:param cls:
:param data: list of values
:param threshold: unused, for future manage flipping around 0
'''
my_data = np.array(data)
zeroes = np.where(my_data == 0)[0]
Expand Down Expand Up @@ -118,8 +116,7 @@ def find_maximums(cls, data, threshold=None):
# maximums = argrelextrema(my_data, np.greater)[0]
if threshold is None:
return peaks
else:
return [k for k in peaks if data[k] > threshold]
return [k for k in peaks if data[k] > threshold]

def __init__(self, app: QtWidgets.QWidget):
self.app = app
Expand All @@ -136,10 +133,10 @@ def reset(self):
def calculateRolloff(self, location1, location2):
if location1 == location2:
return 0, 0
frequency1 = self.app.data21[location1].freq
frequency2 = self.app.data21[location2].freq
gain1 = self.app.data21[location1].gain
gain2 = self.app.data21[location2].gain
frequency1 = self.app.data.s21[location1].freq
frequency2 = self.app.data.s21[location2].freq
gain1 = self.app.data.s21[location1].gain
gain2 = self.app.data.s21[location2].gain
frequency_factor = frequency2 / frequency1
if frequency_factor < 1:
frequency_factor = 1 / frequency_factor
Expand Down
97 changes: 80 additions & 17 deletions NanoVNASaver/Analysis/AntennaAnalysis.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,6 +15,9 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

from PyQt5.Qt import QTimer

'''
Created on May 30th 2020
Expand All @@ -37,28 +40,88 @@ class MagLoopAnalysis(VSWRAnalysis):
'''
max_dips_shown = 1
vswr_limit_value = 2.56
bandwith = 250000

vswr_bandwith_value = 2.56 # -3 dB ?!?
bandwith = 25000 # 25 kHz

def __init__(self, app):
# app.sweep_control.get_start() return -1 ?!?
# will populate first runAnalysis()
self.min_freq = None # app.sweep_control.get_start()
self.max_freq = None # app.sweep_control.get_end()
self.vswr_limit_value = self.vswr_bandwith_value

super().__init__(app)

def runAnalysis(self):
super().runAnalysis()
new_start = self.app.sweep_control.get_start()
new_end = self.app.sweep_control.get_end()
if self.min_freq is None:
self.min_freq = new_start
self.max_freq = new_end
logger.debug("setting hard limits to %s - %s",
self.min_freq, self.max_freq)

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
"Multiple minimums, not magloop or try to lower VSWR limit"))
return
if len(self.minimums) == 1:
m = self.minimums[0]
start, lowest, end = m
if start != end:
Q = self.app.data11[lowest].freq / \
(self.app.data11[end].freq - self.app.data11[start].freq)
self.layout.addRow(
"Q", QtWidgets.QLabel("{}".format(int(Q))))
self.app.sweep_control.set_start(self.app.data11[start].freq)
self.app.sweep_control.set_end(self.app.data11[end].freq)
if self.vswr_limit_value == self.vswr_bandwith_value:
Q = self.app.data.s11[lowest].freq / \
(self.app.data.s11[end].freq -
self.app.data.s11[start].freq)
self.layout.addRow(
"Q", QtWidgets.QLabel("{}".format(int(Q))))
new_start = self.app.data.s11[start].freq - self.bandwith
new_end = self.app.data.s11[end].freq + self.bandwith
logger.debug("Single Spot, new scan on %s-%s",
new_start, new_end)

else:
self.app.sweep_control.set_start(
self.app.data11[start].freq - self.bandwith)
self.app.sweep_control.set_end(
self.app.data11[end].freq + self.bandwith)
new_start = self.app.data.s11[start].freq - 2 * self.bandwith
new_end = self.app.data.s11[end].freq + 2 * self.bandwith
logger.debug(" Zoom to %s-%s", new_start, new_end)

if self.vswr_limit_value > self.vswr_bandwith_value:
self.vswr_limit_value = max(
self.vswr_bandwith_value, self.vswr_limit_value - 1)
self.input_vswr_limit.setValue(self.vswr_limit_value)
logger.debug(
"found higher minimum, lowering vswr search to %s", self.vswr_limit_value)
else:
new_start = new_start - 5 * self.bandwith
new_end = new_end + 5 * self.bandwith
if all((new_start <= self.min_freq,
new_end >= self.max_freq)):
if self.vswr_limit_value < 10:
self.vswr_limit_value += 2
self.input_vswr_limit.setValue(self.vswr_limit_value)
logger.debug(
"no minimum found, looking for higher value %s", self.vswr_limit_value)
new_start = max(self.min_freq, new_start)
new_end = min(self.max_freq, new_end)
logger.debug("next search will be %s - %s for vswr %s",
new_start,
new_end,
self.vswr_limit_value)

self.app.sweep_control.set_start(new_start)
self.app.sweep_control.set_end(new_end)
# set timer to let finish all stuff before new sweep
QTimer.singleShot(2000, self._safe_sweep)

def _safe_sweep(self):
'''
sweep only if button enabled
to prevent multiple/concurrent sweep
'''

if self.app.sweep_control.btn_start.isEnabled():
self.app.sweep_start()
else:
logger.error("sweep alredy running")
Loading

0 comments on commit cbcf61a

Please sign in to comment.