net.beadsproject.beads.analysis.featureextractors
Class FFT

java.lang.Object
  extended by net.beadsproject.beads.analysis.FeatureExtractor<float[],float[]>
      extended by net.beadsproject.beads.analysis.featureextractors.FFT
Direct Known Subclasses:
PowerSpectrum

public class FFT
extends FeatureExtractor<float[],float[]>

FFT performs a Fast Fourier Transform and forwards half of the real part of the data to any listeners.


Field Summary
protected  float[] fftImag
          The imaginary part.
protected  float[] fftReal
          The real part.
protected  java.util.ArrayList<FeatureExtractor<?,float[]>> listeners
           
 
Fields inherited from class net.beadsproject.beads.analysis.FeatureExtractor
featureDescriptions, features, name, numFeatures
 
Constructor Summary
FFT()
          Instantiates a new FFT.
 
Method Summary
 void addListener(FeatureExtractor<?,float[]> fe)
          Adds a FeatureExtractor as a listener.
protected static float[] calculateImaginary(float[] spectrum, int length)
          Gets the imaginary part from the complex spectrum.
protected static float[] calculateReal(float[] spectrum, int length)
          Gets the real part from the complex spectrum.
protected static void fft(float[] data, int n, boolean isign)
          Perform FFT on data with given length, regular or inverse.
 void process(float[] data)
          Process some data of type P (specified by the class def).
 
Methods inherited from class net.beadsproject.beads.analysis.FeatureExtractor
getFeatureDescriptions, getFeatures, getName, getNumberOfFeatures, setName, setNumberOfFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

protected java.util.ArrayList<FeatureExtractor<?,float[]>> listeners

fftReal

protected float[] fftReal
The real part.


fftImag

protected float[] fftImag
The imaginary part.

Constructor Detail

FFT

public FFT()
Instantiates a new FFT.

Method Detail

process

public void process(float[] data)
Description copied from class: FeatureExtractor
Process some data of type P (specified by the class def). This method must be overidden by implementing classes.

Specified by:
process in class FeatureExtractor<float[],float[]>
Parameters:
data - the data.

addListener

public void addListener(FeatureExtractor<?,float[]> fe)
Adds a FeatureExtractor as a listener.

Parameters:
the - FeatureExtractor.

calculateReal

protected static float[] calculateReal(float[] spectrum,
                                       int length)
Gets the real part from the complex spectrum.

Parameters:
spectrum - complex spectrum.
length - length of data to use.
Returns:
real part of given length of complex spectrum.

calculateImaginary

protected static float[] calculateImaginary(float[] spectrum,
                                            int length)
Gets the imaginary part from the complex spectrum.

Parameters:
spectrum - complex spectrum.
length - length of data to use.
Returns:
imaginary part of given length of complex spectrum.

fft

protected static void fft(float[] data,
                          int n,
                          boolean isign)
Perform FFT on data with given length, regular or inverse.

Parameters:
data - the data.
length - the length.
isign - true for regular, false for inverse.