I have a signal, shown in the attachment (blue one). As you can see that the latter part of my signal has a higher dc offset. I want to bring the signal into the same level. I have tried eliminate the low frequency signal by using FFT (I FFT the signal, then set the low frequency element to be 0, then returned it by IFFT), but the result that I get is shown in red color. I am open to any suggestion and any python code is very appreciated.

Additional info: sampling frequency = 100 Hz Low cutoff frequency = 0.05 Hz Raw Signal

Filtered Signal

  • $\begingroup$ What do you need to extract from your signal? Maybe it can be extracted without aligning the pulses. Also avoid filtering by zeroing FFT bins, it creates unwanted artifacts. You will get a better results with a filter (scipy.signal.lfilter function) $\endgroup$ – Pier-Yves Lessard Aug 30 '19 at 14:08
  • $\begingroup$ A simple high pass filter should do the trick $\endgroup$ – Hilmar Aug 30 '19 at 14:09
  • 1
    $\begingroup$ Filtering by zeroing the FFT is almost always a bad idea. As Hilmar said, use a proper high-pass filter. $\endgroup$ – Marcus Müller Aug 30 '19 at 14:42

First part for an answer. There are several unknowns in you question. The fist is of course:

  • why do you really want to bring the signal to the same level?

and the second:

  • what is this "same level"?

Assuming that the baseline is the lower levels, do those simulated signals approximately match your expectations?

Simulated signals


Not the answer you're looking for? Browse other questions tagged or ask your own question.