//---------------------------------------------------------------------
        /// <summary>
        /// A filter that performs dead band compression.
        /// </summary>
        /// <param name="data">Input data</param>
        /// <param name="instrumentPrecision">(Absolut) precision of the instrument</param>
        /// <param name="maxTime">Length of time before for sure a value gets recoreded</param>
        /// <returns>Dead band compressed / filtered data.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="data" /> is <c>null</c>
        /// </exception>
        public static DataPointIterator DeadBandCompression(this IEnumerable <DataPoint> data, double instrumentPrecision, TimeSpan maxTime)
        {
            if (data == null)
            {
                ThrowHelper.ThrowArgumentNull(ThrowHelper.ExceptionArgument.data);
            }

            var compression = new DeadBandCompression(instrumentPrecision, maxTime);

            return(compression.Process(data));
        }
Beispiel #2
0
        //---------------------------------------------------------------------
        /// <summary>
        /// A filter that performs dead band compression.
        /// </summary>
        /// <param name="data">Input data</param>
        /// <param name="instrumentPrecision">(Absolut) precision of the instrument</param>
        /// <param name="maxDeltaX">
        /// Length of x before for sure a value gets recoreded. See <see cref="Compression.MaxDeltaX" />.
        /// </param>
        /// <param name="minDeltaX">
        /// Length of x/time within no value gets recorded (after the last archived value).
        /// See <see cref="Compression.MinDeltaX" />.
        /// </param>
        /// <returns>Dead band compressed / filtered data.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="data" /> is <c>null</c>
        /// </exception>
        public static DataPointIterator DeadBandCompression(this IEnumerable <DataPoint>?data, double instrumentPrecision, double?maxDeltaX = null, double?minDeltaX = null)
        {
            if (data is null)
            {
                ThrowHelper.ThrowArgumentNull(ThrowHelper.ExceptionArgument.data);
            }

            var compression = new DeadBandCompression(instrumentPrecision, maxDeltaX, minDeltaX);

            return(compression.Process(data));
        }