Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: signal: SOS LTI systems #6832

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

ENH: signal: SOS LTI systems #6832

wants to merge 3 commits into from

Conversation

e-q
Copy link
Contributor

@e-q e-q commented Dec 7, 2016

We want second order sections to be first class scipy.signal citizens, so I started working on giving them their own lti subclass. This is very much a work in progress, but I wanted to start a place to have relevant discussions.

Specifically, the usual argument-counting scheme really falls down for sos. (Reminder: we often identify what form the LTI system tuple takes with len(system), 2=TF, 3=ZPK, 4=SS) However, since the cascading sections are specified as an ndarray with shape [n, 6], when we call len(system), we can get literally any integer. This doesn't just affect instantiation of lti objects, but also the input arguments of freqresp, step, lsim, etc. What should we do?

Here is an incomplete list of other TODOs:

  • Docstrings
  • Simulation functions
  • do we need to support multiple inputs/outputs? (Q: What is current suport in other LTI classes?)
  • Add sos support to cont2discrete
  • Add some kind of _sos_normalize function
  • Tests

An alternative, which I believe @endolith has mentioned, is to instead create general cascaded LTI systems. Then, SOS systems are just cascaded second order TF systems. I don't think I've come across other kinds of cascaded systems though.

(As a side note, I moved the lti conversion functions that lived in filter_design to lti_conversion for my own sanity. Even after the moves, filter_design is over 3kloc.)

@endolith
Copy link
Member

endolith commented Dec 7, 2016

What should we do?

Can't you just check if the input has shape [n, 6]?

@rgommers rgommers added enhancement A new feature or improvement scipy.signal labels Dec 7, 2016
@larsoner
Copy link
Member

larsoner commented Dec 7, 2016

Or maybe even if isinstance(x, np.ndarray) and x.shape[1] == 6?

@larsoner
Copy link
Member

larsoner commented Dec 7, 2016

(... and x.ndim == 2 and x.shape[1] == 6 I mean)

@e-q
Copy link
Contributor Author

e-q commented Dec 7, 2016

I guess the only problem with this approach is that in only works with ndarrays, but not a 2D list. This is unfortunate, but not a tragedy.

I also note that this feature will have to include a fix for gh-5668.

@larsoner
Copy link
Member

larsoner commented Dec 8, 2016 via email

@lucascolley lucascolley marked this pull request as draft March 14, 2024 21:59
@lucascolley lucascolley changed the title WIP: SOS LTI systems ENH: signal: SOS LTI systems Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement scipy.signal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants