Package difar
Class DifarProcess
java.lang.Object
PamguardMVC.PamProcess
difar.DifarProcess
- All Implemented Interfaces:
PamObserver
,ProcessAnnotator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Clears all data from all output data blocks of this process.double[]
createMaxAngleSummary
(DifarDataUnit difarDataUnit, double[] freqRange) Create a summary of angles with maximum DIFAR level for each frequencydouble[]
createSummaryLine
(DifarDataUnit difarDataUnit, double[] freqRange) Create a single line summary of DIFAR level against angle within a selected frequency rangedouble
difarGridToDegrees
(DifarDataUnit difarDataUnit, double difarGridPos) Convert a point on the difar grid to an angle in degrees.double
difarGridToFrequency
(int nFreqPoints, double niquist, double gridPos) convert a difar grid position to a freqeuncy.double
difarGridToFrequency
(DifarDataUnit difarDataUnit, double gridPos) void
difarTrigger
(int channelMap, long signalStartMillis, long durationMillis, double[] f, PamDataUnit pamDetection, double displaySampleRate, String triggerSpeciesName, String triggerDataBlockName) Called when there is a trigger caused whether by a detection or by a mark being made on the spectrogram.doBuoyCalibration
(int buoyCalibrationChannel, long endSample) Grab a clip for the latest buoy calibration data.void
estimateTrackedGroup
(DifarDataUnit difarDataUnit) Match the selected bearing to the nearest mean-bearing to a group, and Make sure that the matching group is highlighted in the groups panel.void
finalProcessing
(DifarDataUnit difarDataUnit) Do any final processing of the DIFAR data unit and add it to the datablock.getCalCorrectionHistogram
(int channel) Get the calibration true bearing histogram for a channel.getCalibrationProcess
(int channel) Get the calibration sub-process for a specific channel.getCalTrueBearingHistogram
(int channel) Get the calibration true bearing histogram for a channel.getDifarRangeInfo
(DifarDataUnit difarDataUnit) Called just before a difar unit is stored.int
getDisplayFFTHop
(DifarDataUnit difarDataUnit) int
getDisplayFFTLength
(DifarDataUnit difarDataUnit) Get the display FFT length, which may depend on the type of data unit.int
long
double
getWhaleRange
(DifarDataUnit difarDataUnit, double nominalSourceLevel) void
newData
(PamObservable o, PamDataUnit arg) void
notifyModelChanged
(int changeType) void
pamStart()
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway).void
pamStop()
Stops the process.void
processDifarUnit
(DifarDataUnit difarDataUnit, difar.DifarProcess.DifarDemuxWorker demuxWorker) Process a queued data unit - in normal operation, this involves first demuxing and decimating the data in order to get the waveforms for the three sensors, then calculating the difargram.void
queueDemuxProcess
(DifarDataUnit difarDataUnit) Send a difar unit off for processing in a worker thread.double
rangeForDataType
(DifarDataUnit difarDataUnit) Get a display range for a particular data unit, as will be used by the map.void
setAutoSaveTimer
(difar.DifarProcess.AutoSaveTimer autoSaveTimer) void
setCalibrationDataBlock
(CalibrationDataBlock calibrationData) void
void
called for every process once the systemmodel has been created.void
startBuoyCalibration
(int channel) Start a buoy calibration on a specified channelvoid
Look through the list of data blocks that could contain DIFAR detections, and subscribe to them according to the difarParametersMethods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, absSamplesToMilliseconds, addData, addMultiPlexDataBlock, addOutputDataBlock, changedThreading, createAnnotations, destroyProcess, dumpBufferStatus, flushDataBlockBuffers, getAncestorDataBlock, getAnnotation, getChainPosition, getCompatibleDataUnits, getCpuPercent, getFrequencyRange, getLastSourceNotificationObject, getLastSourceNotificationType, getMuiltiplexDataBlock, getNumAnnotations, getNumMuiltiplexDataBlocks, getNumOutputDataBlocks, getObserverName, getObserverObject, getOfflineData, getOfflineData, getOutputDataBlock, getOutputDataBlocks, getPamControlledUnit, getParentDataBlock, getParentDataBlocks, getParentProcess, getProcessCheck, getProcessName, getRawSourceDataBlock, getRawSourceDataBlock, getSampleRate, getSourceDataBlock, getSourceProcess, hasOutputDatablock, isCanMultiThread, isExternalProcess, isMultiplex, makePamProcess, masterClockUpdate, noteNewSettings, prepareProcess, prepareProcessOK, processNewBuoyData, receiveSourceNotification, relMillisecondsToSamples, relSamplesToMilliseconds, removeAllDataBlocks, removeAllMultiPlexDataBlocks, removeMultiPlexDataBlock, removeObservable, removeOutputDatablock, resetDataBlocks, saveViewerData, setCanMultiThread, setExternalProcess, setMultiplex, setParentDataBlock, setParentDataBlock, setProcessCheck, setProcessName, setSampleRate, toString, updateData
-
Constructor Details
-
DifarProcess
-
-
Method Details
-
newData
- Overrides:
newData
in classPamProcess
-
queueDemuxProcess
Send a difar unit off for processing in a worker thread. For now, only allow one of these, but may consider having more in the future.- Parameters:
difarDataUnit
-
-
processDifarUnit
public void processDifarUnit(DifarDataUnit difarDataUnit, difar.DifarProcess.DifarDemuxWorker demuxWorker) Process a queued data unit - in normal operation, this involves first demuxing and decimating the data in order to get the waveforms for the three sensors, then calculating the difargram.
In viewer mode the demux stage can be skipped since only teh decimated demuxed data were stored in the first place.This is called from within a SwingWorker thread, and can call back through that SwingWorker to update on progress.
- Parameters:
difarDataUnit
-demuxWorker
-
-
estimateTrackedGroup
Match the selected bearing to the nearest mean-bearing to a group, and Make sure that the matching group is highlighted in the groups panel.- Parameters:
difarDataUnit
-
-
difarGridToDegrees
Convert a point on the difar grid to an angle in degrees.- Parameters:
difarGridPos
- position on Grid (double since may interpolate)difarDataUnit2
-- Returns:
- angle in degrees
-
difarGridToFrequency
- Parameters:
difarDataUnit
- difar data unit.gridPos
- grid position- Returns:
- Frequency in Hz.
-
difarGridToFrequency
public double difarGridToFrequency(int nFreqPoints, double niquist, double gridPos) convert a difar grid position to a freqeuncy.- Parameters:
nFreqPoints
- number of frequency points in the gridniquist
- niquist frequency for the decimated datagridPos
- grid position- Returns:
- Frequency in Hz.
-
createSummaryLine
Create a single line summary of DIFAR level against angle within a selected frequency range- Parameters:
difarDataUnit
-freqRange
-- Returns:
-
createMaxAngleSummary
Create a summary of angles with maximum DIFAR level for each frequency- Parameters:
difarDataUnit
-freqRange
-- Returns:
-
getRequiredDataHistory
- Specified by:
getRequiredDataHistory
in interfacePamObserver
- Overrides:
getRequiredDataHistory
in classPamProcess
- Parameters:
arg
- optional argument from PamObservable- Returns:
- time in milliseconds required by data held in PamObservable
-
startBuoyCalibration
public void startBuoyCalibration(int channel) Start a buoy calibration on a specified channel- Parameters:
channel
- channel number
-
doBuoyCalibration
Grab a clip for the latest buoy calibration data.- Parameters:
buoyCalibrationChannel2
-
-
setupProcess
public void setupProcess()Description copied from class:PamProcess
called for every process once the systemmodel has been created. this is a good time to check out and find input data blocks and similar tasks.- Overrides:
setupProcess
in classPamProcess
-
subscribeDataBlocks
public void subscribeDataBlocks()Look through the list of data blocks that could contain DIFAR detections, and subscribe to them according to the difarParameters -
getNumTriggers
public int getNumTriggers()- Returns:
- the total number of Detectors usable by the DIFAR module.
-
pamStart
public void pamStart()Description copied from class:PamProcess
Called for each process to tell it to start (may not be necessary for processes which are listening for data anyway).- Specified by:
pamStart
in classPamProcess
-
pamStop
public void pamStop()Description copied from class:PamProcess
Stops the process.- Specified by:
pamStop
in classPamProcess
-
getAutoSaveTimer
- Returns:
- the autoSaveTimer
-
setDataKeepTimes
public void setDataKeepTimes() -
clearOldData
public void clearOldData()Description copied from class:PamProcess
Clears all data from all output data blocks of this process.
This gets called from the main controller at the start of operations. Can be overridden in some classes which don't want to delete existing data or they can set the clearAtStart flag in any data block.- Overrides:
clearOldData
in classPamProcess
-
difarTrigger
public void difarTrigger(int channelMap, long signalStartMillis, long durationMillis, double[] f, PamDataUnit pamDetection, double displaySampleRate, String triggerSpeciesName, String triggerDataBlockName) Called when there is a trigger caused whether by a detection or by a mark being made on the spectrogram.- Parameters:
signalStartMillis
- start time in millisecondsdurationMillis
- duration in millisecondstriggerSpeciesName
-triggerDataBlockName
-channel
- (for detections)f1
- min frequencyf2
- max frequencyPamDataUnit
- associated detection (null for spectrogram marks).upperFreq
-
-
getQueuedDifarData
-
getProcessedDifarData
-
notifyModelChanged
public void notifyModelChanged(int changeType) - Overrides:
notifyModelChanged
in classPamProcess
-
finalProcessing
Do any final processing of the DIFAR data unit and add it to the datablock.
Save the data unit - but depending on the type of unit (whale or vessel) if it's a vessel data unit, will work out where the boats prop was when that unit was created and work out how much angle correction to apply to the array manager for the corresponding offset.- Parameters:
difarDataUnit
- DIFAR data unit
-
getDifarRangeInfo
Called just before a difar unit is stored. Looks at other channels that have recently had a data unit stored and decides whether or not they are likely to be the same vocalisation. If they are, calculate a crossed bearing to them both. If > 2 channels do some kind of optimised fit.- Parameters:
difarDataUnit
-- Returns:
- information about the range (will already have been put into affected units)
-
rangeForDataType
Get a display range for a particular data unit, as will be used by the map. Currently there is only one value which is fixed in the parameters.- Parameters:
difarDataUnit
-- Returns:
- a range in metres.
-
getWhaleRange
-
getDisplayFFTLength
Get the display FFT length, which may depend on the type of data unit.- Returns:
- FFT length for data display.
-
getDisplayFFTHop
-
getCalibrationProcess
Get the calibration sub-process for a specific channel.- Parameters:
channel
-- Returns:
- calibration process.
-
getCalTrueBearingHistogram
Get the calibration true bearing histogram for a channel.- Parameters:
channel
- channel number (0 - 31)- Returns:
- calibration histogram.
-
getCalCorrectionHistogram
Get the calibration true bearing histogram for a channel.- Parameters:
channel
- channel number (0 - 31)- Returns:
- calibration histogram.
-
cancelAutoSaveTimer
public void cancelAutoSaveTimer() -
setAutoSaveTimer
public void setAutoSaveTimer(difar.DifarProcess.AutoSaveTimer autoSaveTimer) -
getCalibrationDataBlock
-
setCalibrationDataBlock
-