GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Default dt is 0 by sawyerbfuller · Pull Request #431 · python-control/python-control

Conversation

@sawyerbfuller

@sawyerbfuller sawyerbfuller commented Jul 17, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Changes the new default to be dt=0 (continuous-time), rather than dt=None (timebase unspecified) for state space, transfer function, and input output systems. This follows matlab convention as discussed in issue #422

  • new default is dt=0 in these three modules (edit: setting now is in a single location: defaults['control.default_dt'])
  • to make interconnection behavior match what is described in conventions, a new function: lti.common_timebase(dt1, dt2) was introduced. It performs logic to correctly combine timebases of combined systems. The new function now correctly allows discrete-time systems with unspecified sampling time (dt=True) to be combined with systems with specified sampling time (dt!=0, dt!=None, eg dt=0.1).
  • new functions _isstaticgain (edit: now is a method is_static_gain) were added to detect upon initialization whether a state space or transfer function is a static gain. If so, dt=None for such systems so they may be combined with either discrete- or continuous-time systems.
  • I needed to take dt out of the arguments list in iosys init functions because library-wide defaults are not available when modules are first imported, which is when default values in function declarations are evaluated. My solution was to move the dt keyword in the **kwargs dict.
  • fixes to unit tests
  • use_legacy_defaults('0.8.3') reverts to old default behavior of dt=None

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sawyerbfuller added 2 commits July 16, 2020 21:01
@sawyerbfuller
set default dt to be 0 instead of None. Now need to fix resulting uni…
0113f99
…t test failures
@sawyerbfuller
changes so that a default dt=0 passes unit tests. fixed code everywhe…
9aed7cc
…re that combines systems with different timebases
@sawyerbfuller

sawyerbfuller commented Jul 17, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Let me know what you think. If it looks good I will update documentation in modules and in conventions.rst

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Jul 17, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.07%) to 84.278% when pulling dc53eb9 on sawyerbfuller:default_dt_0 into d3142ff on python-control:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coveralls

coveralls commented Jul 17, 2020

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.08%) to 84.296% when pulling 9aed7cc on sawyerbfuller:default_dt_0 into d3142ff on python-control:master.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sawyerbfuller
small bugfix to xferfcn._evalfr to correctly give it dt value
7a9bcd4
@sawyerbfuller

sawyerbfuller commented Jul 18, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

some remarks:

  • most of the unit tests worked as-is with the change, except for ones that implicitly assumed dt=None during the tests. After making that assumption explicit on such systems, pretty much everything worked
  • most of the effort came in implementing a test for static gain in StateSpace and TransferFunction classes (maybe one is needed in iosys?)
  • and in standardizing the use of lti.common_timebase everywhere in the software when interconnecting systems
  • I tested it on a few pages of my own code full of discrete and cont time systems and everything worked unchanged
  • all unit tests work for both dt=0 and dt=None as defaults
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sawyerbfuller
removed a brittle unit test dependency that is already tested elsewhere
d59e57a
@sawyerbfuller
sawyerbfuller force-pushed the default_dt_0 branch from aa6bf84 to d59e57a Compare July 18, 2020 02:40
@murrayrm

murrayrm commented Jul 18, 2020

Copy link
Copy Markdown
Member

For the defaults, it seems like most people are going use the same default for transfer functions, state space systems, and I/O systems. Right now they have to set three defaults. Does it makes sense to collapse this to just one configuration variable? Or perhaps allow both: a "global" default_dt with individual overrides if you want them.

Also: since this will nominally break code, I propose putting this into v0.9 (versus 0.8.4, which we are close to releasing).

Will try to take a closer look at the code itself in a bit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@murrayrm murrayrm mentioned this pull request Jul 18, 2020
Interpretation of argument for use_legacy_defaults is not clear #432
Closed
@murrayrm murrayrm added this to the 0.9.0 milestone Jul 18, 2020
@sawyerbfuller

sawyerbfuller commented Jul 18, 2020

Copy link
Copy Markdown
Contributor Author

Hi Richard, this all makes sense and sounds reasonable. There was some reason (I think it was mostly expedience) for why I didn’t just use a a global default dt - I think I had decided that something about the global defaults hadn’t been completely implemented yet, but let me take a look, I agree that would be the right way to do it if possible.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bnavigator
bnavigator reviewed Jul 18, 2020
View reviewed changes

@bnavigator bnavigator left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I like it!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread control/lti.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread control/tests/discrete_test.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

sawyerbfuller added 3 commits July 20, 2020 08:53
@sawyerbfuller
improved unit test suggestd by ben greiner
c96465d
@sawyerbfuller
re-incorporated lti.timebaseEqual, with a pendingDeprecationWarning
2ec1653
@sawyerbfuller
changes to enable package-wide default, 'control.default_dt')
1e001ee
@sawyerbfuller

sawyerbfuller commented Jul 20, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

OK made a few suggested changes:

  • default dt is now package-wide. change it with set_defaults('control', default_dt=0)
  • re-incorporated timebaseEqual with deprecation warning
  • improved a few unit tests
bnavigator reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sawyerbfuller
fixes to docstrings and conventions.rst to match convention of dt=0 a…
f5c3fac
…s default system timebase
bnavigator
bnavigator reviewed Jul 20, 2020
View reviewed changes
Comment thread .vscode/settings.json Resolved

Uh oh!

There was an error while loading. Please reload this page.

sawyerbfuller added 2 commits July 20, 2020 22:02
@sawyerbfuller
remove extraneous file
c6787cc
@sawyerbfuller
new method is_static_gain() for state space and transfer function sys…
606975d
…tems, refactored __init__ on both to use it
@sawyerbfuller

sawyerbfuller commented Jul 22, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

latest commit creates a new, potentially-useful method, is_static_gain() for StateSpace and TransferFunction systems. refactored their init methods to use it now rather than what it used to be, which was a function internal to the respective module

  • during refactor, added the ability to init using a dt keyword, as suggested in issue Problem with DT State-Space Response #419. If dt is received as both a positional and a keyword argument, the user receives a warning and the positional argument is used.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sawyerbfuller added 2 commits July 22, 2020 13:42
@sawyerbfuller
added keyword arguments to xferfcn.tf and statesp.ss to set dt
2bd912d
@sawyerbfuller
unit tests for is_static_gain system method and dt keyword in system …
dc53eb9
…__init__ methods
@sawyerbfuller

sawyerbfuller commented Jul 23, 2020

Copy link
Copy Markdown
Contributor Author

I think this should also resolve #399

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnavigator

bnavigator commented Jul 23, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Did someone check to merge your PRs with @samlaf's? They seem to work on overlapping functionality.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sawyerbfuller

sawyerbfuller commented Jul 23, 2020

Copy link
Copy Markdown
Contributor Author

Did someone check to merge your PRs with @samlaf's? They seem to work on overlapping functionality.

@bnavigator good to check. A brief glance through suggests that they are are basically operating on different aspects of the iosys functionality, and I don't anticipate any merge problems, except for the occasional empty line. The devil is in the details, of course. I don't know git will enough to do a test merge. If any issues crop up you can let me know and I will be happy to take a look at it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnavigator bnavigator mentioned this pull request Jul 23, 2020
Mergetest Prs #400 #431 #433 bnavigator/python-control#1
Closed
7 tasks done
@bnavigator

bnavigator commented Jul 23, 2020

Copy link
Copy Markdown
Contributor

I made a test merge in bnavigator#1 and reactivated TravisCI for my fork. Tests look good so far, there were merge conflicts in both merges, because the edits were in lines next to each other. Please check, if I resolved correctly.

Originally posted by @bnavigator in #433 (comment)

I postet the comment in the wrong thread. Meant to post it here, so that @samlaf gets notified too. Alas, another mention.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnavigator bnavigator linked an issue Aug 17, 2020 that may be closed by this pull request
Bugs in InterconnectedSystem: different dt's [fixed] and non-proper TFs [open] #399
Closed
@bnavigator bnavigator mentioned this pull request Aug 17, 2020
Bugs in InterconnectedSystem: different dt's [fixed] and non-proper TFs [open] #399
Closed
@sawyerbfuller sawyerbfuller linked an issue Aug 19, 2020 that may be closed by this pull request
Problem with DT State-Space Response #419
Closed
bnavigator added a commit to bnavigator/python-control that referenced this pull request Aug 20, 2020
@bnavigator
declare timebase in timeresp_test explicitely (python-control#431 ind…
d0137a3
…ependent)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Aug 20, 2020
@bnavigator
make iosys_test.py compatible with current source code state
0a01f30
revert this commit when merging into or with python-control#400 and python-control#431
bnavigator added a commit to bnavigator/python-control that referenced this pull request Aug 20, 2020
@bnavigator
make tests work with current source code state
b0aeec4
revert this commit when merging into/with python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Aug 20, 2020
@bnavigator
make iosys_test.py compatible with current source code state
f0fcc08
revert this commit when merging into or with python-control#400 and python-control#431
bnavigator added a commit to bnavigator/python-control that referenced this pull request Aug 20, 2020
@bnavigator
make tests work with current source code state
41e00b0
revert this commit when merging into/with python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
declare timebase in timeresp_test explicitely (python-control#431 ind…
166fe9c
…ependent)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make iosys_test.py compatible with current source code state
2082796
revert this commit when merging into or with python-control#400 and python-control#431
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make tests work with current source code state
abb9940
revert this commit when merging into/with python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
declare timebase in timeresp_test explicitely (python-control#431 ind…
f37de13
…ependent)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make iosys_test.py compatible with current source code state
efcd483
revert this commit when merging into or with python-control#400 and python-control#431
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make tests work with current source code state
50caf2b
revert this commit when merging into/with python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
declare timebase in timeresp_test explicitely (python-control#431 ind…
1ea0201
…ependent)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make iosys_test.py compatible with current source code state
fdf64ca
revert this commit when merging into or with python-control#400 and python-control#431
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make tests work with current source code state
439ee06
revert this commit when merging into/with python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make tests work with pre python-control#431 source code state
7674d30
revert this commit when merging into/with python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 29, 2020
@bnavigator
make tests work with pre python-control#431 source code state
deeb0c7
revert this commit when merging into/with python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 30, 2020
@bnavigator
make tests work with pre python-control#431 source code state
2b98769
revert this commit when merging a rebased python-control#431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
murrayrm pushed a commit that referenced this pull request Dec 30, 2020
@bnavigator
Refactor the test suite using pytest for array and matrix types (#438)
c432fd5
* reorganize travis matrix, extend conftest.py

* pytestify bdalg_test

* pytestify canonical_test

* pytestify config_test

* pytestify convert_test.py

* pytestify ctrlutil_test

* pytestify delay_test.py

* pytestify discrete_test

* pytestify flatsys_test

* pytestify frd_test

* pytestify freqresp_test.py

* pytestify input_element_int_test

* pytestify iosys_test

* pytestify lti_test.py

* pytestify mateqn_test

* pytestify matlab tests

* pytestify minreal_test

* pytestify modelsimp

* pytestify nichols_test

* pytestify phaseplot_test

* pytestify rlocus_test.py

* pytestify robust tests

* pytestify sisotool_test.py

* pytestify slycot_convert_test.py

* pytestify statefbk tests

* pytestify statesp tests

* pytestify timeresp_test.py

* pytestify xferfcn_input_test.py

remove a lot of duplicate code by converting everything into
a single parametrized test function.

* pytestify xferfcn tests

* make tests work with pre #431 source code state

revert this commit when merging a rebased #431

(remove statesp_test.py::test_copy_constructor_nodt if not applicable)
bnavigator added a commit to bnavigator/python-control that referenced this pull request Dec 31, 2020
@bnavigator
Revert "make tests work with pre python-control#431 source code state…
578cfa6
…" from python-control#438

This reverts commit 2b98769.
@bnavigator bnavigator mentioned this pull request Dec 31, 2020
Rebased #431: Default dt is 0 #490
Merged
@bnavigator

bnavigator commented Dec 31, 2020

Copy link
Copy Markdown
Contributor

Superseded by #490

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnavigator bnavigator closed this Dec 31, 2020
@murrayrm murrayrm mentioned this pull request Dec 31, 2020
Problem with DT State-Space Response #419
Closed
bnavigator added a commit that referenced this pull request Dec 31, 2020
@bnavigator
Merge pull request #490 from bnavigator/rebase-pr431
d1502f4
Rebased #431: Default dt is 0
@bnavigator bnavigator mentioned this pull request Dec 31, 2020
generate error for tf2ss of non-proper transfer function #492
Merged
@murrayrm murrayrm removed this from the 0.9.0 milestone Mar 20, 2021
@bnavigator bnavigator mentioned this pull request Mar 29, 2021
fitfrd function #550
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bnavigator bnavigator bnavigator left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

use dt=0 instead of dt=None (unspecified timebase) as default option for lti systems? Problem with DT State-Space Response Bugs in InterconnectedSystem: different dt's [fixed] and non-proper TFs [open]

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@sawyerbfuller @coveralls @murrayrm @bnavigator
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.