public RetentionTimeSummary(Statistics statistics) : base(statistics) { Min = statistics.Min(); Max = statistics.Max(); }
public void QValueTest() { var statPvalues = new Statistics(STOREY_P_VALUES); Assert.AreEqual(0.676341, statPvalues.PiZero(0.5), 1e-6); Assert.AreEqual(0.671857, statPvalues.PiZero(), 1e-6); // First try q values with 0.5 lambda from the paper var qvalues = statPvalues.Qvalues(0.5); Assert.AreEqual(STOREY_P_VALUES.Length, qvalues.Length); Assert.AreEqual(STOREY_Q_VALUES.Length, qvalues.Length); var deltas = new Statistics(qvalues.Select((v, i) => Math.Abs(v - STOREY_Q_VALUES[i]))); Assert.IsTrue(deltas.Mean() < 1.1e-5); Assert.IsTrue(deltas.Max() < 4e-4); // Then try it with automated lambda calculation qvalues = statPvalues.Qvalues(); deltas = new Statistics(qvalues.Select((v, i) => Math.Abs(v - STOREY_Q_VALUES[i]))); Assert.IsTrue(deltas.Mean() < 2.6e-3); Assert.IsTrue(deltas.Max() < 4.5e-3); }
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); } }