scipy.signal.cmplx_sort¶
- scipy.signal.cmplx_sort(p)[source]¶
Sort roots based on magnitude.
- Parameters
- parray_like
The roots to sort, as a 1-D array.
- Returns
- p_sortedndarray
Sorted roots.
- indxndarray
Array of indices needed to sort the input p.
Examples
>>> from scipy import signal >>> vals = [1, 4, 1+1.j, 3] >>> p_sorted, indx = signal.cmplx_sort(vals) >>> p_sorted array([1.+0.j, 1.+1.j, 3.+0.j, 4.+0.j]) >>> indx array([0, 2, 3, 1])