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

enable method='gust' for sosfiltfilt #11205

Open
mike-lawrence opened this issue Dec 11, 2019 · 3 comments
Open

enable method='gust' for sosfiltfilt #11205

mike-lawrence opened this issue Dec 11, 2019 · 3 comments
Labels
enhancement A new feature or improvement scipy.signal

Comments

@mike-lawrence
Copy link

Hopefully a pretty straightforward FR: at present scipy.signal.filtfilt() has a method argument by which one can choose the gust method of padding, but scipy.signal.sosfiltfilt() doesn't, meaning one has to choose between an implementation of filtfilt that has the gust method but is numerically unstable for higher order filter designs, or a numerically stable filter with no gust method.

@larsoner
Copy link
Member

In principle this does sound like a useful addition. I am not familiar with the gust method (only seen that it exists in the code) but if someone can take a look at some point and see if it's doable, that would be great. @mike-lawrence if you have already looked at the code and/or know the method well enough to know it's doable (and have time to work on it), feel free to give it a shot!

@larsoner larsoner added enhancement A new feature or improvement scipy.signal labels Dec 12, 2019
@rkube
Copy link

rkube commented Jan 27, 2021

This addition would be useful for me too.

@CrepeGoat
Copy link

I'm also interested in this addition; atm I'm making do with a loop like the one below, but it feels a little hacky (a formal version would also almost certainly be faster):

sos_coeffs = scipy.signal.butter(..., output=sos)
for b, a in zip(*np.split(sos_coeffs, [3], axis=-1)):
    array = scipy.signal.filtfilt(b, a, array, axis=-1, method="gust")
return array

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

No branches or pull requests

4 participants