moved to pyscaffold directory structure

and fixed resonances analysys crash #608
pull/609/head
Holger Müller 2023-03-06 08:51:21 +01:00
rodzic c0e177bf1a
commit b0110002ec
148 zmienionych plików z 1544 dodań i 372 usunięć

Wyświetl plik

@ -1,20 +1,9 @@
# .coveragerc to control coverage.py
[run]
# ignore GUI code atm.
omit =
NanoVNASaver/About.py
NanoVNASaver/Analysis/*.py
NanoVNASaver/Calibration.py
NanoVNASaver/Charts/*.py
NanoVNASaver/Controls/*.py
NanoVNASaver/Hardware/*.py
NanoVNASaver/Inputs.py
NanoVNASaver/Marker/*.py
NanoVNASaver/NanoVNASaver.py
NanoVNASaver/Settings/Bands.py
NanoVNASaver/SweepWorker.py
NanoVNASaver/Windows/*.py
**/__init__.py
NanoVNASaver/__main__.py
branch = True
source = tests
#omit = src/
[report]
fail_under = 90.0
show_missing = True

76
.gitignore vendored
Wyświetl plik

@ -1,26 +1,54 @@
/venv/
/env/
.idea/
.tox/
.vscode/
/build/
/dist/
/nanovna-saver.spec
*.egg-info/
*.pyc
*.cal
settings.json
.gitignore
.coverage
.flatpak-builder
/nanovna-saver.exe.spec
/deb_dist/
*.deb
*.rpm
*.tar.gz
# Temporary and binary files
*~
.*~
*.bak
*.new
*.old
*.py[cod]
*.so
*.cfg
!.isort.cfg
!setup.cfg
*.orig
*.log
*.pot
__pycache__/*
.cache/*
.*.swp
*/.ipynb_checkpoints/*
.DS_Store
# Project files
.ropeproject
.project
.pydevproject
.settings
.idea
.vscode
tags
# Package files
*.egg
*.eggs/
.installed.cfg
*.egg-info
# Unittest and coverage
htmlcov/*
.coverage
.coverage.*
.tox
junit*.xml
coverage.xml
.pytest_cache/
# Build and docs folder/files
build/*
dist/*
sdist/*
docs/api/*
docs/_rst/*
docs/_build/*
cover/*
MANIFEST
# Per-project virtualenvs
.venv*/
.conda*/
.python-version

27
.readthedocs.yml 100644
Wyświetl plik

@ -0,0 +1,27 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml
# Optionally build your docs in additional formats such as PDF
formats:
- pdf
build:
os: ubuntu-22.04
tools:
python: "3.11"
python:
install:
- requirements: docs/requirements.txt
- {path: ., method: pip}

42
AUTHORS.rst 100644
Wyświetl plik

@ -0,0 +1,42 @@
============
Contributors
============
* Attilio Panniello <attilio.panniello@gmail.com>
* bicycleGuy <michaelrunyan@Michaels-iMac.home>
* Carl Tremblay <cinosh07@hotmail.com>
* cinosh07 <cinosh07@hotmail.com>
* Dan Halbert <halbert@halwitz.org>
* Daniel Lingvay <dlingvay@grubhub.com>
* Davide Gerhard <rainbow@irh.it>
* Denis Bondar <bondar.den@gmail.com>
* dhunt1342 <dhunt1342@users.noreply.github.com>
* DiSlord <dislord@mail.ru>
* Frank Kunz <mailinglists@kunz-im-inter.net>
* Galileo <galileo@pkm-inc.com>
* Holger Mueller <zarath@gmx.de>
* ikatkov <ikatkov@gmail.com>
* Ishmael Samuel <ishmaelsamuel79@gmail.com>
* James Limbouris <james@digitalmatter.com>
* Jaroslav Škarvada <jskarvad@redhat.com>
* Kevin Zembower <kevin@zembower.org>
* Mark Zachmann <Mark.Zachmann@snug.dog>
* Martin <Ho-Ro@users.noreply.github.com>
* Mauro Gaioni <m.gaioni@asst-valcamonica.it>
* Mauro <mauro@lenny.station>
* mihtjel <mihtjel@gmail.com>
* Mike4U <9957897+Mike4U@users.noreply.github.com>
* mss <marcspeck@gmail.com>
* Neil Katin <github2@askneil.com>
* Ohan Smit <psynosaur@gmail.com>
* Olgierd Pilarczyk <opilarczyk@egnyte.com>
* Oscilllator <harry.dudleybestow@gmail.com>
* Patrick Coleman <blinken@gmail.com>
* Peter B Marks <peter.marks@pobox.com>
* Psynosaur <psynosaur@gmail.com>
* RandMental <RandMental@users.noreply.github.com>
* Roel Jordans <r.jordans@tue.nl>
* Rune B. Broberg <mihtjel@gmail.com>
* Sascha Silbe <sascha-pgp@silbe.org>
* sysjoint-tek <63992872+sysjoint-tek@users.noreply.github.com>
* zstadler <zeev.stadler@gmail.com>

322
CONTRIBUTING.rst 100644
Wyświetl plik

@ -0,0 +1,322 @@
============
Contributing
============
Welcome to ``nanovna-saver`` contributor's guide.
This document focuses on getting any potential contributor familiarized
with the development processes, but `other kinds of contributions`_ are also
appreciated.
If you are new to using git_ or have never collaborated in a project previously,
please have a look at `contribution-guide.org`_. Other resources are also
listed in the excellent `guide created by FreeCodeCamp`_ [#contrib1]_.
Please notice, all users and contributors are expected to be **open,
considerate, reasonable, and respectful**. When in doubt, `Python Software
Foundation's Code of Conduct`_ is a good reference in terms of behavior
guidelines.
Issue Reports
=============
If you experience bugs or general issues with ``nanovna-saver``, please have a look
on the `issue tracker`_. If you don't see anything useful there, please feel
free to fire an issue report.
.. tip::
Please don't forget to include the closed issues in your search.
Sometimes a solution was already reported, and the problem is considered
**solved**.
New issue reports should include information about your programming environment
(e.g., operating system, Python version) and steps to reproduce the problem.
Please try also to simplify the reproduction steps to a very minimal example
that still illustrates the problem you are facing. By removing other factors,
you help us to identify the root cause of the issue.
Documentation Improvements
==========================
You can help improve ``nanovna-saver`` docs by making them more readable and coherent, or
by adding missing information and correcting mistakes.
``nanovna-saver`` documentation should use Sphinx_ as its main documentation compiler.
This means that the docs are kept in the same repository as the project code, and
that any documentation update is done in the same way was a code contribution.
.. tip::
Please notice that the `GitHub web interface`_ provides a quick way of
propose changes in ``nanovna-saver``'s files. While this mechanism can
be tricky for normal code contributions, it works perfectly fine for
contributing to the docs, and can be quite handy.
If you are interested in trying this method out, please navigate to
the ``docs`` folder in the source repository_, find which file you
would like to propose changes and click in the little pencil icon at the
top, to open `GitHub's code editor`_. Once you finish editing the file,
please write a message in the form at the bottom of the page describing
which changes have you made and what are the motivations behind them and
submit your proposal.
When working on documentation changes in your local machine, you can
compile them using |tox|_::
tox -e docs
and use Python's built-in web server for a preview in your web browser
(``http://localhost:8000``)::
python3 -m http.server --directory 'docs/_build/html'
Code Contributions
==================
.. todo:: Please include a reference or explanation about the internals of the project.
An architecture description, design principles or at least a summary of the
main concepts will make it easy for potential contributors to get started
quickly.
Submit an issue
---------------
Before you work on any non-trivial code contribution it's best to first create
a report in the `issue tracker`_ to start a discussion on the subject.
This often provides additional considerations and avoids unnecessary work.
Create an environment
---------------------
Before you start coding, we recommend creating an isolated `virtual
environment`_ to avoid any problems with your installed Python packages.
This can easily be done via either |virtualenv|_::
virtualenv <PATH TO VENV>
source <PATH TO VENV>/bin/activate
or Miniconda_::
conda create -n nanovna-saver python=3 six virtualenv pytest pytest-cov
conda activate nanovna-saver
Clone the repository
--------------------
#. Create an user account on |the repository service| if you do not already have one.
#. Fork the project repository_: click on the *Fork* button near the top of the
page. This creates a copy of the code under your account on |the repository service|.
#. Clone this copy to your local disk::
git clone git@github.com:YourLogin/nanovna-saver.git
cd nanovna-saver
#. You should run::
pip install -U pip setuptools -e .
to be able to import the package under development in the Python REPL.
.. todo:: if you are not using pre-commit, please remove the following item:
#. Install |pre-commit|_::
pip install pre-commit
pre-commit install
``nanovna-saver`` comes with a lot of hooks configured to automatically help the
developer to check the code being written.
Implement your changes
----------------------
#. Create a branch to hold your changes::
git checkout -b my-feature
and start making changes. Never work on the main branch!
#. Start your work on this branch. Don't forget to add docstrings_ to new
functions, modules and classes, especially if they are part of public APIs.
#. Add yourself to the list of contributors in ``AUTHORS.rst``.
#. When youre done editing, do::
git add <MODIFIED FILES>
git commit
to record your changes in git_.
.. todo:: if you are not using pre-commit, please remove the following item:
Please make sure to see the validation messages from |pre-commit|_ and fix
any eventual issues.
This should automatically use flake8_/black_ to check/fix the code style
in a way that is compatible with the project.
.. important:: Don't forget to add unit tests and documentation in case your
contribution adds an additional feature and is not just a bugfix.
Moreover, writing a `descriptive commit message`_ is highly recommended.
In case of doubt, you can check the commit history with::
git log --graph --decorate --pretty=oneline --abbrev-commit --all
to look for recurring communication patterns.
#. Please check that your changes don't break any unit tests with::
tox
(after having installed |tox|_ with ``pip install tox`` or ``pipx``).
You can also use |tox|_ to run several other pre-configured tasks in the
repository. Try ``tox -av`` to see a list of the available checks.
Submit your contribution
------------------------
#. If everything works fine, push your local branch to |the repository service| with::
git push -u origin my-feature
#. Go to the web page of your fork and click |contribute button|
to send your changes for review.
.. todo:: if you are using GitHub, you can uncomment the following paragraph
Find more detailed information in `creating a PR`_. You might also want to open
the PR as a draft first and mark it as ready for review after the feedbacks
from the continuous integration (CI) system or any required fixes.
Troubleshooting
---------------
The following tips can be used when facing problems to build or test the
package:
#. Make sure to fetch all the tags from the upstream repository_.
The command ``git describe --abbrev=0 --tags`` should return the version you
are expecting. If you are trying to run CI scripts in a fork repository,
make sure to push all the tags.
You can also try to remove all the egg files or the complete egg folder, i.e.,
``.eggs``, as well as the ``*.egg-info`` folders in the ``src`` folder or
potentially in the root of your project.
#. Sometimes |tox|_ misses out when new dependencies are added, especially to
``setup.cfg`` and ``docs/requirements.txt``. If you find any problems with
missing dependencies when running a command with |tox|_, try to recreate the
``tox`` environment using the ``-r`` flag. For example, instead of::
tox -e docs
Try running::
tox -r -e docs
#. Make sure to have a reliable |tox|_ installation that uses the correct
Python version (e.g., 3.7+). When in doubt you can run::
tox --version
# OR
which tox
If you have trouble and are seeing weird errors upon running |tox|_, you can
also try to create a dedicated `virtual environment`_ with a |tox|_ binary
freshly installed. For example::
virtualenv .venv
source .venv/bin/activate
.venv/bin/pip install tox
.venv/bin/tox -e all
#. `Pytest can drop you`_ in an interactive session in the case an error occurs.
In order to do that you need to pass a ``--pdb`` option (for example by
running ``tox -- -k <NAME OF THE FALLING TEST> --pdb``).
You can also setup breakpoints manually instead of using the ``--pdb`` option.
Maintainer tasks
================
Releases
--------
.. todo:: This section assumes you are using PyPI to publicly release your package.
If instead you are using a different/private package index, please update
the instructions accordingly.
If you are part of the group of maintainers and have correct user permissions
on PyPI_, the following steps can be used to release a new version for
``nanovna-saver``:
#. Make sure all unit tests are successful.
#. Tag the current commit on the main branch with a release tag, e.g., ``v1.2.3``.
#. Push the new tag to the upstream repository_, e.g., ``git push upstream v1.2.3``
#. Clean up the ``dist`` and ``build`` folders with ``tox -e clean``
(or ``rm -rf dist build``)
to avoid confusion with old builds and Sphinx docs.
#. Run ``tox -e build`` and check that the files in ``dist`` have
the correct version (no ``.dirty`` or git_ hash) according to the git_ tag.
Also check the sizes of the distributions, if they are too big (e.g., >
500KB), unwanted clutter may have been accidentally included.
#. Run ``tox -e publish -- --repository pypi`` and check that everything was
uploaded to PyPI_ correctly.
.. [#contrib1] Even though, these resources focus on open source projects and
communities, the general ideas behind collaborating with other developers
to collectively create software are general and can be applied to all sorts
of environments, including private companies and proprietary code bases.
.. <-- start -->
.. todo:: Please review and change the following definitions:
.. |the repository service| replace:: GitHub
.. |contribute button| replace:: "Create pull request"
.. _repository: https://github.com/<USERNAME>/nanovna-saver
.. _issue tracker: https://github.com/<USERNAME>/nanovna-saver/issues
.. <-- end -->
.. |virtualenv| replace:: ``virtualenv``
.. |pre-commit| replace:: ``pre-commit``
.. |tox| replace:: ``tox``
.. _black: https://pypi.org/project/black/
.. _CommonMark: https://commonmark.org/
.. _contribution-guide.org: https://www.contribution-guide.org/
.. _creating a PR: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
.. _descriptive commit message: https://chris.beams.io/posts/git-commit
.. _docstrings: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
.. _first-contributions tutorial: https://github.com/firstcontributions/first-contributions
.. _flake8: https://flake8.pycqa.org/en/stable/
.. _git: https://git-scm.com
.. _GitHub's fork and pull request workflow: https://guides.github.com/activities/forking/
.. _guide created by FreeCodeCamp: https://github.com/FreeCodeCamp/how-to-contribute-to-open-source
.. _Miniconda: https://docs.conda.io/en/latest/miniconda.html
.. _MyST: https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html
.. _other kinds of contributions: https://opensource.guide/how-to-contribute
.. _pre-commit: https://pre-commit.com/
.. _PyPI: https://pypi.org/
.. _PyScaffold's contributor's guide: https://pyscaffold.org/en/stable/contributing.html
.. _Pytest can drop you: https://docs.pytest.org/en/stable/how-to/failures.html#using-python-library-pdb-with-pytest
.. _Python Software Foundation's Code of Conduct: https://www.python.org/psf/conduct/
.. _reStructuredText: https://www.sphinx-doc.org/en/master/usage/restructuredtext/
.. _Sphinx: https://www.sphinx-doc.org/en/master/
.. _tox: https://tox.wiki/en/stable/
.. _virtual environment: https://realpython.com/python-virtual-environments-a-primer/
.. _virtualenv: https://virtualenv.pypa.io/en/stable/
.. _GitHub web interface: https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files
.. _GitHub's code editor: https://docs.github.com/en/repositories/working-with-files/managing-files/editing-files

14
Pipfile
Wyświetl plik

@ -1,14 +0,0 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
pyserial = "*"
pyqt5 = "*"
numpy = "*"
[requires]
python_version = "3.7"

233
README.md
Wyświetl plik

@ -1,233 +0,0 @@
[![Latest Release](https://img.shields.io/github/v/release/NanoVNA-Saver/nanovna-saver.svg)](https://github.com/NanoVNA-Saver/nanovna-saver/releases/latest)
[![License](https://img.shields.io/github/license/NanoVNA-Saver/nanovna-saver.svg)](https://github.com/NanoVNA-Saver/nanovna-saver/blob/master/LICENSE)
[![Downloads](https://img.shields.io/github/downloads/NanoVNA-Saver/nanovna-saver/total.svg)](https://github.com/NanoVNA-Saver/nanovna-saver/releases/)
[![GitHub Releases](https://img.shields.io/github/downloads/NanoVNA-Saver/nanovna-saver/latest/total)](https://github.com/NanoVNA-Saver/nanovna-saver/releases/latest)
[![Donate](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=T8KTGVDQF5K6E&item_name=NanoVNASaver+Development&currency_code=EUR&source=url)
# NanoVNASaver
A multiplatform tool to save Touchstone files from the NanoVNA,
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 2020ff NanoVNA-Saver Authors
<a href="#built-with"></a>
It's written in __Python 3__ using __PyQt5__ and __scipy__.
<details open="open">
<summary>Table of Contents</summary>
- [About](#nanovnasaver)
- [Built With](#built-with)
- [Introduction](#introduction)
- [Current Features](#current-features)
- [Screenshot](#screenshot)
- [Binary Releases](#binary-releases)
- [Installation](#installation)
- [Detailed Installation Instructions](docs/INSTALLATION.md)
- [Usage](#using-the-software)
- [Calibration](#calibration)
- [TDR](#tdr)
- [Measuring inductor core permeability](#measuring-inductor-core-permeability)
- [Latest Changes](#latest-changes)
- [Contributing](#contributing)
- [Contribution Guidlines](docs/CONTRIBUTING.md)
- [License](#license)
- [References](#references)
- [Acknowledgements](#acknowledgements)
</details>
## Introduction
This software connects to a NanoVNA and extracts the data for
display on a computer and allows saving the sweep data to Touchstone files.
<a href="#current-features"></a>
### Current features
- Reading data from a NanoVNA -- Compatible devices: NanoVNA, NanoVNA-H,
NanoVNA-H4, NanoVNA-F, AVNA via Teensy
- Splitting a frequency range into multiple segments to increase resolution
(tried up to >10k points)
- Averaging data for better results particularly at higher frequencies
- Displaying data on multiple chart types, such as Smith, LogMag, Phase and
VSWR-charts, for both S11 and S21
- Displaying markers, and the impedance, VSWR, Q, equivalent
capacitance/inductance etc. at these locations
- Displaying customizable frequency bands as reference, for example amateur
radio bands
- Exporting and importing 1-port and 2-port Touchstone files
- TDR function (measurement of cable length) - including impedance display
- Filter analysis functions for low-pass, high-pass, band-pass and band-stop
filters
- Display of both an active and a reference trace
- Live updates of data from the NanoVNA, including for multi-segment sweeps
- In-application calibration, including compensation for non-ideal calibration
standards
- Customizable display options, including "dark mode"
- Exporting images of plotted values
### Screenshot
![Screenshot of version 0.1.4](https://i.imgur.com/ZoFsV2V.png)
## Running the application
The software was written in Python on Windows, using Pycharm, and the modules
PyQT5, numpy, scipy and pyserial.
Main development is currently done on Linux (Mint 21 "Vanessa" Cinnamon)
## Installation
### Binary releases
You can find current binary releases for Windows, Linux and MacOS under
<https://github.com/NanoVNA-Saver/nanovna-saver/releases/latest>
The 32bit Windows binaries are somewhat smaller and seems to be a
little bit more stable.
[Detailed installation instructions](docs/INSTALLATION.md)
## Using the software
Connect your NanoVNA to a serial port, and enter this serial port in the serial
port box. If the NanoVNA is connected before the application starts, it should
be automatically detected. Otherwise, click "Rescan". Click "Connect to device"
to connect.
The app can collect multiple segments to get more accurate measurements. Enter
the number of segments to be done in the "Segments" box. Each segment is 101
data points, and takes about 1.5 seconds to complete.
Frequencies are entered in Hz, or suffixed with k or M. Scientific notation
(6.5e6 for 6.5MHz) also works.
Markers can be manually entered, or controlled using the mouse. For mouse
control, select the active marker using the radio buttons, or hold "shift"
while clicking to drag the nearest marker. The marker readout boxes show the
actual frequency where values are measured. Marker readouts can be hidden
using the "hide data" button when not needed.
Display settings are available under "Display setup". These allow changing the
chart colours, the application font size and which graphs are displayed. The
settings are saved between program starts.
### Calibration
_Before using NanoVNA-Saver, please ensure that the device itself is in a
reasonable calibration state._
A calibration of both ports across the entire frequency span, saved to save
slot 0, is sufficient. If the NanoVNA is completely uncalibrated, its readings
may be outside the range accepted by the application.
In-application calibration is available, either assuming ideal standards or
with relevant standard correction. To manually calibrate, sweep each standard
in turn and press the relevant button in the calibration window.
For assisted calibration, press the "Calibration Assistant" button. If desired,
enter a note in the provided field describing the conditions under which the
calibration was performed.
Calibration results may be saved and loaded using the provided buttons at the
bottom of the window. Notes are saved and loaded along with the calibration
data.
![Screenshot of Calibration Window](https://i.imgur.com/p94cxOX.png)
Users of known characterized calibration standard sets can enter the data for
these, and save the sets.
After pressing _Apply_, the calibration is immediately applied to the latest
sweep data.
\! _Currently, load capacitance is unsupported_ \!
### TDR
To get accurate TDR measurements, calibrate the device, and attach the cable to
be measured at the calibration plane - i.e. at the same position where the
calibration load would be attached. Open the "Time Domain Reflectometry"
window, and select the correct cable type, or manually enter a propagation
factor.
### Measuring inductor core permeability
The permeability (mu) of cores can be measured using a one-port measurement. Put one or more windings on a core of known dimensions and use the "S11 mu" plot from the "Display Setup". The core dimensions (cross section area in mm2, effective length in mm) and number of windings can be set in the context menu for the plot (right click on the plot).
### Latest Changes
### Changes in 0.5.5
- Measuring inductor core permeability
- Bugfixes for calibration data loading and saving
- Let V2 Devices more time for usb-serial setup
- Make some windows scrollable
### Changes in 0.5.4
- Bugfixes for Python3.11 compatability
- Bugfix for Python3.8 compatability
- use math instead of table for log step calculation
- Support of NanoVNA V2 Plus5 on Windows
- New SI prefixes added - Ronna, Quetta
- addes a Makefile to build a packages
- Simplyfied sweep worker
- Fixed calibration data loading
- Explicit import of scipy functions - #555
- Refactoring of Analysis modules
## Contributing
First off, thanks for taking the time to contribute! Contributions are what
make the open-source community such an amazing place to learn, inspire, and
create. Any contributions you make will benefit everybody else and are
__greatly appreciated__.
Please read [our contribution guidelines](docs/CONTRIBUTING.md), and thank you
for being involved!
## License
This software is licensed under version 3 of the GNU General Public License. It
comes with NO WARRANTY.
You can use it, commercially as well. You may make changes to the code, but I
(and the license) ask that you give these changes back to the community.
## References
- Ohan Smit wrote an introduction to using the application:
[https://zs1sci.com/blog/nanovnasaver/]
- HexAndFlex wrote a 3-part (thus far) series on Getting Started with the NanoVNA:
[https://hexandflex.com/2019/08/31/getting-started-with-the-nanovna-part-1/] - Part 3 is dedicated to NanoVNASaver:
[https://hexandflex.com/2019/09/15/getting-started-with-the-nanovna-part-3-pc-software/]
- Gunthard Kraus did documentation in English and German:
[http://www.gunthard-kraus.de/fertig_NanoVNA/English/]
[http://www.gunthard-kraus.de/fertig_NanoVNA/Deutsch/]
## Acknowledgements
Original application by Rune B. Broberg (5Q5R)
Contributions and changes by Holger Müller (DG5DBH), David Hunt and others.
TDR inspiration shamelessly stolen from the work of Salil (VU2CWA) at
<https://nuclearrambo.com/wordpress/accurately-measuring-cable-length-with-nanovna/>
TDR cable types by Larry Goga.
Bugfixes and Python installation work by Ohan Smit.
Thanks to everyone who have tested, commented and inspired. Particular thanks
go to the alpha testing crew who suffer the early instability of new versions.
This software is available free of charge. If you read all this way, and you
_still_ want to support it, you may donate to the developer using the button
below:
[![Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=T8KTGVDQF5K6E&item_name=NanoVNASaver+Development&currency_code=EUR&source=url)

274
README.rst 100644
Wyświetl plik

@ -0,0 +1,274 @@
.. role:: raw-html-m2r(raw)
:format: html
.. image:: https://img.shields.io/github/v/release/NanoVNA-Saver/nanovna-saver.svg
:target: https://github.com/NanoVNA-Saver/nanovna-saver/releases/latest
:alt: Latest Release
.. image:: https://img.shields.io/github/license/NanoVNA-Saver/nanovna-saver.svg
:target: https://github.com/NanoVNA-Saver/nanovna-saver/blob/master/LICENSE.txt
:alt: License
.. image:: https://img.shields.io/github/downloads/NanoVNA-Saver/nanovna-saver/total.svg
:target: https://github.com/NanoVNA-Saver/nanovna-saver/releases/
:alt: Downloads
.. image:: https://img.shields.io/github/downloads/NanoVNA-Saver/nanovna-saver/latest/total
:target: https://github.com/NanoVNA-Saver/nanovna-saver/releases/latest
:alt: GitHub Releases
.. image:: https://img.shields.io/badge/paypal-donate-yellow.svg
:target: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=T8KTGVDQF5K6E&item_name=NanoVNASaver+Development&currency_code=EUR&source=url
:alt: Donate
NanoVNASaver
============
A multiplatform tool to save Touchstone files from the NanoVNA,
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 2020ff NanoVNA-Saver Authors
It's written in **Python 3** using **PyQt5** and **scipy**.
Introduction
------------
This software connects to a NanoVNA and extracts the data for
display on a computer and allows saving the sweep data to Touchstone files.
:raw-html-m2r:`<a href="#current-features"></a>`
Current features
^^^^^^^^^^^^^^^^
* Reading data from a NanoVNA -- Compatible devices: NanoVNA, NanoVNA-H,
NanoVNA-H4, NanoVNA-F, AVNA via Teensy
* Splitting a frequency range into multiple segments to increase resolution
(tried up to >10k points)
* Averaging data for better results particularly at higher frequencies
* Displaying data on multiple chart types, such as Smith, LogMag, Phase and
VSWR-charts, for both S11 and S21
* Displaying markers, and the impedance, VSWR, Q, equivalent
capacitance/inductance etc. at these locations
* Displaying customizable frequency bands as reference, for example amateur
radio bands
* Exporting and importing 1-port and 2-port Touchstone files
* TDR function (measurement of cable length) - including impedance display
* Filter analysis functions for low-pass, high-pass, band-pass and band-stop
filters
* Display of both an active and a reference trace
* Live updates of data from the NanoVNA, including for multi-segment sweeps
* In-application calibration, including compensation for non-ideal calibration
standards
* Customizable display options, including "dark mode"
* Exporting images of plotted values
Screenshot
^^^^^^^^^^
.. image:: https://i.imgur.com/ZoFsV2V.png
:target: https://i.imgur.com/ZoFsV2V.png
:alt: Screenshot of version 0.1.4
Running the application
-----------------------
The software was written in Python on Windows, using Pycharm, and the modules
PyQT5, numpy, scipy and pyserial.
Main development is currently done on Linux (Mint 21 "Vanessa" Cinnamon)
Installation
------------
Binary releases
^^^^^^^^^^^^^^^
You can find current binary releases for Windows, Linux and MacOS under
https://github.com/NanoVNA-Saver/nanovna-saver/releases/latest
The 32bit Windows binaries are somewhat smaller and seems to be a
little bit more stable.
`Detailed installation instructions <docs/INSTALLATION.md>`_
Using the software
------------------
Connect your NanoVNA to a serial port, and enter this serial port in the serial
port box. If the NanoVNA is connected before the application starts, it should
be automatically detected. Otherwise, click "Rescan". Click "Connect to device"
to connect.
The app can collect multiple segments to get more accurate measurements. Enter
the number of segments to be done in the "Segments" box. Each segment is 101
data points, and takes about 1.5 seconds to complete.
Frequencies are entered in Hz, or suffixed with k or M. Scientific notation
(6.5e6 for 6.5MHz) also works.
Markers can be manually entered, or controlled using the mouse. For mouse
control, select the active marker using the radio buttons, or hold "shift"
while clicking to drag the nearest marker. The marker readout boxes show the
actual frequency where values are measured. Marker readouts can be hidden
using the "hide data" button when not needed.
Display settings are available under "Display setup". These allow changing the
chart colours, the application font size and which graphs are displayed. The
settings are saved between program starts.
Calibration
^^^^^^^^^^^
*Before using NanoVNA-Saver, please ensure that the device itself is in a
reasonable calibration state.*
A calibration of both ports across the entire frequency span, saved to save
slot 0, is sufficient. If the NanoVNA is completely uncalibrated, its readings
may be outside the range accepted by the application.
In-application calibration is available, either assuming ideal standards or
with relevant standard correction. To manually calibrate, sweep each standard
in turn and press the relevant button in the calibration window.
For assisted calibration, press the "Calibration Assistant" button. If desired,
enter a note in the provided field describing the conditions under which the
calibration was performed.
Calibration results may be saved and loaded using the provided buttons at the
bottom of the window. Notes are saved and loaded along with the calibration
data.
.. image:: https://i.imgur.com/p94cxOX.png
:target: https://i.imgur.com/p94cxOX.png
:alt: Screenshot of Calibration Window
Users of known characterized calibration standard sets can enter the data for
these, and save the sets.
After pressing *Apply*\ , the calibration is immediately applied to the latest
sweep data.
! *Currently, load capacitance is unsupported* !
TDR
^^^
To get accurate TDR measurements, calibrate the device, and attach the cable to
be measured at the calibration plane - i.e. at the same position where the
calibration load would be attached. Open the "Time Domain Reflectometry"
window, and select the correct cable type, or manually enter a propagation
factor.
Measuring inductor core permeability
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The permeability (mu) of cores can be measured using a one-port measurement.
Put one or more windings on a core of known dimensions and use the "S11 mu"
plot from the "Display Setup". The core dimensions (cross section area in mm2,
effective length in mm) and number of windings can be set in the context menu
for the plot (right click on the plot).
Latest Changes
^^^^^^^^^^^^^^
Changes in 0.5.5
^^^^^^^^^^^^^^^^
* Measuring inductor core permeability
* Bugfixes for calibration data loading and saving
* Let V2 Devices more time for usb-serial setup
* Make some windows scrollable
Changes in 0.5.4
^^^^^^^^^^^^^^^^
* Bugfixes for Python3.11 compatability
* Bugfix for Python3.8 compatability
* use math instead of table for log step calculation
* Support of NanoVNA V2 Plus5 on Windows
* New SI prefixes added - Ronna, Quetta
* addes a Makefile to build a packages
* Simplyfied sweep worker
* Fixed calibration data loading
* Explicit import of scipy functions - #555
* Refactoring of Analysis modules
Contributing
------------
First off, thanks for taking the time to contribute! Contributions are what
make the open-source community such an amazing place to learn, inspire, and
create. Any contributions you make will benefit everybody else and are
**greatly appreciated**.
Please read `our contribution guidelines <docs/CONTRIBUTING.md>`_\ , and thank
you for being involved!
License
-------
This software is licensed under version 3 of the GNU General Public License. It
comes with NO WARRANTY.
You can use it, commercially as well. You may make changes to the code, but I
(and the license) ask that you give these changes back to the community.
References
----------
* Ohan Smit wrote an introduction to using the application:
[https://zs1sci.com/blog/nanovnasaver/]
* HexAndFlex wrote a 3-part (thus far) series on Getting Started with the
NanoVNA:
[https://hexandflex.com/2019/08/31/getting-started-with-the-nanovna-part-1/]
- Part 3 is dedicated to NanoVNASaver:
[https://hexandflex.com/2019/09/15/getting-started-with-the-nanovna-part-3-pc-software/]
* Gunthard Kraus did documentation in English and German:
[http://www.gunthard-kraus.de/fertig_NanoVNA/English/]
[http://www.gunthard-kraus.de/fertig_NanoVNA/Deutsch/]
Acknowledgements
----------------
Original application by Rune B. Broberg (5Q5R)
Contributions and changes by Holger Müller (DG5DBH), David Hunt and others.
TDR inspiration shamelessly stolen from the work of Salil (VU2CWA) at
https://nuclearrambo.com/wordpress/accurately-measuring-cable-length-with-nanovna/
TDR cable types by Larry Goga.
Bugfixes and Python installation work by Ohan Smit.
Thanks to everyone who have tested, commented and inspired. Particular thanks
go to the alpha testing crew who suffer the early instability of new versions.
This software is available free of charge. If you read all this way, and you
*still* want to support it, you may donate to the developer using the button
below:
.. image:: https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif
:target: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=T8KTGVDQF5K6E&item_name=NanoVNASaver+Development&currency_code=EUR&source=url
:alt: Paypal

29
docs/Makefile 100644
Wyświetl plik

@ -0,0 +1,29 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
AUTODOCDIR = api
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $?), 1)
$(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from https://sphinx-doc.org/")
endif
.PHONY: help clean Makefile
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
clean:
rm -rf $(BUILDDIR)/* $(AUTODOCDIR)
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

1
docs/_static/.gitignore vendored 100644
Wyświetl plik

@ -0,0 +1 @@
# Empty directory

2
docs/authors.rst 100644
Wyświetl plik

@ -0,0 +1,2 @@
.. _authors:
.. include:: ../AUTHORS.rst

286
docs/conf.py 100644
Wyświetl plik

@ -0,0 +1,286 @@
# This file is execfile()d with the current directory set to its containing dir.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import sys
import shutil
# -- Path setup --------------------------------------------------------------
__location__ = os.path.dirname(__file__)
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.join(__location__, "../src"))
# -- Run sphinx-apidoc -------------------------------------------------------
# This hack is necessary since RTD does not issue `sphinx-apidoc` before running
# `sphinx-build -b html . _build/html`. See Issue:
# https://github.com/readthedocs/readthedocs.org/issues/1139
# DON'T FORGET: Check the box "Install your project inside a virtualenv using
# setup.py install" in the RTD Advanced Settings.
# Additionally it helps us to avoid running apidoc manually
try: # for Sphinx >= 1.7
from sphinx.ext import apidoc
except ImportError:
from sphinx import apidoc
output_dir = os.path.join(__location__, "api")
module_dir = os.path.join(__location__, "../src/NanoVNASaver")
try:
shutil.rmtree(output_dir)
except FileNotFoundError:
pass
try:
import sphinx
cmd_line = f"sphinx-apidoc --implicit-namespaces -f -o {output_dir} {module_dir}"
args = cmd_line.split(" ")
if tuple(sphinx.__version__.split(".")) >= ("1", "7"):
# This is a rudimentary parse_version to avoid external dependencies
args = args[1:]
apidoc.main(args)
except Exception as e:
print("Running `sphinx-apidoc` failed!\n{}".format(e))
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.autosummary",
"sphinx.ext.viewcode",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.ifconfig",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix of source filenames.
source_suffix = ".rst"
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "nanovna-saver"
copyright = "2023, Holger Mueller"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# version: The short X.Y version.
# release: The full version, including alpha/beta/rc tags.
# If you dont need the separation provided between version and release,
# just set them both to the same value.
try:
from NanoVNASaver import __version__ as version
except ImportError:
version = ""
if not version or version.lower() == "unknown":
version = os.getenv("READTHEDOCS_VERSION", "unknown") # automatically set by RTD
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
# today = ''
# Else, today_fmt is used as the format for a strftime call.
# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".venv"]
# The reST default role (used for this markup: `text`) to use for all documents.
# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
# keep_warnings = False
# If this is True, todo emits a warning for each TODO entries. The default is False.
todo_emit_warnings = True
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = "alabaster"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
"sidebar_width": "300px",
"page_width": "1200px"
}
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = ""
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
# html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
# If false, no index is generated.
# html_use_index = True
# If true, the index is split into individual pages for each letter.
# html_split_index = False
# If true, links to the reST sources are added to the pages.
# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = "nanovna-saver-doc"
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ("letterpaper" or "a4paper").
# "papersize": "letterpaper",
# The font size ("10pt", "11pt" or "12pt").
# "pointsize": "10pt",
# Additional stuff for the LaTeX preamble.
# "preamble": "",
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
("index", "user_guide.tex", "nanovna-saver Documentation", "Holger Mueller", "manual")
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = ""
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
# latex_use_parts = False
# If true, show page references after internal links.
# latex_show_pagerefs = False
# If true, show URL addresses after external links.
# latex_show_urls = False
# Documents to append as an appendix to all manuals.
# latex_appendices = []
# If false, no module index is generated.
# latex_domain_indices = True
# -- External mapping --------------------------------------------------------
python_version = ".".join(map(str, sys.version_info[0:2]))
intersphinx_mapping = {
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
"python": ("https://docs.python.org/" + python_version, None),
"matplotlib": ("https://matplotlib.org", None),
"numpy": ("https://numpy.org/doc/stable", None),
"sklearn": ("https://scikit-learn.org/stable", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
"setuptools": ("https://setuptools.pypa.io/en/stable/", None),
"pyscaffold": ("https://pyscaffold.org/en/stable", None),
}
print(f"loading configurations for {project} {version} ...", file=sys.stderr)

Wyświetl plik

@ -0,0 +1 @@
.. include:: ../CONTRIBUTING.rst

60
docs/index.rst 100644
Wyświetl plik

@ -0,0 +1,60 @@
=============
nanovna-saver
=============
This is the documentation of **nanovna-saver**.
.. note::
This is the main page of your project's `Sphinx`_ documentation.
It is formatted in `reStructuredText`_. Add additional pages
by creating rst-files in ``docs`` and adding them to the `toctree`_ below.
Use then `references`_ in order to link them from this page, e.g.
:ref:`authors` and :ref:`changes`.
It is also possible to refer to the documentation of other Python packages
with the `Python domain syntax`_. By default you can reference the
documentation of `Sphinx`_, `Python`_, `NumPy`_, `SciPy`_, `matplotlib`_,
`Pandas`_, `Scikit-Learn`_. You can add more by extending the
``intersphinx_mapping`` in your Sphinx's ``conf.py``.
The pretty useful extension `autodoc`_ is activated by default and lets
you include documentation from docstrings. Docstrings can be written in
`Google style`_ (recommended!), `NumPy style`_ and `classical style`_.
Contents
========
.. toctree::
:maxdepth: 2
Overview <readme>
Contributions & Help <contributing>
License <license>
Authors <authors>
Module Reference <api/modules>
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. _toctree: https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html
.. _reStructuredText: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
.. _references: https://www.sphinx-doc.org/en/stable/markup/inline.html
.. _Python domain syntax: https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#the-python-domain
.. _Sphinx: https://www.sphinx-doc.org/
.. _Python: https://docs.python.org/
.. _Numpy: https://numpy.org/doc/stable
.. _SciPy: https://docs.scipy.org/doc/scipy/reference/
.. _matplotlib: https://matplotlib.org/contents.html#
.. _Pandas: https://pandas.pydata.org/pandas-docs/stable
.. _Scikit-Learn: https://scikit-learn.org/stable
.. _autodoc: https://www.sphinx-doc.org/en/master/ext/autodoc.html
.. _Google style: https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings
.. _NumPy style: https://numpydoc.readthedocs.io/en/latest/format.html
.. _classical style: https://www.sphinx-doc.org/en/master/domains.html#info-field-lists

7
docs/license.rst 100644
Wyświetl plik

@ -0,0 +1,7 @@
.. _license:
=======
License
=======
.. include:: ../LICENSE.txt

2
docs/readme.rst 100644
Wyświetl plik

@ -0,0 +1,2 @@
.. _readme:
.. include:: ../README.rst

Wyświetl plik

@ -0,0 +1,5 @@
# Requirements file for ReadTheDocs, check .readthedocs.yml.
# To build the module reference correctly, make sure every external package
# under `install_requires` in `setup.cfg` is also listed here!
sphinx>=3.2.1
# sphinx_rtd_theme

Wyświetl plik

@ -24,7 +24,13 @@ with suppress(ImportError):
# pyright: reportMissingImports=false
import pkg_resources.py2_warn
from NanoVNASaver.__main__ import main
try:
from NanoVNASaver.__main__ import main
except ModuleNotFoundError:
import sys
sys.path.append('src')
from NanoVNASaver.__main__ import main
if __name__ == '__main__':
main()

14
pyproject.toml 100644
Wyświetl plik

@ -0,0 +1,14 @@
[build-system]
# AVOID CHANGING REQUIRES: IT WILL BE UPDATED BY PYSCAFFOLD!
requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
# For smarter version schemes and other configuration options,
# check out https://github.com/pypa/setuptools_scm
version_scheme = "no-guess-dev"
[tool.pytest.ini_options]
pythonpath = [
".", "src",
]

100
setup.cfg
Wyświetl plik

@ -1,3 +1,8 @@
# This file is used to configure your project.
# Read more about the various options under:
# https://setuptools.pypa.io/en/latest/userguide/declarative_config.html
# https://setuptools.pypa.io/en/latest/references/keywords.html
[metadata]
name = NanoVNASaver
author = Rune B. Broberg
@ -5,26 +10,101 @@ author_email= NanoVNA-Saver@users.noreply.github.com
license = GNU GPL V3
license_files = LICENSE,
description = GUI for the NanoVNA and derivates
long_description = file: README.md
long_description = file: README.rst
url = https://github.com/NanoVNA-Saver/nanovna-saver
version = attr: NanoVNASaver.About.VERSION
platforms= all
[options]
# do not use "find_namespace:" because this may recursively include "build"
packages = find:
install_requires=
zip_safe = False
packages = find_namespace:
include_package_data = True
package_dir =
=src
# Require a min/specific Python version (comma-separated conditions)
python_requires = >=3.8, <4
# Add here dependencies of your project (line-separated), e.g. requests>=2.2,<3.0.
# Version specifiers like >=2.2,<3.0 avoid problems due to API changes in
# new major versions. This works if the required packages follow Semantic Versioning.
# For more information, check out https://semver.org/.
install_requires =
pyserial>=3.5
PyQt5>=5.15.0
numpy>=1.21.1
scipy>=1.7.1
Cython>=0.29.24
python_requires = >=3.8, <4
[options.packages.find]
where = src
exclude =
tests
[options.extras_require]
# Add here additional requirements for extra features, to install with:
# `pip install nanovna-saver[PDF]` like:
# PDF = ReportLab; RXP
# Add here test requirements (semicolon/line-separated)
testing =
setuptools
pytest
pytest-cov
[options.entry_points]
console_scripts =
NanoVNASaver = NanoVNASaver.__main__:main
# Add here console scripts like:
# console_scripts =
# script_name = NanoVNASaver.module:function
# For example:
# console_scripts =
# fibonacci = NanoVNASaver.skeleton:run
# And any other entry points, for example:
# pyscaffold.cli =
# awesome = pyscaffoldext.awesome.extension:AwesomeExtension
# without this option the rpm-build includes also the "test" directory
[options.packages.find]
exclude = test
[tool:pytest]
# Specify command line options as you would do when invoking pytest directly.
# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
# in order to write a coverage file that can be read by Jenkins.
# CAUTION: --cov flags may prohibit setting breakpoints while debugging.
# Comment those flags to avoid this pytest issue.
addopts =
--cov NanoVNASaver --cov-report term-missing
--verbose
norecursedirs =
dist
build
.tox
testpaths = tests
# Use pytest markers to select/deselect specific tests
# markers =
# slow: mark tests as slow (deselect with '-m "not slow"')
# system: mark end-to-end system tests
[devpi:upload]
# Options for the devpi: PyPI server and packaging tool
# VCS export must be deactivated since we are using setuptools-scm
no_vcs = 1
formats = bdist_wheel
[flake8]
# Some sane defaults for the code style checker flake8
max_line_length = 88
extend_ignore = E203, W503
# ^ Black-compatible
# E203 and W503 have edge cases handled by black
exclude =
.tox
build
dist
.eggs
docs/conf.py
[pyscaffold]
# PyScaffold's parameters when the project was created.
# This will be used when updating. Do not change!
version = 4.4
package = NanoVNASaver
extensions =
no_skeleton

Wyświetl plik

@ -1,27 +1,21 @@
# 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/>.
"""
Setup file for nanovna-saver.
Use setup.cfg to configure your project.
This file was generated with PyScaffold 4.4.
PyScaffold helps you to put up the scaffold of your new Python project.
Learn more under: https://pyscaffold.org/
"""
from setuptools import setup
setup(
data_files=[
("share/doc/nanovnasaver/", ["LICENSE", "README.md", ]),
("share/applications/", ["NanoVNASaver.desktop", ]),
("share/icons/hicolor/48x48/apps/", ["NanoVNASaver_48x48.png", ]),
]
)
if __name__ == "__main__":
try:
setup(use_scm_version={"version_scheme": "no-guess-dev"})
except: # noqa
print(
"\n\nAn error occurred while building the project, "
"please ensure you have the most updated version of setuptools, "
"setuptools_scm and wheel with:\n"
" pip install -U setuptools setuptools_scm wheel\n\n"
)
raise

Wyświetl plik

@ -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.5.5"
VERSION = "0.6.0-pre"
VERSION_URL = (
"https://raw.githubusercontent.com/"
"NanoVNA-Saver/nanovna-saver/master/NanoVNASaver/About.py")

Wyświetl plik

@ -47,7 +47,7 @@ class EFHWAnalysis(ResonanceAnalysis):
threshold=500))
extended_data = {}
logger.info("TO DO: find near data")
for lowest in self.crossing:
for lowest in self.crossings:
my_data = self._get_data(lowest)
if lowest in extended_data:
extended_data[lowest].update(my_data)

Wyświetl plik

@ -47,7 +47,7 @@ class ResonanceAnalysis(Analysis):
def __init__(self, app):
super().__init__(app)
self.crossing: List[int] = []
self.crossings: List[int] = []
self.filename = ""
self._widget = QtWidgets.QWidget()
self.layout = QtWidgets.QFormLayout()
@ -94,36 +94,26 @@ class ResonanceAnalysis(Analysis):
for _ in range(results_header, self.layout.rowCount()):
self.layout.removeRow(self.layout.rowCount() - 1)
self.crossing = at.zero_crossings([d.phase for d in self.app.data.s11])
self.crossings = sorted(
set(at.zero_crossings([d.phase for d in self.app.data.s11])))
logger.debug("Found %d sections ",
len(self.crossing))
if not self.crossing:
len(self.crossings))
if not self.crossings:
self.layout.addRow(QtWidgets.QLabel(
"No resonance found"))
return
self
self.do_resonance_analysis()
def do_resonance_analysis(self):
extended_data = []
for m in self.crossing:
start, lowest, end = m
my_data = self._get_data(lowest)
s11_low = self.app.data.s11[lowest]
extended_data.append(my_data)
if start != end:
logger.debug(
"Section from %d to %d, lowest at %d",
start, end, lowest)
self.layout.addRow(
"Resonance",
QtWidgets.QLabel(
f"{format_frequency(s11_low.freq)}"
f" ({format_complex_imp(s11_low.impedance())})"))
else:
self.layout.addRow("Resonance", QtWidgets.QLabel(
format_frequency(self.app.data.s11[lowest].freq)))
self.layout.addWidget(QHLine())
for crossing in self.crossings:
extended_data.append(self._get_data(crossing))
self.layout.addRow("Resonance", QtWidgets.QLabel(
format_frequency(self.app.data.s11[crossing].freq)))
self.layout.addWidget(QHLine())
# Remove the final separator line
self.layout.removeRow(self.layout.rowCount() - 1)
if self.filename and extended_data:

Wyświetl plik

@ -23,3 +23,30 @@ from .Smith import SmithChart
from .SParam import SParameterChart
from .TDR import TDRChart
from .VSWR import VSWRChart
__all__ = [
'Chart',
'FrequencyChart',
'PolarChart',
'SquareChart',
'CapacitanceChart',
'InductanceChart',
'GroupDelayChart',
'LogMagChart',
'CombinedLogMagChart',
'MagnitudeChart',
'MagnitudeZChart',
'MagnitudeZShuntChart',
'MagnitudeZSeriesChart',
'PermeabilityChart',
'PhaseChart',
'QualityFactorChart',
'RealImaginaryChart',
'RealImaginaryMuChart',
'RealImaginaryZChart',
'RealImaginaryZShuntChart',
'RealImaginaryZSeriesChart',
'SmithChart',
'SParameterChart',
'TDRChart',
'VSWRChart',
]

Wyświetl plik

@ -425,16 +425,19 @@ class NanoVNASaver(QtWidgets.QWidget):
logger.debug("Finished building interface")
def _sweep_control(self, start: bool = True) -> None:
self.sweep_control.progress_bar.setValue(0 if start else 100)
self.sweep_control.btn_start.setDisabled(start)
self.sweep_control.btn_stop.setDisabled(not start)
self.sweep_control.toggle_settings(start)
def sweep_start(self):
# Run the device data update
if not self.vna.connected():
return
self.worker.stopped = False
self.sweep_control.progress_bar.setValue(0)
self.sweep_control.btn_start.setDisabled(True)
self.sweep_control.btn_stop.setDisabled(False)
self.sweep_control.toggle_settings(True)
self._sweep_control(start=True)
for m in self.markers:
m.resetLabels()
@ -545,10 +548,7 @@ class NanoVNASaver(QtWidgets.QWidget):
self.dataAvailable.emit()
def sweepFinished(self):
self.sweep_control.progress_bar.setValue(100)
self.sweep_control.btn_start.setDisabled(False)
self.sweep_control.btn_stop.setDisabled(True)
self.sweep_control.toggle_settings(False)
self._sweep_control(start=False)
for marker in self.markers:
marker.frequencyInput.textEdited.emit(

Wyświetl plik

@ -47,11 +47,11 @@ class Version:
logger.error("Unable to parse version: %s", vstring)
def __gt__(self, other: "Version") -> bool:
l, r = self.data, other.data
left, right = self.data, other.data
for name in ("major", "minor", "revision"):
if l[name] > r[name]:
if left[name] > right[name]:
return True
if l[name] < r[name]:
if left[name] < right[name]:
return False
return False

Some files were not shown because too many files have changed in this diff Show More