Class MTClassifier

java.lang.Object
matchedTemplateClassifer.MTClassifier
All Implemented Interfaces:
Serializable, Cloneable, ManagedParameters
Direct Known Subclasses:
DefaultTemplates

public class MTClassifier extends Object implements Serializable, Cloneable, ManagedParameters
Parameters and useful functions for a single MT classifier.
Author:
Jamie Macaulay
See Also:
  • Field Details

    • thresholdToAccept

      public double thresholdToAccept
      Threshold to classify
    • normalisation

      public int normalisation
      The normalisation
    • currentSr

      public double currentSr
      The current sample rates of the waveforms
    • waveformMatch

      public MatchTemplate waveformMatch
      The waveform to match
    • waveformReject

      public MatchTemplate waveformReject
      The waveform to reject
    • TEST_FFT_LENGTH

      public static final int TEST_FFT_LENGTH
      See Also:
  • Constructor Details

    • MTClassifier

      public MTClassifier()
      Default MT classifier
  • Method Details

    • getWaveformMatchFFT

      public ComplexArray getWaveformMatchFFT(float sR, int length)
      Get the match waveform FFT for the sampleRate.
      Parameters:
      sR - - the sample rate in samples per second
      fftLength - - the FFTlength to use. Bins around waveform peak are used.
    • getWaveformRejectFFT

      public ComplexArray getWaveformRejectFFT(float sR, int length)
      Get the match waveform for the sample rate
      Parameters:
      sR - - the sample rate in samples per second
    • normaliseWaveform

      public static double[] normaliseWaveform(double[] waveform, int normeType)
      Normalise the waveform.
      Parameters:
      waveform -
      normeType -
      Returns:
    • getFFTLength

      @Deprecated public int getFFTLength(float sR)
      Deprecated.
      Get the FFT length which should be used for the current sample rate.
      Parameters:
      length -
      the - sample rate.
      Returns:
      the FFT length to be used.This is the maximum length of the two templates.
    • reset

      public void reset()
      Reset all interpolated waveforms etc.
    • calcCorrelationMatchTest

      public us.hebi.matlab.mat.types.Struct calcCorrelationMatchTest(ComplexArray click, float sR)
      Tests the correlation function by outputting data to .mat file. Calculate a value for the click reject and match template ration correlation.
      Parameters:
      click - - the input click to perform correlation match on. It should be the same length and sample rate as the templates.
      sR - - the sample rate in samples per second
      Returns:
      an ML Structure with results of all stuff.
    • calcCorrelationMatch

      public MatchedTemplateResult calcCorrelationMatch(ComplexArray click, float sR)
      Calculate a value for the click reject and match template ration correlation
      Parameters:
      click - - the input click FFT to perform correlation match on. It should be the same length and sample rate as the templates.
      sR - - the sample rate in samples per second
      Returns:
      the correlation reject match template.
    • binArray

      public double[] binArray(int start, int stop, double step)
    • conditionClickLength

      public static double[] conditionClickLength(double[] click, int fftLength, int smoothing)
      The click needs to be the same or shorter than the FFT length. If the click is longer need to find the click in the waveform snipper and extract a subsection.
    • getParameterSet

      public PamParameterSet getParameterSet()
      Get the auto-generated parameter set, and then add in the fields that are not included because they are not public and do not have getters. Note: for each field, we search the current class and (if that fails) the superclass. It's done this way because MTClassifier might be used directly (and thus the field would be found in the class) and it also might be used as a superclass to something else (e.g. DefaultTemplates) in which case the field would only be found in the superclass.
      Specified by:
      getParameterSet in interface ManagedParameters
      Returns:
      description of the parameters in a class.