public List <IonLight> GetIonsLight() { List <IonLight> theseIons = new List <IonLight>(MyIons.GetLength(1)); for (int y = 0; y < MyIons.GetLength(1); y++) { double mz = MyIons[0, y]; double intensity = MyIons[1, y]; double scanNo = MyIons[2, y]; double RetTime = Math.Round(MyIons[3, y], 3); theseIons.Add(new IonLight(mz, intensity, RetTime, (int)scanNo)); } return(theseIons); }
public double AverageIntensity(int topX) { double [] d = new double[MyIons.GetLength(1)]; for (int y = 0; y < MyIons.GetLength(1); y++) { d[y] = MyIons[1, y]; } List <double> dd = d.ToList(); if (dd.Count > topX) { dd.Sort((a, b) => b.CompareTo(a)); dd.RemoveRange(topX - 1, dd.Count - topX); } return(dd.Average()); }