whistleClassifier
Class WhistleClassifierProcess

java.lang.Object
  extended by PamguardMVC.PamProcess
      extended by whistleClassifier.WhistleClassifierProcess
All Implemented Interfaces:
Annotator, PamObserver

public class WhistleClassifierProcess
extends PamProcess

Whistle Classifier process

Receives whistles from either whistle detector. Fragments them and either stores the fragments for later training or builds up information on many fragments and then classifies when it's got enough.

Keeps a list or recent whistle times so that it can clear the store if the whistle rate drops too low.

Author:
Doug

Field Summary
private  HistoFragmentStore fragmentStore
           
private  long lastStoreClearTime
           
private  long lastTimingCall
           
private  TrainingDataSet trainingDataSet
           
private  TrainingDataStore trainingDataStore
           
protected  WhistleClasificationDataBlock whistleClasificationDataBlock
           
protected  WhistleClassifierControl whistleClassifierControl
           
private  WhistleClassifierLogging whistleClassifierLogging
           
private  AbstractWhistleDataBlock whistleSourceData
           
private  java.util.LinkedList<java.lang.Long> whistleTimes
          Need to keep a list of recent whistle times so that the system can be cleared if there are no longer any whistles.
 
Fields inherited from class PamguardMVC.PamProcess
outputDataBlocks, processName, sampleRate
 
Constructor Summary
WhistleClassifierProcess(WhistleClassifierControl whistleClassifierControl)
           
 
Method Summary
 void checkLoggingTables()
          Called whenever settings / species list changes to ensure that database table columns match the species list in use.
private  void checkNeedForClear(long timeMilliseconds)
           
private  void clearFragmentStore(long clearTime)
           
 void closeTrainingStore()
           
protected  void findSourceData()
           
private  void fragmentWhistle(AbstractWhistleDataUnit abstractWhistle)
           
 FragmentStore getFragmentStore()
           
 boolean isTraining()
           
 void masterClockUpdate(long timeMilliseconds, long sampleNumber)
           
 void newData(PamObservable o, PamDataUnit arg)
           
private  void newWhistleData(AbstractWhistleDataUnit shapeDataUnit)
           
 void pamHasStopped()
           
 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 prepareTrainingStore()
           
 void prepareTrainingStore(java.lang.String nameBit, java.lang.String wavFolder)
           
private  void processFragment(WhistleFragment fragment, long time)
           
private  boolean runClassification(long timeMillis)
          Run the classification model.
 void runTimingFunctions(long timeMilliseconds)
           
 void setSampleRate(float sampleRate, boolean notify)
          New sample rate
 void setupLogging()
          Called after settings read in so that correct table can be created.
 void writeTrainingStoreData()
           
 
Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addOutputDataBlock, changedThreading, clearOldData, createAnnotations, destroyProcess, fillXMLElement, fillXMLParameters, getAncestorDataBlock, getAnnotation, getBackendProcess, getChainPosition, getCpuPercent, getNumAnnotations, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOutputDataBlock, getPamControlledUnit, getParentDataBlock, getParentProcess, getProcessName, getRawSourceDataBlock, getRequiredDataHistory, getSampleRate, getSourceDataBlock, getSourceProcess, isCanMultiThread, makePamProcess, noteNewSettings, notifyModelChanged, prepareProcess, 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

whistleClassifierControl

protected WhistleClassifierControl whistleClassifierControl

whistleSourceData

private AbstractWhistleDataBlock whistleSourceData

fragmentStore

private HistoFragmentStore fragmentStore

whistleClasificationDataBlock

protected WhistleClasificationDataBlock whistleClasificationDataBlock

whistleClassifierLogging

private WhistleClassifierLogging whistleClassifierLogging

trainingDataStore

private TrainingDataStore trainingDataStore

trainingDataSet

private TrainingDataSet trainingDataSet

whistleTimes

private java.util.LinkedList<java.lang.Long> whistleTimes
Need to keep a list of recent whistle times so that the system can be cleared if there are no longer any whistles.


lastTimingCall

private long lastTimingCall

lastStoreClearTime

private long lastStoreClearTime
Constructor Detail

WhistleClassifierProcess

public WhistleClassifierProcess(WhistleClassifierControl whistleClassifierControl)
Method Detail

setupLogging

public void setupLogging()
Called after settings read in so that correct table can be created.


checkLoggingTables

public void checkLoggingTables()
Called whenever settings / species list changes to ensure that database table columns match the species list in use.


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.

isTraining

public boolean isTraining()

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

pamHasStopped

public void pamHasStopped()

pamStop

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

Specified by:
pamStop in class PamProcess

prepareTrainingStore

public void prepareTrainingStore()

prepareTrainingStore

public void prepareTrainingStore(java.lang.String nameBit,
                                 java.lang.String wavFolder)

writeTrainingStoreData

public void writeTrainingStoreData()

closeTrainingStore

public void closeTrainingStore()

findSourceData

protected void findSourceData()

masterClockUpdate

public void masterClockUpdate(long timeMilliseconds,
                              long sampleNumber)
Specified by:
masterClockUpdate in interface PamObserver
Overrides:
masterClockUpdate in class PamProcess

newData

public void newData(PamObservable o,
                    PamDataUnit arg)
Overrides:
newData in class PamProcess

runTimingFunctions

public void runTimingFunctions(long timeMilliseconds)

checkNeedForClear

private void checkNeedForClear(long timeMilliseconds)

newWhistleData

private void newWhistleData(AbstractWhistleDataUnit shapeDataUnit)

fragmentWhistle

private void fragmentWhistle(AbstractWhistleDataUnit abstractWhistle)

processFragment

private void processFragment(WhistleFragment fragment,
                             long time)

clearFragmentStore

private void clearFragmentStore(long clearTime)

runClassification

private boolean runClassification(long timeMillis)
Run the classification model.

Returns:
true if model ran without errors.

getFragmentStore

public FragmentStore getFragmentStore()