librosa.filters.diagonal_filter
- librosa.filters.diagonal_filter(window, n, *, slope=1.0, angle=None, zero_mean=False)[source]
Build a two-dimensional diagonal filter.
This is primarily used for smoothing recurrence or self-similarity matrices.
- Parameters:
- windowstring, tuple, number, callable, or list-like
The window function to use for the filter.
See
get_window
for details.Note that the window used here should be non-negative.
- nint > 0
the length of the filter
- slopefloat
The slope of the diagonal filter to produce
- anglefloat or None
If given, the slope parameter is ignored, and angle directly sets the orientation of the filter (in radians). Otherwise, angle is inferred as arctan(slope).
- zero_meanbool
If True, a zero-mean filter is used. Otherwise, a non-negative averaging filter is used.
This should be enabled if you want to enhance paths and suppress blocks.
- Returns:
- kernelnp.ndarray, shape=[(m, m)]
The 2-dimensional filter kernel
Notes
This function caches at level 10.