Repository navigation
Conversation
2 similar comments
|
I don't understand why this functionality is useful? It seems like it is just adding a function that is not likely to be used by users? |
|
Hello! Thank you for your review ;) As I said in the description of the PR, the point here is to create an internal function to make dimension check uniform in the library. Currently, the check is partial and varies from a control function to another: in place_varga: in lqr: And it continues like this in the entire library. With this new internal function, the check will be uniform, factorized and unit tested :) |
|
|
||
| class ControlDimension(Exception): | ||
| """Raised when dimensions of system objects are not correct""" | ||
| pass |
| return ss.A, ss.B, ss.C, ss.D | ||
|
|
||
|
|
||
| def consistent_dimensions(A=None, B=None, C=None, D=None): |
There was a problem hiding this comment.
Should this be an internal function (_consistent_dimensions)? Also, a more description function name might be useful. Perhaps _check_statespace_dimensions?
| - D [n_outputs x n_inputs] | ||
| Parameters | ||
| ---------- | ||
| A: ndarray - optional |
There was a problem hiding this comment.
Per numpydocs, this should be "A : ndarray, optional". Same below.
| np.testing.assert_array_equal(D, g.D) | ||
|
|
||
| def test_consistent_dimensions_322(self): | ||
| true = consistent_dimensions(self.A322, self.B322, self.C322, self.D322) |
There was a problem hiding this comment.
A tighter format might be self.assertTrue(_check_statespace_dimensions(self.A322, self.B322, self.C322, self.D322))
|
If we are going to include this PR, a couple of requests:
|
|
PR has been idle for > 6 months => stale. @don4get I will close this PR in a few days unless you will have time to work on it soon. No worries if not; just re-open when you have responded to the comments above. |
Add a function to check dimensions between state space matrices.
It will allow to make this kind of check uniform within the library, in a future PR.
The function requires numpy arrays as inputs but I am not sure we want to force it. Can you give me insights?
I also added some unit tests, feel free to point out some cases I might have missed.