# Filters¶

The pygsp.filters module implements methods used for filtering and defines commonly used filters that can be applied to pygsp.graphs. A filter is associated to a graph and is defined with one or several functions. We define by filter bank a list of filters, usually centered around different frequencies, applied to a single graph.

## Interface¶

The Filter base class implements a common interface to all filters:

 Filter.evaluate(self, x) Evaluate the kernels at given frequencies. Filter.filter(self, s[, method, order]) Filter signals (analysis or synthesis). Filter.analyze(self, s[, method, order]) Convenience alias to filter(). Filter.synthesize(self, s[, method, order]) Convenience wrapper around filter(). Filter.compute_frame(self, \*\*kwargs) Compute the associated frame. Filter.estimate_frame_bounds(self[, min, …]) Estimate lower and upper frame bounds. Filter.plot(self, \*\*kwargs) Plot the filter bank’s frequency response. Filter.localize(self, i, \*\*kwargs) Localize the kernels at a node (to visualize them).

## Filters¶

Then, derived classes implement various common graph filters.

Filter banks of N filters

 Abspline(G[, Nf, lpfactor, scales]) Design an A B cubic spline wavelet filter bank. Gabor(G, k) Design a Gabor filter bank. HalfCosine(G[, Nf]) Design an half cosine filter bank (tight frame). Itersine(G[, Nf, overlap]) Design an itersine filter bank (tight frame). MexicanHat(G[, Nf, lpfactor, scales, normalize]) Design a filter bank of Mexican hat wavelets. Meyer(G[, Nf, scales]) Design a filter bank of Meyer wavelets (tight frame). SimpleTight(G[, Nf, scales]) Design a simple tight frame filter bank (tight frame).

Filter banks of 2 filters: a low pass and a high pass

 Regular(G[, d]) Design 2 filters with the regular construction (tight frame). Held(G[, a]) Design 2 filters with the Held construction (tight frame). Simoncelli(G[, a]) Design 2 filters with the Simoncelli construction (tight frame). Papadakis(G[, a]) Design 2 filters with the Papadakis construction (tight frame).

Low pass filters

 Heat(G[, tau, normalize]) Design a filter bank of heat kernels. Expwin(G[, bmax, a]) Design an exponential window filter.

## Approximations¶

Moreover, two approximation methods are provided for fast filtering. The computational complexity of filtering with those approximations is linear with the number of edges. The complexity of the exact solution, which is to use the Fourier basis, is quadratic with the number of nodes (without taking into account the cost of the necessary eigendecomposition of the graph Laplacian).

Chebyshev polynomials

 compute_cheby_coeff(f[, m, N]) Compute Chebyshev coefficients for a Filterbank. compute_jackson_cheby_coeff(filter_bounds, …) To compute the m+1 coefficients of the polynomial approximation of an ideal band-pass between a and b, between a range of values defined by lambda_min and lambda_max. cheby_op(G, c, signal, \*\*kwargs) Chebyshev polynomial of graph Laplacian applied to vector. cheby_rect(G, bounds, signal, \*\*kwargs) Fast filtering using Chebyshev polynomial for a perfect rectangle filter.

Lanczos algorithm

 lanczos(A, order, x) TODO short description lanczos_op(f, s[, order]) Perform the lanczos approximation of the signal s.