java.lang.Object
clickTrainDetector.clickTrainAlgorithms.mht.mhtMAT.MHTAlgorithmMAT

public class MHTAlgorithmMAT extends Object
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 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

      public void addClassifier(String type, CTClassifierParams clssfrsettings)
      Add a classifier to the algorithm
      Parameters:
      type - - the type of classifier e.g. "Template", "Simple", "Bearing"
      clssfrsettings - - the classifier settings object
    • getStandardMHTParams

      public StandardMHTChi2Params 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 ICI
      newtrackpenalty - - 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

      public void setClicks(Object[][] 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.
    • 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

      public ListIterator<SimpleClick> getSimpleClickIterator()
      Get list iterator from the data block starting at 0
      Returns:
      the list iterator from the data block.
    • addSimpleClick

      public void addSimpleClick(SimpleClick simpleClick)
      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

      public CTDataUnit getCTDataUnit(int n)
      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

      public void classifyCTDataUnit(CTDataUnit ctDataUnit)
      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

      public boolean[] bitSet2Array(BitSet bitSet, int kcount)
      Convert a BitSet to a boolean array.
      Parameters:
      bitSet - - the BitSet to convert.
    • array2BitSet

      public BitSet array2BitSet(boolean[] array)
      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

      public MHTKernel<PamDataUnit> 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

      public StandardMHTChi2Provider 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 back
      nHold - - 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

      public SimpleClickDataBlock 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

      public static void main(String[] args)
      Main class to quickly check the algorithm works sort of.
      Parameters:
      args - - input arguments