java.lang.Object
rawDeepLearningClassifier.dlClassification.delphinID.DelphinIDUtils

public class DelphinIDUtils extends Object
A bunch of utility functions that a re useful for testing and running DelphinID models
  • Constructor Details Link icon

    • DelphinIDUtils Link icon

      public DelphinIDUtils()
  • Method Details Link icon

    • prepDelphinIDModel Link icon

      public static DelphinIDWhistleTest.DelphinIDWorkerTest prepDelphinIDModel(String modelPath)
    • getBaseData Link icon

      public static DataUnitBaseData getBaseData(us.hebi.matlab.mat.types.Struct detectionsStruct, int i, double sampleRate)
      Get base data for a data unit from a MATLAB struct.
      Parameters:
      detectionsStruct - - the struct array containing acoustic detections.
      i - - the index of the unit from the struct.
      sampleRate - - the sample rate in samples per second.
      Returns:
      the base data for the data unit
    • getClicksMAT Link icon

      public static DelphinIDUtils.DetectionGroupMAT getClicksMAT(String filePath)
      Load whistle contours from a MAT file.
      Parameters:
      filePath - - the file path.
      Returns:
      a list of whistle contour objects from the mat file.
    • getClicksMAT Link icon

      public static ArrayList<DelphinIDUtils.ClickDetectionMAT> getClicksMAT(us.hebi.matlab.mat.types.Struct clicksStruct, double sampleRate)
      Load clicks from a MATLAB struct.
      Parameters:
      clicksStruct - - a struct containing a list of whistle contours
      sampleRate - - the sample rate in samples per second.
      fftLen - - the fft length in samples
      fftHop - - the fft hop in samples.
      Returns:
      a list of whistle contour objects from the struct.
    • getWhistleContoursMAT Link icon

      public static DelphinIDUtils.DetectionGroupMAT getWhistleContoursMAT(String filePath)
      Load whistle contours from a MAT file.
      Parameters:
      filePath - - the file path.
      Returns:
      a list of whistle contour objects from the mat file.
    • getWhistleContoursMAT Link icon

      public static ArrayList<AbstractWhistleDataUnit> getWhistleContoursMAT(us.hebi.matlab.mat.types.Struct whistlesStruct, double fftLen, double fftHop, double sampleRate)
      Load whistle contours from a MATLAB struct
      Parameters:
      whistlesStruct - - a struct containing a list of whistle contours
      fftLen - - the FFT length in samples
      fftHop - - the FFT hop in samples.
      sampleRate - - the sample rate in samples per second.
      Returns:
      a list of whistle contour objects from the struct.
    • segmentDetectionData Link icon

      public static ArrayList<SegmenterDetectionGroup> segmentDetectionData(ArrayList<? extends PamDataUnit> whistles, long dataStartMillis, double segLen, double segHop)
      Segment the detections into groups. Note that segments are overlaps so each whistle may belong to multiple segments.
      Parameters:
      whistles - - a list of whistles - not necessarily sorted by time.
      dataStartMillis - - the start time of the data in millis i.e. where the first segment starts.
      segLen - - the segment size in milliseconds.
      segHop - - the segment hop in milliseconds.
      Returns:
      groups of data units within each segment.
    • segmentDetectionData Link icon

      public static ArrayList<SegmenterDetectionGroup> segmentDetectionData(ArrayList<? extends PamDataUnit> detections, long dataStartMillis, double segLen, double segHop, Float sampleRate)
      Segment the detections into groups. Note that segments are overlaps so each whistle may belong to multiple segments.
      Parameters:
      detections - - a list of whistles - not necessarily sorted by time.
      dataStartMillis - - the start time of the data in millis i.e. where the first segment starts.
      segLen - - the segment size in milliseconds.
      segHop - - the segment hop in milliseconds.
      sampleRate - - the sample rate to set.
      Returns:
      groups of data units within each segment.
    • getDensity Link icon

      public static double getDensity(SegmenterDetectionGroup group)
      Calculate the density of whistles for a segmenter group in the absence of a known fft length and hop.
      Parameters:
      group - - the group
      Returns:
    • main Link icon

      public static void main(String[] args)