public PeaksPair(Peak p1, Peak p2)
        {
            int mod = 2;
            position = p1.time;

            peakFrequency1 = p1.frequency;
            peakFrequency1 -= peakFrequency1 % mod;

            peakFrequency2 = p2.frequency;
            peakFrequency2 -= peakFrequency2 % mod;

            dTime = (p2.time - p1.time);
            dTime -= dTime%mod;
        }
Exemple #2
0
        public List<PeaksPair> getPeakPairs()
        {
            List<PeaksPair> result = new List<PeaksPair>();
            getPeaks();

            for (int i = 0; i < peaks.Length; i++)
            {
                for (int j = 0; j < peaks[i].Count; j++)
                {
                    var currentPeak = new Peak(peaks[i][j].Key, i);
                    var adjacentPeaks = getAdjacentPeaks(currentPeak);

                    foreach (var peak in adjacentPeaks)
                    {
                        result.Add(new PeaksPair(currentPeak, peak));
                    }
                }
            }

            return result;
        }
Exemple #3
0
        private List<Peak> getAdjacentPeaks(Peak peak)
        {
            List<Peak> result = new List<Peak>();

            int minDistance = (int)ParamsParser.getParam("minDistance");
            int maxDistance = (int)ParamsParser.getParam("maxDistance");
            int zoneHeight = (int)ParamsParser.getParam("zoneHeight");

            int posStart = Math.Min(width - 1, peak.time + minDistance);
            int posFinish = Math.Min(width - 1, peak.time + maxDistance);
            int freqStart = peak.frequency - zoneHeight;
            int freqFinish = peak.frequency + zoneHeight;

            for (int i = posStart; i <= posFinish; i++)
            {
                for (int j = 0; j < peaks[i].Count; j++)
                {
                    if (peaks[i][j].Key >= freqStart && peaks[i][j].Key <= freqFinish)
                        result.Add(new Peak(peaks[i][j].Key, i));
                }
            }

            return result;
        }