Title: Sisotool and dynamic root locus zoom by icam0 · Pull Request #209 · python-control/python-control · GitHub
Open Graph Title: Sisotool and dynamic root locus zoom by icam0 · Pull Request #209 · python-control/python-control
X Title: Sisotool and dynamic root locus zoom by icam0 · Pull Request #209 · python-control/python-control
Description: This pull request introduces two new features to the python-control package. A matlab inspired sisotool and dynamic recomputing of the root locus plot when zooming. Sisotool In the pictures below a comparison can be seen between the matlab sisotool, the sisotool for matlplotlib 1.x.x and matlplotlib 2.x.x respectively. matlab matplotlib 1.x.x matplotlib 2.x.x The function is essentially a wrapper around the rootlocus, bode and step response functions. When a click is made on the rootlocus plot, the purple point(s) are moved and the other plots are updated as well. Note that a decision was made to keep most of the rootlocus plot update logic inside the rootlocus file and the logic behind updating the other 2 plots in _sisotoolupdate in sisotool.py. Also, use was made of **kwargs whenever neccessary in order to not confuse the end user with parameters in functions without documenting them. Also, this was tested on python 2.7, 3.3 and 3.6 and matplotlib 1.5.3 and 2.2.2 on mac os x. It would be greatly appreciated if more testers can try this on their machine. **Dynamic zooming of the root locus plot ** Firstly, I want to point out an error in existing code in the following code snippet from _default_gains: while (indexes_too_far[0].size > 0) and (kvect.size < 5000): for index in indexes_too_far[0]: new_gains = np.linspace(kvect[index], kvect[index+1], 5) new_points = _RLFindRoots(num, den, new_gains[1:4]) kvect = np.insert(kvect, index+1, new_gains[1:4]) mymat = np.insert(mymat, index+1, new_points, axis=0) Every iteration, 3 points are inserted at the index where the distance between 2 points is too large. What goes wrong however, is that the indexes are not updated. So when for example indexes_too_far = [0,1,2] and in the first iteration 3 points in between 0 and 1 are inserted. The next iteration the points will be inserted in between 1 and 2. However, this point has shifted its index with 3. This is fixed by the following: while (len(indexes_too_far) > 0) and (kvect.size < 5000): for counter,index in enumerate(indexes_too_far): index = index + counter*3 new_gains = np.linspace(kvect[index], kvect[index + 1], 5) new_points = _RLFindRoots(num, den, new_gains[1:4]) kvect = np.insert(kvect, index + 1, new_gains[1:4]) mymat = np.insert(mymat, index + 1, new_points, axis=0) Now a new function _indexes_filt is added which also takes into account if the user is zoomed in on a part of the plot and adds more points to indexes_too_far. If no initial points are within the zoom view, it detects at which point one of the points crosses an xlim or ylim of the zoombox and then more points are added until the zoom tolerance requirements are met. This pull request also includes the #199 and #204 pull requests, because they are an integral part of the sisotool as well. Please note that the Travis CI build sometimes fails due to issue #194 . I was able to get the build passing (https://travis-ci.org/icam0/python-control/builds/387446241) by restarting 2 subbuilds once.
Open Graph Description: This pull request introduces two new features to the python-control package. A matlab inspired sisotool and dynamic recomputing of the root locus plot when zooming. Sisotool In the pictures below a...
X Description: This pull request introduces two new features to the python-control package. A matlab inspired sisotool and dynamic recomputing of the root locus plot when zooming. Sisotool In the pictures below a...
Opengraph URL: https://github.com/python-control/python-control/pull/209
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:039e4e86-a2a6-f6d0-9cc7-d91b7e8df993 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 951E:183EDE:3E3AE2E:5348FED:697B0C74 |
| html-safe-nonce | 28988eff32bd5f982af39a12e89979b53295440d698b53f03c53371a1f312062 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTFFOjE4M0VERTozRTNBRTJFOjUzNDhGRUQ6Njk3QjBDNzQiLCJ2aXNpdG9yX2lkIjoiODQyMTUyNjc4MjkwNDgzMTA5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1a8f92652167689062d1cec239f76c7afb1fdc1a71310e73ea9515cfe945c379 |
| hovercard-subject-tag | pull_request:192259347 |
| 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/209/checks |
| twitter:image | https://avatars.githubusercontent.com/u/821612?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/821612?s=400&v=4 |
| og:image:alt | This pull request introduces two new features to the python-control package. A matlab inspired sisotool and dynamic recomputing of the root locus plot when zooming. Sisotool In the pictures below a... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7ce8ed0a54c4730aeca4e6abacfc6490365fc42e25480b86883054df3f9181c8 |
| 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 | d7bfc78137af9a4828305e52ab993fce981d7085 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width