

import java.util.ArrayList;

import net.beadsproject.beads.analysis.FeatureExtractor;
import net.beadsproject.beads.core.TimeStamp;


public class SlowPowerSpectrum extends FeatureExtractor<float[],float[]>{
	
	
	public SlowPowerSpectrum() {
		super();
	}
	
	/* (non-Javadoc)
	 * @see com.olliebown.beads.analysis.FFT#calculateBuffer()
	 */
	@Override
	public void process(TimeStamp start, TimeStamp end, float[] fftdata) {
		// fftdata is in the format real1,imag1,real2,imag2,...
		// we ignore the redundant half of the fftdata		
		features = new float[fftdata.length/4];		
		numFeatures = fftdata.length/4;
		
		for(int i=0;i<fftdata.length/2;i+=2)
		{
			features[i/2] = (float)Math.hypot((double)fftdata[i],(double)fftdata[i+1]);			
		}
		forward(start, end);
	}	
	
}
