use __call__ instead of evalfr in lti system classes by sawyerbfuller · Pull Request #449 · python-control/python-control
fixes problem reported in #434 and extends #179.
- move to
__call__as primary frequency response method to be used inTransferFunction,StateSpace, andFrequencyResponseDatasystems. (__call__is new forStateSpace, andFrequencyResponse) - the new
__call__has same interface for all three classes, and can now take one or an array ofs, unlike the old_evalfr, which could only take ones - it also adds a convenient keyword argument
squeeze=Truethat automatically squeezes output ifsysis SISO - for
FrequencyResponseData.__call__(s),smust be purely imaginary or an error is raised - private method
_evalfrthat was inconsistent with matlab modulematlab.evalfrwas removed in favor of__call__ - method
sys.evalfr(s)has been deprecated for 2.5 years and is now removed. use__call__instead, ormatlab.evalfr(sys, s)(following discussion in lti.evalfr and sys._evalfr have different behavior #434) - method
sys.freqresp(omega)is now deprecated. Use new pythonic methodsys.frequency_resposeinstead, orfreqresp(sys, omega)from matlab module (following discussion in lti.evalfr and sys._evalfr have different behavior #434) horner(s)now does the same thing for bothTransferFunctionandStateSpacesystems: can evaluate at multiple values ofs- de-duplication of code, cleanup, pythonization and vectorization of code where possible
FRD.evalbehavior was left as-is, except for an optional squeeze argument
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of failing unit tests to still iron out
May I point your interest towards #438, where some of the evalfr/_evalfr/freqresp etc. test have been treated by the iron already. Especially some continuous/discrete inconsistency.
@bnavigator any idea how soon #438 will be ready for prime time? I can plan to try to merge (and figure out how to do that) when you’re done with the PR.
Hi,
I think it is ready. But it depends on the yet unmerged PRs mentioned in the initial post. We should get those approved and merged first. I understand #438 is hard to review. The diff will get smaller with the underlying PRs though.
sawyerbfuller
changed the title
[WIP] use __call__ instead of evalfr in lti system classes
use __call__ instead of evalfr in lti system classes [done]
A few comments: sys.horner was modified slightly so that it only takes care of the low-level algorithm, while __call__ is intended to perform user friendly tasks like input formatting and squeezing the output as necessary.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the numpydoc style
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggested doctoring fix for statesspace.slycot_horner Co-authored-by: Ben Greiner <code@bnavigator.de>
most recent commit moves the task of calling slycot and fall-back if it doesn't work into sys.horner
ok I think ive resolved doc comments with the last two commits
Travis isnt happy about somethng though.
Build 940 and 941 got canceled and 942 didn't start yet. We have to wait a little.
And the day when we can ditch Travis for a different CI will be a happy day for me. (Working on Github Actions for Slycot right now in python-control/Slycot#140, and then I will tackle #446)
Ok looks like Travis is happy now. I’m happy to have it merged but don’t understand the various options, happy to leave it to @murrayrm and @bnavigator discretion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters