Oops. I broke typing
This commit is contained in:
parent
67a1864837
commit
919101b339
|
@ -24,7 +24,8 @@ from PySide6.QtWidgets import (
|
||||||
)
|
)
|
||||||
from skrf import plotting as rf_plt
|
from skrf import plotting as rf_plt
|
||||||
from util import db20, s2vswr
|
from util import db20, s2vswr
|
||||||
from vna import Charon
|
|
||||||
|
# from vna import Charon
|
||||||
|
|
||||||
DEFAULT_CONFIG = dict(
|
DEFAULT_CONFIG = dict(
|
||||||
frequency=np.arange(1e9, 2e9, 11), # Hz
|
frequency=np.arange(1e9, 2e9, 11), # Hz
|
||||||
|
@ -61,9 +62,7 @@ class PlotWidget(QWidget):
|
||||||
self.ax.xaxis.set_major_formatter(EngFormatter())
|
self.ax.xaxis.set_major_formatter(EngFormatter())
|
||||||
self.ax.set_xlabel("Frequency [Hz]")
|
self.ax.set_xlabel("Frequency [Hz]")
|
||||||
|
|
||||||
def update_rect(
|
def update_rect(self, data: xr.DataArray, func: Callable[[npt.ArrayLike], npt.ArrayLike]) -> None:
|
||||||
self, data: xr.DataArray, func: Callable[[npt.ArrayLike[np.complex128]], npt.ArrayLike[float]]
|
|
||||||
) -> None:
|
|
||||||
self.ax.set_xlim(data["frequency"].min().data, data["frequency"].max().data)
|
self.ax.set_xlim(data["frequency"].min().data, data["frequency"].max().data)
|
||||||
# remove old lines
|
# remove old lines
|
||||||
for line in self.ax.lines:
|
for line in self.ax.lines:
|
||||||
|
@ -115,14 +114,14 @@ class PlotWidget(QWidget):
|
||||||
# Subclass QMainWindow to customize your application's main window
|
# Subclass QMainWindow to customize your application's main window
|
||||||
class MainWindow(QMainWindow):
|
class MainWindow(QMainWindow):
|
||||||
config_path: Path | None
|
config_path: Path | None
|
||||||
device: Charon
|
# device: Charon
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.config_path = None
|
self.config_path = None
|
||||||
|
|
||||||
self.device = Charon("ip:192.168.3.1", frequency=DEFAULT_CONFIG["frequency"])
|
# self.device = Charon("ip:192.168.3.1", frequency=DEFAULT_CONFIG["frequency"])
|
||||||
|
|
||||||
mpl.use("QtAgg")
|
mpl.use("QtAgg")
|
||||||
|
|
||||||
|
@ -148,6 +147,12 @@ class MainWindow(QMainWindow):
|
||||||
|
|
||||||
menu_stimulus = QMenu("&Stimulus")
|
menu_stimulus = QMenu("&Stimulus")
|
||||||
menubar.addMenu(menu_stimulus)
|
menubar.addMenu(menu_stimulus)
|
||||||
|
action_set_frequency = QAction("&Frequency", self)
|
||||||
|
menu_stimulus.addAction(action_set_frequency)
|
||||||
|
# action_set_frequency.triggered.connect(self.set_frequency)
|
||||||
|
action_set_power = QAction("&Power", self)
|
||||||
|
menu_stimulus.addAction(action_set_power)
|
||||||
|
# action_set_power.triggered.connect(self.set_power)
|
||||||
|
|
||||||
menu_calibration = QMenu("&Calibration")
|
menu_calibration = QMenu("&Calibration")
|
||||||
menubar.addMenu(menu_calibration)
|
menubar.addMenu(menu_calibration)
|
||||||
|
|
|
@ -38,15 +38,15 @@ HAM_BANDS = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def db10(p: npt.ArrayLike[np.complex128]) -> npt.ArrayLike[float]:
|
def db10(p: npt.ArrayLike) -> npt.ArrayLike:
|
||||||
return 10 * np.log10(np.abs(p))
|
return 10 * np.log10(np.abs(p))
|
||||||
|
|
||||||
|
|
||||||
def db20(v: npt.ArrayLike[np.complex128]) -> npt.ArrayLike[float]:
|
def db20(v: npt.ArrayLike) -> npt.ArrayLike:
|
||||||
return 20 * np.log10(np.abs(v))
|
return 20 * np.log10(np.abs(v))
|
||||||
|
|
||||||
|
|
||||||
def s2vswr(s: npt.ArrayLike[np.complex128]) -> npt.ArrayLike[float]:
|
def s2vswr(s: npt.ArrayLike) -> npt.ArrayLike:
|
||||||
return (1 + np.abs(s)) / (1 - np.abs(s))
|
return (1 + np.abs(s)) / (1 - np.abs(s))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user