当前位置: 首页>>代码示例>>Python>>正文


Python EEGsynth.online_filter方法代码示例

本文整理汇总了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
开发者ID:neuroidss,项目名称:eegsynth,代码行数:33,代码来源:sonification.py

示例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):
开发者ID:nicofarr,项目名称:eegsynth,代码行数:33,代码来源:preprocessing.py


注:本文中的EEGsynth.online_filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。