bandpass#

gwpy.signal.filter_design.bandpass(
flow: QuantityLike,
fhigh: QuantityLike,
sample_rate: QuantityLike,
fstop: tuple[QuantityLike, QuantityLike] | None = None,
gpass: float = 2,
gstop: float = 30,
type: Literal['iir'] = 'iir',
output: Literal['zpk'] = 'zpk',
**kwargs,
) ZpkType[source]#
gwpy.signal.filter_design.bandpass(
flow: QuantityLike,
fhigh: QuantityLike,
sample_rate: QuantityLike,
fstop: tuple[QuantityLike, QuantityLike] | None = None,
gpass: float = 2,
gstop: float = 30,
type: Literal['iir'] = 'iir',
output: Literal['ba'] = 'ba',
**kwargs,
) BAType
gwpy.signal.filter_design.bandpass(
flow: QuantityLike,
fhigh: QuantityLike,
sample_rate: QuantityLike,
fstop: tuple[QuantityLike, QuantityLike] | None = None,
gpass: float = 2,
gstop: float = 30,
type: Literal['iir'] = 'iir',
output: Literal['sos'] = 'sos',
**kwargs,
) SosType
gwpy.signal.filter_design.bandpass(
flow: QuantityLike,
fhigh: QuantityLike,
sample_rate: QuantityLike,
fstop: tuple[QuantityLike, QuantityLike] | None = None,
gpass: float = 2,
gstop: float = 30,
type: Literal['fir'] = 'fir',
**kwargs,
) TapsType

Design a band-pass filter for the given cutoff frequencies.

Parameters:
flowfloat, Quantity

Lower corner frequency of pass band.

fhighfloat, Quantity

Upper corner frequency of pass band.

sample_ratefloat, Quantity

Sampling rate of target data.

fstoptuple of float

(low, high) edge-frequencies of stop band.

gpassfloat

The maximum loss in the passband (dB).

gstopfloat

The minimum attenuation in the stopband (dB).

typestr

The filter type, either 'iir' or 'fir'.

outputstr, optional, default: 'zpk'

The output format for an IIR filter, either 'zpk', 'ba', or 'sos'.

kwargs

Other keyword arguments are passed directly to iirdesign() or firwin().

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).

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 band-pass filter for 100-1000 Hz for 4096 Hz-sampled data:

>>> from gwpy.signal.filter_design import bandpass
>>> bp = bandpass(100, 1000, 4096)

To view the filter, you can use the BodePlot:

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

(png)

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