Title: Display Connection Matrix · Issue #963 · python-control/python-control · GitHub
Open Graph Title: Display Connection Matrix · Issue #963 · python-control/python-control
X Title: Display Connection Matrix · Issue #963 · python-control/python-control
Description: Hi, I wanted to expand on #925 and display a sparse graph of all the system connections, some of which had the same signal name, which is a case I found the new connection table feature a bit confusing for so I wrote this short function ...
Open Graph Description: Hi, I wanted to expand on #925 and display a sparse graph of all the system connections, some of which had the same signal name, which is a case I found the new connection table feature a bit confu...
X Description: Hi, I wanted to expand on #925 and display a sparse graph of all the system connections, some of which had the same signal name, which is a case I found the new connection table feature a bit confu...
Opengraph URL: https://github.com/python-control/python-control/issues/963
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Display Connection Matrix","articleBody":"Hi,\r\n\r\nI wanted to expand on #925 and display a sparse graph of all the system connections, some of which had the same signal name, which is a case I found the new connection table feature a bit confusing for so I wrote this short function to display the connection matrix directly using matplotlib imshow.\r\n\r\n```python\r\ndef make_connection_plot(self):\r\n iinx = {}\r\n oinx = {}\r\n sinx = {} \r\n\r\n # Go through the system list and keep track of counts, offsets\r\n for sysidx, sys in enumerate(self.syslist):\r\n\r\n for st in range(sys.nstates):\r\n iinx[ max(iinx.keys())+1 if iinx else 0 + st] = f'{sys.name}.{sys.state_labels[st]}'\r\n for st in range(sys.noutputs):\r\n oinx[ max(oinx.keys())+1 if oinx else 0 +st] = f'{sys.name}.{sys.output_labels[st]}'\r\n for st in range(sys.ninputs):\r\n sinx[max(sinx.keys())+1 if sinx else 0 +st] = f'{sys.name}.{sys.input_labels[st]}'\r\n\r\n cmm = self.connect_map.copy()\r\n cmm[cmm==0] = np.nan\r\n imshow(cmm)\r\n grid()\r\n title(f'Connection Map: {self.name}')\r\n xticks(ticks=list(oinx.keys()),labels=list(oinx.values()),rotation=90)\r\n yticks(ticks=list(sinx.keys()),labels=list(sinx.values()))\r\n xlabel('Outputs')\r\n ylabel('Inputs')\r\n \r\n tight_layout()\r\n```\r\n\r\nThis code results in this plot, displaying the gain via color as well as the scoped input and output names.\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/SoundsSerious","@type":"Person","name":"SoundsSerious"},"datePublished":"2024-01-21T03:53:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/963/python-control/issues/963"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:79d0e965-8662-9bec-bbf0-b0c2a89fda95 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D460:183EDE:1DA462E:27ABF3C:697AAAF2 |
| html-safe-nonce | fad5ccbc3804016183287127e1deac7262b72c870bcc1aada5d0544b3328ea60 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDYwOjE4M0VERToxREE0NjJFOjI3QUJGM0M6Njk3QUFBRjIiLCJ2aXNpdG9yX2lkIjoiNDE4NjE3MzEwODk4NzI3NjAxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8e2dac42cadafef9b89bc3be45c11617f84114e826cad490da9764cd7e6b0a4f |
| hovercard-subject-tag | issue:2092407547 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python-control/python-control/963/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e59be953afa4a5ccb012d7956be12ce6797e75bdff33d72a17b4f40f2cb2c980/python-control/python-control/issues/963 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e59be953afa4a5ccb012d7956be12ce6797e75bdff33d72a17b4f40f2cb2c980/python-control/python-control/issues/963 |
| og:image:alt | Hi, I wanted to expand on #925 and display a sparse graph of all the system connections, some of which had the same signal name, which is a case I found the new connection table feature a bit confu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SoundsSerious |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4d375b6c612de26fd037e0638eaf57e32cf9b16daf53ab68c25c04cd3b058113 |
| 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 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5b310e2c1221fb24ffd3f38a097000863d2dfdd4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width