Data.Scans.ScanPoint.Variance C# (CSharp) Method

Variance() private method

private Variance ( ArrayList shots, int index, double startTime, double endTime ) : double
shots System.Collections.ArrayList
index int
startTime double
endTime double
return double
        private double Variance(ArrayList shots, int index, double startTime, double endTime)
        {
            double tempMn = 0;
            double tempx2 = 0;
            double vari = 0;
            double n = shots.Count;

            if (n==1)
            {
                return vari;
            }
            else
            {
            foreach (Shot s in shots) tempMn += s.Integrate(index, startTime, endTime);
            foreach (Shot s in shots) tempx2 += Math.Pow(s.Integrate(index, startTime, endTime),2);
            return vari = (n / (n - 1)) * ((tempx2 / n) - Math.Pow((tempMn / n), 2));
            }
        }