コード例 #1
0
        /// <summary>
        ///     Gets the peak that fits the point at a given index with a Lorentzian fit.
        /// </summary>
        /// <param name="index">index of the point in the m/z vectors which is the apex of the peak.</param>
        /// <param name="mzs">List of raw data of m\zs.</param>
        /// <param name="intensities">List of raw data of intensities.</param>
        /// <param name="fwhm"></param>
        /// <returns>returns the m/z of the peak.</returns>
        private double LorentzianFit(List <double> mzs, List <double> intensities, int index, double fwhm)
        {
            var a  = intensities[index];
            var vo = mzs[index];
            var e  = Math.Abs((vo - mzs[index + 1]) / 100);

            if (index < 1)
            {
                return(mzs[index]);
            }
            if (index == mzs.Count)
            {
                return(mzs[index]);
            }

            var lstart = PeakIndex.GetNearest(mzs, vo + fwhm, index) + 1;
            var lstop  = PeakIndex.GetNearest(mzs, vo - fwhm, index) - 1;

            var currentE = LorentzianLS(mzs, intensities, a, fwhm, vo, lstart, lstop);

            for (var i = 0; i < 50; i++)
            {
                var lastE = currentE;
                vo       = vo + e;
                currentE = LorentzianLS(mzs, intensities, a, fwhm, vo, lstart, lstop);
                if (currentE > lastE)
                {
                    break;
                }
            }

            vo       = vo - e;
            currentE = LorentzianLS(mzs, intensities, a, fwhm, vo, lstart, lstop);
            for (var i = 0; i < 50; i++)
            {
                var lastE = currentE;
                vo       = vo - e;
                currentE = LorentzianLS(mzs, intensities, a, fwhm, vo, lstart, lstop);
                if (currentE > lastE)
                {
                    break;
                }
            }
            vo = vo + e;
            return(vo);
        }
コード例 #2
0
        /// <summary>
        /// Gets the signal to noise for a point.
        /// </summary>
        /// <param name="mzList">is List of m/z values.</param>
        /// <param name="intensityList">is List of intensity values.</param>
        /// <param name="peak">is the m/z value at which we want to find the signal to noise ratio.</param>
        /// <returns>returns the signal to noise value of the peak.</returns>
        public double GetSignalToNoise(List <double> mzList, List <double> intensityList, double peak)
        {
            var index = PeakIndex.GetNearest(mzList, peak, 0);

            return(PeakStatistician.FindSignalToNoise(intensityList[index], intensityList, index));
        }
コード例 #3
0
        /// <summary>
        /// Gets the FWHM for a point.
        /// </summary>
        /// <param name="mzList">is List of m/z values.</param>
        /// <param name="intensityList">is List of intensity values.</param>
        /// <param name="peak">is the m/z value at which we want to find FWHM.</param>
        /// <returns>returns the m/z value of the peak.</returns>
        public double GetFWHM(List <double> mzList, List <double> intensityList, double peak)
        {
            var index = PeakIndex.GetNearest(mzList, peak, 0);

            return(PeakStatistician.FindFwhm(mzList, intensityList, index));
        }