/** * Cycles through the array of power values and gets rid of all the values less than the average * power for the interval. */ private void filterPeaks() { validFrequencies = new ArrayList<Integer>(); // list of frequencies with power > average power for (int frequency = 0; frequency < freqPower.length; frequency++) { double thisPower = freqPower[frequency]; if (thisPower > averagePower) { validFrequencies.add( frequency); // add to the list of valid frequencies if greater than average power } } getLocalPeaks(); }
/** Extracts the local peaks from the spectrum at this particular time interval. */ private void getLocalPeaks() { for (int i = 0; i < validFrequencies.size(); i++) { try { if (isPeakAt(i)) { int frequency = validFrequencies.get(i); // get the frequency at the particular index Peak peak = new Peak(spectrumNumber, frequency, freqPower[frequency]); // System.out.println(spectrumNumber + " " + frequency); peaks.add(peak); // System.out.println(peak.getTime() + " " + peak.getFrequency()); } } catch (IndexOutOfBoundsException e) { // do nothing } } }