private IEnumerable <double> GetLocalPeaks(float[] input, IEnumerable <LocalRange> models, ChirpModel mainModel) { var peaks = new List <double>(); Parallel.ForEach <LocalRange>(models, x => { var complexResult = ChirpFFT(input, mainModel, x); peaks.Add(FrequencyHelpers.GetZoomedFrequency(complexResult.GetPeakIndex(), x.LeftThreshold, x.RightThreshold, x.ZoomOptions.TargetNumberOfSamples)); }); return(peaks); }
public static void AssignFrequencyValues(this ObservableDataSource <Point> source, List <double> newValues, int sampleRate) { if (newValues == null) { return; } source.SuspendUpdate(); source.Collection.Clear(); var length = newValues.Count; for (int i = 0; i < length; i += 20) { var x = FrequencyHelpers.GetFrequency(length, i, sampleRate); source.Collection.Add(new Point { X = x, Y = newValues[i] }); } source.ResumeUpdate(); }