void NewMonitorMeasureReady(object sender, EventArgs<int[]> e) { var currentMeasure = new List<long>(); foreach (var ped in peaksForMatrix) { currentMeasure.Add(ped.AssociatedPoints.PLSreference.PeakSum); } if (doBackgroundPremeasure) { if (currentMeasure.Count != backgroundResult.Count) { // length mismatch // TODO: throw smth } // distract background for (int i = 0; i < backgroundResult.Count; ++i) { currentMeasure[i] -= backgroundResult[i]; } } if (matrix != null) { // solve matrix equation double[] result = matrix.Solve(currentMeasure.ConvertAll<double>(x => (double)x)); // TODO: now it is normalized to 999 on maximum of peak spectrum component // but we want actual value // weight of mass measured also can differ from 999 Config.AutoSaveSolvedSpectra(result); // TODO: put here all automatic logic from measure modes } }