Title: Update pole/zero and root locus plots to use _map/_plot pattern by murrayrm · Pull Request #953 · python-control/python-control · GitHub
Open Graph Title: Update pole/zero and root locus plots to use _map/_plot pattern by murrayrm · Pull Request #953 · python-control/python-control
X Title: Update pole/zero and root locus plots to use _map/_plot pattern by murrayrm · Pull Request #953 · python-control/python-control
Description: This PR updates pole/zero and root locus plots to use the _map/_plot calling pattern described in #645. The following patterns will work: rldata = ct.root_locus_map(syslist[, klist]) lines = rldata.plot(plot_options) lines = ct.root_locus_plot(response[, klist, plot_options]) ct.root_locus(sys) ct.rlocus(sys) ct.pole_zero_map(sys).plot() ct.pole_zero_plot(sys) ct.pzmap(sys) Everything is mostly backwards compatible except that the outputs from a _plot function are now an array of Line2D objects instead of the roots and gains. You can still get the original data using the _map function and there is some legacy processing if you used the plot keyword to try let some code work without changes. Summary of changes: All pole/zero and root locus plots now have a _map function and a _plot function. You can access the latter via the .plot() method on the response. The _plot functions accept either the output of the _map function or a list of systems (in which case the _map function is called internally). This allows the common pattern of pole_zero_plot(sys), root_locus_plot(sys) to work as expected. The interactive mode for root locus plots is on by default (it used to be there only within sisotool). Clicking on a portion of the root locus diagram will generate markers at the locations on the loci corresponding to that gain and add a message above the plot giving the frequency and damping ratio for the point that was clicked. The print_gain keyword is replaced with interactive. The (deprecated) Plot keyword is now plot (and generates a warning, since it triggers the legacy return values). Recalculation of the root locus plot when zooming no longer works (you can still zoom in and out, you just don't get a recalculated curve). The short versions pzmap and rlocus are still there. The control.matlab version of rlocus returns roots, gains (compatible with MATLAB) Added unit tests plus user documentation. Some other small fixes, code streamlining, etc along the way. This PR is going to break existing code. It would be great if a few people could try this out so that we can make sure we are OK with the changes here. Examples (from the user documentation): Pole/zero maps and root locus diagrams provide insights into system response based on the locations of system poles and zeros in the complex plane. The pole_zero_map() function returns the poles and zeros and can be used to generate a pole/zero plot: sys = ct.tf([1, 2], [1, 2, 3], name='SISO transfer function') response = ct.pole_zero_map(sys) ct.pole_zero_plot(response) A root locus plot shows the location of the closed loop poles of a system as a function of the loop gain: ct.root_locus_map(sys).plot() The grid in the left hand plane shows lines of constant damping ratio as well as arcs corresponding to the frequency of the complex pole. The grid can be turned off using the grid keyword. Setting grid to False will turn off the grid but show the real and imaginary axis. To completely remove all lines except the root loci, use grid=’empty’. On systems that support interactive plots, clicking on a location on the root locus diagram will mark the pole locations on all branches of the diagram and display the gain and damping ratio below the plot title: Root locus diagrams are also supported for discrete time systems, in which case the grid is show inside the unit circle: sysd = sys.sample(0.1) ct.root_locus_plot(sysd) Lists of systems can also be given, in which case the root locus diagram for each system is plotted in different colors: sys1 = ct.tf([1], [1, 2, 1], name='sys1') sys2 = ct.tf([1, 0.2], [1, 1, 3, 1, 1], name='sys2') ct.root_locus_plot([sys1, sys2], grid=False)
Open Graph Description: This PR updates pole/zero and root locus plots to use the _map/_plot calling pattern described in #645. The following patterns will work: rldata = ct.root_locus_map(syslist[, klist]) lines = rldata...
X Description: This PR updates pole/zero and root locus plots to use the _map/_plot calling pattern described in #645. The following patterns will work: rldata = ct.root_locus_map(syslist[, klist]) lines = rldata...
Opengraph URL: https://github.com/python-control/python-control/pull/953
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:7eaba624-c093-55ba-a929-18272c4bd5f7 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | E308:2A8A53:2156AA:2E9DD8:697B4020 |
| html-safe-nonce | 363230a6f4856824a7c8f335cfb0cd3ce9aa6a9c864978766edaf9cad665ed43 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzA4OjJBOEE1MzoyMTU2QUE6MkU5REQ4OjY5N0I0MDIwIiwidmlzaXRvcl9pZCI6IjIwMjAxMTk5NjM3MjQ2MjgwMDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2d552c3dfd49440f4f621cbb89f0096aa52e768c6414350f7da175e5661d637b |
| hovercard-subject-tag | pull_request:1660087444 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-control/python-control/pull/953/checks |
| twitter:image | https://avatars.githubusercontent.com/u/293362?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/293362?s=400&v=4 |
| og:image:alt | This PR updates pole/zero and root locus plots to use the _map/_plot calling pattern described in #645. The following patterns will work: rldata = ct.root_locus_map(syslist[, klist]) lines = rldata... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6fe64d94889230be19a900846cfc91707e7dd4206878d6c208922b46a6b0735d |
| turbo-cache-control | no-preview |
| go-import | github.com/python-control/python-control git https://github.com/python-control/python-control.git |
| octolytics-dimension-user_id | 2285872 |
| octolytics-dimension-user_login | python-control |
| octolytics-dimension-repository_id | 22791752 |
| octolytics-dimension-repository_nwo | python-control/python-control |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22791752 |
| octolytics-dimension-repository_network_root_nwo | python-control/python-control |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 15736a47b83581130a149aa1b928696bea06adde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width