{ } Raw JSON

bundles / scipy latest / scipy / signal / _filter_design / _cplxpair

function

scipy.signal._filter_design:_cplxpair

source: /scipy/signal/_filter_design.py :1088

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_like

1-D input array to be sorted.

tol : float, optional

Relative tolerance for testing realness and conjugate equality. Default is 100 * spacing(1) of z's data type (i.e., 2e-14 for float64)

Returns

y : ndarray

Complex conjugate pairs followed by real numbers.

Raises

: ValueError

If there are any complex numbers in z for 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

_cplxreal

Aliases

  • scipy.signal._filter_design._cplxpair