diff --git a/RFG_ADC_dataplotter.py b/RFG_ADC_dataplotter.py index f019a80..184cf37 100755 --- a/RFG_ADC_dataplotter.py +++ b/RFG_ADC_dataplotter.py @@ -38,7 +38,7 @@ SWEEP_FREQ_MIN_GHZ = 3.3 SWEEP_FREQ_MAX_GHZ = 14.3 LOG_BASE = 10.0 LOG_SCALER = 0.001 # int32 значения приходят в fixed-point лог-шкале с шагом 1e-3 -LOG_POSTSCALER = 1 +LOG_POSTSCALER = 10 LOG_EXP_LIMIT = 300.0 # запас до переполнения float64 при возведении LOG_BASE в степень C_M_S = 299_792_458.0 # Порог для инверсии сырых данных: если среднее значение свипа ниже порога — @@ -364,6 +364,7 @@ def _find_peak_width_markers(xs: np.ndarray, ys: np.ndarray) -> Optional[Dict[st "left": left_x, "right": right_x, "width": width, + "amplitude": peak_y, } @@ -1557,6 +1558,7 @@ def main(): bg_subtract_enabled = False peak_calibrate_mode = bool(getattr(args, "calibrate", False)) current_peak_width: Optional[float] = None + current_peak_amplitude: Optional[float] = None norm_type = str(getattr(args, "norm_type", "projector")).strip().lower() cb = None c_boxes = [] @@ -1971,7 +1973,7 @@ def main(): return base.T # (bins, time) def update(_frame): - nonlocal frames_since_ylim_update, current_peak_width + nonlocal frames_since_ylim_update, current_peak_width, current_peak_amplitude if peak_calibrate_mode and any(getattr(tb, "capturekeystrokes", False) for tb in c_boxes): return ( line_obj, @@ -2058,6 +2060,7 @@ def main(): spec_left_obj.set_visible(True) spec_right_obj.set_visible(True) current_peak_width = markers["width"] + current_peak_amplitude = markers["amplitude"] else: fft_bg_obj.set_visible(False) fft_left_obj.set_visible(False) @@ -2065,6 +2068,7 @@ def main(): spec_left_obj.set_visible(False) spec_right_obj.set_visible(False) current_peak_width = None + current_peak_amplitude = None else: fft_bg_obj.set_visible(False) fft_left_obj.set_visible(False) @@ -2072,6 +2076,7 @@ def main(): spec_left_obj.set_visible(False) spec_right_obj.set_visible(False) current_peak_width = None + current_peak_amplitude = None # Обновление водопада if changed and ring is not None: @@ -2146,6 +2151,8 @@ def main(): status_payload = dict(current_info) if peak_calibrate_mode and current_peak_width is not None: status_payload["peak_w"] = current_peak_width + if peak_calibrate_mode and current_peak_amplitude is not None: + status_payload["peak_a"] = current_peak_amplitude status_text.set_text(_format_status_kv(status_payload)) chs = current_info.get("chs") if isinstance(current_info, dict) else None if chs is None: @@ -2395,6 +2402,7 @@ def run_pyqtgraph(args): calib_enabled = False bg_subtract_enabled = False current_peak_width: Optional[float] = None + current_peak_amplitude: Optional[float] = None norm_type = str(getattr(args, "norm_type", "projector")).strip().lower() c_edits = [] c_value_labels = [] @@ -2695,7 +2703,7 @@ def run_pyqtgraph(args): pass def update(): - nonlocal current_peak_width, plot_dirty, current_fft_db + nonlocal current_peak_width, current_peak_amplitude, plot_dirty, current_fft_db if peak_calibrate_mode and any(edit.hasFocus() for edit in c_edits): return changed = drain_queue() > 0 @@ -2767,6 +2775,7 @@ def run_pyqtgraph(args): spec_left_line.setVisible(True) spec_right_line.setVisible(True) current_peak_width = markers["width"] + current_peak_amplitude = markers["amplitude"] else: fft_bg_line.setVisible(False) fft_left_line.setVisible(False) @@ -2774,6 +2783,7 @@ def run_pyqtgraph(args): spec_left_line.setVisible(False) spec_right_line.setVisible(False) current_peak_width = None + current_peak_amplitude = None else: fft_bg_line.setVisible(False) fft_left_line.setVisible(False) @@ -2781,6 +2791,7 @@ def run_pyqtgraph(args): spec_left_line.setVisible(False) spec_right_line.setVisible(False) current_peak_width = None + current_peak_amplitude = None plot_dirty = False if changed and ring is not None: @@ -2797,6 +2808,8 @@ def run_pyqtgraph(args): status_payload = dict(current_info) if peak_calibrate_mode and current_peak_width is not None: status_payload["peak_w"] = current_peak_width + if peak_calibrate_mode and current_peak_amplitude is not None: + status_payload["peak_a"] = current_peak_amplitude status.setText(_format_status_kv(status_payload)) except Exception: pass