コード例 #1
0
        /// <summary>
        /// perform moving average or moving median filter, unlike other bindings instead in-place calculation it returns new array
        /// </summary>
        /// <param name="data"></param>
        /// <param name="period"></param>
        /// <param name="operation"></param>
        /// <returns>filered data</returns>
        public static double[] perform_rolling_filter(double[] data, int period, int operation)
        {
            double[] filtered_data = new double[data.Length];
            Array.Copy(data, filtered_data, data.Length);
            int res = DataHandlerLibrary.perform_rolling_filter(filtered_data, filtered_data.Length, period, operation);

            if (res != (int)CustomExitCodes.STATUS_OK)
            {
                throw new BrainFlowException(res);
            }
            return(filtered_data);
        }