本文整理汇总了Python中EEGsynth.online_filter方法的典型用法代码示例。如果您正苦于以下问题:Python EEGsynth.online_filter方法的具体用法?Python EEGsynth.online_filter怎么用?Python EEGsynth.online_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EEGsynth
的用法示例。
在下文中一共展示了EEGsynth.online_filter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: float
# 需要导入模块: import EEGsynth [as 别名]
# 或者: from EEGsynth import online_filter [as 别名]
dat_input = ft_input.getData([begsample, endsample])
dat_output = np.zeros((nOutput,hdr_output.nChannels))
# construct a time vector for input and output
begtime = float(begsample ) / hdr_input.fSample
endtime = float(endsample+1) / hdr_input.fSample
tim_input = np.linspace(begtime, endtime, nInput, endpoint=False)
tim_output = np.linspace(begtime, endtime, nOutput, endpoint=False)
for chan, i in zip(left, range(len(left))):
# interpolate each channel onto the output sampling rate
vec_output = np.interp(tim_output, tim_input, dat_input[:, chan-1])
# multiply with the modulating signal
vec_output *= np.cos(tim_output * left_f[i] * 2 * np.pi)
# apply the filter to remove one sideband
vec_output, left_zi[i] = EEGsynth.online_filter(left_b[i], left_a[i], vec_output, zi=left_zi[i])
# add it to the output
dat_output[:,0] += vec_output
for chan, i in zip(right, range(len(right))):
# interpolate each channel onto the output sampling rate
vec_output = np.interp(tim_output, tim_input, dat_input[:, chan-1])
# multiply with the modulating signal
vec_output *= np.cos(tim_output * right_f[i] * 2 * np.pi)
# apply the filter to remove one sideband
vec_output, right_zi[i] = EEGsynth.online_filter(right_b[i], right_a[i], vec_output, zi=right_zi[i])
# add it to the output
dat_output[:,1] += vec_output
# normalize for the number of channels
dat_output /= hdr_input.nChannels
示例2: show_change
# 需要导入模块: import EEGsynth [as 别名]
# 或者: from EEGsynth import online_filter [as 别名]
if highpassfilter != None:
highpassfilter = EEGsynth.rescale(highpassfilter, slope=scale_highpass, offset=offset_highpass)
lowpassfilter = patch.getfloat('processing', 'lowpassfilter', default=None)
if lowpassfilter != None:
lowpassfilter = EEGsynth.rescale(lowpassfilter, slope=scale_lowpass, offset=offset_lowpass)
change = False
change = show_change('highpassfilter', highpassfilter) or change
change = show_change('lowpassfilter', lowpassfilter) or change
if change:
# update the filter parameters
b, a, zi = EEGsynth.initialize_online_filter(hdr_input.fSample, highpassfilter, lowpassfilter, filterorder, dat_output, axis=0)
if not(highpassfilter is None) or not(lowpassfilter is None):
# apply the filter to the data
dat_output, zi = EEGsynth.online_filter(b, a, dat_output, axis=0, zi=zi)
if debug>1:
print("filtered ", window, "samples in", (time.time()-start)*1000, "ms")
# Downsampling
if not(downsample is None):
dat_output = decimate(dat_output, downsample, ftype='iir', axis=0, zero_phase=True)
window_new = int(window / downsample)
if debug>1:
print("downsampled ", window, "samples in", (time.time()-start)*1000, "ms")
else:
window_new = window
# Smoothing
if not(smoothing is None):
for t in range(window):