Skip to content

Add sos2ss, sos2tf, and sos2zp to transfer module - #86

Merged
cokelaer merged 2 commits into
masterfrom
copilot/implement-sos2ss-function
Mar 4, 2026
Merged

cokelaer merged 2 commits into
masterfrom
copilot/implement-sos2ss-function

Conversation

Copilot AI commented Mar 4, 2026 •

Copy link
Copy Markdown
Contributor

The transfer module listed sos2ss, sos2tf, and sos2zp as planned but unimplemented. This adds all three.

New functions

  • sos2tf(sos) — wraps scipy.signal.sos2tf; converts SOS array → transfer function (b, a)
  • sos2zp(sos) — wraps scipy.signal.sos2zpk; converts SOS array → zeros/poles/gain (z, p, k)
  • sos2ss(sos) — converts SOS array → state-space (A, B, C, D) by chaining sos2tf → scipy.signal.tf2ss
import scipy.signal
from spectrum.transfer import sos2ss, sos2tf, sos2zp

sos = scipy.signal.butter(4, 0.2, output='sos')

b, a   = sos2tf(sos)          # transfer function
z, p, k = sos2zp(sos)         # zero-pole-gain
A, B, C, D = sos2ss(sos)      # state-space

All three are exported via __all__.

Original prompt

This section details on the original issue you should resolve

<issue_title>sos2ss implementation</issue_title>
<issue_description>Hello, is there any plan to implement sos2ss function in python?</issue_description>

Comments on the Issue (you are @copilot in this section)

@cokelaer @iPsych not now but if you have a prototype, or are willing to add a PR, I'll be more than happy to incorporate it in the package with your contributions of course

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: cokelaer <778821+cokelaer@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sos2ss implementation in Python Add sos2ss, sos2tf, and sos2zp to transfer module Mar 4, 2026
@cokelaer
cokelaer marked this pull request as ready for review March 4, 2026 22:18
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 97.017% (+0.01%) from 97.006%
when pulling 5eb290d on copilot/implement-sos2ss-function
into 080e5aa on master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 97.017% (+0.01%) from 97.006%
when pulling 5eb290d on copilot/implement-sos2ss-function
into 080e5aa on master.

@cokelaer
cokelaer merged commit bd02ad3 into master Mar 4, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sos2ss implementation

3 participants