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 — Updated system class functionality by murrayrm · Pull Request #721 · python-control/python-control

Conversation

@murrayrm

@murrayrm murrayrm commented Apr 9, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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:

classes

Sorry, something went wrong.

Uh oh!

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

All reactions
murrayrm added 15 commits April 1, 2022 21:14
@murrayrm
add documentation on predict keyword + input_output_response list pro…
e5b4cb3
…cessing
@murrayrm
retrigger checks
33a0744
@murrayrm
check for unused keywords
a4bb80e
@murrayrm
add kwarg tests for lqe, dlqe
c2e3993
@murrayrm
remove _NamedIOStateSystem class
96d813c
@murrayrm
allow creation of NonlinearIOSystem via ss()
ad714fe
@murrayrm
allow TimeResponseData to be converted to pandas
e1f8d3a
@murrayrm
allow FrequencyResponseData signal naming + pandas conversion
51f6bfc
@murrayrm
frequency_response() returns FRD; FRD allows return_magphase
6c3c630
@murrayrm
add frequency_reponse() + FRD properties mag, phase, freq
ecdf1e7
@murrayrm
tweak iosys kwargs checking
14fa890
@murrayrm
change pole(), zero() to poles(), zeros(), with legacy interface avai…
f3cda64
…lable
@murrayrm
rebase cleanup
fb38fd3
@murrayrm
update repr, str representations on NamedIOSystem objects
2264c76
@murrayrm
refactor system classes (frdata, iosys, namedio, statesp, xferfcn)
e2f76df
* 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
@murrayrm murrayrm mentioned this pull request Apr 9, 2022
Change InputOutputSystem repr to show type, name, inputs, and outputs #699
Closed
@murrayrm murrayrm added this to the 0.9.2 milestone Apr 9, 2022
@coveralls

coveralls commented Apr 9, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.1%) to 94.201% when pulling 135734a on murrayrm:ioclass_25Mar2022 into 983726c on python-control:master.

All reactions

Sorry, something went wrong.

Uh oh!

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

murrayrm added 2 commits April 9, 2022 13:41
@murrayrm
add documentation on system class structure
dc5a392
@murrayrm
add flatsys.systraj.response() to create TimeResponseData object
afa4967
@sawyerbfuller

sawyerbfuller commented Apr 10, 2022

Copy link
Copy Markdown
Contributor

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?
All reactions

Sorry, something went wrong.

Uh oh!

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

@sawyerbfuller

sawyerbfuller commented Apr 12, 2022

Copy link
Copy Markdown
Contributor

I think this was in a previous commit, but the input_labels property are very nice. All looks good to me otherwise.

All reactions

Sorry, something went wrong.

Uh oh!

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

@murrayrm
added more documentation on return_magphase per @sawyerbfuller
135734a
@murrayrm
murrayrm merged commit 2102181 into python-control:master Apr 16, 2022
@murrayrm
murrayrm deleted the ioclass_25Mar2022 branch April 16, 2022 01:03
@murrayrm murrayrm mentioned this pull request Nov 13, 2022
fix to insure that when a StateSpace and a LinearIOSystem are combined, the result is a LinearIOSystem #785
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

0.9.2

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

3 participants

@murrayrm @coveralls @sawyerbfuller
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.