fili.js
fili.js copied to clipboard
Function to compute initial state for newly-created filter
One thing that's nice about working with scipy's linear filters is that you can compute the initial state of a filter with lfilter_zi before you pass any signal through. This eliminates ringing in many cases.
However, this functionality doesn't appear to be available in fili. I am curious what the feasibility of adding this would be?
I'm working on this right now here: https://github.com/jdpigeon/fili.js/commit/6ff33ed68d7239eec816daff870828e8e22d24d6
Any explanation for this functionality? How to use function? Thanks.
Unfortunately, its been a while since Ive worked on this project, so I'm not entirely sure how the code I wrote integrated with fili. However, I do remember that computing the initial filter state wasn't as effective as I'd hope at reducing ringing at the beginning of the data stream in the app I was building.
I wouldn't recommend bothering going further with this idea unless you know what you're doing when ti comes to linear filter designs, but if you're interested, the computeInitialState
function I wrote is functionally equivalent to this function from scipy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.lfilter_zi.html
At the moment there is no way to set the initial state of the filter other than 0. I could however integrate an interface that lets you do that. You can then use whatever calculation method you like to set the initial state.