0

it is my first question in stack.

For EEG filters I try to use lfilter from spicy by the next function:

def butter_lowpass_filter(data):    
    b, a = butter(3, 0.05)
    y = lfilter(b, a, data)
    return y

but every time when calling function and send data by NumPy massive to the function, I receive the result that starts from zero. Why Butterworth filter every time from 0, I need measure in real-time.

Here, already trying to decide this problem, but without result. How to filter/smooth with SciPy/Numpy?

it is not good for me, because i every time receive the next picture enter image description here

Osadhi Virochana
  • 1,294
  • 2
  • 11
  • 21
dfsdf
  • 37
  • 9

1 Answers1

1

This behavior is fine. However, it would create a spike in the beginning of your data. To avoid this you should subtract the first value (or the mean of the first N values) of your EEG so the data itself will also start at zero, or close to zero. The process can be referred to as baseline correction or, in some cases when you remove a straight line from start to finish, as detrending. Note that filtering EEG is a whole science, you may want to look at packages designed for that, such as MNE python (here is their summary on filters)

Yuval Harpaz
  • 1,416
  • 1
  • 12
  • 16