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

Copy link
Copy Markdown
Contributor

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.

@marko1olo

marko1olo commented Jun 9, 2026

Copy link
Copy Markdown
Contributor 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.

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.

1 participant