neurodsp.filt.utils.compute_pass_band

neurodsp.filt.utils.compute_pass_band(fs, pass_type, f_range)[source]

Compute the pass bandwidth of a filter.

Parameters
fsfloat

Sampling rate, in Hz.

pass_type{‘bandpass’, ‘bandstop’, ‘lowpass’, ‘highpass’}

Which kind of filter to apply:

  • ‘bandpass’: apply a bandpass filter

  • ‘bandstop’: apply a bandstop (notch) filter

  • ‘lowpass’: apply a lowpass filter

  • ‘highpass’ : apply a highpass filter

f_rangetuple of (float, float) or float

Cutoff frequency(ies) used for filter, specified as f_lo & f_hi. For ‘bandpass’ & ‘bandstop’, must be a tuple. For ‘lowpass’ or ‘highpass’, can be a float that specifies pass frequency, or can be a tuple and is assumed to be (None, f_hi) for ‘lowpass’, and (f_lo, None) for ‘highpass’.

Returns
pass_bwfloat

The pass bandwidth of the filter, in Hz.

Examples

Compute the bandwidth of a bandpass filter:

>>> compute_pass_band(fs=500, pass_type='bandpass', f_range=(5, 25))
20.0