in --calibrate mode implemented peak intensity measurement (height above some reference)
This commit is contained in:
@ -38,7 +38,7 @@ SWEEP_FREQ_MIN_GHZ = 3.3
|
|||||||
SWEEP_FREQ_MAX_GHZ = 14.3
|
SWEEP_FREQ_MAX_GHZ = 14.3
|
||||||
LOG_BASE = 10.0
|
LOG_BASE = 10.0
|
||||||
LOG_SCALER = 0.001 # int32 значения приходят в fixed-point лог-шкале с шагом 1e-3
|
LOG_SCALER = 0.001 # int32 значения приходят в fixed-point лог-шкале с шагом 1e-3
|
||||||
LOG_POSTSCALER = 1
|
LOG_POSTSCALER = 10
|
||||||
LOG_EXP_LIMIT = 300.0 # запас до переполнения float64 при возведении LOG_BASE в степень
|
LOG_EXP_LIMIT = 300.0 # запас до переполнения float64 при возведении LOG_BASE в степень
|
||||||
C_M_S = 299_792_458.0
|
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,
|
"left": left_x,
|
||||||
"right": right_x,
|
"right": right_x,
|
||||||
"width": width,
|
"width": width,
|
||||||
|
"amplitude": peak_y,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1557,6 +1558,7 @@ def main():
|
|||||||
bg_subtract_enabled = False
|
bg_subtract_enabled = False
|
||||||
peak_calibrate_mode = bool(getattr(args, "calibrate", False))
|
peak_calibrate_mode = bool(getattr(args, "calibrate", False))
|
||||||
current_peak_width: Optional[float] = None
|
current_peak_width: Optional[float] = None
|
||||||
|
current_peak_amplitude: Optional[float] = None
|
||||||
norm_type = str(getattr(args, "norm_type", "projector")).strip().lower()
|
norm_type = str(getattr(args, "norm_type", "projector")).strip().lower()
|
||||||
cb = None
|
cb = None
|
||||||
c_boxes = []
|
c_boxes = []
|
||||||
@ -1971,7 +1973,7 @@ def main():
|
|||||||
return base.T # (bins, time)
|
return base.T # (bins, time)
|
||||||
|
|
||||||
def update(_frame):
|
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):
|
if peak_calibrate_mode and any(getattr(tb, "capturekeystrokes", False) for tb in c_boxes):
|
||||||
return (
|
return (
|
||||||
line_obj,
|
line_obj,
|
||||||
@ -2058,6 +2060,7 @@ def main():
|
|||||||
spec_left_obj.set_visible(True)
|
spec_left_obj.set_visible(True)
|
||||||
spec_right_obj.set_visible(True)
|
spec_right_obj.set_visible(True)
|
||||||
current_peak_width = markers["width"]
|
current_peak_width = markers["width"]
|
||||||
|
current_peak_amplitude = markers["amplitude"]
|
||||||
else:
|
else:
|
||||||
fft_bg_obj.set_visible(False)
|
fft_bg_obj.set_visible(False)
|
||||||
fft_left_obj.set_visible(False)
|
fft_left_obj.set_visible(False)
|
||||||
@ -2065,6 +2068,7 @@ def main():
|
|||||||
spec_left_obj.set_visible(False)
|
spec_left_obj.set_visible(False)
|
||||||
spec_right_obj.set_visible(False)
|
spec_right_obj.set_visible(False)
|
||||||
current_peak_width = None
|
current_peak_width = None
|
||||||
|
current_peak_amplitude = None
|
||||||
else:
|
else:
|
||||||
fft_bg_obj.set_visible(False)
|
fft_bg_obj.set_visible(False)
|
||||||
fft_left_obj.set_visible(False)
|
fft_left_obj.set_visible(False)
|
||||||
@ -2072,6 +2076,7 @@ def main():
|
|||||||
spec_left_obj.set_visible(False)
|
spec_left_obj.set_visible(False)
|
||||||
spec_right_obj.set_visible(False)
|
spec_right_obj.set_visible(False)
|
||||||
current_peak_width = None
|
current_peak_width = None
|
||||||
|
current_peak_amplitude = None
|
||||||
|
|
||||||
# Обновление водопада
|
# Обновление водопада
|
||||||
if changed and ring is not None:
|
if changed and ring is not None:
|
||||||
@ -2146,6 +2151,8 @@ def main():
|
|||||||
status_payload = dict(current_info)
|
status_payload = dict(current_info)
|
||||||
if peak_calibrate_mode and current_peak_width is not None:
|
if peak_calibrate_mode and current_peak_width is not None:
|
||||||
status_payload["peak_w"] = current_peak_width
|
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))
|
status_text.set_text(_format_status_kv(status_payload))
|
||||||
chs = current_info.get("chs") if isinstance(current_info, dict) else None
|
chs = current_info.get("chs") if isinstance(current_info, dict) else None
|
||||||
if chs is None:
|
if chs is None:
|
||||||
@ -2395,6 +2402,7 @@ def run_pyqtgraph(args):
|
|||||||
calib_enabled = False
|
calib_enabled = False
|
||||||
bg_subtract_enabled = False
|
bg_subtract_enabled = False
|
||||||
current_peak_width: Optional[float] = None
|
current_peak_width: Optional[float] = None
|
||||||
|
current_peak_amplitude: Optional[float] = None
|
||||||
norm_type = str(getattr(args, "norm_type", "projector")).strip().lower()
|
norm_type = str(getattr(args, "norm_type", "projector")).strip().lower()
|
||||||
c_edits = []
|
c_edits = []
|
||||||
c_value_labels = []
|
c_value_labels = []
|
||||||
@ -2695,7 +2703,7 @@ def run_pyqtgraph(args):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def update():
|
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):
|
if peak_calibrate_mode and any(edit.hasFocus() for edit in c_edits):
|
||||||
return
|
return
|
||||||
changed = drain_queue() > 0
|
changed = drain_queue() > 0
|
||||||
@ -2767,6 +2775,7 @@ def run_pyqtgraph(args):
|
|||||||
spec_left_line.setVisible(True)
|
spec_left_line.setVisible(True)
|
||||||
spec_right_line.setVisible(True)
|
spec_right_line.setVisible(True)
|
||||||
current_peak_width = markers["width"]
|
current_peak_width = markers["width"]
|
||||||
|
current_peak_amplitude = markers["amplitude"]
|
||||||
else:
|
else:
|
||||||
fft_bg_line.setVisible(False)
|
fft_bg_line.setVisible(False)
|
||||||
fft_left_line.setVisible(False)
|
fft_left_line.setVisible(False)
|
||||||
@ -2774,6 +2783,7 @@ def run_pyqtgraph(args):
|
|||||||
spec_left_line.setVisible(False)
|
spec_left_line.setVisible(False)
|
||||||
spec_right_line.setVisible(False)
|
spec_right_line.setVisible(False)
|
||||||
current_peak_width = None
|
current_peak_width = None
|
||||||
|
current_peak_amplitude = None
|
||||||
else:
|
else:
|
||||||
fft_bg_line.setVisible(False)
|
fft_bg_line.setVisible(False)
|
||||||
fft_left_line.setVisible(False)
|
fft_left_line.setVisible(False)
|
||||||
@ -2781,6 +2791,7 @@ def run_pyqtgraph(args):
|
|||||||
spec_left_line.setVisible(False)
|
spec_left_line.setVisible(False)
|
||||||
spec_right_line.setVisible(False)
|
spec_right_line.setVisible(False)
|
||||||
current_peak_width = None
|
current_peak_width = None
|
||||||
|
current_peak_amplitude = None
|
||||||
plot_dirty = False
|
plot_dirty = False
|
||||||
|
|
||||||
if changed and ring is not None:
|
if changed and ring is not None:
|
||||||
@ -2797,6 +2808,8 @@ def run_pyqtgraph(args):
|
|||||||
status_payload = dict(current_info)
|
status_payload = dict(current_info)
|
||||||
if peak_calibrate_mode and current_peak_width is not None:
|
if peak_calibrate_mode and current_peak_width is not None:
|
||||||
status_payload["peak_w"] = current_peak_width
|
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))
|
status.setText(_format_status_kv(status_payload))
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user