BodePlot#
- class gwpy.plot.BodePlot( )[source]#
Bases:
PlotA
Plotclass for visualising transfer functions.- Parameters:
- filters
lti,FrequencySeries Any number of the following:
- frequencies
numpy.ndarray,int, optional List of frequencies (in Hertz) at which to plot, or an integer specifying the number of frequencies to generate.
- dB
bool, optional If
True, display magnitude in decibels, otherwise display amplitude.- analog
bool, optional If
True, indicates that the input filters are analogue filters.- sample_rate
float,Quantity, optional The sampling rate of a digital filter. If
analog=Falsethis option is required.- unit
str, optional For analogue ZPK filters, the units in which the zeros and poles are specified. Either
'Hz'or'rad/s'(default).- normalize_gain
bool, 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'ins2z()).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'ins2z()).
Only used for analogue filters in Hz (
analog=True, unit="Hz").- kwargs
All other keyword arguments are passed to
plot().
- filters
- Returns:
Attributes Summary
Methods Summary
add_filter(filter_[, frequencies, dB, ...])Add a linear time-invariant filter to this BodePlot.
add_frequencyseries(spectrum, *[, dB, power])Plot the magnitude and phase of a complex-valued
FrequencySeries.set(*[, agg_filter, alpha, animated, ...])Set multiple properties at once.
Attributes Documentation
Methods Documentation
- add_filter(
- filter_: FilterType,
- frequencies: Array1D | int | None = None,
- *,
- dB: bool = True,
- analog: bool = False,
- sample_rate: QuantityLike = 1.0,
- unit: str | None = None,
- normalize_gain: bool = False,
- **kwargs,
Add a linear time-invariant filter to this BodePlot.
- Parameters:
- filter_
lti,tuple The filter to plot, either as a
lti, or atuplewith the following number and meaning of elements2: (numerator, denominator)
3: (zeros, poles, gain)
4: (A, B, C, D)
- frequencies
numpy.ndarray, optional List of frequencies (in Hertz) at which to plot.
- dB
bool, optional If
True, display magnitude in decibels, otherwise display amplitude, default:True.- analog
bool, optional If
True, indicates thatfilter_is an analogue filter.- sample_rate
float,Quantity, optional The sampling rate of a digital filter. If
analog=Falsethis option is required.- unit
str, optional For analogue ZPK filters, the units in which the zeros and poles are specified. Either
'Hz'or'rad/s'(default).- normalize_gain
bool, 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'ins2z()).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'ins2z()).
Only used for analogue filters in Hz (
analog=True, unit="Hz").- kwargs
All other keyword arguments are passed to
plot().
- filter_
- Returns:
- mag, phase
matplotlib.lines.Line2D The lines drawn for the magnitude and phase of the filter.
- mag, phase
- Raises:
ValueErrorIf
analog=Falseis given andsample_rateisn’t.
- add_frequencyseries(
- spectrum: FrequencySeries,
- *,
- dB: bool = True,
- power: bool = False,
- **kwargs,
Plot the magnitude and phase of a complex-valued
FrequencySeries.- Parameters:
- spectrum
FrequencySeries the (complex-valued)
FrequencySeriesto display- dB
bool, optional If
True, display magnitude in decibels, otherwise display amplitude.- power
bool, optional Give
Trueto incidate thatspectrumholds power values, sodB = 10 * log(abs(spectrum)), otherwisedb = 20 * log(abs(spectrum)). This argument is ignored ifdb=False.- **kwargs
All other keyword arguments are passed to
plot().
- spectrum
- Returns:
- mag, phase
matplotlib.lines.Line2D The lines drawn for the magnitude and phase of the filter.
- mag, phase
- set(
- *,
- agg_filter=<UNSET>,
- alpha=<UNSET>,
- animated=<UNSET>,
- canvas=<UNSET>,
- clip_box=<UNSET>,
- clip_on=<UNSET>,
- clip_path=<UNSET>,
- constrained_layout=<UNSET>,
- constrained_layout_pads=<UNSET>,
- dpi=<UNSET>,
- edgecolor=<UNSET>,
- facecolor=<UNSET>,
- figheight=<UNSET>,
- figwidth=<UNSET>,
- frameon=<UNSET>,
- gid=<UNSET>,
- in_layout=<UNSET>,
- label=<UNSET>,
- layout_engine=<UNSET>,
- linewidth=<UNSET>,
- mouseover=<UNSET>,
- path_effects=<UNSET>,
- picker=<UNSET>,
- rasterized=<UNSET>,
- size_inches=<UNSET>,
- sketch_params=<UNSET>,
- snap=<UNSET>,
- tight_layout=<UNSET>,
- transform=<UNSET>,
- url=<UNSET>,
- visible=<UNSET>,
- zorder=<UNSET>,
Set multiple properties at once.
Supported properties are
- Properties:
agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: float or None animated: bool canvas: FigureCanvas clip_box:
BboxBaseor None clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: unknown figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: {‘constrained’, ‘compressed’, ‘tight’, ‘none’,LayoutEngine, None} linewidth: number mouseover: bool path_effects: list ofAbstractPathEffectpicker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform:Transformurl: str visible: bool zorder: float