- Notifications
You must be signed in to change notification settings - Fork441
Standardize squeeze processing in frequency response functions#507
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 commentedJan 14, 2021 • 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.
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.
LGTM
(except for the commit sequence. make sure to rebase/squash before merge)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
61bba31
toa69a331
Comparea69a331
to4ec6377
Comparehttps://github.com/python-control/python-control/pull/507/checks?check_run_id=1703414743#step:5:75
Better use pytest.warns to keep the warnings clean. |
murrayrm commentedJan 17, 2021 • 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.
b337c9c
to90da4fb
Comparecontrol/frdata.py Outdated
@@ -423,9 +440,14 @@ def __call__(self, s, squeeze=True): | |||
:class:`FrequencyDomainData` systems are only defined at imaginary | |||
frequency values. | |||
""" | |||
# Make sure that we are operating on a simple list | |||
if len(np.array(s, ndmin=1).shape) > 1: |
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.
iflen(np.array(s,ndmin=1).shape)>1: | |
iflen(np.atleast1d(s).shape)>1: |
control/frdata.py Outdated
# Make sure that we are operating on a simple list | ||
if len(np.array(s, ndmin=1).shape) > 1: | ||
raise ValueError("input list must be 1D") | ||
if any(abs(np.array(s, ndmin=1).real) > 0): |
sawyerbfullerJan 18, 2021 • 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.
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.
ifany(abs(np.array(s,ndmin=1).real)>0): | |
ifany(abs(np.atleast1d(s).real)>0): |
control/statesp.py Outdated
`m = self.inputs` number of inputs and `p = self.outputs` number of | ||
outputs. | ||
In general the system may be multiple input, multiple output |
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.
Can probably remove this paragraph. Was added to precisely specify return array size but now no longer needed
squeeze is False, the array is 3D, indexed by the output, input, and | ||
frequency. If ``squeeze`` is True then single-dimensional axes are | ||
removed. | ||
phase : ndarray |
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.
In ‘notes’ on line 575ish below, this function is actually a wrapper for :meth:’lti.frequency_response’
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.
Because of the way the documentation is built, theLTI
class does not show up, so the documentation appears in the StateSpace and TransferFunction classes. Leaving unchanged.
Uh oh!
There was an error while loading.Please reload this page.
This PR addresses issue#453 by implementing a uniform method for handling the
squeeze
keyword in frequency response functions (frequency_response
,__call__
, etc). This PR matches the changes in PR#511 to improve consistency between time and frequency response, as described in issue#453.The following behavior is implemented:
squeeze=None
(default case): squeeze inputs and outputs, but leave frequencies alone. This is consistent with current behavior.squeeze=True
: numpy squeeze => all singleton axes are removed, consistent with numpy.squeeze=False
: full MIMO, even for SISO. You always get a p x m array for outputs versus inputs.Additional changes:
control.squeeze_frequency_response
that sets the default value for the squeeze keyword (set toNone
initially).ValueError
exception.squeeze
are correct.