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

Zero-phase digital filtering #54

Closed
rob-luke opened this issue Jul 2, 2014 · 10 comments
Closed

Zero-phase digital filtering #54

rob-luke opened this issue Jul 2, 2014 · 10 comments

Comments

@rob-luke
Copy link
Member

rob-luke commented Jul 2, 2014

Is there any interest in an equivalent matlab filtfilt function?
Or is this a bit high level and people can implement their own?

@simonster
Copy link
Member

Yes, this would be nice to have.

@mbauman
Copy link

mbauman commented Jul 3, 2014

I would love this as well. I've started looking into this. One thing that would be helpful here is an in-place definition of filt!: JuliaLang/julia#7513

@rob-luke
Copy link
Member Author

rob-luke commented Jul 4, 2014

@mbauman So you are giving this a shot or I should put time in to it?

@mbauman
Copy link

mbauman commented Jul 4, 2014

I won't have a chance to get back to this for a few days, so don't let me get in your way! Upon further consideration, I reverted part of my changes to filt in 7513. But it'll still be important to use here. You're welcome to grab it and run. filt! will be very nice for performance on long vectors since we're doing it twice, but it's not essential. The trickier part is setting initial conditions, which won't be possible until 7513 goes through (or we move filt to DSP.jl).

@rob-luke
Copy link
Member Author

rob-luke commented Jul 6, 2014

Is it ok to port across the scipy implementation of the initial condition matching?
Or is that under a license we can't use (I assumed the matlab implementation was off bounds)?
I have no experience with open source software before this, so Ive no idea how this works?

@mbauman
Copy link

mbauman commented Jul 7, 2014

Yup, it's not a problem at all. DSP.jl is distributed under an MIT license, which is compatible with SciPy's 3-clause BSD license. On the top of many of the files is the SciPy license as much of DSP.jl is already derived from it.

@rob-luke
Copy link
Member Author

rob-luke commented Jul 7, 2014

@mbauman Thanks for the response.
Your filt function with initial conditions will be good to use.

How do I import this in to my copy of julia?
I tried overwriting the /Applications/Julia/Contents/Resources/julia/share/julia/base/dsp.jl and export.jl but it is not recognised in the julia prompt after restarting.

@rob-luke
Copy link
Member Author

rob-luke commented Jul 7, 2014

And you implemented calculation of the initial state!
Seems you had this under control already :)

@mbauman
Copy link

mbauman commented Jul 7, 2014

In order to use that pull request as written, you would have to recompile Julia. It's much simpler to copy the definitions and paste them into your REPL/IJulia/editor/whatever-your-workflow-is. In this case I think it should work just fine (I don't think there are any non-exported dependencies) but sometimes you'll need to explicitly import Base: private_fcn in order to get snippets to work this way. Or to make it play nicely with existing multi-dispatch methods, you need to import Base: DSP.filt itself so you overwrite the existing definitions instead of shadowing them. But again, in this case, it shouldn't matter.

I had also been playing with Gustafsson's method for matching the beginning and ending initial conditions, but it doesn't seem to work the way I had imagined. I'm not sure what the applications in which having the same conditions for both directions is important, but I don't think it applies in my case, so I won't be pursuing it further.

@rob-luke
Copy link
Member Author

rob-luke commented Jul 7, 2014

Thanks for your help @mbauman
I have submitted a pull request with an initial implementation that includes your code.
I hope this is ok, if not please just say.

@rob-luke rob-luke closed this as completed Jul 7, 2014
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

No branches or pull requests

3 participants