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


Python signal.sosfilt方法代码示例

本文整理汇总了Python中scipy.signal.sosfilt方法的典型用法代码示例。如果您正苦于以下问题:Python signal.sosfilt方法的具体用法?Python signal.sosfilt怎么用?Python signal.sosfilt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.signal的用法示例。


在下文中一共展示了signal.sosfilt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: bandpass_filter

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def bandpass_filter(signal_in,f_band_nom): 


	'''	Filter N channels with fir filter of order 101

	Keyword arguments:
	signal_in -- numpy array of size [NO_channels, NO_samples]
	f_band_nom -- normalized frequency band [freq_start, freq_end]

	Return:	filtered signal 
	'''
	order = 4
	sos = butter(order, f_band_nom, analog=False, btype='band', output='sos')
	sig_filt = sosfilt(sos, signal_in)

	return sig_filt 
开发者ID:MultiScale-BCI,项目名称:IV-2a,代码行数:18,代码来源:filters.py

示例2: __butter_bandstop_filter

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def __butter_bandstop_filter(self, data, lowcut, highcut, fs, order=5):
        sos = self.__butter_bandstop(lowcut, highcut, fs, order=order)
        y = sosfilt(sos, data).astype(np.float32)
        return y 
开发者ID:iver56,项目名称:audiomentations,代码行数:6,代码来源:transforms.py

示例3: test_iir_filter

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def test_iir_filter(filtername):
    sos = FILTERS[filtername]
    assert len(sos.shape) == 2
    assert sos.shape[1] == 6, sos.shape

    t, noise = noisy_chirp(fs=FS, seconds=1.0)

    ref = signal.sosfilt(sos, noise)
    out = eml_signal.iirfilter(sos, noise)
    rel_err = numpy.abs((out-ref)/ref)

    assert ref.shape == out.shape, out.shape
    numpy.testing.assert_allclose(ref, out, atol=1e-4)
    assert numpy.median(rel_err) < 1e-4 
开发者ID:emlearn,项目名称:emlearn,代码行数:16,代码来源:test_filters.py

示例4: filter

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def filter(self,x):
        """
        Filter the signal using second-order sections
        """
        y = signal.sosfilt(self.sos,x)
        return y 
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:8,代码来源:multirate_helper.py

示例5: up

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def up(self,x,L_change = 12):
        """
        Upsample and filter the signal
        """
        y = L_change*ssd.upsample(x,L_change)
        y = signal.sosfilt(self.sos,y)
        return y 
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:9,代码来源:multirate_helper.py

示例6: dn

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def dn(self,x,M_change = 12):
        """
        Downsample and filter the signal
        """
        y = signal.sosfilt(self.sos,x)
        y = ssd.downsample(y,M_change)
        return y 
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:9,代码来源:multirate_helper.py

示例7: driving_signals_25d

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def driving_signals_25d(delay, weight, sos, phaseshift, signal):
    """Get 2.5-dimensional NFC-HOA driving signals.

    Parameters
    ----------
    delay : float
        Overall delay in seconds.
    weight : float
        Overall weight.
    sos : list of array_like
        Second-order section filters :func:`scipy.signal.sosfilt`.
    phaseshift : (N,) array_like
        Phase shift in radians.
    signal : (L,) array_like + float
        Excitation signal consisting of (mono) audio data and a sampling
        rate (in Hertz).  A `DelayedSignal` object can also be used.

    Returns
    -------
    `DelayedSignal`
        A tuple containing the delayed signals (in a `numpy.ndarray`
        with shape ``(L, N)``), followed by the sampling rate (in Hertz)
        and a (possibly negative) time offset (in seconds).

    """
    data, fs, t_offset = _util.as_delayed_signal(signal)
    N = len(phaseshift)
    out = _np.tile(_np.expand_dims(_sig.sosfilt(sos[0], data), 1), (1, N))
    for m in range(1, len(sos)):
        modal_response = _sig.sosfilt(sos[m], data)[:, _np.newaxis]
        out += modal_response * _np.cos(m * phaseshift)
    return _util.DelayedSignal(2 * weight * out, fs, t_offset + delay) 
开发者ID:sfstoolbox,项目名称:sfs-python,代码行数:34,代码来源:nfchoa.py

示例8: driving_signals_3d

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def driving_signals_3d(delay, weight, sos, phaseshift, signal):
    """Get 3-dimensional NFC-HOA driving signals.

    Parameters
    ----------
    delay : float
        Overall delay in seconds.
    weight : float
        Overall weight.
    sos : list of array_like
        Second-order section filters :func:`scipy.signal.sosfilt`.
    phaseshift : (N,) array_like
        Phase shift in radians.
    signal : (L,) array_like + float
        Excitation signal consisting of (mono) audio data and a sampling
        rate (in Hertz).  A `DelayedSignal` object can also be used.

    Returns
    -------
    `DelayedSignal`
        A tuple containing the delayed signals (in a `numpy.ndarray`
        with shape ``(L, N)``), followed by the sampling rate (in Hertz)
        and a (possibly negative) time offset (in seconds).

    """
    data, fs, t_offset = _util.as_delayed_signal(signal)
    N = len(phaseshift)
    out = _np.tile(_np.expand_dims(_sig.sosfilt(sos[0], data), 1), (1, N))
    for m in range(1, len(sos)):
        modal_response = _sig.sosfilt(sos[m], data)[:, _np.newaxis]
        out += (2 * m + 1) * modal_response * _legendre(m, _np.cos(phaseshift))
    return _util.DelayedSignal(weight / 4 / _np.pi * out, fs, t_offset + delay) 
开发者ID:sfstoolbox,项目名称:sfs-python,代码行数:34,代码来源:nfchoa.py

示例9: butter_fir_filter

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def butter_fir_filter(signal_in,filter_coeff):

	if filter_coeff.ndim == 2: # butter worth 
		return sosfilt(filter_coeff, signal_in)
	elif filter_coeff.ndim ==1: # fir filter 
		
		NO_channels ,NO_samples = signal_in.shape 
		sig_filt = np.zeros((NO_channels ,NO_samples))

		for channel in range(0,NO_channels):
			sig_filt[channel] = signal.convolve(signal_in[channel,:],filter_coeff,mode='same') # signal has same size as signal_in (centered)
		
		return sig_filt 
开发者ID:MultiScale-BCI,项目名称:IV-2a,代码行数:15,代码来源:filters.py

示例10: butter_bandpass_filter

# 需要导入模块: from scipy import signal [as 别名]
# 或者: from scipy.signal import sosfilt [as 别名]
def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
        sos = butter_bandpass(lowcut, highcut, fs, order=order)
        y = sosfilt(sos, data)
        return y 
开发者ID:MultiScale-BCI,项目名称:IV-2a,代码行数:6,代码来源:filters.py


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