[SciPy-Dev] Proposal: calling signal.lti object returns transfer function value

Warren Weckesser warren.weckesser@gmail....
Tue Jul 23 07:09:43 CDT 2013


On 7/23/13, Juan Luis Cano <juanlu001@gmail.com> wrote:
> On 07/20/2013 05:39 PM, Ralf Gommers wrote:
>>
>>
>>
>> On Tue, Jul 16, 2013 at 4:49 PM, Juan Luis Cano <juanlu001@gmail.com
>> <mailto:juanlu001@gmail.com>> wrote:
>>
>>     Hello all,
>>
>>     I've been trying the scipy.signal module lately for some easy
>>     things and
>>     I had an idea, but I thought it would be better to bring it up in the
>>     mailing list before filing a PR on GitHub.
>>
>>     My proposal is to implement the __call__ method on signal.lti
>>     objects so
>>     it returns the value on the transfer function.
>>
>>     I took the idea from the `bode` function. This line:
>>
>>          y = numpy.polyval(sys.num, jw) / numpy.polyval(sys.den, jw)
>>
>>
>> (https://github.com/scipy/scipy/blob/v0.12.0/scipy/signal/ltisys.py#L940)
>>
>>     could be moved to signal.lti.__call__, and then in `bode` write
>>
>>          y = sys(jw)
>>
>>     The detail is trivial (so is the implementation) but I think it
>>     would be
>>     a useful thing. What do others think? Shall I open a pull request?
>>
>>
>> Not sure, is writing
>>     y = lti_sys(jw)
>> instead of
>>     jw, y = lti_sys.freqresp(jw)
>> clearer and umambiguous? It may make sense, but would be good to get
>> the opinion of some users on this.
>>
>> Ralf
>
> I am sorry but I was unaware of the freqresp function, probably it's the
> clearest way. Maybe it should be used in the `bode` function too.


There was some work on bode and freqresp earlier this year.  The
latest version of `bode` uses `freqresp`:
https://github.com/scipy/scipy/blob/master/scipy/signal/ltisys.py#L856

Warren


>
> Juan Luis Cano
>


More information about the SciPy-Dev mailing list