kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
Full Precission sweep format
rodzic
9c465303a7
commit
c8afac2dc6
|
@ -126,7 +126,7 @@ class RFTools:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def formatSweepFrequency(freq: Number) -> str:
|
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
|
@staticmethod
|
||||||
def parseFrequency(freq: str) -> int:
|
def parseFrequency(freq: str) -> int:
|
||||||
|
|
|
@ -28,6 +28,7 @@ class Format(NamedTuple):
|
||||||
assume_infinity: bool = True
|
assume_infinity: bool = True
|
||||||
min_offset: int = -8
|
min_offset: int = -8
|
||||||
max_offset: int = 8
|
max_offset: int = 8
|
||||||
|
allow_strip: bool = False
|
||||||
parse_sloppy_unit: bool = False
|
parse_sloppy_unit: bool = False
|
||||||
parse_sloppy_kilo: bool = False
|
parse_sloppy_kilo: bool = False
|
||||||
|
|
||||||
|
@ -73,6 +74,9 @@ class Value():
|
||||||
if float(result) == 0.0:
|
if float(result) == 0.0:
|
||||||
offset = 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
|
return result + fmt.space_str + PREFIXES[offset + 8] + self._unit
|
||||||
|
|
||||||
def parse(self, value: str) -> float:
|
def parse(self, value: str) -> float:
|
||||||
|
|
Ładowanie…
Reference in New Issue