whistleDetector
Class WhistleDetector

java.lang.Object
  extended by PamguardMVC.PamProcess
      extended by whistleDetector.WhistleDetector
All Implemented Interfaces:
Annotator, PamObserver

public class WhistleDetector
extends PamProcess

Author:
Doug Gillespie

Re-implementation of the IFAW 2003 whistle detector

Uses the PeakDetector and WhistleLinker to do the actual work


Field Summary
(package private)  long currentSample
           
(package private)  AcquisitionProcess daqProcess
           
(package private)  DetectionGroupLocaliser detectionGroupLocaliser
           
(package private)  WhistleEventDetector eventDetector
           
(package private)  FFTDataBlock fftDataBlock
           
(package private)  int fftHop
           
(package private)  int fftLength
           
private  int nChannelGroups
           
(package private)  PamDataBlock<PeakDataUnit> peakDataBlock
           
(package private)  PeakDetector[] peakDetectors
           
private  int peakDetectorType
           
(package private)  FFTDataBlock supressedSpectrogram
           
(package private)  WhistleControl whistleControl
           
(package private)  AbstractWhistleDataBlock whistleDataBlock
           
(package private)  WhistleLinker[] whistleLinkers
           
(package private)  PamDataBlock<WhistleGroupDetection> whistleLocations
          Cross channel grouping.
 
Fields inherited from class PamguardMVC.PamProcess
outputDataBlocks, processName, sampleRate
 
Constructor Summary
WhistleDetector(WhistleControl whistleControl)
           
 
Method Summary
 double binsToHz(int nFrequencyBins)
          Convert a number of frequency bins in the spectrgram matrix to a frequency in Hz.
 double binsToSeconds(int nTimeBins)
          Convert a number of time bins in the spectrgram matris to a a time in seconds
private  void buildDetectors()
           
(package private)  ShapeDataUnit crossChannelLink(ShapeDataUnit newUnit)
           
private  void destroyDetectors()
           
 void destroyProcess()
          Called from the PamControlled unit when a PamControlled unit is removed from the model.
 FFTDataBlock getFftDataBlock()
           
 int getFftHop()
           
 int getFftLength()
           
(package private)  double getFOverlap(ShapeDataUnit w1, ShapeDataUnit w2)
           
 long getRequiredDataHistory(PamObservable o, java.lang.Object arg)
           
(package private)  double getTOverlap(ShapeDataUnit w1, ShapeDataUnit w2)
           
 WhistleControl getWhistleControl()
           
 int hzToBins(double frequency)
           
private  boolean isGoodWhistle(WhistleShape newWhistle)
           
private  boolean localiseWhistle(ShapeDataUnit shapeDataUnit)
          sorts out the bearing(s) for a single whistle (any number of close together channels)
 void newData(PamObservable obs, PamDataUnit obj)
           
(package private)  boolean newWhistleEmbryo(WhistleShape newWhistle, int groupChannels, int detectionChannel)
           
 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.
private  void prepareEqualisedSpectrumData(FFTDataUnit fftData, double[] background)
           
 void prepareProcess()
          Called for each process before any of them receive the PamStart command
 void setSampleRate(float sampleRate, boolean notify)
          New sample rate
 
Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, fillXMLElement, fillXMLParameters, getAncestorDataBlock, getAnnotation, getBackendProcess, getChainPosition, getCpuPercent, getNumAnnotations, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOutputDataBlock, getPamControlledUnit, getParentDataBlock, getParentProcess, getProcessName, getRawSourceDataBlock, getSampleRate, getSourceDataBlock, getSourceProcess, isCanMultiThread, makePamProcess, masterClockUpdate, noteNewSettings, notifyModelChanged, relMillisecondsToSamples, relSamplesToMilliseconds, removeObservable, removeOutputDatablock, saveViewerData, setBackendProcess, setCanMultiThread, setParentDataBlock, setParentDataBlock, setProcessName, setupProcess, toString, update, updateData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

whistleControl

WhistleControl whistleControl

peakDetectors

PeakDetector[] peakDetectors

whistleLinkers

WhistleLinker[] whistleLinkers

eventDetector

WhistleEventDetector eventDetector

peakDataBlock

PamDataBlock<PeakDataUnit> peakDataBlock

whistleDataBlock

AbstractWhistleDataBlock whistleDataBlock

supressedSpectrogram

FFTDataBlock supressedSpectrogram

whistleLocations

PamDataBlock<WhistleGroupDetection> whistleLocations
Cross channel grouping.


daqProcess

AcquisitionProcess daqProcess

fftDataBlock

FFTDataBlock fftDataBlock

fftLength

int fftLength

fftHop

int fftHop

currentSample

long currentSample

nChannelGroups

private int nChannelGroups

detectionGroupLocaliser

DetectionGroupLocaliser detectionGroupLocaliser

peakDetectorType

private int peakDetectorType
Constructor Detail

WhistleDetector

public WhistleDetector(WhistleControl whistleControl)
Parameters:
whistleControl - reference ot a WhistleControl PamControlledUnit pamguard plug-in
Method Detail

buildDetectors

private void buildDetectors()

destroyDetectors

private void destroyDetectors()

destroyProcess

public void destroyProcess()
Description copied from class: PamProcess
Called from the PamControlled unit when a PamControlled unit is removed from the model. Offers an opportunity to disconnect individual processed from the rest of the model. May be necessary to override to clean up some processes.

Overrides:
destroyProcess in class PamProcess

setSampleRate

public void setSampleRate(float sampleRate,
                          boolean notify)
Description copied from interface: PamObserver
New sample rate

Specified by:
setSampleRate in interface PamObserver
Overrides:
setSampleRate in class PamProcess
notify - Notify other PamObservers and PamObservables in the chain.

newData

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

prepareEqualisedSpectrumData

private void prepareEqualisedSpectrumData(FFTDataUnit fftData,
                                          double[] background)

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

newWhistleEmbryo

boolean newWhistleEmbryo(WhistleShape newWhistle,
                         int groupChannels,
                         int detectionChannel)

isGoodWhistle

private boolean isGoodWhistle(WhistleShape newWhistle)

localiseWhistle

private boolean localiseWhistle(ShapeDataUnit shapeDataUnit)
sorts out the bearing(s) for a single whistle (any number of close together channels)

Parameters:
shapeDataUnit -
Returns:

crossChannelLink

ShapeDataUnit crossChannelLink(ShapeDataUnit newUnit)

getTOverlap

double getTOverlap(ShapeDataUnit w1,
                   ShapeDataUnit w2)

getFOverlap

double getFOverlap(ShapeDataUnit w1,
                   ShapeDataUnit w2)

prepareProcess

public void prepareProcess()
Description copied from class: PamProcess
Called for each process before any of them receive the PamStart command

Overrides:
prepareProcess in class PamProcess

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

binsToHz

public double binsToHz(int nFrequencyBins)
Convert a number of frequency bins in the spectrgram matrix to a frequency in Hz.

Parameters:
nFrequencyBins - number of frequency bins
Returns:
frequency in Hz

hzToBins

public int hzToBins(double frequency)

binsToSeconds

public double binsToSeconds(int nTimeBins)
Convert a number of time bins in the spectrgram matris to a a time in seconds

Parameters:
nTimeBins - number of time bins
Returns:
time in seconds

getFftHop

public int getFftHop()

getFftLength

public int getFftLength()

getWhistleControl

public WhistleControl getWhistleControl()

getFftDataBlock

public FFTDataBlock getFftDataBlock()