private void calPeaks() { if (AllPeaksIdx == null) { AllPeaksIdx = new List <int>(); } else { AllPeaksIdx.Clear(); } for (int i = 1; i < YData.Count - 1; i++) { if (YData[i] - YData[i - 1] > 0 && YData[i] - YData[i + 1] > 0) { AllPeaksIdx.Add(i); } } try { curPeaksIdx = retrievePeaks(cutThreshold, curShowType); } catch (Exception) { } }
public bool isPeak(int idx) { return(AllPeaksIdx.Any(i => i == idx)); }