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

Time response plots#920

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
murrayrm merged 12 commits intopython-control:mainfrommurrayrm:time_plots-20Jun2023
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
12 commits
Select commitHold shift + click to select a range
ece5f92
initial implementation
murrayrmJun 21, 2023
dacf17c
add support for plot_input='overlay', trace labeling, legend processing
murrayrmJun 25, 2023
9f99219
unit tests + bug fixes
murrayrmJun 28, 2023
3f7e275
add user documentation (with figures) + combine_traces function
murrayrmJun 29, 2023
97f2fd1
updated unit tests (coverage)
murrayrmJun 30, 2023
6bb8b56
change ioresp_plot to time_response_plot
murrayrmJun 30, 2023
29054ec
customizable line properties, combine_* -> overlay_*, documentation
murrayrmJul 1, 2023
7f92ce0
add trace_labels option to time_response_plot()
murrayrmJul 3, 2023
1f44fd6
fix shape of output for time_reesponse_plot()
murrayrmJul 3, 2023
3290809
update line properties code for Python 3.8
murrayrmJul 3, 2023
1a9e64f
fix processing of custom font sizes (w/ unit test)
murrayrmJul 3, 2023
bab5071
rename combine_traces to combine_time_responses, updated trace labels
murrayrmJul 4, 2023
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
5 changes: 4 additions & 1 deletioncontrol/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -77,6 +77,10 @@
from .xferfcn import *
from .frdata import *

# Time responses and plotting
from .timeresp import *
from .timeplot import *

from .bdalg import *
from .delay import *
from .descfcn import *
Expand All@@ -91,7 +95,6 @@
from .rlocus import *
from .statefbk import *
from .stochsys import *
from .timeresp import *
from .ctrlutil import *
from .canonical import *
from .robust import *
Expand Down
3 changes: 3 additions & 0 deletionscontrol/config.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -135,6 +135,9 @@ def reset_defaults():
from .optimal import _optimal_defaults
defaults.update(_optimal_defaults)

from .timeplot import _timeplot_defaults
defaults.update(_timeplot_defaults)


def _get_param(module, param, argval=None, defval=None, pop=False, last=False):
"""Return the default value for a configuration option.
Expand Down
4 changes: 3 additions & 1 deletioncontrol/nlsys.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1488,6 +1488,7 @@ def ufun(t):
return TimeResponseData(
t_eval, y, None, u, issiso=sys.issiso(),
output_labels=sys.output_labels, input_labels=sys.input_labels,
title="Input/output response for " + sys.name, sysname=sys.name,
transpose=transpose, return_x=return_x, squeeze=squeeze)

# Create a lambda function for the right hand side
Expand DownExpand Up@@ -1567,7 +1568,8 @@ def ivp_rhs(t, x):
return TimeResponseData(
soln.t, y, soln.y, u, issiso=sys.issiso(),
output_labels=sys.output_labels, input_labels=sys.input_labels,
state_labels=sys.state_labels,
state_labels=sys.state_labels, sysname=sys.name,
title="Input/output response for " + sys.name,
transpose=transpose, return_x=return_x, squeeze=squeeze)


Expand Down
20 changes: 19 additions & 1 deletioncontrol/tests/kwargs_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,7 @@
import control.tests.statefbk_test as statefbk_test
import control.tests.stochsys_test as stochsys_test
import control.tests.trdata_test as trdata_test
import control.tests.timeplot_test as timeplot_test

@pytest.mark.parametrize("module, prefix", [
(control, ""), (control.flatsys, "flatsys."), (control.optimal, "optimal.")
Expand DownExpand Up@@ -74,7 +75,8 @@ def test_kwarg_search(module, prefix):
# @parametrize messes up the check, but we know it is there
pass

elif source and source.find('unrecognized keyword') < 0:
elif source and source.find('unrecognized keyword') < 0 and \
source.find('unexpected keyword') < 0:
warnings.warn(
f"'unrecognized keyword' not found in unit test "
f"for {name}")
Expand DownExpand Up@@ -161,7 +163,21 @@ def test_matplotlib_kwargs(function, nsysargs, moreargs, kwargs, mplcleanup):
function(*args, **kwargs, unknown=None)


@pytest.mark.parametrize(
"function", [control.time_response_plot, control.TimeResponseData.plot])
def test_time_response_plot_kwargs(function):
# Create a system for testing
response = control.step_response(control.rss(4, 2, 2))

# Call the plotting function normally and make sure it works
function(response)

# Now add an unrecognized keyword and make sure there is an error
with pytest.raises(AttributeError,
match="(has no property|unexpected keyword)"):
function(response, unknown=None)


#
# List of all unit tests that check for unrecognized keywords
#
Expand All@@ -185,6 +201,7 @@ def test_matplotlib_kwargs(function, nsysargs, moreargs, kwargs, mplcleanup):
'gangof4_plot': test_matplotlib_kwargs,
'input_output_response': test_unrecognized_kwargs,
'interconnect': interconnect_test.test_interconnect_exceptions,
'time_response_plot': timeplot_test.test_errors,
'linearize': test_unrecognized_kwargs,
'lqe': test_unrecognized_kwargs,
'lqr': test_unrecognized_kwargs,
Expand DownExpand Up@@ -230,6 +247,7 @@ def test_matplotlib_kwargs(function, nsysargs, moreargs, kwargs, mplcleanup):
'StateSpace.__init__': test_unrecognized_kwargs,
'StateSpace.sample': test_unrecognized_kwargs,
'TimeResponseData.__call__': trdata_test.test_response_copy,
'TimeResponseData.plot': timeplot_test.test_errors,
'TransferFunction.__init__': test_unrecognized_kwargs,
'TransferFunction.sample': test_unrecognized_kwargs,
'optimal.OptimalControlProblem.__init__':
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp