GeezerVison is showing github.com — Updated system class functionality by murrayrm · Pull Request #721 · python-control/python-control
Conversation
murrayrm
commented
Apr 9, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
This PR contains a refactoring of the code that is used to implement the I/O and LTI systems classes, building on some of the changes started in PR #710 and adding new functionality (and consistency). There are quite a few changes, but everything is either new functionality or backward compatible and so existing code does not need to change.
Summary of changes:
- Changed the
LTI class to use poles() and zeros() for retrieving poles and zeros, with pole() and zero() generating a PendingDeprecationWarning (which is ignored by default in Python). (The MATLAB compatibility module still uses pole() and zero().)
- The
TimeResponseData and FrequencyResponseData objects now implement a to_pandas() method that creates a simple pandas dataframe.
- The
FrequencyResponseData class is now used as the output for frequency response produced by freqresp() and a new function frequency_response has been defined, to be consistent with the input_output_response function. A FrequencyResponseData object can be assigned to a tuple to provide magnitude, phase, and frequency arrays, mirroring TimeResponseData functionality from PR Time response data class #649.
- The
LTI class is now a subclass of NamedIOSystem (formerly _NamedIOSystem), which allows state space and transfer functions systems to have system and signal names. In addition, the separate _NamedIOStateSystem class was eliminated in favor of using nstates to distinguish a system with no state space functionality (nstates == None, used for TransferFunction and FrequencyResponseData systems) from a system defined in state space (nstates >= 0, used for InputOutputSystem and StateSpace systems).
- The
__repr__ method for NamedIOSystem has been updated to implement the changes in draft PR Change InputOutputSystem repr to show type, name, inputs, and outputs #699 and the __str__ method has been updated for linear I/O system to combine the information for an I/O system and a state space system. In particular, I/O systems are now displayed as SystemClass:sysname:[input_labels]->[output_labels]>.
- Common functionality for the LTI and InputOutputSystem classes is now pulled up into the
NamedIOSystem class (and namedio.py) and a common parsing function _process_namedio_keywords() is used for consistent behavior across system creation functions.
- The
drss, rss, ss2tf, tf2ss, tf2io, and ss2io functions now all accept system and signal name arguments (via _process_namedio_keywords().
-
- The
rss function can now accept a dt argument and can create either continuous-time or discrete-time random systems. The drss function just calls rss() with dt=True.
- The
ss function can now accept function names as arguments, in which case it creates a NonlinearIOSystem (I'm not sure how useful this is, but ss is a sort of wrapper function that calls the appropriate class constructor, so it was easy enough to implement.)
- The
interconnect function now has a warn_duplicate flag that can be used to turn on/off warning messages about duplicate objects. The default value is None, in which case warnings are suppressed for duplicated systems with generic names (of the form sys[n]. (The let's you do things like H = G * G without getting warning messages for state space systems without specified names.)
- The
SystemTrajectory class for flat systems now has a response() method that generates a TimeDataResponse object.
- Added some missing type conversions between systems by using the
__array_priority__ class variable to allow the right operand to override the left operand when needed. This mainly affect the FrequencyResponseData class.
- Updated unit tests, docstrings, user documentation, and examples to match new functionality.
The following diagram (from the user documentation) illustrates the relationship between the various classes:

Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
* LTI is NamedIOSystem instead of StateSpace, TransferFunction, and FRD
* implement _process_namedio_keywords and use for system/signal name, dt
* move timebase functions from lti to namedio
* move statesp/_ss code to iosys/ss and iosys/copy to namedio/copy
* clean up duplicate object/sysname warnings
* updated unit tests
coveralls
commented
Apr 9, 2022
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Coverage decreased (-0.1%) to 94.201% when pulling 135734a on murrayrm:ioclass_25Mar2022 into 983726c on python-control:master.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This is a nice re-architecting that gives named signals for tfs and ss systems.
- having
frequency _response both a method and a function seems fine.
- very helpful inheritance figure
- I like the power of using frd as return type. is
FRD.return_magphase Documented?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I think this was in a previous commit, but the input_labels property are very nice. All looks good to me otherwise.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|