Skip to content

Fix time_response_plot for response lists - #1231

Open
marko1olo wants to merge 1 commit into
python-control:mainfrom
marko1olo:fix-time-response-plot-list
Open

Fix time_response_plot for response lists#1231
marko1olo wants to merge 1 commit into
python-control:mainfrom
marko1olo:fix-time-response-plot-list

Conversation

@marko1olo

@marko1olo marko1olo commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Fixes time_response_plot() when called directly with a list of TimeResponseData objects, as shown in #1171.

The function now combines response lists into a multi-trace response before calculating plot layout, so callers do not hit AttributeError on list attributes such as plot_inputs or ninputs.

Checks

  • Red repro before fix: ct.time_response_plot([resp1, resp2]) failed with AttributeError: 'list' object has no attribute 'plot_inputs'.
  • Red repro before fix: ct.time_response_plot([resp1, resp2], plot_inputs=True) failed with AttributeError: 'list' object has no attribute 'ninputs'.
  • MPLBACKEND=Agg python -m pytest control/tests/timeplot_test.py::test_time_response_plot_response_list control/tests/timeplot_test.py::test_list_responses -q passed: 6 passed.
  • MPLBACKEND=Agg python -m pytest control/tests/timeplot_test.py -q passed: 74 passed, 3 skipped.
  • MPLBACKEND=Agg python -m pytest control/tests/timeresp_test.py control/tests/trdata_test.py -q passed: 276 passed, 46 skipped.
  • python -m ruff check control/timeplot.py control/tests/timeplot_test.py passed.
  • python -m compileall -q control/timeplot.py control/tests/timeplot_test.py passed.
  • git diff --check HEAD~1..HEAD passed.

AI Disclosure: Claude Code (Opus 5) was used during code navigation, initial drafting, and PR text preparation. All logic, code changes, and test cases have been manually reviewed, verified, and tested locally by the author in accordance with the NumPy AI Policy.

@marko1olo

marko1olo commented Jun 9, 2026

Copy link
Copy Markdown
Author

Local verification on b2087f35:

python -m pytest control/tests/timeplot_test.py -q
74 passed, 3 skipped

python -m ruff check control/timeplot.py control/tests/timeplot_test.py
All checks passed

git diff --check origin/main..HEAD
passed

The only local warning was pytest being unable to write .pytest_cache in this Windows worktree; the tests themselves passed.

@murrayrm

murrayrm commented Aug 9, 2026

Copy link
Copy Markdown
Member

@marko1olo Please rebase off of main to trigger updated CI checks from PR #1243.

@coveralls

coveralls commented Aug 13, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 94.777% (+0.02%) from 94.757% — marko1olo:fix-time-response-plot-list into python-control:main

@marko1olo

Copy link
Copy Markdown
Author

Rebased on main to trigger the updated CI checks. Thanks!

@slivingston

Copy link
Copy Markdown
Member

@marko1olo What is the relationship between this PR and #1224, which has the same title (verbatim) and also claims to fix #1171 ?

@marko1olo

Copy link
Copy Markdown
Author

@slivingston My bad on the confusion — #1224 was an earlier branch that had merge conflicts. I pushed the clean rebased commit here in #1231 and just closed #1224 so we can track the fix cleanly in one place.

@slivingston

Copy link
Copy Markdown
Member

@marko1olo Please be more careful before you submit PRs... Though you give the reason that #1224 had a "merge conflict," it was opened only 2 days before this PR, and you kept both open for a long time and handled #1224 as if it still deserved review (e.g., when Richard asked for it to be rebased a few days ago, you rebased it).

@marko1olo

Copy link
Copy Markdown
Author

@slivingston You're right, apologies. #1224 had a merge conflict and I opened #1231 as a clean rewrite on a fresh branch. I should have closed #1224 right away — that was my mistake. #1224 is already closed, so #1231 is the only active one for this fix. Sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants