coherence — ACOUSTICS dual op

資料種類:signal × signaltable

呼叫:import acoustics; acoustics.coherence(x, y, rate, win=None, hop=None, window='hann')(或 opsacoustics.get("coherence"))

用法

普通同調:`y 中能被 x` 線性解釋的比例。

> 以下的詳細說明為原文 —— 摘要與標題已翻譯。

`gamma**2(f) = |Pxy|**2 / (Pxx * Pyy)`, Welch-averaged. It is bounded in

`[0, 1]`, and it is the number that says whether a transfer function is

worth reading at a given frequency.

A single frame makes it identically 1.0 — the Cauchy-Schwarz inequality

is an equality without averaging — so an unaveraged coherence is a perfect

score that carries no information at all. That case is refused, not returned.

`win` defaults to the largest power of two leaving at least 8 frames,

capped at 1024; the value used is returned.

Returns a dict: `freqs, coherence, n_frames, win, hop`,

`rate, mean_coherence, bias` (the coherence a *pair of independent

noise records* would show with this many frames, `1/n_frames` — anything

at or below this is indistinguishable from nothing).

Measured at 16 kHz over 16384 samples, win = 1024, 31 frames:

======================================= ============== ========

case mean coherence min

======================================= ============== ========

y = 2.5 * x (noiseless) 1.000000 1.0000

y = 0.8 * x delayed 37 samples 0.983003 0.9661

y = 2.5 x + independent noise, 0 dB SNR 0.509143 0.2219

y, x independent noise 0.035640 0.0001

======================================= ============== ========

Row three against its closed form: for output noise the expected coherence

is `SNR/(1+SNR)` = 0.5000 at 0 dB, measured 0.5091. Row four against the

bias floor `1/n_frames = 1/31 = 0.0323`, measured 0.0356 — which is why

`bias` is returned: an uncorrelated pair does not read zero, and

reading 0.03 as "a little bit of coupling" is the mistake this number

prevents. Row two shows the other honest limit: a pure delay is a perfectly

linear system and still reads 0.983, not 1, because a delay of 37 samples

moves signal across the frame boundaries the estimator averages over.

Raises `ValueError: everything :func:_as_signal` refuses on either

channel, unequal channel lengths, fewer than 2 frames, `win` longer than

the record, an unknown window.

詳細使用指南

acoustic_condition_monitoring 族使用指南

參考(範例資料・文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

• 演算法的正典(作者・年份)與用途見上面的族使用指南

可執行的範例(實際呼叫該運算子並已驗證的樣例)

acoustic_condition_monitoringpy -3.11 examples/acoustic_condition_monitoring.py

型別可銜接的下一個運算子(可接受 table 作為輸入)

istft

同類別(dual)

transfer_function


*Provenance: acoustics.py — ACOUSTICS 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.