remove half junk from spectre

This commit is contained in:
awe
2026-02-26 16:57:07 +03:00
parent 00323af0f0
commit 33e1976233
4 changed files with 11 additions and 5 deletions

View File

@ -69,7 +69,7 @@ def build_frequency_axis_hz(sweep_width: int) -> np.ndarray:
"""Построить частотную сетку (Гц) для текущей длины свипа."""
n = int(sweep_width)
if n <= 0:
return np.zeros((0,), dtype=np.float64)
return np.zeros((0,), dtype=np.float128)
if n == 1:
return np.array([FREQ_MIN_GHZ * 1e9], dtype=np.float64)
return np.linspace(FREQ_MIN_GHZ * 1e9, FREQ_MAX_GHZ * 1e9, n, dtype=np.float64)
@ -101,7 +101,6 @@ def unwrap_arccos_phase_continuous(x_norm: np.ndarray) -> np.ndarray:
phi0 = np.arccos(x)
out = np.empty_like(phi0, dtype=np.float64)
out[0] = float(phi0[0])
for i in range(1, phi0.size):
base_phi = float(phi0[i])
prev = float(out[i - 1])
@ -125,7 +124,7 @@ def unwrap_arccos_phase_continuous(x_norm: np.ndarray) -> np.ndarray:
out[i] = prev if best_cand is None else float(best_cand)
return out
return phi0
def reconstruct_complex_spectrum_from_real_trace(sweep: np.ndarray) -> np.ndarray:
"""Восстановить комплексный спектр из вещественного следа через arccos+Euler."""
@ -238,7 +237,7 @@ def compute_ifft_profile_from_sweep(sweep: Optional[np.ndarray]) -> tuple[np.nda
n = min(depth_m.size, y.size)
if n <= 0:
return _fallback_depth_response(s.size, s)
return depth_m[:n].astype(np.float32, copy=False), y[:n].astype(np.float32, copy=False)
return depth_m[:n].astype(np.float128, copy=False), y[:n].astype(np.float128, copy=False) *20
except Exception as exc: # noqa: BLE001
logger.error("compute_ifft_profile_from_sweep failed: %r", exc)
return _fallback_depth_response(np.asarray(sweep).size if sweep is not None else 1, sweep)