Package PamguardMVC.blockprocess
Class PamBlockProcess
java.lang.Object
PamguardMVC.PamProcess
PamguardMVC.blockprocess.PamBlockProcess
- All Implemented Interfaces:
PamObserver
,ProcessAnnotator
- Direct Known Subclasses:
GPLProcess
Modified PamProcess which can block data for analysis in chunks rather than a continuous data stream.
There are two or three options with block processes and some messing about to do at PAMGuard starts and stops:
1. Calls into parent process are separated for processing background and processing data
2. Can also handle reverse input buffering
3. Extra things to think about and decide upon at end of a file / run, ie. whether or not to process an incomplete block.
Complicated threading so a block can be simultaneously filling and emptying at the same time.
- Author:
- dg50
-
Constructor Summary
ConstructorDescriptionPamBlockProcess
(PamControlledUnit pamControlledUnit, PamDataBlock parentDataBlock) PamBlockProcess
(PamControlledUnit pamControlledUnit, PamDataBlock parentDataBlock, String processName) -
Method Summary
Modifier and TypeMethodDescriptionlong
absSamplesToMilliseconds
(long samples) Convert am ADC sample number to a millisecond time.abstract void
addBlockData
(PamBlockDataList blockDataList) Called in sequence for data in a block so it can make background measurementsabstract void
addSingleData
(PamObservable o, PamDataUnit dataUnit) Called in sequence for data in a block so it can run detectorschannelSplitList
(PamBlockDataList dataList) Split a data list into individual channels.abstract PamBlockParams
boolean
isLastChannel
(PamObservable obs, PamDataUnit dataUnit) Is this the last channel in a group from that datablock ?final void
newData
(PamObservable o, PamDataUnit dataUnit) Override the PamProcess new data call.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
receiveSourceNotification
(int type, Object object) Receive a notification from the data source - typically a change in DAQ status.reverseDataList
(PamBlockDataList dataList) Reverse a data list into a new list.abstract void
setBlockState
(BlockState state) Set the block state - tell it what to expect next so that it can clean up at the start middle and end of a block of data.void
setParentDataBlock
(PamDataBlock newParentDataBlock, boolean reThread) Set a parent data block for the process with the option to rethread the data exchange process.Methods inherited from class PamguardMVC.PamProcess
absMillisecondsToSamples, addData, addMultiPlexDataBlock, addOutputDataBlock, changedThreading, clearOldData, 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, getRequiredDataHistory, getSampleRate, getSourceDataBlock, getSourceProcess, hasOutputDatablock, isCanMultiThread, isExternalProcess, isMultiplex, makePamProcess, masterClockUpdate, noteNewSettings, notifyModelChanged, prepareProcess, prepareProcessOK, processNewBuoyData, relMillisecondsToSamples, relSamplesToMilliseconds, removeAllDataBlocks, removeAllMultiPlexDataBlocks, removeMultiPlexDataBlock, removeObservable, removeOutputDatablock, resetDataBlocks, saveViewerData, setCanMultiThread, setExternalProcess, setMultiplex, setParentDataBlock, setProcessCheck, setProcessName, setSampleRate, setupProcess, toString, updateData
-
Constructor Details
-
PamBlockProcess
-
PamBlockProcess
public PamBlockProcess(PamControlledUnit pamControlledUnit, PamDataBlock parentDataBlock, String processName)
-
-
Method Details
-
setParentDataBlock
Description copied from class:PamProcess
Set a parent data block for the process with the option to rethread the data exchange process. This is overridden to false if the main PAMGUARD option to rethread is off.- Overrides:
setParentDataBlock
in classPamProcess
- Parameters:
newParentDataBlock
- source data blockreThread
- rethread if multithreading is enabled.
-
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
-
newData
Override the PamProcess new data call. It's here that we're going to stack up all the input data into blocks. Then pass on to two separate functions blockBackground and blockData.- Overrides:
newData
in classPamProcess
-
absSamplesToMilliseconds
public long absSamplesToMilliseconds(long samples) Convert am ADC sample number to a millisecond time. This function was re-written on 11/11/08 to deal with problems of sound card clocks not running at same speed as PC clock, so milliseconds from PC clock and milliseconds based on samples would drift apart. This new system bases the calculation on the times of the most recently received data unit.- Overrides:
absSamplesToMilliseconds
in classPamProcess
- Parameters:
samples
- sample number (from start of run)- Returns:
- Millisecond time (UTC milliseconds from the epoch - the standard Java way)
-
receiveSourceNotification
Description copied from interface:PamObserver
Receive a notification from the data source - typically a change in DAQ status. See the constants listed in AcquisitionProcess for potential change types.- Specified by:
receiveSourceNotification
in interfacePamObserver
- Overrides:
receiveSourceNotification
in classPamProcess
- Parameters:
type
- the type of changeobject
- generic object added here so that we can include anything in the future
-
isLastChannel
Is this the last channel in a group from that datablock ?- Parameters:
channelMap
-- Returns:
-
getBlockParams
-
setBlockState
Set the block state - tell it what to expect next so that it can clean up at the start middle and end of a block of data.- Parameters:
state
-
-
channelSplitList
Split a data list into individual channels.- Parameters:
dataList
- data list with multiple channels of data. Assuming it's a type of data which only has one channel per data unit (e.g. raw or fft)- Returns:
- list of data separated by channel. If channels were not continuous, then there may be some nulls.
-
reverseDataList
Reverse a data list into a new list. Swap channel orders, so channels are in correct order, but time is reversed.- Parameters:
blockDataList
-- Returns:
-
addBlockData
Called in sequence for data in a block so it can make background measurements- Parameters:
blockDataList
- blocked list of data units (possibly interleaved by channel)
-
addSingleData
Called in sequence for data in a block so it can run detectors- Parameters:
o
-dataUnit
-
-