Class RealBlockAverage

java.lang.Object
likelihoodDetectionModule.linearAverageSpectra.RealBlockAverage

public class RealBlockAverage extends Object
This is a helper class to compute block averages. The first time processData is called, it creates a block of memory the same length as the data passed to the processData() method. After each call to processData, the user can check the status by calling averageReady(). After an average is computed (averageReady() returns true), no more data will be accepted until you call the average() method to collect the results. The averageTimestamp() and averageAbsBlockIndex() return the timestamp and AbsBlockIndex of the averaged result. The timestamp is that of the first block used in computing the average, FIXME what to do with AbsBlockIndex
Author:
dave
  • Constructor Details

    • RealBlockAverage

      public RealBlockAverage(int nAvg)
  • Method Details

    • processData

      public boolean processData(long timestamp, long startSample, ComplexArray complexArray)
      Processes a block of data at given timestamp and absolute block index.
      Parameters:
      timestamp - The timestamp of the input block
      complexArray - The complex input data
      Returns:
      true if the data was processed and is safe to discard, false if there is a pending average to be read, and the input data was not used
    • averageReady

      public boolean averageReady()
    • averageTimestamp

      public long averageTimestamp()
    • averageStartSample

      public long averageStartSample()
    • average

      public double[] average()
      Returns the processed average data. Call averageReady() to know when data is ready.
      Returns:
      The pending average, null if no average is ready
      See Also: