fun_K03_peak_wavevector.py

输入似然应有限且包含可定位的峰。非有限或完全平坦的数组抛 ValueError;相等最大值按数组顺序取第一个。

直接用途

定位对数似然网格的极大点。

参数表

参数

方向

shape / 范围

含义

单位 / 归一化

索引 / 轴约定

log_likelihood

in

(nky, nkx)

来自 fun_K03_joint_log_likelihood 的似然。

无量纲

输出按 [iy, ix] 索引,与 numpy.meshgrid 默认次序一致。

kx_values

in

(nkx,)

波数网格。

rad/m

对应输出的轴 1。

ky_values

in

(nky,)

波数网格。

rad/m

对应输出的轴 0。

返回值

dict,含 kx、ky、k_magnitude、angle_deg 和 peak_log_likelihood。

局部假设 / 前置条件

  • 估计值被限制在网格上,精度与网格分辨率及混叠分支选择有关。

实现逻辑

  • argmax 后 unravel_index,同时给出直角坐标与极坐标形式。

调用注意

  • 峰位落在边界时,可扩大范围并比较结果;angle_deg 由 arctan2 给出。

The input likelihood must be finite and have a locatable peak. Nonfinite or flat arrays raise ValueError; exact ties select the first point in array order.

Direct Purpose

Locate the maximum of a log-likelihood grid.

Parameter Table

Parameter

Direction

Shape / range

Meaning

Units / normalisation

Indexing / axis convention

log_likelihood

in

(nky, nkx)

Likelihood from fun_K03_joint_log_likelihood.

Dimensionless

The output is indexed [iy, ix], matching the numpy.meshgrid default ordering.

kx_values

in

(nkx,)

Wavenumber grid.

rad/m

Maps to axis 1 of the output.

ky_values

in

(nky,)

Wavenumber grid.

rad/m

Maps to axis 0 of the output.

Return Value

dict with kx, ky, k_magnitude, angle_deg and peak_log_likelihood.

Local Assumptions and Preconditions

  • The estimate is confined to the grid, so the accuracy depends on grid resolution and alias selection.

Implementation Notes

  • argmax followed by unravel_index, reported in both Cartesian and polar form.

Calling Notes

  • For a boundary peak, expand the range and compare the resulting estimates. angle_deg comes from arctan2.