从时间序列数据中删除电气工件

时间:2019-10-05 15:24:54

标签: time-series noise artifact

我正在尝试使用jupyter实验室使用时间序列数据(熊猫和scipy)检测峰,峰突出和峰宽。我的数据中存在电噪声,这会影响我的峰检测和突出值。 我如何(向下)消除/过滤这些噪声,以便获得具有干净峰值的输出,从而使峰值检测没有错误?

附上的图是显示检测到的峰(红点),突出(绿线),宽度(灰线)的图。

import pandas as pd
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import bokeh.plotting as bp
from scipy import signal
from scipy.signal import find_peaks, peak_prominences,peak_widths
from bokeh.io import output_notebook, show
output_notebook()

df = pd.read_csv(home_dir +"/concatenated_file/concat_csv.csv")
time = df.loc[:,"Time(s)"]   
ch465 = df.loc[:,"AIn-1 - Dem (AOut-2)"] #signal, 465
ch405 = fd.loc[:,"AIn-1 - Dem (AOut-1)"] #background, 405
ca= (ch465-ch405/ch405)
peaks, _ = 
find_peaks(ca,height=None,threshold=None,distance=10000,prominence= 
(0.05,0.2),width=None,wlen=500,rel_height=0.5,plateau_size=None)
prominences = peak_prominences(ca, peaks)[0]
contour_heights = ca[peaks] - prominences
peak_half_width = peak_widths(ca, peaks, rel_height=0.5)
y1=(peak_half_width[1])
w1=(peak_half_width[2]/121.9)
w2=(peak_half_width[3]/121.9)

pa1 = figure( plot_height=350, plot_width=700) 
pa1.line( time, ca, line_width=1)
pa1.circle(time[peaks], ca[peaks], color="red", size=8,)
pa1.segment(time[peaks], contour_heights, time[peaks], ca[peaks], 
color="green", line_width=0.5) #vertical line depecting prominences
pa1.segment(w1,y1,w2,y1, color="grey", line_width=0.5) #horizontal line 
depecting peak width
pa1.xgrid.visible = False
pa1.yaxis.axis_label = "DeltaF/F"
pa1.xaxis.axis_label = "time(sec)"
show (pa1)

example is in the link below-

noise and peak entire trace

0 个答案:

没有答案