Exemple #1
0
        public static double EEGPSD(List<DataReading> data, BandFrequencyDefinition BFD, Func<DataReading, double> valueAccesor)
        {
            List<FFT> ffts = new List<FFT>();
            for (int i = 0; i < data.Count - FFT.SAMPLING_WINDOW_LENGTH; i++)
            {
                FFT temp = new FFT(data.Skip(i).Take(FFT.SAMPLING_WINDOW_LENGTH).Select(x => valueAccesor(x)).ToList());
                if (double.IsNegativeInfinity(temp.AbsoluteBandPower[BFD.Label]))
                {
                    int j = 0;
                }
                ffts.Add(temp);

            }

            return ffts.Average(x => x.AbsoluteBandPower[BFD.Label]);
        }
Exemple #2
0
 public static double DASM(List<DataReading> data, string band, Func<DataReading, double> valueAccessor1, Func<DataReading, double> valueAccessor2)
 {
     FFT fft1 = new FFT(data.Select(x => valueAccessor1(x)).ToList());
     FFT fft2 = new FFT(data.Select(x => valueAccessor2(x)).ToList());
     return fft1.AbsoluteBandPower[band] - fft2.AbsoluteBandPower[band];
 }