Пример #1
0
 private void ValidateTimeRange(GraphChromatogram graphChromatogram, double[] msMsRTs, double range, double gradientLength)
 {
     var statMsMsRTs = new Statistics(msMsRTs);
     double minRT = double.MaxValue, maxRT = double.MinValue;
     foreach (var curve in graphChromatogram.CurveList)
     {
         minRT = Math.Min(minRT, curve.Points[0].X);
         maxRT = Math.Max(maxRT, curve.Points[curve.NPts - 1].X);
     }
     if (statMsMsRTs.Min() < range/2)
     {
         Assert.AreEqual(minRT, 0.0, 1);
         minRT = statMsMsRTs.Min() - range/2;
     }
     if (statMsMsRTs.Max() > gradientLength - range/2)
     {
         Assert.AreEqual(maxRT, gradientLength, 1);
         maxRT = statMsMsRTs.Max() + range/2;
     }
     double msMsRtsRange = statMsMsRTs.Range();
     double rangeActual = maxRT - minRT - msMsRtsRange;
     if (Math.Abs(range - rangeActual) > 0.2)
     {
         // Some cases with very wide range of scans may not have enough gradient
         // to accomodate the desired range.
         string message = string.Format("Expected: {0}, Actual: {1}, RangeIds: {2}, Min: {3}, Max: {4}, MinIds: {5}, MaxIds: {6}",
             range, rangeActual, msMsRtsRange, minRT, maxRT, statMsMsRTs.Min(), statMsMsRTs.Max());
         Assert.IsTrue(msMsRtsRange > 10, message);
         Assert.IsTrue(rangeActual > range - 1, message);
     }
 }