Package difar
Class DifarDataUnit
- All Implemented Interfaces:
Comparable<PamDataUnit>
,PamDetection
,AcousticDataUnit
,RawDataHolder
-
Field Summary
Fields inherited from class clipgenerator.ClipDataUnit
fileName, triggerMilliseconds, triggerName
-
Constructor Summary
ConstructorDescriptionDifarDataUnit
(long clipStartMillis, long triggerMilliseconds, long startSample, int durationSamples, int channelMap, String fileName, String triggerName, double[][] rawData, long signalStartMillis, PamDataUnit parentDetection, double[] frequencyRange, float sourceSampleRate, float displaySampleRate, double[] calFreqs, double[] calGains) Constructor to use if storing data into the binary system. -
Method Summary
Modifier and TypeMethodDescriptionNow also work out the DIFAR gain for that angle.calculateDifarGain
(Double selectedAngle, Double selectedFrequency) Calculate teh DIFAR gain for a given angle and frequencyboolean
Autoprocess everything except "Default" clipsboolean
//this is a bit pointless now as action performed doesn't attempt save if timer is stopped whether the difar unit has been interacted with causing autosave to be inapropriatevoid
//this is a bit pointless now as action performed doesn't attempt save if timer is stoppedvoid
Gets called just before unit is added to processed data.static double[]
decimateData
(double[] ds, float origSmp, float displaySampRate) static boolean[]
decimateLockArray
(boolean[] lockInput, float origSmp, float displaySampRate) double[][]
getCalibratedSpectrogramData
(int channel, int fftLength, int fftHop) Return a spectrogram clip that has calibrated intensity Intensity is "calibrated" using an arbitrary filter to correct for the DIFAR frequency response.getClipImage
(int spectrogramImageChoice, int iChannel, int fftLen, int fftHop, double scaleMin, double scaleMax, Color[] colours) Get a clip image for a particular wave type - decimated original, Om, EW, NSlong
double[][]
float
double
Used by some displaysboolean[][]
double[]
double[]
getOriginLatLong
(boolean recalculate) Get the latlong of the mean hydrophone position at the time of this detection.double
getRange()
Get the angle selectedfrom the DIFARGram.long
Signal start time in milliseconds relative to start of sound.Get a species code - mostly used by the database.Return an html formatted summary string describing the detection which can be used in tooltips anywhere in PAMGuard.double[][]
double[]
Get the true bearing relative to the DIFAR buoy.boolean
isVessel()
void
saveCrossing
(boolean save) Move the crossing info from it's temp position to a saved position.void
void
setDemuxedDecimatedData
(double[][] demuxedDecimatedData) void
setDifarCrossing
(DIFARCrossingInfo difarCrossing) void
setDifarGain
(double difarGain) void
setDisplaySampleRate
(float displaySampleRate) void
setFrequencyResponse
(double[] f, double[] gain) void
setLockDecimatedData
(boolean[][] lockArrays) Set the lock array iformation in the data unit.void
setLutSpeciesItem
(LookupItem lutSpeciesItem) void
setMaximumAngle
(Double maximumAngle) void
setMaximumAngleSummary
(double[] surfaceSummary) void
setMaximumFrequency
(Double maximumFrequency) void
setParentDetection
(PamDataUnit parentDetection) void
setPreMarkSeconds
(double preMarkSeconds) void
setSelectedAngle
(Double selectedAngle) Set the selected angle from the DIFARGram.void
setSelectedFrequency
(Double selectedFrequency) void
setSpeciesCode
(LookupList speciesList, String speciesCode) Called in viewer when data are read back from binary store to sort out the species luukup item.void
setSpectrogramSensor
(int spectrogramSensor) Choice of data for spectrogram displays.void
setSurfaceData
(double[][] surfaceData) void
setSurfaceSummary
(double[] surfaceSummary) void
setTempCrossing
(DIFARCrossingInfo tempCrossing) void
setTempGroup
(String tempGroup) void
setTrackedGroup
(String newGroup) void
setVessel
(boolean isVessel) toString()
void
updateDataUnit
(long updateTime) Methods inherited from class clipgenerator.ClipDataUnit
clearClipSpecData, findTriggerDataUnit, generateComplexSpectrogram, generateSpectrogramArrays, getClipImage, getDataTransforms, getLocalisation, getRawData, getSourceSampleRate, getSpectrogramData, getTriggerDataUnit, getTriggerMilliseconds, getTriggerUID, getWaveData, getWindowType, setRawData, setTimeMilliseconds, setTriggerDataUnit, setTriggerUID, setWindowType
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, 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
-
Constructor Details
-
DifarDataUnit
public DifarDataUnit(long clipStartMillis, long triggerMilliseconds, long startSample, int durationSamples, int channelMap, String fileName, String triggerName, double[][] rawData, long signalStartMillis, PamDataUnit parentDetection, double[] frequencyRange, float sourceSampleRate, float displaySampleRate, double[] calFreqs, double[] calGains) Constructor to use if storing data into the binary system.- Parameters:
triggerMilliseconds
-startSample
-durationSamples
-channelMap
-fileName
-triggerName
-rawData
-timeMilliseconds
-upperFreq
-
-
-
Method Details
-
decimateData
public static double[] decimateData(double[] ds, float origSmp, float displaySampRate) -
setFrequencyResponse
public void setFrequencyResponse(double[] f, double[] gain) -
getParentDetection
-
setParentDetection
-
getMultiplexedData
public double[] getMultiplexedData() -
getSignalStart
public long getSignalStart()Signal start time in milliseconds relative to start of sound.- Returns:
- signal start time in milliseconds
-
getSurfaceData
public double[][] getSurfaceData() -
setSurfaceData
public void setSurfaceData(double[][] surfaceData) -
isVessel
public boolean isVessel()- Returns:
- the isVessel
-
setVessel
public void setVessel(boolean isVessel) - Parameters:
isVessel
- the isVessel to set
-
getLutSpeciesItem
- Returns:
- the lutSpeciesItem
-
setLutSpeciesItem
- Parameters:
lutSpeciesItem
- the lutSpeciesItem to set
-
getDisplaySampleRate
public float getDisplaySampleRate()- Overrides:
getDisplaySampleRate
in classClipDataUnit
- Returns:
- the displaySampleRate
-
setDisplaySampleRate
public void setDisplaySampleRate(float displaySampleRate) - Parameters:
displaySampleRate
- the displaySampleRate to set
-
getSelectedAngle
Get the angle selectedfrom the DIFARGram. Note that this is the angle relative to the DIFAR buoy and is therefore a MAGNETIC angle. If you want an angle corrected for magnetic deviation, use getTrueAngle();- Returns:
- the selectedAngle
-
getRange
-
getTrueAngle
Get the true bearing relative to the DIFAR buoy. This is the selected angle (see getSelectedAngle() + the local magnetic deviation calulcated from the World Magnetic Model. For map display, this bearing may be further corrected for any offset in the buoy heading in the array manager. If there is no offset in the arraymanager, then return the magnetic bearing since returning null for the trueBearing may cause problems down the line.- Returns:
- true angle (if the buoy is orientated right !)
-
getTrackedGroup
-
setTrackedGroup
-
setSelectedAngle
Set the selected angle from the DIFARGram. Note that this is the angle relative to the DIFAR buoy and is therefore a MAGNETIC angle.- Parameters:
selectedAngle
- the selectedAngle to set
-
calculateDifarGain
Now also work out the DIFAR gain for that angle. This means taking the closest point in the summary line and seeing what it's value is for that angle- Returns:
- gain.
-
calculateDifarGain
Calculate teh DIFAR gain for a given angle and frequency- Parameters:
selectedAngle
- angle 0 - 360selectedFrequency
- Frequency Hz- Returns:
- gain
-
getSelectedFrequency
- Returns:
- the selectedFrequency
-
setSelectedFrequency
- Parameters:
selectedFrequency
- the selectedFrequency to set
-
getSurfaceSummary
public double[] getSurfaceSummary()- Returns:
- the surfaceSummary
-
setSurfaceSummary
public void setSurfaceSummary(double[] surfaceSummary) - Parameters:
surfaceSummary
- the surfaceSummary to set
-
getMaximumAngleSummary
public double[] getMaximumAngleSummary()- Returns:
- the maximumAngleSummary
-
setMaximumAngleSummary
public void setMaximumAngleSummary(double[] surfaceSummary) - Parameters:
surfaceSummary
- the surfaceSummary to set
-
getMaximumAngle
- Returns:
- the maximumAngle
-
setMaximumAngle
- Parameters:
maximumAngle
- the maximumAngle to set
-
getMaximumFrequency
- Returns:
- the maximumFrequency
-
setMaximumFrequency
- Parameters:
maximumFrequency
- the maximumFrequency to set
-
setSpectrogramSensor
public void setSpectrogramSensor(int spectrogramSensor) Choice of data for spectrogram displays.
0 = decimated original data.
1 = Omni demuxed
2 = EW demuxed
3 = NS demuxed- Parameters:
spectrogramSensor
- the spectrogramSensor to set
-
getDemuxedDecimatedData
public double[][] getDemuxedDecimatedData()- Returns:
- the demuxedDecimatedData
-
setDemuxedDecimatedData
public void setDemuxedDecimatedData(double[][] demuxedDecimatedData) - Parameters:
demuxedDecimatedData
- the demuxedDecimatedData to set
-
getClipImage
public BufferedImage getClipImage(int spectrogramImageChoice, int iChannel, int fftLen, int fftHop, double scaleMin, double scaleMax, Color[] colours) Get a clip image for a particular wave type - decimated original, Om, EW, NS- Parameters:
spectrogramImageChoice
-iChannel
-fftLen
-fftHop
-scaleMin
-scaleMax
-colours
-- Returns:
-
getSpeciesName
- Returns:
- null, Vessel or the long name from the lookup
-
getSpeciesCode
Get a species code - mostly used by the database.- Returns:
- a species code (the shorter bit from the lookup table) TODO: Store species parameters with each data unit
-
setSpeciesCode
Called in viewer when data are read back from binary store to sort out the species luukup item.- Parameters:
speciesList
- list of programmed species codesspeciesCode
- data units code or "Vessel"
-
decimateLockArray
public static boolean[] decimateLockArray(boolean[] lockInput, float origSmp, float displaySampRate) - Parameters:
lock_15
-sampleRate
-displaySampleRate2
-
-
getDifarGain
- Returns:
- the difarGain
-
setDifarGain
public void setDifarGain(double difarGain) - Parameters:
difarGain
- the difarGain to set
-
setLockDecimatedData
public void setLockDecimatedData(boolean[][] lockArrays) Set the lock array iformation in the data unit. This is a 2xn boolean array of the 7.5 and 15kHz locks, decimated to the same freqeuncy as the demuxed audio data.- Parameters:
lockArrays
- TODO: Move all lock related code into the Greeneridge demux
-
getLockDecimatedData
public boolean[][] getLockDecimatedData() -
cleanUpData
public void cleanUpData()Gets called just before unit is added to processed data. Some things are no longer needed at this point, so can clean them up. -
getDurationInSeconds
public double getDurationInSeconds()Used by some displays- Returns:
-
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 classClipDataUnit
- Returns:
- summary string
-
getPreMarkSeconds
public double getPreMarkSeconds()- Returns:
- the Number of seconds added to the sound prior to the specrogram mark or detection.
-
setPreMarkSeconds
public void setPreMarkSeconds(double preMarkSeconds) - Parameters:
the
- Number of seconds added to the sound prior to the specrogram mark or detection
-
getClipStartMillis
public long getClipStartMillis()- Returns:
- the clipStartMillis. This is the start of the clip - which will generally have been put afew secs before the actual sound.
-
canAutoProcess
public boolean canAutoProcess()Autoprocess everything except "Default" clips- Returns:
-
cancelAutoSave
public void cancelAutoSave()//this is a bit pointless now as action performed doesn't attempt save if timer is stopped- Parameters:
sets
- canAutoSave false
-
canAutoSave
public boolean canAutoSave()//this is a bit pointless now as action performed doesn't attempt save if timer is stopped whether the difar unit has been interacted with causing autosave to be inapropriate -
toString
-
saveCrossing
public void saveCrossing(boolean save) Move the crossing info from it's temp position to a saved position. Called just at the point when the difar unit is saved and moved from the queue to the output data block.- Parameters:
save
- - save it, or discard it (also from other units associated with this crossing
-
getDifarCrossing
- Returns:
- the crossing point when multiple matching DIFAR bearings are crossed.
-
setDifarCrossing
- Parameters:
difarCrossing
- the difarCrossing to set
-
getTempCrossing
- Returns:
- the tempCrossing
-
setTempCrossing
- Parameters:
tempCrossing
- the tempCrossing to set
-
getTempGroup
- Returns:
- the tempCrossing
-
setTempGroup
- Parameters:
tempCrossing
- the tempCrossing to set
-
getOriginLatLong
Description copied from class:PamDataUnit
Get the latlong of the mean hydrophone position at the time of this detection. If the data unit has a channel bitmap of zero, then get the GPS position of the vessel at that time.- Overrides:
getOriginLatLong
in classPamDataUnit<PamDataUnit,
SuperDetection> - Returns:
- Lat long of detection origin (usually the position of the reference hydrophone at time of detection)
-
saveGroup
public void saveGroup() -
getCalibratedSpectrogramData
public double[][] getCalibratedSpectrogramData(int channel, int fftLength, int fftHop) Return a spectrogram clip that has calibrated intensity Intensity is "calibrated" using an arbitrary filter to correct for the DIFAR frequency response.- Parameters:
fftLength
-fftHop
-i
-- Returns:
-
updateDataUnit
public void updateDataUnit(long updateTime) - Overrides:
updateDataUnit
in classPamDataUnit<PamDataUnit,
SuperDetection>
-