neurodsp.plts.plot_filter_properties

neurodsp.plts.plot_filter_properties(f_db, db, fs, impulse_response)[source]

Plot filter properties, including frequency response and filter kernel.

Parameters
f_db1d array

Frequency vector corresponding to attenuation decibels, in Hz.

db1d array

Degree of attenuation for each frequency specified in f_db, in dB.

fsfloat

Sampling rate, in Hz.

impulse_response1d array

The impulse response of a filter. For an FIR filter, these are the filter coefficients.

Examples

Plot the properties of an FIR bandpass filter:

>>> from neurodsp.filt import design_fir_filter
>>> from neurodsp.filt.utils import compute_frequency_response
>>> fs = 500
>>> filter_coefs = design_fir_filter(fs, pass_type='bandpass', f_range=(1, 40))
>>> f_db, db = compute_frequency_response(filter_coefs, 1, fs)
>>> plot_filter_properties(f_db, db, fs, filter_coefs)