Class PamBlockProcess

java.lang.Object
PamguardMVC.PamProcess
PamguardMVC.blockprocess.PamBlockProcess
All Implemented Interfaces:
PamObserver, ProcessAnnotator
Direct Known Subclasses:
GPLProcess

public abstract class PamBlockProcess extends PamProcess
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 Details

  • Method Details

    • setParentDataBlock

      public void setParentDataBlock(PamDataBlock newParentDataBlock, boolean reThread)
      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 class PamProcess
      Parameters:
      newParentDataBlock - source data block
      reThread - 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 class PamProcess
    • pamStop

      public void pamStop()
      Description copied from class: PamProcess
      Stops the process.
      Specified by:
      pamStop in class PamProcess
    • newData

      public final void newData(PamObservable o, PamDataUnit dataUnit)
      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 class PamProcess
    • 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 class PamProcess
      Parameters:
      samples - sample number (from start of run)
      Returns:
      Millisecond time (UTC milliseconds from the epoch - the standard Java way)
    • receiveSourceNotification

      public void receiveSourceNotification(int type, Object object)
      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 interface PamObserver
      Overrides:
      receiveSourceNotification in class PamProcess
      Parameters:
      type - the type of change
      object - generic object added here so that we can include anything in the future
    • isLastChannel

      public boolean isLastChannel(PamObservable obs, PamDataUnit dataUnit)
      Is this the last channel in a group from that datablock ?
      Parameters:
      channelMap -
      Returns:
    • getBlockParams

      public abstract PamBlockParams getBlockParams()
    • setBlockState

      public 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.
      Parameters:
      state -
    • channelSplitList

      public PamBlockDataList[] channelSplitList(PamBlockDataList dataList)
      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

      public PamBlockDataList reverseDataList(PamBlockDataList dataList)
      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

      public abstract void addBlockData(PamBlockDataList blockDataList)
      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

      public abstract void addSingleData(PamObservable o, PamDataUnit dataUnit)
      Called in sequence for data in a block so it can run detectors
      Parameters:
      o -
      dataUnit -