-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Great idea. You already maintain the machinery (I/Q envelope, P_{\text{disp}}=|\hat\eta|^2, and spectral moments). Here are drop-in metrics you can estimate online, with compact formulas and how they relate to “regularity”.
⸻
Moment-family (add M_3, M_4)
Let M_k=\langle P_{\text{disp}};\omega^k\rangle (your EMAs). You already have M_0,M_1,M_2.
• Add: M_3=\langle P\omega^3\rangle,; M_4=\langle P\omega^4\rangle.
From these:
• Mean angular frequency: \bar\omega = M_1/M_0 (you already use this).
• Central moments (about \bar\omega):
\mu_2 = \frac{M_2}{M_0}-\bar\omega^2,\qquad
\mu_3 = \frac{M_3}{M_0}-3\bar\omega\frac{M_2}{M_0}+2\bar\omega^3,
\mu_4 = \frac{M_4}{M_0}-4\bar\omega\frac{M_3}{M_0}+6\bar\omega^2\frac{M_2}{M_0}-3\bar\omega^4.
• (Excess) kurtosis (your “M4 metric”):
\gamma_2 = \frac{\mu_4}{\mu_2^2}-3.
Interpretation: narrow, peaky spectra \Rightarrow \gamma_2 \uparrow. Broadband \Rightarrow \gamma_2 \downarrow (toward 0 for quasi-Gaussian).
• Skewness:
\gamma_1 = \frac{\mu_3}{\mu_2^{3/2}}.
Interpretation: asymmetric spectral mass around \bar\omega (e.g., wind-sea tail vs swell).
• Classical oceanographic bandwidth (Cartwright–Longuet-Higgins):
\varepsilon = \sqrt{1-\frac{M_2^2}{M_0,M_4}} \quad \in [0,1].
Interpretation: \varepsilon!\downarrow \Rightarrow more narrowband (regular); \varepsilon!\uparrow broadband.
• Period summaries (very handy readouts):
T_{m01}=\frac{2\pi,M_0}{M_1},\qquad
T_{m02}=2\pi\sqrt{\frac{M_0}{M_2}}.
• Mean zero-upcrossing period: T_z = T_{m02}.
• Upcrossing rate: \nu_0=\dfrac{1}{T_z}=\dfrac{1}{2\pi}\sqrt{M_2/M_0}.
⸻
Entropy-family (broadband vs regular)
Let a power-weighted frequency PDF be
p(\omega) \approx \frac{P_{\text{disp}}(\omega)}{\int P_{\text{disp}}(\omega’),d\omega’}.
Online, approximate by binning \omega (e.g., 16–32 bins) and EMA-accumulating E_i=\langle P\cdot \mathbf{1}{\omega\in \text{bin }i}\rangle, then p_i=E_i/\sum_j E_j.
• Shannon spectral entropy (discrete):
H{\text{spec}} = -\sum_i p_i \log p_i,\qquad
H_{\text{norm}}=\frac{H_{\text{spec}}}{\log N_{\text{bins}}}\in[0,1].
Interpretation: regular/narrow \Rightarrow H_{\text{norm}}!\downarrow; broadband \Rightarrow H_{\text{norm}}!\uparrow.
• Rényi entropy (order \alpha, e.g., 2):
H_\alpha = \frac{1}{1-\alpha}\log!\sum_i p_i^\alpha
More sensitive to peaks for \alpha>1.
• Spectral flatness (geometric/arith. mean):
\mathrm{SF} = \frac{\exp\big(\sum_i p_i \log s_i\big)}{\sum_i p_i s_i},\quad s_i:=E_i/(\Delta\omega_i)
(Or compute on envelope power samples with a log-EMA and linear-EMA pair.)
Interpretation: \mathrm{SF}\to 0 for peaky (regular), \mathrm{SF}\to 1 for white-like.
⸻
Phase/circular statistics add-ons
You already track R_{\text{phase}} = |\langle \mathbf{u}\rangle| with \mathbf{u} = z/|z|.
• Von Mises concentration \kappa from R (use standard R!\to!\kappa approximation); then circular (differential) entropy of the von Mises model:
h_{\text{circ}} \approx \log!\big(2\pi I_0(\kappa)\big) - \kappa,\frac{I_1(\kappa)}{I_0(\kappa)}.
Interpretation: lower h_{\text{circ}} \Rightarrow more phase-locked (regular).
(If you’d rather avoid Bessel: coarse-bin the phase of z into p_k and compute Shannon entropy like above.)
• Phase slip rate: EMA of |\dot\phi - \omega_{\text{lp}}| normalized by \omega_{\text{lp}}. Interpretation: demodulation consistency; lower is more regular.
• Rice K-factor on the complex envelope z:
K = \frac{|\langle z\rangle|^2}{\langle |z-\langle z\rangle|^2\rangle}.
Interpretation: large K = strong “line-of-sight” (single tone) + weak scatter; small K = diffuse/broadband.
⸻
Amplitude/envelope statistics
Using |\hat\eta| (disp envelope magnitude):
• Crest factor:
\mathrm{CF} = \frac{\max_t |\hat\eta|}{\sqrt{\langle \hat\eta^2\rangle}}\quad
\text{(use running max over, e.g., (30–60) s).}
Higher CF often indicates intermittent broadening or harmonics.
• Envelope coefficient of variation:
\mathrm{CV} = \frac{\mathrm{std}(|\hat\eta|)}{\mathrm{mean}(|\hat\eta|)}.
Regular seas trend to lower CV (after spin-up).
• Rayleighness test (for narrowband Gaussian seas): compare empirical CDF of |\hat\eta| to Rayleigh with parameter \sigma^2=\tfrac{1}{2}\langle \hat\eta^2\rangle; report a KS distance D_R. Small D_R supports classical narrowband assumption.
⸻
Quick oceanographic “derived” set (from M_0,M_1,M_2,M_4)
• Significant height (you already have): H_s\approx 4\sqrt{m_0} for displacement; your online M_0 is the time-domain analog—keep your blend.
• Peak period proxies:
• T_{m01}=2\pi M_0/M_1
• T_{m02}=2\pi\sqrt{M_0/M_2}=T_z (mean zero-upcrossing period)
• Bandwidth \varepsilon as above, and optionally the Benassai parameter B = \sqrt{1-\dfrac{M_1^2}{M_0 M_2}} (another width measure, less sensitive to tails).
⸻
Implementation sketch (what to add to your class)
• Accumulators: M3, M4 (float), optional bins_K (small array) for entropy, plus EMAs for meanZ and varZ to get Rice K.
• In updateSpectralMoments():
// After computing P_disp and omega_norm
M3 = (1-a_m)M3 + a_m * (P_disp * omega_normomega_normomega_norm);
M4 = (1-a_m)M4 + a_m * (P_disp * omega_normomega_normomega_norm*omega_norm);
• Maintain meanZ_r/i and varZ over the displacement envelope (or over z directly) to compute K.
• For entropy: choose, say, 24 ω-bins between [\omega_{\min},\omega_{\max}]; EMA add P_{\text{disp}} into the active bin; readout H_\text{norm} from normalized bin sums.
⸻
How they help you
• Diagnostics: \gamma_2 (excess kurtosis) and \varepsilon separate “really narrow” (clean swell) from “merely not too wide”; entropy and flatness catch multi-peak/shouldered spectra your RBW can miss.
• Fusion: you can build a richer R by blending R_{\text{phase}} with two orthogonal “spread” signals: one moment-based (\varepsilon or \gamma_2) and one information-theoretic (H_{\text{norm}} or SF).
• QA: T_{m01}, T_{m02} give period sanity checks vs your tracker; K exposes hidden AM/FM clutter.
If you want, I can patch your header with M3/M4 + ε + γ2 + H_norm + K fields and exact lines to compute each in your existing methods.