bundles / scipy 1.17.1 / scipy / signal / _filter_design / _cplxpair
function
scipy.signal._filter_design:_cplxpair
Signature
def _cplxpair ( z , tol = None ) Summary
Sort into pairs of complex conjugates.
Extended Summary
Complex conjugates in z are sorted by increasing real part. In each pair, the number with negative imaginary part appears first.
If pairs have identical real parts, they are sorted by increasing imaginary magnitude.
Two complex numbers are considered a conjugate pair if their real and imaginary parts differ in magnitude by less than tol * abs(z). The pairs are forced to be exact complex conjugates by averaging the positive and negative values.
Purely real numbers are also sorted, but placed after the complex conjugate pairs. A number is considered real if its imaginary part is smaller than tol times the magnitude of the number.
Parameters
z: array_like1-D input array to be sorted.
tol: float, optionalRelative tolerance for testing realness and conjugate equality. Default is
100 * spacing(1)ofz's data type (i.e., 2e-14 for float64)
Returns
y: ndarrayComplex conjugate pairs followed by real numbers.
Raises
: ValueErrorIf there are any complex numbers in
zfor which a conjugate cannot be found.
Examples
from scipy.signal._filter_design import _cplxpair a = [4, 3, 1, 2-2j, 2+2j, 2-1j, 2+1j, 2-1j, 2+1j, 1+1j, 1-1j] z = _cplxpair(a)✓
print(z)
✗See also
Aliases
-
scipy.signal._filter_design._cplxpair