{ } Raw JSON

bundles / scipy 1.17.1 / scipy / signal / _filter_design / _cplxreal

function

scipy.signal._filter_design:_cplxreal

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

Signature

def   _cplxreal ( z tol = None )

Summary

Split into complex and real parts, combining conjugate pairs.

Extended Summary

The 1-D input vector z is split up into its complex (zc) and real (zr) elements. Every complex element must be part of a complex-conjugate pair, which are combined into a single number (with positive imaginary part) in the output. Two complex numbers are considered a conjugate pair if their real and imaginary parts differ in magnitude by less than tol * abs(z).

Parameters

z : array_like

Vector of complex numbers to be sorted and split

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

zc : ndarray

Complex elements of z, with each pair represented by a single value having positive imaginary part, sorted first by real part, and then by magnitude of imaginary part. The pairs are averaged when combined to reduce error.

zr : ndarray

Real elements of z (those having imaginary part less than tol times their magnitude), sorted by value.

Raises

: ValueError

If there are any complex numbers in z for which a conjugate cannot be found.

Examples

from scipy.signal._filter_design import _cplxreal
a = [4, 3, 1, 2-2j, 2+2j, 2-1j, 2+1j, 2-1j, 2+1j, 1+1j, 1-1j]
zc, zr = _cplxreal(a)
print(zc)
print(zr)

See also

_cplxpair

Aliases

  • scipy.signal._filter_design._cplxreal