Пример #1
0
        public List <Point> GetSpectrum(int index)
        {
            var voltege       = voltages.Get(index);
            var frequencyScan = spectras.Get(voltege);

            return(frequencyScan.Select(frequency => new Point(frequency.Key, frequency.Value)).ToList());
        }
Пример #2
0
        public void Read(string filePath)
        {
            spectra.BeginLoading();
            voltage.BeginLoading();

            var lines = System.IO.File.ReadAllLines(filePath);

            var voltages = lines[0].Split('\t');

            foreach (var value in voltages.Select(double.Parse))
            {
                voltage.Add(value);
            }

            var frequencies = new List <double>();

            for (var i = 1; i < lines.Length; i++)
            {
                var entries   = lines[i].Split('\t');
                var frequency = double.Parse(entries[0]);

                frequencies.Add(frequency);

                for (var j = 1; j < entries.Length; j++)
                {
                    var currentVoltage   = voltage.Get(j - 1);
                    var currentFrequency = frequencies[i - 1];
                    var value            = double.Parse(entries[j]);
                    if (value > 0)
                    {
                        spectra.Add(currentVoltage, currentFrequency, value);
                    }
                }
            }
            spectra.EndLoading();
            voltage.EndLoading();
        }