简体   繁体   English

选择*最佳*带宽进行小波变换

[英]Choose the *best* bandwidth for wavelet transformation

Transformed a 1-D continuous signal data and generated a range of transformations for the given bandwidth/scale. 转换一维连续信号数据,并生成给定带宽/比例的一系列转换。 Now how to pick the best bandwidth or scale in the given range automatically? 现在如何自动选择最佳带宽或在给定范围内进行缩放?

Example: in the chart, the dark blue line is the original 1D continuous signal data. 示例:在图表中,深蓝色线是原始的一维连续信号数据。 Every other curve is a transformation of that data for a range of bandwidths [10, 20, 30, 40, 50]. 每隔一条曲线是针对一定带宽范围[10、20、30、40、50]的数据转换。 For this example, how to automatically pick the bandwidth which captures the variation in the curve best ? 对于此示例,如何自动选择最能捕获曲线变化的带宽

Note: answers can be Python specific or very general about how to calculate the "best" bandwidth. 注意:答案可以是Python特定的,也可以是关于如何计算“最佳”带宽的通用方法。

import numpy 
import matplotlib.pyplot as plt
from scipy.signal import ricker, cwt

data         #numpy.ndarray
# data = ([11,  8,  8,  2,  2,  4,  4,  4,  4,  3,  3,  5,  5,  9, 12, 17, 19, 19, 20, 19, 19, 14, 12, 11,  9,  6,  4,  3,  3,  2,  2,  6,  9, 12, 16, 17, 19, 20, 20, 19, 17, 15, 13,  9,  7,  6,  5,  3,  2,  4], dtype=int64)
bandwidths = np.arange(10, 60, 10)
cwt_data = cwt(data, ricker, bandwidths)   #transforms the data
plt.plot(cwt_speed.T, label='Transformed data')
plt.plot(speed, label='original data', linewidth=2)
plt.legend()

在此处输入图片说明

For this type of problem you can you use Welch's method scipy.signal.welch to identify expected power of your wave carried by a given frequency. 对于此类问题,您可以使用Welch的scipy.signal.welch方法来确定给定频率携带的电波的预期功率。

在此处输入图片说明

The simple explanation for this method is that it bandpasses overlapping frequency ranges at several time duration and through successive averaging determines the signal-to-noise ratio represented at each frequency. 此方法的简单解释是,它在几个时间段内使重叠的频率范围带通,并通过连续平均确定每个频率下表示的信噪比。

There a couple ways to use this analysis to select your band-pass for convolution. 有两种方法可以使用此分析选择卷积带通。

I would recommend you look at the PSD and identify local maxima in the frequency spectra where the power deviates from the 1/f curve. 我建议您查看PSD,并在频谱中找出功率偏离1 / f曲线的局部最大值。 The lower frequency ranges will usually be a better statistical fit (unless your signal carries an explicit encoded oscillatory signal), so the selecting the overall maximum would be affected by that. 较低的频率范围通常会更好地进行统计拟合(除非您的信号带有显式编码的振荡信号),因此选择整体最大值会受到该影响。

For unencoded signals (neural data, historical trends, observed data, etc.), which it looks like you are working with, we are typically more concerned with where the 'bumps' on the curve occur, because those indicate at which frequency oscillatory drivers carry part of the signal. 对于看起来像您正在使用的未编码信号(神经数据,历史趋势,观察到的数据等),我们通常更关注曲线上“凸点”的发生位置,因为这些信号指示振荡驱动器在哪个频率上携带部分信号。 That way we can represent significant information instead of best fit due to randomness. 这样,由于随机性,我们可以表示重要信息,而不是最佳拟合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM