-
Notifications
You must be signed in to change notification settings - Fork 112
Zero phase digital filtering #58
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
Conversation
Code coverage decreases on coveralls because I only do a cursory test of the |
Currently the test fails
Thanks! This is great. It's awesome to see that we match Matlab here… and good on you for digging through my dirty trash to pull out the I just updated my PR over at Julia to improve the performance of filt. Even when that gets merged, though, I suppose we'll need an implementation here to allow folks with older versions of Julia to use DSP.jl. I can also help you make sure you hit all the code paths in the testing — the biggest one that's missing could be solved with a filter that has a scalar |
|
||
x = [vec(2*x[1] - x[pad_length+1:-1:2]) , x, vec(2 * x[end] - x[end-1:-1:end-pad_length])] | ||
|
||
x = flipud(filt!(b, a, x, zi*x[1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverse!
should be better here since it doesn't need to allocate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only managed to get this to work for the 1d case.
This may be microoptimizing, but is it possible that we could do this without having to make two copies of |
Thank you both for the feedback. @mbauman I will change the @simonster Thanks for the comments. I will make the changes you suggested. Do we want this to work on non vector data? Perhaps columns of matrices? |
Yes, I think that'd be nice to allow. It's a pretty simple modification to the base It makes the initial states a bit trickier, but Julia has a nice advantage over SciPy in its array shapes - |
Alright, I'm done futzing with the base implementation of
|
A few more thoughts on this:
|
I think it's safe to drop support for 0.2. I also agree about designing SOS filters directly instead of converting back and forth. |
Sorry for the commit noise. Should I develop this elsewhere then commit once its ready? I will drop support for 0.2 |
This only fails on the release not on the nightlies. Because of the lack of I think I have taken everyone's suggestion in to account. Have I missed anything? |
I merged this code with some tweaks to reduce the number of temporaries it needs to allocate down to the bare minimum (at least until we have a way to preserve the state vector when filtering). I'll work on SOS |
This is wonderful to have. Thanks @codles and @simonster! |
filtfilt
function and associated tests are included.This code is merely a wrapper for the work done by @mbauman