[SciPy-Dev] scipy.signal.butter returns complex coefficients
Charles R Harris
Thu Feb 21 15:11:05 CST 2013
On Thu, Feb 21, 2013 at 10:03 AM, Pierre Haessig
> Hi Chuck,
> Le 21/02/2013 17:53, Charles R Harris a écrit :
> Now, it may be possible to write signal.buttap in a bit more complex
>> fashion to generate true complex conjugate roots but I'm not sure it's a
>> good to rely on np.poly to make some "smart conjugate detection". In the
>> new polynomial package I'm not sure this is even implemented (
>> From my unexerced eye, the code of
>> numpy.polynomial.polynomial.polyfromroots and numpy.poly looks very
> The multiplications in numpy/polynomial/polynomial are done as a sort of
> binary tree, multiplying successively higher degree polynomials together
> while trying to keep the roots in each widely separated so as to minimize
> numerical error, but it make no attempt to detect conjugate roots. It
> probably needs an `asreal` attribute so the user, who knows more about the
> problem than the computer, can specify the type of the result.
> I fully agree with this "explicit better than implicit" approach.
> (and thanks for the explanation of the iterative construction of the
> Do you think `asreal` it would be a useful addition to polyfromroots or is
> it better to just call np.real in signal.iirfilter ?
I think it, or something with a similar name, should be added, but it won't
be available until the next release at a minimum. So, taking the real part
of the coefficients is probably the way to go. I'm trying to recall which
release the polynomial functions went in... looks like 1.5, so that should
be OK for scipy.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-Dev