Skip to content

Fix time_response_plot for response lists#1224

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

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

Conversation

@marko1olo

Copy link
Copy Markdown
Contributor

Fixes #1171.

step_response([sys1, sys2]) and related simulation calls return TimeResponseList. Calling .plot() on that object already worked, but calling the public function directly raised before it could plot:

AttributeError: 'TimeResponseList' object has no attribute 'plot_inputs'

This routes TimeResponseList and plain Python lists of time responses through the existing TimeResponseList.plot() path. The change is scoped to the crash/list-support part of the issue and leaves the color-improvement discussion separate.

Local validation:

  • Red repro before fix: ct.time_response_plot(ct.step_response([sys1, sys2])) raised AttributeError: 'TimeResponseList' object has no attribute 'plot_inputs'.
  • After fix smoke: same call returns a (1, 1) plot with two lines for SISO responses.
  • MPLBACKEND=Agg PYTHONPATH=. python -m pytest control\tests\timeplot_test.py::test_list_responses -q -> 5 passed
  • MPLBACKEND=Agg PYTHONPATH=. python -m pytest control\tests\timeplot_test.py -q -> 73 passed, 3 skipped
  • python -m ruff check control\timeplot.py control\tests\timeplot_test.py
  • python -m compileall -q control\timeplot.py control\tests\timeplot_test.py
  • git diff --check

Authored with assistance from OpenAI Codex.

Route TimeResponseList and plain lists of time responses through the existing TimeResponseList plotting path when calling the public time_response_plot function directly. This keeps response_list.plot() behavior unchanged while fixing the standalone function for list-returning simulation calls.
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.

Bug in time_response_plot for multiple responses + improvements in input/output colors.

1 participant