bundles / scipy 1.17.1 / scipy / signal / _filter_design / tf2sos
function
scipy.signal._filter_design:tf2sos
Signature
def tf2sos ( b , a , pairing = None , * , analog = False ) Summary
Return second-order sections from transfer function representation
Parameters
b: array_likeNumerator polynomial coefficients.
a: array_likeDenominator polynomial coefficients.
pairing: {None, 'nearest', 'keep_odd', 'minimal'}, optionalThe method to use to combine pairs of poles and zeros into sections. See zpk2sos for information and restrictions on
pairingandanalogarguments.analog: bool, optionalIf True, system is analog, otherwise discrete.
Returns
sos: ndarrayArray of second-order filter coefficients, with shape
(n_sections, 6). See sosfilt for the SOS filter format specification.
Notes
It is generally discouraged to convert from TF to SOS format, since doing so usually will not improve numerical precision errors. Instead, consider designing filters in ZPK format and converting directly to SOS. TF is converted to SOS by first converting to ZPK format, then converting ZPK to SOS.
Array API Standard Support
tf2sos has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ✅ PyTorch ✅ ⛔ JAX ⚠️ no JIT ⛔ Dask ⚠️ computes graph n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
Find the 'sos' (second-order sections) of the transfer function H(s) using its polynomial representation. .. math:: H(s) = \frac{s^2 - 3.5s - 2}{s^4 + 3s^3 - 15s^2 - 19s + 30}from scipy.signal import tf2sos tf2sos([1, -3.5, -2], [1, 3, -15, -19, 30], analog=True)✓
See also
Aliases
-
scipy.signal.tf2sos