This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / signal / _peak_finding / _identify_ridge_lines

function

scipy.signal._peak_finding:_identify_ridge_lines

source: build-install/usr/lib/python3.14/site-packages/scipy/signal/_peak_finding.py:1013

Signature

def _identify_ridge_lines(matr, max_distances, gap_thresh)

Summary

Identify ridges in the 2-D matrix.

Extended Summary

Expect that the width of the wavelet feature increases with increasing row number.

Parameters

matr : 2-D ndarray

Matrix in which to identify ridge lines.

max_distances : 1-D sequence

At each row, a ridge line is only connected if the relative max at row[n] is within `max_distances`[n] from the relative max at row[n+1].

gap_thresh : int

If a relative maximum is not found within max_distances, there will be a gap. A ridge line is discontinued if there are more than gap_thresh points without connecting a new relative maximum.

Returns

ridge_lines : tuple

Tuple of 2 1-D sequences. `ridge_lines`[ii][0] are the rows of the ii-th ridge-line, `ridge_lines`[ii][1] are the columns. Empty if none found. Each ridge-line will be sorted by row (increasing), but the order of the ridge lines is not specified.

Notes

This function is intended to be used in conjunction with cwt as part of find_peaks_cwt.

Examples

import numpy as np
from scipy.signal._peak_finding import _identify_ridge_lines
rng = np.random.default_rng()
data = rng.random((5,5))
max_dist = 3
max_distances = np.full(20, max_dist)
ridge_lines = _identify_ridge_lines(data, max_distances, 1)
✓

Aliases

  • scipy.signal._peak_finding._identify_ridge_lines