Skip to content

discard zero imaginary part for sys.dcgain() #579

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2021

Conversation

bnavigator
Copy link
Contributor

Closes #578

@coveralls
Copy link

coveralls commented Mar 19, 2021

Coverage Status

Coverage increased (+0.2%) to 89.14% when pulling 9a54254 on bnavigator:dcgain-real into 22b9953 on python-control:master.

@bnavigator bnavigator marked this pull request as ready for review March 19, 2021 23:10
@@ -448,7 +448,7 @@ def test_dcgain_consistency():
np.testing.assert_equal(
sys_tf(0j, warn_infinite=False), complex(np.nan, np.nan))
np.testing.assert_equal(
sys_tf.dcgain(warn_infinite=False), complex(np.nan, np.nan))
sys_tf.dcgain(warn_infinite=False), np.nan)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a test to show that dcgain() on a system with negative gain at zero frequency returns a negative number.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already exists:

# Make sure that we get the *signed* DC gain
sys_tf = -1 / (s + 1)
np.testing.assert_almost_equal(sys_tf.dcgain(), -1)

@murrayrm murrayrm merged commit 55d7e2b into python-control:master Mar 20, 2021
@@ -1070,12 +1070,19 @@ def dcgain(self, warn_infinite=False):

Returns
-------
gain : ndarray
The zero-frequency gain
gain : (outputs, inputs) ndarray or scalar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gain : (noutputs, ninputs) ndarray or scalar

zero-frequency (or DC) gain, or, if the frequency response is
singular, the array will be filled with (inf + nanj).

gain : (outputs, inputs) ndarray or scalar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gain : (noutputs, ninputs) ndarray or scalar

@murrayrm murrayrm added this to the 0.9.0 milestone Mar 20, 2021
@bnavigator bnavigator deleted the dcgain-real branch February 18, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants