clickDetector
Class ClickDetection

java.lang.Object
  extended by PamguardMVC.PamDataUnit
      extended by PamDetection.AcousticDataUnit
          extended by PamDetection.PamDetection<PamDetection,PamDetection>
              extended by clickDetector.ClickDetection
All Implemented Interfaces:
java.lang.Comparable<PamDataUnit>
Direct Known Subclasses:
OfflineClickDetection

public class ClickDetection
extends PamDetection<PamDetection,PamDetection>

Class for Click Detector clicks.

Author:
Doug Gillespie

Field Summary
private  double[] amplitude
           
private  double[][] analyticWaveform
           
protected  ClickDetector.ChannelGroupDetector channelGroupDetector
           
static int CLICK_CLICK
           
static int CLICK_NOISEWAVE
           
private  ClickDetector clickDetector
           
private  ClickLocalisation clickLocalisation
           
(package private)  long clickNumber
          Click number in list.
private  byte clickType
          Click species.
private  Complex[][] complexSpectrum
           
private  int currentSpectrumLength
           
(package private)  byte dataType
          Click data type
private  double[] delays
           
(package private)  boolean discard
           
(package private)  int eventId
           
protected  long filePos
           
(package private)  int flags
           
(package private)  double ICI
           
private  int nChan
           
private  int nDelays
           
private  double[][] powerSpectra
           
private  int shortestFFTLength
           
private  double[] totalPowerSpectrum
           
(package private)  boolean tracked
           
(package private)  int triggerList
           
private  double[][] waveData
           
 
Fields inherited from class PamDetection.AcousticDataUnit
AMPLITUDE_SCALE_DBREMPA, AMPLITUDE_SCALE_LINREFSD, duration, frequency, startSample
 
Fields inherited from class PamguardMVC.PamDataUnit
absBlockIndex, channelBitmap, localisation, oLL, timeMilliseconds
 
Constructor Summary
ClickDetection()
           
ClickDetection(int channelBitmap, long startSample, long duration, ClickDetector clickDetector, ClickDetector.ChannelGroupDetector channelGroupDetector, int triggerList)
           
 
Method Summary
 double clickLength(double percent)
          Calculates the length of a click in seconds averaged over all channels
 double clickLength(int channel, double percent)
          Calculates the length of a click in seconds for a particular channel
private  AcquisitionControl findDaqControl()
           
 void freeClickMemory()
           
 double getAmplitude(int channel)
           
 double[] getAnalysticWaveform(int iChan)
          Get the analytic waveform for a given channel
 double getAngle()
          Returns the angle in degress for compatibilty with older version of click detector
 ClickDetector getClickDetector()
           
 ClickLocalisation getClickLocalisation()
           
 byte getClickType()
           
 Complex[] getComplexSpectrum(int channel)
          Returns the complex spectrum for a given channel using the shortest possible FFT length
 Complex[] getComplexSpectrum(int channel, int fftLength)
          Returns the complex spectrum for a given channel using a set FFT length
 int getCurrentSpectrumLength()
           
 byte getDataType()
           
 double[] getDelays()
          return a list of delays.
 int getEventId()
           
 double getMeanAmplitude()
           
 double getMeanFrequency(double[] searchRange)
           
 int getNChan()
           
 double[] getPowerSpectrum(int channel)
          Get the power spectrum of the entire click.
 double[] getPowerSpectrum(int channel, int fftLength)
          Returns the power spectrum for a given channel (square of magnitude of complex spectrum)
 int getShortestFFTLength()
           
private  int getSpikeWidth(double[] data, int peakPos, double percent)
          Calculates the width of a peak - either time or frequency data
 double[] getTotalPowerSpectrum(int fftLength)
          Returns the sum of the power spectra for all channels
 double[][] getWaveData()
           
 double[] getWaveData(int channelIndex)
          Get raw waveform data for a given click channel index.
 boolean hasComplexSpectrum()
          Find out whether there are complex spectrum data - and if there are, data may get cleaned up.
 double inBandEnergy(double[] freqs)
          Calculates the total energy within a particular frequency band
 boolean isTracked()
           
private  void makeClickLocalisation()
           
 double peakFrequency(double[] searchRange)
           
 double peakFrequencyWidth(double peakFrequency, double percent)
           
 void setAmplitude(int channel, double amplitude)
          Set the amplitude for a given channel
 void setChannelBitmap(int channelBitmap)
           
 void setClickDetector(ClickDetector clickDetector)
           
 void setClickLocalisation(ClickLocalisation clickLocalisation)
           
 void setClickType(byte clickType)
           
 void setDataType(byte dataType)
           
 void setDelay(int iDelay, double delay)
          Set the time of arrival delay in samples.
 void setDelayCorrection(double delayCorrection)
          Set the correction to the delay in fractions of a sample (derived from quadratic interpolation around the peak of the cross correlation function)
 void setEventId(int eventId)
           
private  void setReferenceHydrophones(int channelMap)
           
 void setTracked(boolean tracked)
           
 void setWaveData(double[][] waveData)
           
 
Methods inherited from class PamDetection.PamDetection
addSubDetection, addSuperDetection, getDetectionType, getPeakTime, getSubDetection, getSubDetectionsCount, getSubDetectionSyncronisation, getSuperDetection, getSuperDetection, getSuperDetectionsCount, getSuperDetectionSyncronisation, removeSubDetection, removeSuperDetection, setDetectionType, setPeakTime, setUniqueSuperDetection
 
Methods inherited from class PamDetection.AcousticDataUnit
amplifyMeasuredAmplitudeByDB, amplifyMeasuredAmplitudeByLinear, compareTo, getAmplitudeDB, getCalculatedAmlitudeDB, getDuration, getFrequency, getFrequencyOverlap, getLastSample, getMeasuredAmplitude, getMeasuredAmplitudeType, getSeconds, getStartSample, getTimeOverlap, setCalculatedAmlitudeDB, setDuration, setFrequency, setInfo, setMeasuredAmplitude, setMeasuredAmplitude, setMeasuredAmplitudeType, setStartSample
 
Methods inherited from class PamguardMVC.PamDataUnit
clearUpdateCount, getAbsBlockIndex, getChannelBitmap, getDatabaseIndex, getDatabaseUpdateOf, getDataUnitFileInformation, getGpsPosition, getLastUpdateTime, getLocalisation, getOriginLatLong, getPairAngle, getParentDataBlock, getTimeMilliseconds, getUpdateCount, setAbsBlockIndex, setDatabaseIndex, setDatabaseUpdateOf, setDataUnitFileInformation, setLastUpdateTime, setLocalisation, setOriginLatLong, setParentDataBlock, setTimeMilliseconds, updateDataUnit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLICK_CLICK

public static final int CLICK_CLICK
See Also:
Constant Field Values

CLICK_NOISEWAVE

public static final int CLICK_NOISEWAVE
See Also:
Constant Field Values

clickNumber

long clickNumber
Click number in list.


triggerList

int triggerList

waveData

private double[][] waveData

amplitude

private double[] amplitude

tracked

boolean tracked

flags

int flags

dataType

byte dataType
Click data type


filePos

protected long filePos

clickType

private byte clickType
Click species.


clickDetector

private ClickDetector clickDetector

eventId

int eventId

discard

boolean discard

ICI

double ICI

powerSpectra

private double[][] powerSpectra

totalPowerSpectrum

private double[] totalPowerSpectrum

complexSpectrum

private Complex[][] complexSpectrum

currentSpectrumLength

private int currentSpectrumLength

analyticWaveform

private double[][] analyticWaveform

nChan

private int nChan

shortestFFTLength

private int shortestFFTLength

clickLocalisation

private ClickLocalisation clickLocalisation

nDelays

private int nDelays

delays

private double[] delays

channelGroupDetector

protected ClickDetector.ChannelGroupDetector channelGroupDetector
Constructor Detail

ClickDetection

public ClickDetection(int channelBitmap,
                      long startSample,
                      long duration,
                      ClickDetector clickDetector,
                      ClickDetector.ChannelGroupDetector channelGroupDetector,
                      int triggerList)

ClickDetection

public ClickDetection()
Method Detail

getShortestFFTLength

public int getShortestFFTLength()

isTracked

public boolean isTracked()

setTracked

public void setTracked(boolean tracked)

getEventId

public int getEventId()

setEventId

public void setEventId(int eventId)

getComplexSpectrum

public Complex[] getComplexSpectrum(int channel)
Returns the complex spectrum for a given channel using the shortest possible FFT length

Parameters:
channel -
Returns:
The complex spectrum

getComplexSpectrum

public Complex[] getComplexSpectrum(int channel,
                                    int fftLength)
Returns the complex spectrum for a given channel using a set FFT length

Parameters:
channel -
fftLength -
Returns:
the complex spectrum

hasComplexSpectrum

public boolean hasComplexSpectrum()
Find out whether there are complex spectrum data - and if there are, data may get cleaned up.

Returns:
true if complex spec data exist.

getCurrentSpectrumLength

public int getCurrentSpectrumLength()

getPowerSpectrum

public double[] getPowerSpectrum(int channel)
Get the power spectrum of the entire click.

Parameters:
channel - channel number
Returns:
power spectrum

getPowerSpectrum

public double[] getPowerSpectrum(int channel,
                                 int fftLength)
Returns the power spectrum for a given channel (square of magnitude of complex spectrum)

Parameters:
channel - channel number
fftLength -
Returns:
Power spectrum

getTotalPowerSpectrum

public double[] getTotalPowerSpectrum(int fftLength)
Returns the sum of the power spectra for all channels

Parameters:
fftLength -
Returns:
Sum of power spectra

getAnalysticWaveform

public double[] getAnalysticWaveform(int iChan)
Get the analytic waveform for a given channel

Parameters:
iChan - channel index
Returns:
analytic waveform

inBandEnergy

public double inBandEnergy(double[] freqs)
Calculates the total energy within a particular frequency band

Parameters:
freqs -
Returns:
In Band Energy
See Also:
BasicClickIdentifier

clickLength

public double clickLength(double percent)
Calculates the length of a click in seconds averaged over all channels

Parameters:
percent - Fraction of total click energy to use in the calculation
Returns:
click length in seconds
See Also:
BasicClickIdentifier

clickLength

public double clickLength(int channel,
                          double percent)
Calculates the length of a click in seconds for a particular channel

Parameters:
channel -
percent - Fraction of total click energy to use in the calculation
Returns:
Click Length (seconds)
See Also:
BasicClickIdentifier

getSpikeWidth

private int getSpikeWidth(double[] data,
                          int peakPos,
                          double percent)
Calculates the width of a peak - either time or frequency data

Parameters:
data -
peakPos -
percent -
Returns:
Width of spike in whatever bins are used for raw data given

peakFrequency

public double peakFrequency(double[] searchRange)

peakFrequencyWidth

public double peakFrequencyWidth(double peakFrequency,
                                 double percent)

getMeanFrequency

public double getMeanFrequency(double[] searchRange)

getWaveData

public double[] getWaveData(int channelIndex)
Get raw waveform data for a given click channel index.

Parameters:
channelIndex - channel index
Returns:
waveform data

getWaveData

public double[][] getWaveData()
Returns:
waveform data for all channels.

setWaveData

public void setWaveData(double[][] waveData)

freeClickMemory

public void freeClickMemory()

setDelay

public void setDelay(int iDelay,
                     double delay)
Set the time of arrival delay in samples.

Parameters:
delay - delay in samples

getDelays

public double[] getDelays()
return a list of delays.

Returns:

setDelayCorrection

public void setDelayCorrection(double delayCorrection)
Set the correction to the delay in fractions of a sample (derived from quadratic interpolation around the peak of the cross correlation function)

Parameters:
delayCorrection - delay correction

setAmplitude

public void setAmplitude(int channel,
                         double amplitude)
Set the amplitude for a given channel

Parameters:
channel - channel number
amplitude - amplitude

getAmplitude

public double getAmplitude(int channel)

getAngle

public double getAngle()
Returns the angle in degress for compatibilty with older version of click detector

Returns:
angle of the click detection in degrees

getMeanAmplitude

public double getMeanAmplitude()

makeClickLocalisation

private void makeClickLocalisation()

setReferenceHydrophones

private void setReferenceHydrophones(int channelMap)

findDaqControl

private AcquisitionControl findDaqControl()

getClickLocalisation

public ClickLocalisation getClickLocalisation()

setClickLocalisation

public void setClickLocalisation(ClickLocalisation clickLocalisation)

getNChan

public int getNChan()

setChannelBitmap

public void setChannelBitmap(int channelBitmap)
Overrides:
setChannelBitmap in class PamDataUnit

setClickType

public void setClickType(byte clickType)
Parameters:
clickType - the clickType (click species) to set

getClickType

public byte getClickType()
Returns:
the clickType (click species)

getDataType

public byte getDataType()
Returns:
the type of data - click, noise, etc.

setDataType

public void setDataType(byte dataType)
Parameters:
dataType - the type of data - click, noise, etc.

setClickDetector

public void setClickDetector(ClickDetector clickDetector)
Parameters:
clickDetector - the clickDetector to set

getClickDetector

public ClickDetector getClickDetector()
Returns:
the clickDetector