GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Turn off warn_infinite for phase_crossover_frequencies() calculation by murrayrm · Pull Request #1106 · python-control/python-control

Conversation

@murrayrm

@murrayrm murrayrm commented Jan 29, 2025

Copy link
Copy Markdown
Member

This PR addresses #1105 where warning messages were being generated if a system had poles at the origin (which generates a phase crossover at infinity). The fix was simple: warning messages should be turned off when computing the crossover gains (as they are in stability_margins).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@murrayrm
turn off warn_infinite for phase_crossover_frequencies() calculation
6fcf741
@coveralls

coveralls commented Jan 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Coverage Status

coverage: 94.649% (+0.001%) from 94.648%
when pulling d9e44d2 on murrayrm:fix_phase_crossover-28Jan2025
into 71bd731 on python-control:main.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@slivingston
slivingston self-requested a review January 29, 2025 05:06
slivingston
slivingston reviewed Jan 29, 2025
View reviewed changes

@slivingston slivingston left a comment

Copy link
Copy Markdown
Member

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.

Good work! Besides my comment about the regression test, this is ready to merge.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread control/tests/margin_test.py Outdated
Comment on lines +15 to +19
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

@slivingston slivingston Jan 29, 2025

Copy link
Copy Markdown
Member

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

  • Although the tests/ directory is a subpackage and therefore can use the relative import syntax, this change will prevent running tests from outside of the control package.
  • Users of control necessarily write absolute imports (import control or from control...). Tests of the public API should follow the patterns of users.

Arguments in favor

  • Relative import syntax is more concise.
  • I might have missed something, but none of the CI jobs run the tests against a copy of control other than where they are located. In other words, "running tests from outside of the control package" is not done in practice, so not important to support.
  • We are already using the relative import syntax in config_test.py.

For comparison, neither numpy nor scipy seem to be consistent: most of their tests are written using absolute imports (import numpy or import scipy etc.), 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread control/tests/margin_test.py
((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]),

@slivingston slivingston Jan 29, 2025

Copy link
Copy Markdown
Member

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.

Warnings do not cause the test to fail, so this case does not provide a regression test. To fix this, add the decorator @pytest.mark.filterwarnings("error") as done in another test in margin_test.py.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@murrayrm
address @slivingston review comments
d9e44d2
slivingston
slivingston approved these changes Jan 30, 2025
View reviewed changes
@murrayrm
murrayrm merged commit ebff125 into python-control:main Jan 30, 2025
@murrayrm murrayrm mentioned this pull request Jan 30, 2025
phase_crossover_frequencies generates errors with poles at origin #1105
Closed
@murrayrm murrayrm added this to the 0.10.2 milestone Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@slivingston slivingston slivingston approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.10.2

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@murrayrm @coveralls @slivingston
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.