frequency_response#

gwpy.signal.filter_design.frequency_response(
filt: FilterCompatible,
frequencies: NDArray | int | None,
*,
analog: bool = False,
sample_rate: QuantityLike = 1.0,
unit: str | UnitBase = 'rad/s',
normalize_gain: bool = False,
) tuple[numpy.ndarray[tuple[int]], numpy.ndarray[tuple[int]]][source]#

Compute the frequency response of a filter at given frequencies.

Parameters:
filtFilterCompatible

Filter definition in one of the supported formats.

frequenciesnumpy.ndarray

Frequencies (in Hz) at which to compute the response.

analogbool, optional

Whether the filter is analogue (True) or digital (False).

sample_rateastropy.units.Quantity-like, optional

Sample rate of the digital data (only used if analog is False).

unitstr, optional

For analogue ZPK filters, the units in which the zeros and poles are specified. Either 'Hz' or 'rad/s' (default).

normalize_gainbool, optional

Whether to normalize the gain when converting from Hz to rad/s.

  • False (default): Multiply zeros/poles by -2π but leave gain unchanged. This matches the LIGO GDS ‘f’ plane convention (plane='f' in s2z()).

  • True: Normalize gain to preserve frequency response magnitude. Gain is scaled by \(|∏p_i/∏z_i| · (2π)^{(n_p - n_z)}\). Use this when your filter was designed with the transfer function \(H(f) = k·∏(f-z_i)/∏(f-p_i)\) in Hz. This matches the LIGO GDS ‘n’ plane convention (plane='n' in s2z()).

Only used for analogue filters in Hz (analog=True, unit="Hz").

Returns:
frequenciesnumpy.ndarray

Frequencies at which the response was computed. If analog=True, unit='rad/s', these are in rad/s, otherwise they are in Hz.

responsenumpy.ndarray

Frequency response of the filter at the given frequencies.