After looking at such a plot, I'm asked if my smoothing is causal.
Once, during pre-processing, I smooth my raw data using this function:
def _smooth(x, data_freq):
LpFilt_cutoffFreq = 4
LpFilt_order = 4
lowpass_filter = scipy.signal.butter(
LpFilt_order,
LpFilt_cutoffFreq,
fs=data_freq,
output="sos",
)
result = scipy.signal.sosfiltfilt(lowpass_filter, x)
return result
and one last time, during my analysis, I smooth the plot like this:
signal_avg_conv = np.convolve(signal_avg, np.ones(smoothbin) / smoothbin, 'same')
How can I know if my smoothing is causal?