notch#

gwpy.signal.filter_design.notch(
frequency: QuantityLike,
sample_rate: QuantityLike,
type: Literal['iir'] = 'iir',
output: Literal['zpk'] = 'zpk',
**kwargs,
) ZpkType[source]#
gwpy.signal.filter_design.notch(
frequency: QuantityLike,
sample_rate: QuantityLike,
type: Literal['iir'] = 'iir',
output: Literal['ba'] = 'ba',
**kwargs,
) BAType
gwpy.signal.filter_design.notch(
frequency: QuantityLike,
sample_rate: QuantityLike,
type: Literal['iir'] = 'iir',
output: Literal['sos'] = 'sos',
**kwargs,
) SosType

Design a ZPK notch filter for the given frequency and sampling rate.

Parameters:
frequencyfloat, Quantity

Frequency (default in Hertz) at which to apply the notch.

sample_ratefloat, Quantity

Number of samples per second for TimeSeries to which this notch filter will be applied.

typestr, optional, default: ‘iir’

Type of filter to apply, currently only ‘iir’ is supported.

outputstr, optional, default: ‘zpk’

Output format for notch.

kwargs

Other keyword arguments to pass to scipy.signal.iirdesign.

Returns:
filter

The formatted filter. The output format for an IIR filter depends on the input arguments, default is a tuple of (zeros, poles, gain).

See also

scipy.signal.iirdesign

For details on the IIR filter design method and the output formats.

Notes

By default a digital filter is returned, meaning the zeros and poles are given in the Z-domain in units of radians/sample.

Examples

To create a low-pass filter at 1000 Hz for 4096 Hz-sampled data:

>>> from gwpy.signal.filter_design import notch
>>> n = notch(100, 4096)

To view the filter, you can use the BodePlot:

>>> from gwpy.plot import BodePlot
>>> plot = BodePlot(n, sample_rate=4096)
>>> plot.show()

(png)

../../_images/gwpy-signal-filter_design-notch-1.png