Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

@murrayrm
Copy link
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).

@murrayrmmurrayrm linked an issueDec 31, 2024 that may beclosed by this pull request
@coveralls
Copy link

coveralls commentedDec 31, 2024
edited
Loading

Coverage Status

coverage: 94.731% (+0.001%) from 94.73%
when pulling7707ea8 on murrayrm:fix_topandas-30Dec2024
into859ece6 on python-control:main.

@slivingstonslivingston self-requested a reviewDecember 31, 2024 18:20
Comment on lines 1279 to 1282
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])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
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.

Comment on lines 1287 to 1290
np.testing.assert_equal(
df[df['trace']==label]['time'],res.time)
np.testing.assert_equal(
df[df['trace']==label]['u0'],res.inputs['u0',i])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
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.

Copy link
Contributor

@joaoantoniocardosojoaoantoniocardoso left a 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

@murrayrmmurrayrm merged commit21c8f31 intopython-control:mainJan 2, 2025
23 checks passed
@murrayrmmurrayrm added this to the0.10.2 milestoneFeb 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@slivingstonslivingstonslivingston approved these changes

+1 more reviewer

@joaoantoniocardosojoaoantoniocardosojoaoantoniocardoso approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.10.2

Development

Successfully merging this pull request may close these issues.

control.timeresp.TimeResponseData.to_pandas() failing

4 participants

@murrayrm@coveralls@slivingston@joaoantoniocardoso

[8]ページ先頭

©2009-2025 Movatter.jp