VNA.py 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. # NanoVNASaver
  2. #
  3. # A python program to view and export Touchstone data from a NanoVNA
  4. # Copyright (C) 2019, 2020 Rune B. Broberg
  5. # Copyright (C) 2020 NanoVNA-Saver Authors
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. from .Hardware import get_interfaces
  20. from .NanoVNA_V2 import NanoVNA_V2_H4
  21. class MetaVna(type):
  22. def __call__(cls, *args, **kwargs):
  23. return super(MetaVna, NanoVNA_V2_H4).__call__(*args, **kwargs)
  24. class Vna:
  25. name = "Vna"
  26. def __init__(self, *args, **kwargs):
  27. super(Vna, self).__init__(*args, **kwargs)
  28. def connect(self) -> bool:
  29. assert NotImplementedError('Device does not support this method')
  30. def disconnect(self) -> bool:
  31. assert NotImplementedError('Device does not support this method')
  32. def set_bw(self):
  33. assert NotImplementedError('Device does not support this method')
  34. def set_sweep(self, freq_start: float, freq_end: float, points: int):
  35. assert NotImplementedError('Device does not support this method')
  36. def get_bw(self) -> float:
  37. assert NotImplementedError('Device does not support this method')
  38. def get_sweep(self) -> list:
  39. assert NotImplementedError('Device does not support this method')
  40. def get_info(self) -> dict:
  41. assert NotImplementedError('Device does not support this method')
  42. def measure(self) -> list:
  43. assert NotImplementedError('Device does not support this method')
  44. def set_power(self, power: float):
  45. assert NotImplementedError('Device does not support this method')
  46. def get_power(self) -> float:
  47. assert NotImplementedError('Device does not support this method')
  48. def set_cal(self):
  49. assert NotImplementedError('Device does not support this method')
  50. def get_cal(self):
  51. assert NotImplementedError('Device does not support this method')