Title: Missing labels from forced_response output · Issue #891 · python-control/python-control · GitHub
Open Graph Title: Missing labels from forced_response output · Issue #891 · python-control/python-control
X Title: Missing labels from forced_response output · Issue #891 · python-control/python-control
Description: Hi, I wrote a state-space system representation with labels, like: sys = ct.ss( A, B, C, D, name="motor", states=("Ia", "Wm"), inputs=("Va", "Tl"), outputs=("Ia", "Wm", "Va", "Tl"), ) But after simulating it, the result (a TimeResponseDa...
Open Graph Description: Hi, I wrote a state-space system representation with labels, like: sys = ct.ss( A, B, C, D, name="motor", states=("Ia", "Wm"), inputs=("Va", "Tl"), outputs=("Ia", "Wm", "Va", "Tl"), ) But after sim...
X Description: Hi, I wrote a state-space system representation with labels, like: sys = ct.ss( A, B, C, D, name="motor", states=("Ia", "Wm"), inputs=("Va", "Tl"),...
Opengraph URL: https://github.com/python-control/python-control/issues/891
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Missing labels from forced_response output","articleBody":"Hi,\r\n\r\nI wrote a state-space system representation with labels, like:\r\n\r\n``` Python\r\nsys = ct.ss(\r\n A, B, C, D,\r\n name=\"motor\",\r\n states=(\"Ia\", \"Wm\"),\r\n inputs=(\"Va\", \"Tl\"),\r\n outputs=(\"Ia\", \"Wm\", \"Va\", \"Tl\"),\r\n)\r\n```\r\n\r\nBut after simulating it, the result (a `TimeResponseData`), lacks information about the labels of the simulated system:\r\n``` Python\r\nT = np.linspace(0, 0.360, 360)\r\nVa = np.ones_like(T) * 36\r\nTl = np.linspace(0, 15, len(T))\r\n\r\nres = ct.forced_response(motor, T, U=[Va, Tl], X0=[0, 0])\r\nprint(res.output_labels) # this is None\r\nprint(res.input_labels) # this is None\r\nprint(res.state_labels) # this is None\r\n```\r\n\r\nI wanted to use `.to_pandas()`, and after assigning it manually, it works, so it's probably just a matter of passing it forward internally in the code:\r\n``` Python\r\nres.output_labels = motor.output_labels\r\nres.input_labels = motor.input_labels\r\nres.state_labels = motor.state_labels\r\ndf = res.to_pandas().set_index(\"time\")\r\n```\r\n\r\nFor completeness, this is the error if I try to use `.to_pandass()` without the abovementioned workaround:\r\n\r\n``` Python\r\n 648 # Create a dict for setting up the data frame\r\n 649 data = {'time': self.time}\r\n 650 data.update(\r\n--\u003e 651 {name: self.u[i] for i, name in enumerate(self.input_labels)})\r\n 652 data.update(\r\n 653 {name: self.y[i] for i, name in enumerate(self.output_labels)})\r\n 654 data.update(\r\n 655 {name: self.x[i] for i, name in enumerate(self.state_labels)})\r\n\r\nTypeError: 'NoneType' object is not iterable\r\n```\r\n\r\nThanks","author":{"url":"https://github.com/joaoantoniocardoso","@type":"Person","name":"joaoantoniocardoso"},"datePublished":"2023-05-20T16:37:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/891/python-control/issues/891"}
| 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:1b5cf926-a1b7-21df-85a5-353ab97c0f76 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CBFE:183EDE:6FBA10:998469:697A6A80 |
| html-safe-nonce | b63765a61d2aad0ff8890c27dd35a9524d7dc71db379d48b56cd142b30ba243b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkZFOjE4M0VERTo2RkJBMTA6OTk4NDY5OjY5N0E2QTgwIiwidmlzaXRvcl9pZCI6IjEzNjczNDU5MTg5NzMyMDkyMTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2c1bd213c8368be7271c51dcb4ee0256b019705bfcefbfed40d377e93f08ba82 |
| hovercard-subject-tag | issue:1718222203 |
| 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/891/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b59857ea89a508d74601d99ee2b8e80ee121efc55be178ec3ab96d131df560f3/python-control/python-control/issues/891 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b59857ea89a508d74601d99ee2b8e80ee121efc55be178ec3ab96d131df560f3/python-control/python-control/issues/891 |
| og:image:alt | Hi, I wrote a state-space system representation with labels, like: sys = ct.ss( A, B, C, D, name="motor", states=("Ia", "Wm"), inputs=("Va", "Tl"), outputs=("Ia", "Wm", "Va", "Tl"), ) But after sim... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | joaoantoniocardoso |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4f4c032790588250388c2e36a0e1ea776c0a3f887d37d994e1ac3d7ea79d34ef |
| 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 | 06b3a5a9a6214e1e06e508d250d778cbaf17c577 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width