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


Python pywt.wavelist方法代码示例

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


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

示例1: __init__

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def __init__(self,
                 wavelet: str = 'db8') -> None:
        """
        Parameters
        ----------
        wavelet : str
            Wavelet.

        Returns
        -------
        NoneType
            None
        """

        # create list of supported wavelets
        supported = []
        for family in pywt.families():
            supported += pywt.wavelist(family)

        # check if wavelet is supported
        if wavelet not in supported:
            raise ValueError(f'DWT supports only {supported} as input wavelet.')

        self.m_wavelet = wavelet 
开发者ID:PynPoint,项目名称:PynPoint,代码行数:26,代码来源:timedenoising.py

示例2: _wavelet_coefs

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def _wavelet_coefs(data, wavelet_name='db4'):
    """Compute Discrete Wavelet Transform coefficients.

    Parameters
    ----------
    data : ndarray, shape (n_channels, n_times)

    wavelet_name : str (default: db4)
         Wavelet name (to be used with ``pywt.Wavelet``). The full list of
         Wavelet names are given by: ``[name for family in pywt.families() for
         name in pywt.wavelist(family)]``.

    Returns
    -------
    coefs : list of ndarray
         Coefficients of a DWT (Discrete Wavelet Transform). ``coefs[0]`` is
         the array of approximation coefficient and ``coefs[1:]`` is the list
         of detail coefficients.
    """
    wavelet = pywt.Wavelet(wavelet_name)
    levdec = min(pywt.dwt_max_level(data.shape[-1], wavelet.dec_len), 6)
    coefs = pywt.wavedec(data, wavelet=wavelet, level=levdec)
    return coefs 
开发者ID:mne-tools,项目名称:mne-features,代码行数:25,代码来源:utils.py

示例3: test_wavedecn_coeff_reshape_even

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_wavedecn_coeff_reshape_even():
    # verify round trip is correct:
    #   wavedecn - >coeffs_to_array-> array_to_coeffs -> waverecn
    # This is done for wavedec{1, 2, n}
    rng = np.random.RandomState(1234)
    params = {'wavedec': {'d': 1, 'dec': pywt.wavedec, 'rec': pywt.waverec},
              'wavedec2': {'d': 2, 'dec': pywt.wavedec2, 'rec': pywt.waverec2},
              'wavedecn': {'d': 3, 'dec': pywt.wavedecn, 'rec': pywt.waverecn}}
    N = 28
    for f in params:
        x1 = rng.randn(*([N] * params[f]['d']))
        for mode in pywt.Modes.modes:
            for wave in wavelist:
                w = pywt.Wavelet(wave)
                maxlevel = pywt.dwt_max_level(np.min(x1.shape), w.dec_len)
                if maxlevel == 0:
                    continue

                coeffs = params[f]['dec'](x1, w, mode=mode)
                coeff_arr, coeff_slices = pywt.coeffs_to_array(coeffs)
                coeffs2 = pywt.array_to_coeffs(coeff_arr, coeff_slices,
                                               output_format=f)
                x1r = params[f]['rec'](coeffs2, w, mode=mode)

                assert_allclose(x1, x1r, rtol=1e-4, atol=1e-4) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:27,代码来源:test_multilevel.py

示例4: test_perfect_reconstruction

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_perfect_reconstruction():
    families = ('db', 'sym', 'coif', 'bior', 'rbio')
    wavelets = sum([pywt.wavelist(name) for name in families], [])
    # list of mode names in pywt and matlab
    modes = [('zero', 'zpd'),
             ('constant', 'sp0'),
             ('symmetric', 'sym'),
             ('periodic', 'ppd'),
             ('smooth', 'sp1'),
             ('periodization', 'per')]

    dtypes = (np.float32, np.float64)

    for wavelet in wavelets:
        for pmode, mmode in modes:
            for dt in dtypes:
                yield check_reconstruction, pmode, mmode, wavelet, dt 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:19,代码来源:test_perfect_reconstruction.py

示例5: _checkwavelet

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def _checkwavelet(wavelet):
    """Check that wavelet belongs to pywt.wavelist
    """
    wavelist = pywt.wavelist(kind='discrete')
    if wavelet not in wavelist:
        raise ValueError("'%s' not in family set = %s" % (wavelet,
                                                          wavelist)) 
开发者ID:equinor,项目名称:pylops,代码行数:9,代码来源:DWT.py

示例6: test_wavelet_coefficients

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_wavelet_coefficients():
    families = ('db', 'sym', 'coif', 'bior', 'rbio')
    wavelets = sum([pywt.wavelist(name) for name in families], [])
    for wavelet in wavelets:
        if (pywt.Wavelet(wavelet).orthogonal):
            yield check_coefficients_orthogonal, wavelet
        elif(pywt.Wavelet(wavelet).biorthogonal):
            yield check_coefficients_biorthogonal, wavelet
        else:
            yield check_coefficients, wavelet 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:12,代码来源:test_wavelet.py

示例7: test_waverec_all_wavelets_modes

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_waverec_all_wavelets_modes():
    # test 2D case using all wavelets and modes
    rstate = np.random.RandomState(1234)
    r = rstate.randn(80)
    for wavelet in wavelist:
        for mode in pywt.Modes.modes:
            coeffs = pywt.wavedec(r, wavelet, mode=mode)
            assert_allclose(pywt.waverec(coeffs, wavelet, mode=mode),
                            r, rtol=tol_single, atol=tol_single)

####
# 2d multilevel dwt function tests
#### 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:15,代码来源:test_multilevel.py

示例8: test_waverec2_all_wavelets_modes

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_waverec2_all_wavelets_modes():
    # test 2D case using all wavelets and modes
    rstate = np.random.RandomState(1234)
    r = rstate.randn(80, 96)
    for wavelet in wavelist:
        for mode in pywt.Modes.modes:
            coeffs = pywt.wavedec2(r, wavelet, mode=mode)
            assert_allclose(pywt.waverec2(coeffs, wavelet, mode=mode),
                            r, rtol=tol_single, atol=tol_single) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:11,代码来源:test_multilevel.py

示例9: test_waverecn_all_wavelets_modes

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_waverecn_all_wavelets_modes():
    # test 2D case using all wavelets and modes
    rstate = np.random.RandomState(1234)
    r = rstate.randn(80, 96)
    for wavelet in wavelist:
        for mode in pywt.Modes.modes:
            coeffs = pywt.wavedecn(r, wavelet, mode=mode)
            assert_allclose(pywt.waverecn(coeffs, wavelet, mode=mode),
                            r, rtol=tol_single, atol=tol_single) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:11,代码来源:test_multilevel.py

示例10: test_swt2_iswt2_integration

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_swt2_iswt2_integration():
    # This function performs a round-trip swt2/iswt2 transform test on
    # all available types of wavelets in PyWavelets - except the
    # 'dmey' wavelet. The latter has been excluded because it does not
    # produce very precise results. This is likely due to the fact
    # that the 'dmey' wavelet is a discrete approximation of a
    # continuous wavelet. All wavelets are tested up to 3 levels. The
    # test validates neither swt2 or iswt2 as such, but it does ensure
    # that they are each other's inverse.

    max_level = 3
    wavelets = pywt.wavelist()
    if 'dmey' in wavelets:
        # The 'dmey' wavelet seems to be a bit special - disregard it for now
        wavelets.remove('dmey')
    for current_wavelet_str in wavelets:
        current_wavelet = pywt.DiscreteContinuousWavelet(current_wavelet_str)
        if isinstance(current_wavelet, pywt.Wavelet):
            input_length_power = int(np.ceil(np.log2(max(
                current_wavelet.dec_len,
                current_wavelet.rec_len))))
            input_length = 2**(input_length_power + max_level - 1)
            X = np.arange(input_length**2).reshape(input_length, input_length)

            with warnings.catch_warnings():
                warnings.simplefilter('ignore', FutureWarning)
                coeffs = pywt.swt2(X, current_wavelet, max_level)
                Y = pywt.iswt2(coeffs, current_wavelet)
            assert_allclose(Y, X, rtol=1e-5, atol=1e-5) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:31,代码来源:test_swt.py

示例11: test_compare_downcoef_coeffs

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_compare_downcoef_coeffs():
    rstate = np.random.RandomState(1234)
    r = rstate.randn(16)
    # compare downcoef against wavedec outputs
    for nlevels in [1, 2, 3]:
        for wavelet in pywt.wavelist():
            wavelet = pywt.DiscreteContinuousWavelet(wavelet)
            if isinstance(wavelet, pywt.Wavelet):
                max_level = pywt.dwt_max_level(r.size, wavelet.dec_len)
                if nlevels <= max_level:
                    a = pywt.downcoef('a', r, wavelet, level=nlevels)
                    d = pywt.downcoef('d', r, wavelet, level=nlevels)
                    coeffs = pywt.wavedec(r, wavelet, level=nlevels)
                    assert_allclose(a, coeffs[0])
                    assert_allclose(d, coeffs[1]) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:17,代码来源:test__pywt.py

示例12: test_wavelist

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_wavelist():
    for name in pywt.wavelist(family='coif'):
        assert_(name.startswith('coif'))

    assert_('cgau7' in pywt.wavelist(kind='continuous'))
    assert_('sym20' in pywt.wavelist(kind='discrete'))
    assert_(len(pywt.wavelist(kind='continuous')) +
            len(pywt.wavelist(kind='discrete')) ==
            len(pywt.wavelist(kind='all')))

    assert_raises(ValueError, pywt.wavelist, kind='foobar') 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:13,代码来源:test__pywt.py

示例13: test_dwdtn_idwtn_allwavelets

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def test_dwdtn_idwtn_allwavelets():
    rstate = np.random.RandomState(1234)
    r = rstate.randn(16, 16)
    # test 2D case only for all wavelet types
    wavelist = pywt.wavelist()
    if 'dmey' in wavelist:
        wavelist.remove('dmey')
    for wavelet in wavelist:
        if isinstance(pywt.DiscreteContinuousWavelet(wavelet), pywt.Wavelet):
            for mode in pywt.Modes.modes:
                coeffs = pywt.dwtn(r, wavelet, mode=mode)
                assert_allclose(pywt.idwtn(coeffs, wavelet, mode=mode),
                                r, rtol=1e-7, atol=1e-7) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:15,代码来源:test_multidim.py

示例14: available_first_stage_filters

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def available_first_stage_filters():
    """
    Iterable of available wavelet filters compatible with the 
    first stage of dual-tree complex wavelent transform.

    Returns
    -------
    wavelets : iterable
        List of sorted string names. The wavelet numerical values can be 
        retrieved from the :func:`dt_first_stage` function.
    """
    return sorted(filter(lambda name: name != "dmey", wavelist(kind="discrete")))


# For backwards compatibility with iris 
开发者ID:LaurentRDC,项目名称:scikit-ued,代码行数:17,代码来源:dtcwt.py

示例15: get_wavlist

# 需要导入模块: import pywt [as 别名]
# 或者: from pywt import wavelist [as 别名]
def get_wavlist():
    """Returns the list of continuous wavelet functions available in the
    PyWavelets library.
    """
    l = []
    for name in pywt.wavelist(kind='continuous'):
        # supress warnings when the wavelet name is missing parameters
        completion = {
            'cmor': 'cmor1.5-1.0',
            'fbsp': 'fbsp1-1.5-1.0',
            'shan': 'shan1.5-1.0' }
        if name in completion:
            name =  completion[name]# supress warning
        l.append( name+" :\t"+pywt.ContinuousWavelet(name).family_name )
    return l 
开发者ID:alsauve,项目名称:scaleogram,代码行数:17,代码来源:wfun.py


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