Class DelphinIDUtils
java.lang.Object
rawDeepLearningClassifier.dlClassification.delphinID.DelphinIDUtils
A bunch of utility functions that a re useful for testing and running
DelphinID models
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Subclass of Abstract whsitle data unit for loading whistle contours from .mat files.static class
DelphinIDUtils.DetectionGroupMAT<T extends PamDataUnit>
Holds a whistle group and some extra information on sample rate, fft length and hop and the start of the processed file.static class
Subclass of Abstract whsitle data unit for loading whistle contours from .mat files. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DataUnitBaseData
getBaseData
(us.hebi.matlab.mat.types.Struct detectionsStruct, int i, double sampleRate) Get base data for a data unit from a MATLAB struct.getClicksMAT
(String filePath) Load whistle contours from a MAT file.getClicksMAT
(us.hebi.matlab.mat.types.Struct clicksStruct, double sampleRate) Load clicks from a MATLAB struct.static double
Calculate the density of whistles for a segmenter group in the absence of a known fft length and hop.getWhistleContoursMAT
(String filePath) Load whistle contours from a MAT file.static ArrayList
<AbstractWhistleDataUnit> getWhistleContoursMAT
(us.hebi.matlab.mat.types.Struct whistlesStruct, double fftLen, double fftHop, double sampleRate) Load whistle contours from a MATLAB structstatic void
prepDelphinIDModel
(String modelPath) static ArrayList
<SegmenterDetectionGroup> segmentDetectionData
(ArrayList<? extends PamDataUnit> whistles, long dataStartMillis, double segLen, double segHop) Segment the detections into groups.static ArrayList
<SegmenterDetectionGroup> segmentDetectionData
(ArrayList<? extends PamDataUnit> detections, long dataStartMillis, double segLen, double segHop, Float sampleRate) Segment the detections into groups.
-
Constructor Details
-
Method Details
-
prepDelphinIDModel
-
getBaseData
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
Load whistle contours from a MAT file.- Parameters:
filePath
- - the file path.- Returns:
- a list of whistle contour objects from the mat file.
-
getClicksMAT
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 contourssampleRate
- - the sample rate in samples per second.fftLen
- - the fft length in samplesfftHop
- - the fft hop in samples.- Returns:
- a list of whistle contour objects from the struct.
-
getWhistleContoursMAT
Load whistle contours from a MAT file.- Parameters:
filePath
- - the file path.- Returns:
- a list of whistle contour objects from the mat file.
-
getWhistleContoursMAT
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 contoursfftLen
- - the FFT length in samplesfftHop
- - the FFT hop in samples.sampleRate
- - the sample rate in samples per second.- Returns:
- a list of whistle contour objects from the struct.
-
segmentDetectionData
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
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
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
-