using System.Collections.Generic; namespace DTS.Utilities { public static class SignalToNoiseRatio { /// /// Calculates Noise given a full scale peak-to-peak /// /// Data set /// The full scale peak-to-peak of the data set; 65536.0 by default for ADC data /// public static double CalculateSNR(IEnumerable values, double fullScalePP = 65536.0) { var stdDev = StandardDev.StandardDeviation(values); return -20 * System.Math.Log10(3.0 * stdDev / fullScalePP); } } }