- Notifications
You must be signed in to change notification settings - Fork446
Fix TimeResponseData.to_pandas() for multi-trace responses#1088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
coveralls commentedDec 31, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
| np.testing.assert_equal( | ||
| df[df['trace']=='From u0']['time'],res.time) | ||
| np.testing.assert_equal( | ||
| df[df['trace']=='From u0']['y1'],res.outputs['y1',0]) |
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.
| np.testing.assert_equal( | |
| df[df['trace']=='From u0']['time'],res.time) | |
| np.testing.assert_equal( | |
| df[df['trace']=='From u0']['y1'],res.outputs['y1',0]) | |
| np.testing.assert_equal( | |
| df[df['trace']=='From u0']['time'],res.time) | |
| np.testing.assert_equal( | |
| df[df['trace']=='From u0']['u0'],res.inputs['u0',0]) | |
| np.testing.assert_equal( | |
| df[df['trace']=='From u0']['y1'],res.outputs['y1',0]) |
Include comparison ofinputs here to be symmetric with comparisons in the for-loop below.
control/tests/timeresp_test.py Outdated
| np.testing.assert_equal( | ||
| df[df['trace']==label]['time'],res.time) | ||
| np.testing.assert_equal( | ||
| df[df['trace']==label]['u0'],res.inputs['u0',i]) |
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.
| np.testing.assert_equal( | |
| df[df['trace']==label]['time'],res.time) | |
| np.testing.assert_equal( | |
| df[df['trace']==label]['u0'],res.inputs['u0',i]) | |
| np.testing.assert_equal( | |
| df[df['trace']==label]['time'],res.time) | |
| np.testing.assert_equal( | |
| df[df['trace']==label]['u0'],res.inputs['u0',i]) | |
| np.testing.assert_equal( | |
| df[df['trace']==label]['y1'],res.outputs['y1',i]) |
Include comparison ofoutputs here to be symmetric with comparisons for the case of single-trace above.
joaoantoniocardoso left a comment
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.
Woah, that one was quick!
I've just tested it here, and it worked as a charm!
Thank you so much for keeping this lib, awesome work! And happy New Year! =D
21c8f31 intopython-control:mainUh oh!
There was an error while loading.Please reload this page.
This PR addresses issue#1087. Multi-trace data (e.g., the output from a MIMO step response) was not being processed correctly. This PR creates a new column 'trace' for multi-trace responses and reshapes the data appropriately. Unit tests and updated documentation are included.
Thanks to@joaoantoniocardoso for finding this bug and providing a fix (modified only slightly here).
@joaoantoniocardoso: if you have time to try this out and confirm that it works for your use case, that would be great. I think the only difference is that I used 'trace' for the column label instead of 'trace_label'. I also had to do things a bit differently for the case where there were multiple traces (your example was "multi-trace" but with sys.ntrace=1 since you selected an input).