kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
Y Axis changes in charts
rodzic
08c4a6dc2a
commit
f95f223656
|
@ -40,6 +40,7 @@ class FrequencyChart(Chart):
|
|||
maxFrequency = 100000000
|
||||
minFrequency = 1000000
|
||||
|
||||
# TODO: use unscaled values instead of unit dependend ones
|
||||
minDisplayValue = -1
|
||||
maxDisplayValue = 1
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import math
|
|||
from numbers import Number
|
||||
|
||||
from NanoVNASaver import SITools
|
||||
from NanoVNASaver.RFTools import FMT_SHORT
|
||||
|
||||
FMT_FREQ = SITools.Format()
|
||||
FMT_FREQ_SHORT = SITools.Format(max_nr_digits=4)
|
||||
|
@ -37,10 +36,11 @@ FMT_REACT = SITools.Format(max_nr_digits=5, space_str=" ", allow_strip=True)
|
|||
FMT_COMPLEX = SITools.Format(max_nr_digits=3, allow_strip=True,
|
||||
printable_min=0, unprintable_under="- ")
|
||||
FMT_COMPLEX_NEG = SITools.Format(max_nr_digits=3, allow_strip=True)
|
||||
FMT_SHORT = SITools.Format(max_nr_digits=4)
|
||||
FMT_WAVELENGTH = SITools.Format(max_nr_digits=4, space_str=" ")
|
||||
FMT_PARSE = SITools.Format(parse_sloppy_unit=True, parse_sloppy_kilo=True,
|
||||
parse_clamp_min=0)
|
||||
|
||||
FMT_PARSE_VALUE = SITools.Format(parse_sloppy_unit=True, parse_sloppy_kilo=True)
|
||||
|
||||
def format_frequency(freq: Number) -> str:
|
||||
return str(SITools.Value(freq, "Hz", FMT_FREQ))
|
||||
|
@ -130,9 +130,10 @@ def parse_frequency(freq: str) -> int:
|
|||
except (ValueError, IndexError):
|
||||
return -1
|
||||
|
||||
def parse_value(val: str) -> int:
|
||||
def parse_value(val: str, unit: str = "",
|
||||
fmt: SITools.Format = FMT_PARSE_VALUE) -> int:
|
||||
try:
|
||||
val.replace(',', '.')
|
||||
return float(SITools.Value(val, "", FMT_PARSE))
|
||||
return float(SITools.Value(val, unit, fmt))
|
||||
except (ValueError, IndexError):
|
||||
return 0.0
|
||||
|
|
Ładowanie…
Reference in New Issue