【发布时间】:2013-03-31 11:57:35
【问题描述】:
我有几个一维信号,显示两个或更多波段。一个例子如下所示。
我需要提取属于单个波段的数据点。
我的第一个简单方法是对数据进行移动平均,并获取数据大于平均值的索引。
def seperate(x):
average = scipy.ndimage.gaussian_filter(x, 10)
# this gives me a boolean array with the indices of the upper band.
idx = x > average
# return the indices of the upper and lower band
return idx, ~idx
绘制这些曲线和平均曲线将如下所示,其中红色表示上限,蓝色表示下限。
这在本示例中非常有效,但是当存在两个以上的波段和/或波段没有很好地分离时会失败。
我正在寻找更强大和更通用的解决方案。我正在研究 scikit-learn,想知道是否可以使用其中一种聚类算法来实现这一目标。
【问题讨论】:
标签: python cluster-analysis scikit-learn