amplitude for switch

This commit is contained in:
awe
2026-05-29 18:07:37 +03:00
parent 446a5c774e
commit 8e5057aef6

View File

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