applyaf
applyaf is a Python 3.12+ module that applies frequency dependent antenna factors and cable losses to spectrum analyzer readings in order to calculate the incident field. Any duplicate frequency entries in the antenna factors or cable losses data are removed before interpolating the frequencies to match those of the spectrum analyzer readings.
Inputs
Three csv files containing the following are required inputs:
- Spectrum analyzer measurements
- Antenna factor data
- Cable loss data
Each CSV file should contain data in two columns:
- Frequency
- Amplitude
The amplitude is expected to be in dB.
Dependencies
See the pyproject.toml and uv.lock files for the dependency requirements.
Future Improvements
Some thoughts for future improvements include:
- Allowing CSV data files that contain non-dB amplitudes and then convert as needed. Should this be a per-file setting?
- Generalize the code to handle a variable number (>3) of data to be interpolated and applied to the given data set.
- If the code is generalized, should this be wrapped into the siganalysis project or left on its own?
Contributing
Contributions are welcome! To contribute please:
- Fork the repository
- Create a feature branch
- Add code and tests
- Pass lint and tests
- Submit a pull request
Development Setup
Development Setup Using uv
Development Setup on macOS
$ brew install uv just
With uv and Just installed, development has been simplified to simply running Just to see the available commands.
$ just
ruff and pyright are deliberately absent from that line. Both are dev
dependencies pinned in uv.lock and reached through uv run, so every recipe
and every CI job uses the same version. A brew install ruff would put a
second, unpinned copy on the path for an editor to find, and ruff releases
change how code is formatted: the editor would then reformat code that
ruff format --check rejects on the next run.
Releasing to PyPI
just release cuts the release. It first checks that a release is possible at
all, then lints, type checks, and tests, then shows the entries waiting under
Unreleased and the version each kind of bump would produce, and asks which to
cut. Once answered it bumps the version, closes out the CHANGELOG, updates the
lock file, commits, and tags. Pushing the tag is what publishes.
$ just release
Releasing from 3.0.1, with these entries under Unreleased:
### Fixed
- `read_csv_file()` returned a 0-d array for a single row file.
1) patch 3.0.1 -> 3.0.2
2) minor 3.0.1 -> 3.1.0
3) major 3.0.1 -> 4.0.0
q) cancel
Which release? [1] 2
Tagged v3.1.0. Publish it with:
git push --follow-tags
The entries decide the bump, so the prompt puts them next to the versions they
would produce rather than leaving the choice to memory. Answering q, or
anything unrecognized, changes nothing.
The tag push runs the release workflow, which waits on the whole CI
workflow before it does anything else: the 3.12, 3.13, and 3.14
matrix and the dependency floor job. git push --follow-tags starts both at
once, so without that wait an upload could go out while 3.14 was still running,
or already red. It then checks that the tagged commit is on master, since a
tag is only a pointer and one placed anywhere else would otherwise publish
whatever it points at, rechecks the tag against the version in pyproject.toml,
and builds.
Every check to that point runs against the source tree, so the workflow then
installs the wheel it just built somewhere src/ is not on the path and imports
it there, which is the only step that can catch a packaging mistake that left
something out of the distribution. It uploads once that passes. There is no PyPI
API token anywhere: the workflow authenticates with trusted publishing, which
mints a short lived credential from the GitHub OIDC identity of that run. The
upload names a --check-url, so a run that uploaded one distribution and then
failed on the other can be retried instead of stranding a version number that
PyPI will never allow to be reused.
Uploading is followed by a GitHub release for the tag, carrying the CHANGELOG section for that version as its notes and the built distributions as its assets. The notes are collected before the upload rather than after, so that a CHANGELOG with no section for the version being released stops the release while stopping it is still possible.
Pushing the tag is the point of no return, since PyPI never lets a version
number be reused. Everything just release does is local and amendable until
then, and it refuses to start against a dirty working tree, off master, on a
master behind its upstream, with a CHANGELOG whose Unreleased section is
empty, or when the tag it would create already exists. Those refusals come
before the lint and test run, so a release that cannot happen is turned away at
once rather than after the suite. A refusal leaves the version and the CHANGELOG
untouched.
just build runs the same checks and produces the same distributions without
releasing anything, which is the way to inspect what CI would upload.
This depends on one piece of configuration that lives outside the repository. A
trusted publisher has to be registered for applyaf on
PyPI, pointing at the questrail/applyaf repository, the release.yml
workflow, and the pypi environment. It is a one time setup per project.
License
applyaf is released under the MIT license. Please see the LICENSE.txt file for more information.
Release files for applyaf 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| applyaf-3.0.2.tar.gz | 49.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| applyaf-3.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.8 kB
Release files / applyaf-3.0.2.tar.gz
| Download URL | applyaf-3.0.2.tar.gz |
|---|---|
| Size | 49.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8bc0133e07a2f967f4d3abc625afde744afb65898aed38f1ca8fb96dbcd62fef
|
|
BLAKE2b-256 checksum How to use checksums |
d2e309130720f3bd5aa2edb8dec10b0d55c4904f13d831fad45535208c2f29e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / applyaf-3.0.2-py3-none-any.whl
| Download URL | applyaf-3.0.2-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ae8b3ab543f7ec6c3b637426175ad4809347da007b9a7f40ab07250d5bc3625
|
|
BLAKE2b-256 checksum How to use checksums |
e8bdb7058c5145eaf44c980867d92dee9e77d9096e685dcd6e7dcffb743d368c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|