示例#1
0
 /// <summary>
 /// Calculate masking bits for missing values.
 /// </summary>
 /// <param name="source">Input stream</param>
 /// <param name="period">Period of input signal stream</param>
 /// <param name="gap_tol">Gap tolerance</param>
 /// <param name="offset">Offset</param>
 /// <returns>Signal after missing values filled with `val`</returns>
 public static IStreamable <Empty, bool> Mask(
     this IStreamable <Empty, Signal> source,
     long period,
     long gap_tol,
     long offset = 0)
 {
     return(source
            .Chop(offset, period, gap_tol)
            .Select((t, s) => t != s.ts)
            );
 }
示例#2
0
 /// <summary>
 /// Fill missing values with a constant.
 /// </summary>
 /// <param name="source">Input stream</param>
 /// <param name="period">Period of input signal stream</param>
 /// <param name="gap_tol">Gap tolerance</param>
 /// <param name="val">Filler value</param>
 /// <param name="offset">Offset</param>
 /// <returns>Signal after missing values filled with `val`</returns>
 public static IStreamable <Empty, Signal> FillConst(
     this IStreamable <Empty, Signal> source,
     long period,
     long gap_tol,
     float val,
     long offset = 0)
 {
     return(source
            .Chop(offset, period, gap_tol)
            .Select((t, s) => (t == s.ts) ? s : new Signal(t, val))
            );
 }