prepare_analog_filter#

gwpy.signal.filter_design.prepare_analog_filter(
filt: FilterCompatible,
*,
unit: str | UnitBase = 'Hz',
normalize_gain: bool = False,
) tuple[Literal['ba', 'zpk', 'sos'], BAType | ZpkType | SosType][source]#

Prepare an analog filter by parsing and converting units.

This handles:

  1. Parsing filter specification

  2. Converting Hz → rad/s for ZPK filters (if unit=’Hz’)

  3. Applying gain normalization (if requested)

Does NOT:

  • Convert to digital

  • Extract gain for SOS

  • Apply prewarping

Parameters:
filtfilter specification

Filter as (b, a), (z, p, k), sos array, or lti object.

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

Ignored when unit='rad/s'.

Returns:
formstr

Filter form: 'ba', 'zpk', or 'sos'.

filttuple or numpy.ndarray

Filter coefficients in the identified form.

See also

prepare_digital_filter

Prepare filter for digital filtering with prewarping and gain extraction.

parse_filter

Parse filter specification without unit conversion.