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

fix time series inconsistency between continuous and discrete time simulations#295

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 2 commits intopython-control:masterfrommurrayrm:fix_time_series
May 2, 2019

Conversation

murrayrm
Copy link
Member

As pointed out in issue#239, there is an inconsistency between the way that continuous time simulations and discrete time simulations return their outputs for single output systems. In continuous time, the code follows the documentation and the following works:

t, y = step_response(sys)plot(t, y)

However, in discrete time simulations the returned value fory had shape(1, len(t)), which meant that you had to do the following for discrete time systems:

t, y = step_response(sysd)plot(t, y[0])

The problem was that for continuous time simulationsforced_response() (the ultimate function that gets called) had annp.squeeze() at the end but this wasn't present for discrete time simulations. This PR fixes that problem so that the behavior is consistent, resolving the bug in issue#239.

Other small changes:

  • Added unit tests that catch the original bug

  • Added asqueeze keyword that controls whether this behavior is implemented (default =True).

  • Did some PEP8 cleanup ontimeresponse.py

Note that this may make some existing code break since discrete time simulations can now return an output that is a 1D array instead of 2D. The fix is either to remove the output index (y[0] becomesy) or set thesqueeze keyword toFalse).

@coveralls
Copy link

coveralls commentedApr 21, 2019
edited
Loading

Coverage Status

Coverage increased (+0.006%) to 78.228% when pullingf474179 on murrayrm:fix_time_series intod8d0a9c on python-control:master.

Copy link
Member

@repaghrepagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

looks good


else:
# Discrete type system => use SciPy signal processing toolbox
if (sys.dt!= True):
if (sys.dtis not True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Any reason why there are brackets around the test?

@murrayrmmurrayrm merged commitc765811 intopython-control:masterMay 2, 2019
@murrayrmmurrayrm deleted the fix_time_series branchMay 12, 2019 05:49
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@repaghrepaghrepagh approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
0.8.3
Development

Successfully merging this pull request may close these issues.

3 participants
@murrayrm@coveralls@repagh

[8]ページ先頭

©2009-2025 Movatter.jp