- Notifications
You must be signed in to change notification settings - Fork441
Rory ss static pole#110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
coveralls commentedAug 31, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Reran this on Travis today, everything passes [1]. [1]https://travis-ci.org/roryyorke/python-control/builds/156620754 |
I will review it within 12 hours. |
In315a1ea you add the comment "TODO: use super here?" above LTI.__init__(self,inputs=D.shape[1],outputs=D.shape[0],dt=dt) in the definition of |
However, changing to use |
from control import matlab | ||
from control.statesp import StateSpace, _convertToStateSpace | ||
from control.statesp import StateSpace, _convertToStateSpace,tf2ss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thoughtf2ss
is added here, it is not used in this module (statesp_test.py). Am I missing something?
@roryyorke Did you write "BugFix?" in the first commit to indicate that the change might be thought of as adding a new feature, instead of fixing a bug? |
For posterity and because I closed#107 in favor of this PR, I want to reference the comment#107 (comment) from there, which raises concerns about |
Regarding the behavior of I studied the constructor code for
Thus, I guess that one design motivation is to map 1-dimensional arrays to row matrices, without specially treating empty arrays. [1] line 270 of numpy/matrixlib/defmatrix.py,https://github.com/numpy/numpy/blob/2498b74420074dffa3a062ab7fc69dfeb88a5050/numpy/matrixlib/defmatrix.py#L270 |
My recommendations:
Once these are addressed, this PR is ready to be merged. |
Thanks for the thorough review! I'll put all my responses here. TODO for super: I think we agree this change doesn't belong in this PR; I suppose the Right Thing would have been to open a new issue. "BugFix?": indeed, whether this is a bugfix or enhancement is not very clear. I can edit the log (I guess? never done that with git) if you like. On empty SS objects: I have implemented this, unfortunately didn't push it to the PR. It follows the proposed solution. See [1]. tf2ss: I don't remember why that's there; some sort of exploratory debugging, I guess. Will remove. I'll see if I can do the rebase you suggest. I'll add the recommended assertion, thanks. OK, so for now I will:
The empty SS object extension of [1] is on the same theme as the rest of the PR, but would require additional review. I could either add it here, or open a new PR for it. |
…cts.Allows StateSpace([],[],[],D), which failed previously. Static gainshave sizes enforced as follows: A 0-by-0, B 0-by-ninputs, Cnoutputs-by-0.Tests added for instantiation, and sum, product, feedback, and appending,of 1x1, 2x3, and 3x2 static gains StateSpace objects.
On Python 2.7, the special case "all states useless" in_remove_useless_states resulted in A=[[0]] (and similarly for B and C).The special case is no longer needed, since empty A, B, C matrices canbe handled. numpy.delete does the right thing w.r.t. matrixsizes (e.g., deleting all columns of a nxm matrix gives an nx0 matrix).Added test for this.
Do this by only calling Slycot's tb01pd for non-static systems.
a68ad6c
toc84debb
Comparecoveralls commentedDec 28, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Changes Unknown when pullingc84debb on roryyorke:rory-ss-static-pole into ** on python-control:master**. |
I squashed the "messagefix" commit in the rebase, otherwise changes as in previous comment. |
I squashed the messagefix commit, otherwise rebase is as described in previous comment. |
#110Changes are from branch `rory-ss-static-pole` ofhttps://github.com/roryyorke/python-control.git
Thanks; the rebase is good. To better organize discussion, I decided to leave consideration of a wrapper of |
#101Changes are from branch `master` ofhttps://github.com/mp4096/python-control.gitThere was merge conflict in how a for-loop was refactored into`map` (here) vs. list comprehension (from PR#110).I compared the two alternatives using %timeit of Jupyter for matricesthat would correspond to LTI systems with 10 state dimensions, 2inputs, 2 outputs (so, the A matrix has shape (10, 10), B matrix hasshape (10,2), etc.), and with 100 state dimensions, 20 inputs,20 outputs, all using matrices from numpy.random.random((r,c)).The difference in timing performance does not appearsignificant. However, the case of `map` was slightly faster(approximately 500 to 900 ns less in duration), so I decided to usethat one to resolve the merge conflict.
This is a mod on top of#108, rebased oncdd3e73. If#107 and#108 and this mod are all OK, I guess one could just take this PR and delete the others (which I haven't rebased yet).
The mod lets StateSpace.pole work with static gains; it returns np.array([]), which is both reasonable, and the behaviour as TransferFunction.pole for static gains.Without this mod, the eigval call in StateSpace.pole results in an exception when A is an empty matrix.
Regression test added.
I'm pretty sure the Python 3.3 failure on Travis CI [1] hasn't got anything to do with this.
Prompted by modelsimp.minreal bugging out when minreal()'ing a statespace object was reduced to a static gain.
[1]https://travis-ci.org/roryyorke/python-control/jobs/156620757