Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions control/tests/timeplot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def test_combine_time_responses():
sys_mimo = ct.rss(4, 2, 2)
timepts = np.linspace(0, 10, 100)

# Combine two response with ntrace = 0
# Combine two responses with ntrace = 0
U = np.vstack([np.sin(timepts), np.cos(2*timepts)])
resp1 = ct.input_output_response(sys_mimo, timepts, U)

Expand Down Expand Up @@ -293,6 +293,7 @@ def test_combine_time_responses():
combresp4 = ct.combine_time_responses(
[resp1, resp2, resp3], trace_labels=labels)
assert combresp4.trace_labels == labels
assert combresp4.trace_types == [None, None, 'step', 'step']

# Automatically generated trace label names and types
resp5 = ct.step_response(sys_mimo, timepts)
Expand All @@ -302,7 +303,13 @@ def test_combine_time_responses():
combresp5 = ct.combine_time_responses([resp1, resp5])
assert combresp5.trace_labels == [resp1.title] + \
["test, trace 0", "test, trace 1"]
assert combresp4.trace_types == [None, None, 'step', 'step']
assert combresp5.trace_types == [None, None, None]

# ntraces = 0 with trace_types != None
# https://github.com/python-control/python-control/issues/1025
resp6 = ct.forced_response(sys_mimo, timepts, U)
combresp6 = ct.combine_time_responses([resp1, resp6])
assert combresp6.trace_types == [None, 'forced']

with pytest.raises(ValueError, match="must have the same number"):
resp = ct.step_response(ct.rss(4, 2, 3), timepts)
Expand Down
3 changes: 2 additions & 1 deletion control/timeplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,8 @@ def combine_time_responses(response_list, trace_labels=None, title=None):
if generate_trace_labels:
trace_labels.append(response.title)
trace_types.append(
None if response.trace_types is None else response.types[0])
None if response.trace_types is None
else response.trace_types[0])

else:
# Save the data
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy