Пример #1
0
        public IReadOnlyCollection <IReadOnlyCollection <Point> > QuickAnalysis(int searchWindow, double alpha,
                                                                                double threshold, int maxPeaksCount)
        {
            var quickViewPeaks = new List <IReadOnlyList <Point> >();
            var spectrum       = dataCursor.GetSpectrum();
            var smoothSpectrum = dataSmoother.Smooth(spectrum, alpha);
            var quickpeaks     = peaksFinder.Find(spectrum, smoothSpectrum, searchWindow, threshold, maxPeaksCount);

            if (quickpeaks.Count == 0)
            {
                return(quickViewPeaks);
            }

            var initialFrequency = spectrum.First().X;
            var finalFrequency   = spectrum.Last().X;

            for (var i = 0; i < quickpeaks.Count; i++)
            {
                var peak        = quickpeaks[i];
                var a           = peak.Alpha;
                var b           = peak.Beta;
                var g           = peak.Gamma;
                var currentPeak = lorentzian.Model(initialFrequency, finalFrequency, a, b, g);
                quickViewPeaks.Add(currentPeak);
            }

            return(quickViewPeaks);
        }
Пример #2
0
        private void OnSpectrumLoaded(object sender, EventArgs e)
        {
            WindowSizeMax = dataCursor.GetSpectrum()?.Count ?? 3;

            if (WindowSizeMax >= 30)
            {
                SearchWindow = WindowSizeMax / 10;
            }
        }