Class MHTAlgorithmMAT
java.lang.Object
clickTrainDetector.clickTrainAlgorithms.mht.mhtMAT.MHTAlgorithmMAT
An MHT algorithm with all the hooks required for running in MATLAB.
This MHT algorithm works only with time, amplitude and bearing.
- Author:
- Jamie Macaulay
-
Constructor Summary
ConstructorDescriptionMHTAlgorithmMAT
(boolean[] mhTVar) Constructor for the MATLAB based algorithm. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassifier
(String type, CTClassifierParams clssfrsettings) Add a classifier to the algorithmvoid
addSimpleClick
(SimpleClick simpleClick) Add a simple click to the click train.array2BitSet
(boolean[] array) Convert a boolean array to a BitSet.boolean[]
bitSet2Array
(BitSet bitSet, int kcount) Convert a BitSet to a boolean array.void
classifyCTDataUnit
(CTDataUnit ctDataUnit) Classify a CTDataUnitvoid
Clear the MHT kernel.void
Confirm the remaining tracks.boolean[]
getActiveBranch
(int n) Get a active array from the MHTKernel.int
Get the number of active branches.boolean[]
getConfirmedBranch
(int n) Get a confirmed track from the MHTKernel.double
getConfirmedBranchChi2
(int n) Get a confirmed track from the MHTKernel.int
Get the number of confirmed branches.getCTDataUnit
(int n) Get a CTDataUnit form the confirmed track.Get the chi^2 calculator.Get the MHT Kernel.boolean[]
getPossibility
(int n) Get a possibility array from the MHTKernel.double
getPossibilityChi2
(int n) Get the chi^2 values for a possibility from the MHTKernel.int
Get the size of possibility matrix.Get list iterator from the data block starting at 0Get the StandardMHTChi2Paramsboolean
Checks whether the garbage bot is enabledstatic void
Main class to quickly check the algorithm works sort of.void
Print the settings for the MHT algorithms to the console.void
Print out a list of simple clicksvoid
reset()
Reset the array.void
run()
Runs the whole algorithm based on data in the SimpleClickDataBlock.void
setClicks
(double[][] simpleClicks, float sR) Add a series of clicks to the data block to be analysed.void
Add a series of clicks to the data block to be analysed.void
setEnableGarbageBot
(boolean enableGarbageBot) Set whether the garbage bot is enabledvoid
setMaxBearingJump
(double jump) Set the maximum bearing jump.void
setMHTKernelParams
(int npruneback, int nprunestart, int nhold, int maxcoasts) Set some parameters for the MHT Kernel.void
setMHTVarEnable
(boolean[] enabled) Set which of the MHT variables are enabledvoid
setMHTVarSettings
(int var, double error, double minErr) Set the error value for a MHT chi^2 parameter.void
setParams
(int nPruneback, int nHold, int nPruneStart, int maxCoasts, double maxICI) Convenience function to set some parameters.void
setStandardMHTParams
(double maxICI, double newtrackpenalty, double coastpenalty, double longiciexponenet, double longtrackexponent) Set settings for the standard MHT parameters.void
Test the algorithm.
-
Constructor Details
-
MHTAlgorithmMAT
public MHTAlgorithmMAT() -
MHTAlgorithmMAT
public MHTAlgorithmMAT(boolean[] mhTVar) Constructor for the MATLAB based algorithm.- Parameters:
mhTVar
- - the list of algorithms to enable.
-
-
Method Details
-
addClassifier
Add a classifier to the algorithm- Parameters:
type
- - the type of classifier e.g. "Template", "Simple", "Bearing"clssfrsettings
- - the classifier settings object
-
getStandardMHTParams
Get the StandardMHTChi2Params- Returns:
- the StandardMHTChi2Params;
-
setMHTVarEnable
public void setMHTVarEnable(boolean[] enabled) Set which of the MHT variables are enabled- Parameters:
enabled
- - array showing which chi2 variables are enabled- should be the same size as the number of availble chi2 variables
-
setMHTVarSettings
public void setMHTVarSettings(int var, double error, double minErr) Set the error value for a MHT chi^2 parameter.- Parameters:
var
- - the parameter index.error
- - the error value to set.
-
setMHTKernelParams
public void setMHTKernelParams(int npruneback, int nprunestart, int nhold, int maxcoasts) Set some parameters for the MHT Kernel. Allows MATLAB to change params easily.- Parameters:
npruneback
- - the prune back value.nprunestart
- - the minimum number of detections before prune back occurs.nhold
- - the max number of tracks.maxcoasts
- - the maximum allowed number for coasts for a track.
-
setStandardMHTParams
public void setStandardMHTParams(double maxICI, double newtrackpenalty, double coastpenalty, double longiciexponenet, double longtrackexponent) Set settings for the standard MHT parameters. Convenience function for MATLAB to easily set parameters.- Parameters:
maxICI
- - the maximum allowed ICInewtrackpenalty
- - the new track penalty factor.coastpenalty
- - the coast penalty.longiciexponenet
- - bonus factor for long ICI tracks.longtrackexponent
- - bonus factor for long ICI tracks.
-
setClicks
public void setClicks(double[][] simpleClicks, float sR) Add a series of clicks to the data block to be analysed. The input for simple clicks is time (seconds), amplitude (dB re 1uPa) and optionally bearing.- Parameters:
simpleClicks
- a list of clicks.sR
- - the sample rate in samples per second.
-
setClicks
Add a series of clicks to the data block to be analysed. The input for simple clicks is time (seconds), amplitude (dB re 1uPa) and optionally bearing.- Parameters:
simpleClicks
- a list of clicks.sR
- - the sample rate in samples per second.
-
printSimpleClickData
public void printSimpleClickData()Print out a list of simple clicks -
run
public void run()Runs the whole algorithm based on data in the SimpleClickDataBlock. -
getSimpleClickIterator
Get list iterator from the data block starting at 0- Returns:
- the list iterator from the data block.
-
addSimpleClick
Add a simple click to the click train. This must be sequential. -
getActiveBranchSize
public int getActiveBranchSize()Get the number of active branches. These are the unconfirmed branches which are still in the possibility mix but with prune back- Usually used for plotting.- Returns:
- the number of active branches.
-
getActiveBranch
public boolean[] getActiveBranch(int n) Get a active array from the MHTKernel.- Parameters:
n
- - the possibility index- Returns:
- a boolean array of possibilities starting from the reference detection.
-
getConfirmedBranchSize
public int getConfirmedBranchSize()Get the number of confirmed branches.- Returns:
- the number of confirmed branches.
-
getConfirmedBranch
public boolean[] getConfirmedBranch(int n) Get a confirmed track from the MHTKernel.- Parameters:
n
- - the confirmed track index- Returns:
- a boolean array of confirmed detections starting from the reference detection.
-
getCTDataUnit
Get a CTDataUnit form the confirmed track. Also adds classification information to the CTDataUnit if classifier are present.- Parameters:
n
- - the confirmed track index.- Returns:
- the CTDF
-
classifyCTDataUnit
Classify a CTDataUnit- Parameters:
ctDataUnit
- - the CTDataUnit to classify
-
getConfirmedBranchChi2
public double getConfirmedBranchChi2(int n) Get a confirmed track from the MHTKernel.- Parameters:
n
- - the possibility index- Returns:
- a boolean array of confirmed detections starting from the reference detection.
-
getPossibilitySize
public int getPossibilitySize()Get the size of possibility matrix. -
getPossibility
public boolean[] getPossibility(int n) Get a possibility array from the MHTKernel.- Parameters:
n
- - the possibility index- Returns:
- a boolean array of possibilities starting from the reference detection.
-
getPossibilityChi2
public double getPossibilityChi2(int n) Get the chi^2 values for a possibility from the MHTKernel.- Parameters:
n
- - the possibility index.- Returns:
- a chi^2 value for the possibility.
-
bitSet2Array
Convert a BitSet to a boolean array.- Parameters:
bitSet
- - the BitSet to convert.
-
array2BitSet
Convert a boolean array to a BitSet.- Parameters:
array
- , the array to convert.
-
reset
public void reset()Reset the array. -
clearKernel
public void clearKernel()Clear the MHT kernel. Also clears the current datablock. -
getMHTKernel
Get the MHT Kernel.- Returns:
- the MHTT kernel
-
confirmRemainingTracks
public void confirmRemainingTracks()Confirm the remaining tracks. This should be called at the end of the an analysis run. -
getMHTChi2
Get the chi^2 calculator.- Returns:
- the chi2 calculator.
-
setParams
public void setParams(int nPruneback, int nHold, int nPruneStart, int maxCoasts, double maxICI) Convenience function to set some parameters.- Parameters:
nPruneback
- - the prune backnHold
- - the number of holds.nPruneStart
- - the prune start.maxCoasts
- - max coasts.maxICI
- - the maximum inter-click-interval.
-
printSettings
public void printSettings()Print the settings for the MHT algorithms to the console. -
testRunAlgorithm
public void testRunAlgorithm()Test the algorithm. -
getSimpleClickDataBlock
- Returns:
- the simpleClickDataBlock
-
isEnableGarbageBot
public boolean isEnableGarbageBot()Checks whether the garbage bot is enabled- Returns:
- true if garbage bot is enabled
-
setEnableGarbageBot
public void setEnableGarbageBot(boolean enableGarbageBot) Set whether the garbage bot is enabled- Parameters:
enableGarbageBot
- - true to enable garbage bot
-
setMaxBearingJump
public void setMaxBearingJump(double jump) Set the maximum bearing jump. This is a hard cutoff in the maximum a click train can jump in bearing- prevents tracks going crazy for sperm whales and other slowly changing bearings especially in quiet environments.- Parameters:
jump
- - the max bearing jump in DEGREES
-
main
Main class to quickly check the algorithm works sort of.- Parameters:
args
- - input arguments
-