GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix TimeResponseData.to_pandas() for multi-trace responses by murrayrm · Pull Request #1088 · python-control/python-control Conversation
Member
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).
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
There was an error while loading. Please reload this page.
|
coverage: 94.731% (+0.001%) from 94.73% |
Sorry, something went wrong.
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.
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 of inputs here to be symmetric with comparisons in the for-loop below.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 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.
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 of outputs here to be symmetric with comparisons for the case of single-trace above.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
control.timeresp.TimeResponseData.to_pandas() failing
There was an error while loading. Please reload this page.