new complex for --bin

This commit is contained in:
awe
2026-04-10 20:20:16 +03:00
parent eee1039099
commit fac0add45d
6 changed files with 36 additions and 15 deletions

View File

@ -528,12 +528,15 @@ def run_pyqtgraph(args) -> None:
"""Start the PyQtGraph GUI."""
peak_calibrate_mode = bool(getattr(args, "calibrate", False))
peak_search_enabled = bool(getattr(args, "peak_search", False))
bin_mode = bool(getattr(args, "bin_mode", False))
complex_ascii_mode = bool(getattr(args, "parser_complex_ascii", False))
complex_sweep_mode = bool(
complex_ascii_mode
bin_mode
or complex_ascii_mode
or getattr(args, "parser_16_bit_x2", False)
or getattr(args, "parser_test", False)
)
bin_iq_power_mode = bool(bin_mode)
if not sys.platform.startswith("win"):
display_name = os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY")
if not display_name:
@ -556,7 +559,7 @@ def run_pyqtgraph(args) -> None:
queue,
stop_event,
fancy=bool(args.fancy),
bin_mode=bool(args.bin_mode),
bin_mode=bin_mode,
logscale=bool(args.logscale),
parser_16_bit_x2=bool(args.parser_16_bit_x2),
parser_test=bool(args.parser_test),
@ -657,8 +660,12 @@ def run_pyqtgraph(args) -> None:
p_fft.setLabel("left", "Амплитуда" if complex_sweep_mode else "дБ")
if complex_sweep_mode:
try:
p_fft.setTitle("FFT: Re / Im / Abs")
p_line.setTitle("Сырые данные до FFT")
if bin_iq_power_mode:
p_fft.setTitle("FFT: CH1 + i*CH2")
p_line.setTitle("Сырые CH1/CH2 и CH1^2 + CH2^2")
else:
p_fft.setTitle("FFT: Re / Im / Abs")
p_line.setTitle("Сырые данные до FFT")
except Exception:
pass
@ -759,7 +766,9 @@ def run_pyqtgraph(args) -> None:
parsed_data_cb = QtWidgets.QCheckBox("данные после парсинга")
if complex_sweep_mode:
try:
parsed_data_cb.setText("Сырые Re/Im")
parsed_data_cb.setText("Сырые CH1/CH2" if bin_iq_power_mode else "Сырые Re/Im")
if bin_iq_power_mode:
parsed_data_cb.setChecked(True)
except Exception:
pass
fft_curve_group = QtWidgets.QGroupBox("FFT кривые")
@ -1568,7 +1577,15 @@ def run_pyqtgraph(args) -> None:
runtime.full_current_fft_source = (
calibrated_aux_1.astype(np.complex64) + (1j * calibrated_aux_2.astype(np.complex64))
)
runtime.full_current_sweep_raw = np.abs(runtime.full_current_fft_source).astype(np.float32)
if bin_iq_power_mode:
aux_1_f64 = calibrated_aux_1.astype(np.float64, copy=False)
aux_2_f64 = calibrated_aux_2.astype(np.float64, copy=False)
runtime.full_current_sweep_raw = np.asarray(
(aux_1_f64 * aux_1_f64) + (aux_2_f64 * aux_2_f64),
dtype=np.float32,
)
else:
runtime.full_current_sweep_raw = np.abs(runtime.full_current_fft_source).astype(np.float32)
except Exception:
runtime.full_current_aux_curves = None
runtime.full_current_fft_source = None