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

Compute initial state when creating filter operators #13

Open
jdpigeon opened this issue Feb 23, 2018 · 2 comments
Open

Compute initial state when creating filter operators #13

jdpigeon opened this issue Feb 23, 2018 · 2 comments
Assignees

Comments

@jdpigeon
Copy link
Contributor

Currently, whenever data starts flowing through a pipe with a filter operator the outputs of the filter fluctuate wildly for a few seconds due to 'ringing' as the filter state adjusts to the signal.

In python projects such as muse-lsl, we've overcome this issue by computing an initial state for the filter before the signal is applied. This is easy to do in scipy with the lfilter_zi function, but does not appear to be implemented in fili.

Implementing this might require significant changes to our filtering code so we should probably wait on it until we've figured out how we're going to proceed with filtering, either sticking to fili or forking and developing our own library.

@jdpigeon jdpigeon self-assigned this Feb 23, 2018
@jdpigeon
Copy link
Contributor Author

Spent a bunch of time on this today and think I'm close to having it implemented.

It turns out that the initial state for all fili's filters are arrays of 0s. I'm trying to improve this by calculating more appropriate initial states, like we do in muse-lsl's lsl-viewer. I've ported scipy's lfilter_zi function to JS and will experiment with adding into eeg pipes soon.

@jdpigeon
Copy link
Contributor Author

I've made the changes to fili and am assessing how it impacts EEG artifacts. Oddly, I don't see any large filter artifacts with or without the precomputation when testing against Muse data. Maybe these filter artifacts only appear at high frequency sampling rates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant