fix gain handling in rlocus and sisotool by sawyerbfuller · Pull Request #809 · python-control/python-control
Added some more fixes to the kvect kwarg in rlocus and sisotool. kvect was intended to let the user specify their own array of gains, but it wasn't being used that way. Two primary changes aim to make it do what I believe was its intended purpose:
-
I deprecated
kvectin sisotool, because you probably don't want to specify your own set of gains to plot in the rlocus plot in sisotool anyway. You probably want to use the ones that are computed automatically. Especially because sisotool/rlocus allows you to zoom in, and it re-computes gain points for the new zoomed root locus plot, to get a more precise click. Instead, there is now a new keyword,initial_gainthat allows the user to specify the starting value of the closed-loop gain to plot in its four plots.kvectcan be still given, and it reproduces the old behavior of sisotool usingkvect[0]as the initial gain, and ignoring everything else inkvect. And there is now a deprecation warning. -
For rlocus, you might actually want to specify your own
kvectif for example you only want to see where the roots go for a certain set of gains. But this wasn't what was happening: the rlocus plot ignores thekvectargument altogether and essentially always uses its own pre-computed gains. This is because any time the axis range is changed,kvectis automatically recomputed, which is basically every time the plot is created. I fixed it so that the new behavior is that ifkvectis supplied to rlocus, it is no longer recomputed automatically if the plot is zoomed. -
Other improvements:
- docstring fixes
- pep8 cleanups
- change
mymattoroot_arrayin rlocus to better describe its function