Full Precission sweep format

pull/98/head
Holger Mueller 2019-11-18 08:00:45 +01:00
rodzic 9c465303a7
commit c8afac2dc6
2 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -126,7 +126,7 @@ class RFTools:
@staticmethod
def formatSweepFrequency(freq: Number) -> str:
return str(Value(freq, "Hz", Format(max_nr_digits=5)))
return str(Value(freq, "Hz", Format(max_nr_digits=9, allow_strip=True)))
@staticmethod
def parseFrequency(freq: str) -> int:

Wyświetl plik

@ -28,6 +28,7 @@ class Format(NamedTuple):
assume_infinity: bool = True
min_offset: int = -8
max_offset: int = 8
allow_strip: bool = False
parse_sloppy_unit: bool = False
parse_sloppy_kilo: bool = False
@ -73,6 +74,9 @@ class Value():
if float(result) == 0.0:
offset = 0
if self.fmt.allow_strip and "." in result:
result = result.rstrip("0").rstrip(".")
return result + fmt.space_str + PREFIXES[offset + 8] + self._unit
def parse(self, value: str) -> float: