This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

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