bettah port handling
Some checks failed
Publish Python 🐍 distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Failing after -58s
Publish Python 🐍 distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been skipped

This commit is contained in:
2025-07-07 22:10:02 -06:00
parent f021780971
commit 81143a72c4
2 changed files with 6 additions and 3 deletions

View File

@ -90,8 +90,11 @@ class Charon:
self,
ip: str = DEFAULT_IP,
frequency: npt.ArrayLike = np.linspace(1e9, 2e9, 3),
ports: Tuple[int] = (1,),
ports: Tuple[int] | int = 1,
):
if isinstance(ports, int):
ports = (np.arange(ports) + 1).tolist()
ports = tuple(ports)
self.ports = ports
self.frequency = frequency
@ -143,7 +146,7 @@ class Charon:
self._set_dac_code(value=0, channel=2)
# set default switch state
self.set_switches(a=0, b=0)
self.set_switches(a=self.ports[0] - 1, b=self.ports[0] - 1)
def get_config(self) -> Dict[str, Any]:
config = dict()

View File

@ -8,7 +8,7 @@ from charon_vna.vna import Charon
frequency = np.linspace(80e6, 280e6, 31)
# %%
vna = Charon(frequency=frequency, ports=[1, 2])
vna = Charon(frequency=frequency, ports=2)
# %%
s = vna.sweep_b_over_a()