Detrend or Filter a sawtooth signal (Python)
<p>I was trying to remove the trend (sawtooth) of a signal by using a filfilt filter without good results. Here the <a href="https://www.dropbox.com/sh/ckrh6hisfrbpcbi/AABwXcaoTQKqOeWZsRb92BSVa?dl=0" rel="nofollow noreferrer">data</a></p>

<pre><code>core_3 = pd.read_csv(filename_3, sep=";",header=0,index_col = 0,
                     parse_dates=True, names='date','temp'], infer_datetime_format=True, dayfirst=True)

core_7 = pd.read_csv(filename_7 ,sep=";",header=0,index_col = 0,
                    parse_dates=True, names=['date','temp'], infer_datetime_format=True,dayfirst=True)
</code></pre>

<p>When I applied a Butterworth filter</p>

<pre><code>b3, a3 = sg.butter(1, 0.045)
y3     = sg.filtfilt(b3, a3, core_3.temp)
b7, a7 = sg.butter(1, 0.030)
y7     = sg.filtfilt(b7, a7, core_7.temp)
</code></pre>

<p>The result is
<a href="https://i.stack.imgur.com/6Y9T1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Y9T1.png" alt="enter image description here"></a></p>

<p>As you can see for 3 THz signal there is a sawtoohth-trend. At 21:45 the signal have a perturbation (I wanna study that perturbation). That perturbation is clearly observed at 7 THz. At 3 THz is was observed a interruption of the sawtooth. So, I need to detrend or filter this signal. I tried using a <code>filtfilt</code> filter, but I dont know if is more convenient to use <code>scipy.detrend</code>.</p>