kinextract.compute_losvd_roughness
- kinextract.compute_losvd_roughness(b: ndarray) float[source]
Peak-normalised maximum absolute second difference of a LOSVD array.
Measures local curvature: smooth LOSVDs (e.g. a Gaussian with sigma ~ 3 LOSVD bins) have roughness ~ 0.10; jagged noise spikes produce values > 0.20. Used by
_auto_select_xlam()(and logged as a diagnostic at every point of thexlamgrid search) to judge whether the current regularisation strength is sufficient to suppress noise-driven wiggles in the recovered LOSVD.- Parameters:
b (ndarray) – LOSVD histogram to assess (negative values are clipped to zero before computing curvature).
- Returns:
Roughness statistic: the maximum absolute second difference of the (clipped) LOSVD, divided by its peak value. Returns 0.0 if b has fewer than 3 elements, and
infif the peak is essentially zero (a degenerate LOSVD is treated as maximally rough so thatxlamselection pushes toward stronger regularisation).- Return type: