diff --git a/rfg_adc_plotter/gui/pyqtgraph_backend.py b/rfg_adc_plotter/gui/pyqtgraph_backend.py index ddbc4d1..f6b4336 100644 --- a/rfg_adc_plotter/gui/pyqtgraph_backend.py +++ b/rfg_adc_plotter/gui/pyqtgraph_backend.py @@ -950,7 +950,7 @@ def run_pyqtgraph(args) -> None: p_line_aux_vb = pg.ViewBox() try: p_line.showAxis("right") - p_line.getAxis("right").setLabel("CH1/CH2, В") + p_line.getAxis("right").setLabel("√(CH1²+CH2²), В") p_line.scene().addItem(p_line_aux_vb) p_line.getAxis("right").linkToView(p_line_aux_vb) p_line_aux_vb.setXLink(p_line) @@ -989,7 +989,7 @@ def run_pyqtgraph(args) -> None: p_line.setLabel("left", "Y") if bin_iq_power_mode: try: - p_line.setLabel("left", "CH1^2 + CH2^2, В^2") + p_line.setLabel("left", "CH1²+CH2², В²") except Exception: pass ch_text = pg.TextItem("", anchor=(1, 1)) @@ -1239,7 +1239,7 @@ def run_pyqtgraph(args) -> None: parsed_data_cb = QtWidgets.QCheckBox("данные после парсинга") if complex_sweep_mode: try: - parsed_data_cb.setText("Сырые CH1/CH2 (В)" if bin_iq_power_mode else "Сырые Re/Im") + parsed_data_cb.setText("√(CH1²+CH2²) (В)" if bin_iq_power_mode else "Сырые Re/Im") parsed_data_cb.setChecked(False) except Exception: pass @@ -1721,15 +1721,15 @@ def run_pyqtgraph(args) -> None: p_fft.setTitle("FFT: exp(V)") parsed_data_cb.setText("Сырые log-detector (В)") elif is_do1_tagged: - p_line.setTitle("DO1 tagged raw: LOW/HIGH CH1^2 + CH2^2 (В^2)") - p_line.setLabel("left", "CH1^2 + CH2^2, В^2") + p_line.setTitle("DO1 tagged raw: LOW/HIGH CH1²+CH2² (В²)") + p_line.setLabel("left", "CH1²+CH2², В²") p_fft.setTitle("FFT") - parsed_data_cb.setText("DO1 tagged CH1/CH2 (В)") + parsed_data_cb.setText("DO1 tagged √(CH1²+CH2²) (В)") elif is_bin_iq: - p_line.setTitle("Сырые CH1/CH2 (В) и CH1^2 + CH2^2 (В^2)") - p_line.setLabel("left", "CH1^2 + CH2^2, В^2") + p_line.setTitle("√(CH1²+CH2²) (В) и CH1²+CH2² (В²)") + p_line.setLabel("left", "CH1²+CH2², В²") p_fft.setTitle("FFT: CH1 + i*CH2") - parsed_data_cb.setText("Сырые CH1/CH2 (В)") + parsed_data_cb.setText("√(CH1²+CH2²) (В)") elif complex_sweep_mode: p_line.setTitle("Сырые данные до FFT") p_line.setLabel("left", "Y") @@ -2885,18 +2885,24 @@ def run_pyqtgraph(args) -> None: if isinstance(secondary_payload, dict): sec_ch1 = secondary_payload.get("ch1") sec_ch2 = secondary_payload.get("ch2") - if sec_ch1 is not None: + if sec_ch1 is not None and sec_ch2 is not None: + sec_ch1_calibrated = np.asarray( + calibrate_freqs({"F": base_freqs, "I": sec_ch1})["I"], + dtype=np.float32, + ) + sec_ch2_calibrated = np.asarray( + calibrate_freqs({"F": base_freqs, "I": sec_ch2})["I"], + dtype=np.float32, + ) + v_ch1 = convert_tty_i16_to_voltage(sec_ch1_calibrated, tty_range_v) + v_ch2 = convert_tty_i16_to_voltage(sec_ch2_calibrated, tty_range_v) + runtime.full_secondary_ch1 = np.sqrt(v_ch1 ** 2 + v_ch2 ** 2) + elif sec_ch1 is not None: sec_ch1_calibrated = np.asarray( calibrate_freqs({"F": base_freqs, "I": sec_ch1})["I"], dtype=np.float32, ) runtime.full_secondary_ch1 = convert_tty_i16_to_voltage(sec_ch1_calibrated, tty_range_v) - if sec_ch2 is not None: - sec_ch2_calibrated = np.asarray( - calibrate_freqs({"F": base_freqs, "I": sec_ch2})["I"], - dtype=np.float32, - ) - runtime.full_secondary_ch2 = convert_tty_i16_to_voltage(sec_ch2_calibrated, tty_range_v) refresh_current_window(push_to_ring=True) processed_frames += 1 last_packet_processed_at = time.time()