init
This commit is contained in:
19
Common/DTS.Common.Utilities/SignalToNoiseRatio.cs
Normal file
19
Common/DTS.Common.Utilities/SignalToNoiseRatio.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user