Repository navigation
Turn off warn_infinite for phase_crossover_frequencies() calculation #1106
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
murrayrm
merged 2 commits into
python-control:main
from
murrayrm:fix_phase_crossover-28Jan2025
Jan 30, 2025
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
turn off warn_infinite for phase_crossover_frequencies() calculation
- Loading branch information
commit 6fcf7419e7b30148a8e7a287ee6790a2806cbaf0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,12 +12,11 @@ | |
| from numpy import inf, nan | ||
| from numpy.testing import assert_allclose | ||
|
|
||
| from control.frdata import FrequencyResponseData | ||
| from control.margins import (margin, phase_crossover_frequencies, | ||
| stability_margins) | ||
| from control.statesp import StateSpace | ||
| from control.xferfcn import TransferFunction | ||
| from control.exception import ControlMIMONotImplemented | ||
| from ..frdata import FrequencyResponseData | ||
| from ..margins import margin, phase_crossover_frequencies, stability_margins | ||
| from ..statesp import StateSpace | ||
| from ..xferfcn import TransferFunction | ||
| from ..exception import ControlMIMONotImplemented | ||
|
|
||
| s = TransferFunction.s | ||
|
|
||
|
|
@@ -119,6 +118,8 @@ def test_margin_3input(tsys): | |
| (([2], [1, 3, 3, 1]), [1.732, 0.], [-0.25, 2.]), | ||
| ((np.array([3, 11, 3]) * 1e-4, [1., -2.7145, 2.4562, -0.7408], .1), | ||
| [1.6235, 0.], [-0.28598, 1.88889]), | ||
| (([200.0], [1.0, 21.0, 20.0, 0.0]), | ||
| [4.47213595, 0], [-0.47619048, inf]), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Warnings do not cause the test to fail, so this case does not provide a regression test. To fix this, add the decorator |
||
| ]) | ||
| def test_phase_crossover_frequencies(tfargs, omega_ref, gain_ref): | ||
| """Test phase_crossover_frequencies() function""" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we use relative imports in test files?
Arguments against relative imports in test files
controlpackage.controlnecessarily write absolute imports (import controlorfrom control...). Tests of the public API should follow the patterns of users.Arguments in favor
controlother than where they are located. In other words, "running tests from outside of thecontrolpackage" is not done in practice, so not important to support.For comparison, neither numpy nor scipy seem to be consistent: most of their tests are written using absolute imports (
import numpyorimport scipyetc.), but some tests use relative imports.Conclusion
I like the generality in principle of keeping these as absolute imports, but practically both patterns seem good.