fftManager
Class PamFFTProcess

java.lang.Object
  extended by PamguardMVC.PamProcess
      extended by fftManager.PamFFTProcess
All Implemented Interfaces:
Annotator, PamObserver

public class PamFFTProcess
extends PamProcess

Author:
Doug Gillespie PamFFTProcess is a extends the PamProcess superclass
Main processing class to calculate FFT data.
Modified October 13 2009 to correctly interleave data from > 1 channel rather then sending data out in chunks corresponding to individual input raw data which is packed as single channels
PamFFTProcess is then notified when new chunks of raw data have been generated (e.g. by reading from a file or taking input from a sound card). It then processes the data to produce blocks of overlapping FFT data which are used to create a new PamDataUnit that is sent to be included in a new PamDataBlock of type PamFFTDataBlock

Nested Class Summary
(package private)  class PamFFTProcess.TempOutputStore
           
 
Field Summary
private  int[] channelCounts
           
(package private)  int[] channelPointer
           
private  ClickRemoval clickRemoval
           
private  double[] dataToFFT
           
private  FastFFT fastFFT
           
private  java.util.Vector<Annotation> fftAnnotations
           
private  int[] fftBlocks
           
private  PamFFTControl fftControl
           
private  Complex[] fftData
           
private  int fftOverlap
           
private  double[] fftRealBlock
           
private  long[] lastChannelMillis
           
private  int logFftLength
           
private  FFTDataBlock outputData
           
private  int[] rawBlocks
           
private  PamRawDataBlock rawDataBlock
           
private  PamFFTProcess.TempOutputStore[] tempStores
           
private  double[][] windowedData
           
private  double[] windowFunction
           
 
Fields inherited from class PamguardMVC.PamProcess
outputDataBlocks, processName, sampleRate
 
Constructor Summary
PamFFTProcess(PamFFTControl pamControlledUnit, PamDataBlock parentDataBlock)
           
 
Method Summary
 Annotation getAnnotation(PamDataBlock pamDataBlock, int annotation)
          Get an Annotation
 int getChannelMap()
           
 PamFFTControl getFftControl()
           
 int getFftHop()
           
 int getFftLength()
           
 int getNumAnnotations(PamDataBlock pamDataBlock)
           
 FFTDataBlock getOutputData()
           
 long getRequiredDataHistory(PamObservable o, java.lang.Object arg)
           
 void makeAnnotations()
           
 void newData(PamObservable obs, PamDataUnit pamRawData)
           
 void pamStart()
          Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway.
 void pamStop()
          Stops the process.
 void setupFFT()
           
 
Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, fillXMLElement, fillXMLParameters, getAncestorDataBlock, getBackendProcess, getChainPosition, getCpuPercent, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOutputDataBlock, getPamControlledUnit, getParentDataBlock, getParentProcess, getProcessName, getRawSourceDataBlock, getSampleRate, getSourceDataBlock, getSourceProcess, isCanMultiThread, makePamProcess, masterClockUpdate, noteNewSettings, notifyModelChanged, prepareProcess, relMillisecondsToSamples, relSamplesToMilliseconds, removeObservable, removeOutputDatablock, saveViewerData, setBackendProcess, setCanMultiThread, setParentDataBlock, setParentDataBlock, setProcessName, setSampleRate, setupProcess, toString, update, updateData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logFftLength

private int logFftLength

fftOverlap

private int fftOverlap

channelPointer

int[] channelPointer

windowFunction

private double[] windowFunction

windowedData

private double[][] windowedData

dataToFFT

private double[] dataToFFT

fftData

private Complex[] fftData

fftRealBlock

private double[] fftRealBlock

fftControl

private PamFFTControl fftControl

clickRemoval

private ClickRemoval clickRemoval

rawBlocks

private int[] rawBlocks

fftBlocks

private int[] fftBlocks

channelCounts

private int[] channelCounts

outputData

private FFTDataBlock outputData

tempStores

private PamFFTProcess.TempOutputStore[] tempStores

lastChannelMillis

private long[] lastChannelMillis

fastFFT

private FastFFT fastFFT

fftAnnotations

private java.util.Vector<Annotation> fftAnnotations

rawDataBlock

private PamRawDataBlock rawDataBlock
Constructor Detail

PamFFTProcess

public PamFFTProcess(PamFFTControl pamControlledUnit,
                     PamDataBlock parentDataBlock)
Method Detail

setupFFT

public void setupFFT()

getFftLength

public int getFftLength()

getFftHop

public int getFftHop()

getChannelMap

public int getChannelMap()

newData

public void newData(PamObservable obs,
                    PamDataUnit pamRawData)
Overrides:
newData in class PamProcess

getRequiredDataHistory

public long getRequiredDataHistory(PamObservable o,
                                   java.lang.Object arg)
Specified by:
getRequiredDataHistory in interface PamObserver
Overrides:
getRequiredDataHistory in class PamProcess
Parameters:
o - PamObservable class requiring the data
arg - optional argument from PamObservable
Returns:
time in milliseconds requried by data held in PamObservable

pamStart

public void pamStart()
Description copied from class: PamProcess
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway.

Specified by:
pamStart in class PamProcess

pamStop

public void pamStop()
Description copied from class: PamProcess
Stops the process.

Specified by:
pamStop in class PamProcess

getOutputData

public FFTDataBlock getOutputData()

getAnnotation

public Annotation getAnnotation(PamDataBlock pamDataBlock,
                                int annotation)
Description copied from interface: Annotator
Get an Annotation

Specified by:
getAnnotation in interface Annotator
Overrides:
getAnnotation in class PamProcess
Parameters:
pamDataBlock - Annotated datablock
annotation - annotation number
Returns:
Annotation

getNumAnnotations

public int getNumAnnotations(PamDataBlock pamDataBlock)
Specified by:
getNumAnnotations in interface Annotator
Overrides:
getNumAnnotations in class PamProcess
Parameters:
pamDataBlock - Annotated datablock
Returns:
the number of annotations

makeAnnotations

public void makeAnnotations()

getFftControl

public PamFFTControl getFftControl()