/// <summary>
 /// Add a function to the filter
 /// will determine if this function has dynamic parameters of data[] only, or data[] and sampling_rate
 /// </summary>
 static void AddSignalFilterFunction(SignalFilter filter, MethodInfo mi, Dictionary <string, string> paramDict, object[] parameters)
 {
     if (paramDict.ContainsKey("sampling_rate"))
     {
         filter.AddFunction(new SignalFilterFunctionDataSampleRate(typeof(DataFilter).Assembly, mi, parameters));
     }
     else
     {
         filter.AddFunction(new SignalFilterFunctionData(typeof(DataFilter).Assembly, mi, parameters));
     }
 }
        /// <summary>
        /// Create a default filter for 60Hz mains noise
        /// </summary>
        static void CreateDefaultFilterNotch50()
        {
            var newFilter = new SignalFilter("default50");

            MethodInfo mi        = typeof(DataFilter).GetMethod("perform_bandstop", BindingFlags.Public | BindingFlags.Static);
            var        paramDict = new Dictionary <string, string>
            {
                ["data"]          = "",
                ["sampling_rate"] = "0",
                ["center_freq"]   = "50.0",
                ["band_width"]    = "2.0",
                ["order"]         = "6",
                ["filter_type"]   = "1",
                ["ripple"]        = "1.0"
            };

            //  create object array from parameters, casting to proper type
            object[] parameters = mi.GetParameters().Select(p => paramDict[p.Name].Length > 0 ? Convert.ChangeType(paramDict[p.Name], p.ParameterType) : null).ToArray();
            newFilter.AddFunction(new SignalFilterFunctionDataSampleRate(typeof(DataFilter).Assembly, mi, parameters));

            mi        = typeof(DataFilter).GetMethod("perform_bandpass", BindingFlags.Public | BindingFlags.Static);
            paramDict = new Dictionary <string, string>
            {
                ["data"]          = "",
                ["sampling_rate"] = "0",
                ["center_freq"]   = "25.5",
                ["band_width"]    = "47",
                ["order"]         = "2",
                ["filter_type"]   = "0",
                ["ripple"]        = "0.0"
            };

            //  create object array from parameters, casting to proper type
            parameters = mi.GetParameters().Select(p => paramDict[p.Name].Length > 0 ? Convert.ChangeType(paramDict[p.Name], p.ParameterType) : null).ToArray();
            newFilter.AddFunction(new SignalFilterFunctionDataSampleRate(typeof(DataFilter).Assembly, mi, parameters));

            mi        = typeof(DataFilter).GetMethod("perform_wavelet_denoising", BindingFlags.Public | BindingFlags.Static);
            paramDict = new Dictionary <string, string>
            {
                ["data"]                = "",
                ["wavelet"]             = "db12",
                ["decomposition_level"] = "3",
            };

            //  create object array from parameters, casting to proper type
            parameters = mi.GetParameters().Select(p => paramDict[p.Name].Length > 0 ? Convert.ChangeType(paramDict[p.Name], p.ParameterType) : null).ToArray();
            newFilter.AddFunction(new SignalFilterFunctionData(typeof(DataFilter).Assembly, mi, parameters));

            Filters.Add(newFilter.Name, newFilter);
        }