Package clipgenerator
Class ClipDataUnit
- All Implemented Interfaces:
Comparable<PamDataUnit>
,PamDetection
,AcousticDataUnit
,RawDataHolder
- Direct Known Subclasses:
DifarDataUnit
public class ClipDataUnit
extends PamDataUnit<PamDataUnit,SuperDetection>
implements PamDetection, RawDataHolder
-
Field Summary
-
Constructor Summary
ConstructorDescriptionClipDataUnit
(long timeMilliseconds, long triggerMilliseconds, long startSample, int durationSamples, int channelMap, String fileName, String triggerName, double[][] rawData, float sourceSampleRate) Constructor to use if storing data into the binary system. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear existing clip spectrogram data.Complex[][]
generateComplexSpectrogram
(int channel, int fftLength, int fftHop) Generate complex spectrogram data for the clip.generateSpectrogramArrays
(int channel, int fftLength, int fftHop) Generate complex spectrogram data for the clip.getClipImage
(int channel, int fftLength, int fftHop, double scaleMin, double scaleMax, Color[] colorTable) Get an image of the clipGet the raw data transforms class.float
double[][]
final float
double[][]
getSpectrogramData
(int channel, int fftLength, int fftHop) get spectrogram data for the clip.Return an html formatted summary string describing the detection which can be used in tooltips anywhere in PAMGuard.Reference to the data unit that triggered the clip
This is going to be correct in normal mode, but the unit will have to be searched for in other modes, so is not 100% guaranteed.long
long
UID of trigger data unitdouble[][]
Get all the wave data into an array.int
void
setRawData
(double[][] rawData) void
setTimeMilliseconds
(long timeMilliseconds) Set the millisecond time of the data unit using the standard Java time system of milliseconds since midnight, January 1, 1970 UTCvoid
setTriggerDataUnit
(PamDataUnit triggerDataUnit) Reference to the data unit that triggered the clipvoid
setTriggerUID
(long triggerUID) UID of trigger data unitstatic void
setWindowType
(int windowType) Methods inherited from class PamguardMVC.PamDataUnit
addDataAnnotation, addSuperDetection, amplifyMeasuredAmplitudeByDB, amplifyMeasuredAmplitudeByLinear, calcSnapshotGeometry, clearOandAngles, clearUpdateCount, compareTo, findDataAnnotation, findDataAnnotation, freeData, getAbsBlockIndex, getAmplitudeDB, getAnnotationsSummaryString, getBasicData, getCalculatedAmlitudeDB, getChannelBitmap, getColourIndex, getDataAnnotation, getDatabaseIndex, getDatabaseUpdateOf, getDataUnitFileInformation, getDataUnitPopupMenu, getDurationInMilliseconds, getEndTimeInMilliseconds, getFrequency, getFrequencyOverlap, getHydrophoneBitmap, getHydrophoneHeading, getLastChangeTime, getLastSample, getLastUpdateTime, getMeasuredAmplitude, getMeasuredAmplitudeType, getNoiseBackground, getNumDataAnnotations, getOriginLatLong, getParentDataBlock, getSampleDuration, getSampleDurationAsInt, getSeconds, getSequenceBitmap, getSequenceBitmapObject, getSignalExcess, getSignalSPL, getSnapshotGeometry, getStartSample, getSuperDetection, getSuperDetection, getSuperDetection, getSuperDetection, getSuperDetection, getSuperDetectionsCount, getSuperDetectionSyncronisation, getSuperId, getTimeDelaysSeconds, getTimeMilliseconds, getTimeNanoseconds, getTimeOverlap, getUID, getUpdateCount, isEmbryonic, isForceAmpRecalc, linAmplitudeToDB, removeDataAnnotation, removeDataAnnotation, removeSuperDetection, setAbsBlockIndex, setCalculatedAmlitudeDB, setChannelBitmap, setDatabaseIndex, setDatabaseUpdateOf, setDataUnitFileInformation, setDurationInMilliseconds, setEmbryonic, setForceAmpRecalc, setFrequency, setInfo, setLastUpdateTime, setLocalisation, setMeasuredAmpAndType, setMeasuredAmplitude, setMeasuredAmplitudeType, setNoiseBackground, setParentDataBlock, setSampleDuration, setSequenceBitmap, setSignalExcess, setSignalSPL, setSnapshotGeometry, setStartSample, setTimeDelaysSeconds, setUID, setUniqueSuperDetection, sortOutputMaps, updateDataUnit
-
Field Details
-
fileName
-
triggerName
-
triggerMilliseconds
public long triggerMilliseconds
-
-
Constructor Details
-
ClipDataUnit
public ClipDataUnit(long timeMilliseconds, long triggerMilliseconds, long startSample, int durationSamples, int channelMap, String fileName, String triggerName, double[][] rawData, float sourceSampleRate) Constructor to use if storing data into the binary system.- Parameters:
timeMilliseconds
-triggerMilliseconds
-startSample
-durationSamples
-channelMap
-fileName
-triggerName
-rawData
-
-
-
Method Details
-
getClipImage
public BufferedImage getClipImage(int channel, int fftLength, int fftHop, double scaleMin, double scaleMax, Color[] colorTable) Get an image of the clip- Parameters:
channel
-fftLength
-fftHop
-scaleMin
-scaleMax
-colorTable
-- Returns:
- clip image (Swing buffered image)
-
clearClipSpecData
public void clearClipSpecData()Clear existing clip spectrogram data.
This will force it to regenerate the data when next requested rather than recycling it -
getSpectrogramData
public double[][] getSpectrogramData(int channel, int fftLength, int fftHop) get spectrogram data for the clip.- Parameters:
fftLength
- FFT lengthfftHop
- FFT hop- Returns:
- double array of mag squared data or null if the clip waveform cannot be found
-
generateComplexSpectrogram
Generate complex spectrogram data for the clip.- Parameters:
channel
-fftLength
- FFT lengthfftHop
- FFT hop- Returns:
- double array of mag squared data or null if the clip waveform cannot be found
-
generateSpectrogramArrays
Generate complex spectrogram data for the clip.- Parameters:
channel
-fftLength
- FFT lengthfftHop
- FFT hop- Returns:
- Array of ComplexArray FFT data (half fft length, due to real input)
-
getWaveData
public double[][] getWaveData()Get all the wave data into an array.- Specified by:
getWaveData
in interfaceRawDataHolder
- Returns:
- the wave data or null if it can't be found.
-
getTriggerMilliseconds
public long getTriggerMilliseconds()- Returns:
- the triggerMilliseconds
-
getRawData
public double[][] getRawData()- Returns:
- the rawData
-
setRawData
public void setRawData(double[][] rawData) - Parameters:
rawData
- the rawData to set
-
getSourceSampleRate
public final float getSourceSampleRate()- Returns:
- the sourceSampleRate
-
getDisplaySampleRate
public float getDisplaySampleRate()- Returns:
- Sample rate for the display
-
getWindowType
public int getWindowType() -
setWindowType
public static void setWindowType(int windowType) -
getLocalisation
- Overrides:
getLocalisation
in classPamDataUnit<PamDataUnit,
SuperDetection> - Returns:
- Returns the localisation.
-
findTriggerDataUnit
-
setTimeMilliseconds
public void setTimeMilliseconds(long timeMilliseconds) Description copied from class:PamDataUnit
Set the millisecond time of the data unit using the standard Java time system of milliseconds since midnight, January 1, 1970 UTC- Overrides:
setTimeMilliseconds
in classPamDataUnit<PamDataUnit,
SuperDetection> - Parameters:
timeMilliseconds
- time in milliseconds.
-
getTriggerDataUnit
Reference to the data unit that triggered the clip
This is going to be correct in normal mode, but the unit will have to be searched for in other modes, so is not 100% guaranteed.- Returns:
- the triggerDataUnit
-
setTriggerDataUnit
Reference to the data unit that triggered the clip- Parameters:
triggerDataUnit
- the triggerDataUnit to set
-
getTriggerUID
public long getTriggerUID()UID of trigger data unit- Returns:
- the triggerUID
-
setTriggerUID
public void setTriggerUID(long triggerUID) UID of trigger data unit- Parameters:
triggerUID
- the triggerUID to set
-
getDataTransforms
Description copied from interface:RawDataHolder
Get the raw data transforms class. This handles standard data transforms that are often used in raw data units, e.g. calculating the spectrum, filtering waveforms, getting data as an int16 (short) array, etc.- Specified by:
getDataTransforms
in interfaceRawDataHolder
- Returns:
- the data transforms object.
-
getSummaryString
Description copied from class:PamDataUnit
Return an html formatted summary string describing the detection which can be used in tooltips anywhere in PAMGuard.- Overrides:
getSummaryString
in classPamDataUnit<PamDataUnit,
SuperDetection> - Returns:
- summary string
-