Added r as attribute to Touchstone

pull/106/head
Holger Mueller 2019-11-21 13:23:17 +01:00
rodzic ec8eb79168
commit b6d041e999
2 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -113,7 +113,11 @@ class Touchstone:
def s22data(self) -> list: def s22data(self) -> list:
return self.s("22") return self.s("22")
def s(self, name: str): @property
def r(self) -> int:
return self.opts.resistance
def s(self, name: str) -> list:
return self.sdata[Touchstone.FIELD_ORDER.index(name)] return self.sdata[Touchstone.FIELD_ORDER.index(name)]
def _parse_comments(self, fp) -> str: def _parse_comments(self, fp) -> str:

Wyświetl plik

@ -61,6 +61,7 @@ class TestTouchstoneTouchstone(unittest.TestCase):
self.assertEqual(str(ts.opts), "# HZ S RI R 50") self.assertEqual(str(ts.opts), "# HZ S RI R 50")
self.assertEqual(len(ts.s11data), 1010) self.assertEqual(len(ts.s11data), 1010)
self.assertEqual(len(ts.s21data), 0) self.assertEqual(len(ts.s21data), 0)
self.assertEqual(ts.r, 50)
ts = Touchstone("./test/data/valid.s2p") ts = Touchstone("./test/data/valid.s2p")
ts.load() ts.load()