我想通过将采样频率减半来进行下采样。我的信号由IObservable<Sample>
表示。因此,我必须跳过流中的每个第二个样本。我试过这样的。但是在Buffer(2)之后第二个select命令出错。
IntelliSense消息(在select命令上)是:“无法根据用法推断出方法[... SkipEverySecond ...]的类型参数。请尝试明确指定类型参数。”通过删除赋值“samples =&gt;”可以消除此错误。我不明白为什么......
/// <summary>
/// Called when a part's imports have been satisfied and it is safe to use
/// </summary>
public void OnImportsSatisfied()
{
signalFiltering.ConfigureFilters(filterParameter);
configManager.LoadAttributed(this, this);
//currentRdm.ForwardedDataSource is an imported Observable
//ToDo: Skip every second sample (downsampling)
this._forwardedDataSource = this.currentRdm.ForwardedDataSource.Select(
sample => signalFiltering.Filter(sample, filterParameter)).
Buffer(2).Select(samples => SkipEverySecond);
this._qrsComplexis = this._forwardedDataSource.Buffer(QRSWINDOWSIZE).Select(SamplePacketProcess);
}
private Sample SkipEverySecond(IEnumerable<Sample> samples )
{
return samples.First();
}
答案 0 :(得分:1)
您不需要lambda表达式samples =>
。 Select正在应用于Buffer的输出,如果我理解正确的话,IEnumerable<Sample>