diff --git a/charon_vna/gui.py b/charon_vna/gui.py index e293037..a5cda73 100644 --- a/charon_vna/gui.py +++ b/charon_vna/gui.py @@ -24,7 +24,8 @@ from PySide6.QtWidgets import ( ) from skrf import plotting as rf_plt from util import db20, s2vswr -from vna import Charon + +# from vna import Charon DEFAULT_CONFIG = dict( frequency=np.arange(1e9, 2e9, 11), # Hz @@ -61,9 +62,7 @@ class PlotWidget(QWidget): self.ax.xaxis.set_major_formatter(EngFormatter()) self.ax.set_xlabel("Frequency [Hz]") - def update_rect( - self, data: xr.DataArray, func: Callable[[npt.ArrayLike[np.complex128]], npt.ArrayLike[float]] - ) -> None: + def update_rect(self, data: xr.DataArray, func: Callable[[npt.ArrayLike], npt.ArrayLike]) -> None: self.ax.set_xlim(data["frequency"].min().data, data["frequency"].max().data) # remove old lines for line in self.ax.lines: @@ -115,14 +114,14 @@ class PlotWidget(QWidget): # Subclass QMainWindow to customize your application's main window class MainWindow(QMainWindow): config_path: Path | None - device: Charon + # device: Charon def __init__(self): super().__init__() 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") @@ -148,6 +147,12 @@ class MainWindow(QMainWindow): menu_stimulus = QMenu("&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") menubar.addMenu(menu_calibration) diff --git a/charon_vna/util.py b/charon_vna/util.py index dff9dcd..249131a 100644 --- a/charon_vna/util.py +++ b/charon_vna/util.py @@ -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)) -def db20(v: npt.ArrayLike[np.complex128]) -> npt.ArrayLike[float]: +def db20(v: npt.ArrayLike) -> npt.ArrayLike: 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))