本文整理汇总了C#中InputData.SplitData方法的典型用法代码示例。如果您正苦于以下问题:C# InputData.SplitData方法的具体用法?C# InputData.SplitData怎么用?C# InputData.SplitData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputData
的用法示例。
在下文中一共展示了InputData.SplitData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InputDataSplitDataReturnsEntireDataForOverDuration
public void InputDataSplitDataReturnsEntireDataForOverDuration()
{
IDictionary<string, object> config = new Dictionary<string, object>();
var srate = new Measurement(1000, "Hz");
IInputData inData = new InputData(this.Data, srate, DateTimeOffset.Now).DataWithStreamConfiguration(streamFake, new Dictionary<string, object>());
var duration = new TimeSpan(1, 0, 0); //1 hr
var result = inData.SplitData(duration);
Assert.AreEqual(inData.Data, result.Head.Data);
Assert.AreEqual(0, result.Rest.Duration.TotalSeconds);
}
示例2: InputDataSplitsDataAtDuration
public void InputDataSplitsDataAtDuration(
[Values(0.01, 0.5, 0.751)] double splitDuration
)
{
IDictionary<string, object> config = new Dictionary<string, object>();
const int nSamples = 1000;
var srate = new Measurement(nSamples, "Hz");
var data = Enumerable.Range(0, nSamples).Select(i => new Measurement(i, "V")).ToList();
IInputData inData = new InputData(data, srate, DateTimeOffset.Now);
var duration = new TimeSpan((long)Math.Ceiling(splitDuration * TimeSpan.TicksPerSecond));
var result = inData.SplitData(duration);
//rounds samples up for duration
int numSamples = (int)Math.Ceiling(duration.TotalSeconds * (double)inData.SampleRate.QuantityInBaseUnits);
IEnumerable firstData = Enumerable.Range(0, numSamples).Select(i => inData.Data[i]).ToList();
IEnumerable restData = Enumerable.Range(numSamples, inData.Data.Count - numSamples).Select(i => inData.Data[i]).ToList();
Assert.AreEqual(firstData, result.Head.Data);
Assert.AreEqual(restData, result.Rest.Data);
}
示例3: PushInputDataAllowsForDataGranularity
public void PushInputDataAllowsForDataGranularity()
{
var srate = new Measurement(1, "Hz");
IList<IMeasurement> list = new List<IMeasurement>() { new Measurement(1, "V") };
var grainyData = new InputData(list, srate, DateTime.Now);
var dur = TimeSpan.FromSeconds(0.6);
var shortStream = new ResponseInputDataStream(response, Option<TimeSpan>.Some(dur));
var cons = grainyData.SplitData(dur);
Assert.DoesNotThrow(() => shortStream.PushInputData(cons.Head));
}