[SciPy-Dev] Strange code in scipy.signal.decimate
Eric Quintero
eric.antonio.quintero at gmail.com
Thu Oct 18 21:18:06 EDT 2018
Warren is correct; there were some changes to how the `dlti` objects were being internally passed around on PR 7835, and this extra instantiation flew under the radar. A PR to simplify the code would be very welcome.
-Eric Q.
> On Oct 18, 2018, at 7:07 PM, Warren Weckesser <warren.weckesser at gmail.com> wrote:
>
> On 10/18/18, Daniele Nicolodi <daniele at grinta.net> wrote:
>> On 18-10-2018 15:28, Paul Hobson wrote:
>>> Dan,
>>>
>>> I might be missing something, but dlti returns a subclass of
>>> LinearTimeInvariant. Point is, it's not a tuple, but a class with
>>> multiple attributes and method. Simple tuple unpacking won't likely work
>>> unless the authors of LinearTimeInvariant really went out of their way
>>> to make it so.
>>
>> The point is not to go through the `dlti` class at all.
>>
>> Please look at the replacement code I posted: it works.
>>
>
>
> There have been several incremental changes to that function over the
> years. I suspect the last person to change it simply did not notice
> that the code could be simplified. Your proposed change looks good.
>
> Warren
>
>
>> Cheers,
>> Dan
>>
>>> -Paul
>>>
>>> On Thu, Oct 18, 2018 at 1:58 PM Daniele Nicolodi <daniele at grinta.net
>>> <mailto:daniele at grinta.net>> wrote:
>>>
>>> Hello,
>>>
>>> I was having a look at the scipy.signal.decimate() function and I
>>> noticed some strange looking code:
>>>
>>> elif ftype == 'iir':
>>> if n is None:
>>> n = 8
>>> system = dlti(*cheby1(n, 0.05, 0.8 / q))
>>> b, a = system.num, system.den
>>>
>>> This is used to setup the anti aliasing low pass filter. What I don't
>>> understand is the dance to obtain the IIR numerator and denominator
>>> coefficients. Couldn't the above be simply as the code below?
>>>
>>> elif ftype == 'iir':
>>> if n is None:
>>> n = 8
>>> b, a = cheby1(n, 0.05, 0.8 / q)
>>>
>>> Am I missing something?
>>>
>>> Thanks!
>>>
>>> Cheers,
>>> Dan
>>> _______________________________________________
>>> SciPy-Dev mailing list
>>> SciPy-Dev at python.org <mailto:SciPy-Dev at python.org>
>>> https://mail.python.org/mailman/listinfo/scipy-dev
>>>
>>>
>>>
>>> _______________________________________________
>>> SciPy-Dev mailing list
>>> SciPy-Dev at python.org
>>> https://mail.python.org/mailman/listinfo/scipy-dev
>>>
>>
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev at python.org
>> https://mail.python.org/mailman/listinfo/scipy-dev
>>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
More information about the SciPy-Dev
mailing list