Compare commits

...

2 Commits

Author SHA1 Message Date
67a1864837 util improvements
All checks were successful
Publish Python 🐍 distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Successful in -41s
Publish Python 🐍 distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been skipped
2024-12-18 23:38:45 -07:00
eca933ccef update readme 2024-12-18 23:34:56 -07:00
3 changed files with 12 additions and 6 deletions

View File

@ -31,7 +31,7 @@ Note that unlike the main calibration, power calibration frequencies do not need
You need a few things:
- [Analog Devices Pluto SDR](https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/adalm-pluto.html).
Any variant of the Pluto *should* work too such as the [Pluto+](https://github.com/plutoplus/plutoplus?tab=readme-ov-file)
Any variant of the Pluto *should* work too such as the [Pluto+](https://github.com/plutoplus/plutoplus?tab=readme-ov-file) however I have only tested with the basic flavor.
- Directional couplers (1 per port up to 4 ports).
I have been using [AAMCS-UDC-0.5G-18G-10dB-Sf](http://www.aa-mcs.com/wp-content/uploads/documents/AAMCS-UDC-0.5G-18G-10dB-Sf.pdf)
- Charon switch board - coming soon.

View File

@ -23,6 +23,7 @@ from PySide6.QtWidgets import (
QWidget,
)
from skrf import plotting as rf_plt
from util import db20, s2vswr
from vna import Charon
DEFAULT_CONFIG = dict(
@ -76,7 +77,7 @@ class PlotWidget(QWidget):
self.ax.set_ylabel("Amplitude [dB]")
def update_logmag(self, data: xr.DataArray) -> None:
self.update_rect(data, lambda s: 20 * np.log10(np.abs(s)))
self.update_rect(data, db20)
def setup_phase(self) -> None:
self.setup_rect()
@ -93,7 +94,7 @@ class PlotWidget(QWidget):
self.ax.set_ylabel("VSWR")
def update_vswr(self, data: xr.DataArray) -> None:
self.update_rect(data, lambda s: (1 + np.abs(s)) / (1 - np.abs(s)))
self.update_rect(data, s2vswr)
def setup_smith(self) -> None:
self.ax.grid(False)

View File

@ -1,6 +1,7 @@
import numpy as np
import skrf as rf
import xarray as xr
from numpy import typing as npt
HAM_BANDS = [
[135.7e3, 137.8e3],
@ -37,12 +38,16 @@ HAM_BANDS = [
]
def db10(p):
def db10(p: npt.ArrayLike[np.complex128]) -> npt.ArrayLike[float]:
return 10 * np.log10(np.abs(p))
def db20(p):
return 20 * np.log10(np.abs(p))
def db20(v: npt.ArrayLike[np.complex128]) -> npt.ArrayLike[float]:
return 20 * np.log10(np.abs(v))
def s2vswr(s: npt.ArrayLike[np.complex128]) -> npt.ArrayLike[float]:
return (1 + np.abs(s)) / (1 - np.abs(s))
def minmax(x):