Exemplo n.º 1
0
        public static IList <BiosignalRecord> SmoothTimestamp(IEnumerable <BiosignalRecord> records, double?recordInterval = null)
        {
            var list = records.ToList();

            if (list.Count <= 1)
            {
                return(list);
            }
            ulong min = ulong.MaxValue, max = ulong.MinValue;

            foreach (var record in list)
            {
                var t = record.Timestamp;
                if (t < min)
                {
                    min = t;
                }
                if (t > max)
                {
                    max = t;
                }
            }
            var interval = recordInterval ?? (max - min) / (double)list.Count;

            for (var i = 0; i < list.Count; i++)
            {
                var record = list[i];
                var t      = min + (ulong)(i * interval);
                list[i] = new BiosignalRecord(record.Values, record.Index, t);
            }
            return(list);
        }
Exemplo n.º 2
0
 public static bool TryParse(string line, ulong index, out BiosignalRecord biosignalRecord) => TryParse(line, index, (values, idx, timestamp) => new BiosignalRecord(values, idx, timestamp), out biosignalRecord);