Package decimator

Class DecimatorWorker

java.lang.Object
decimator.DecimatorWorker

public class DecimatorWorker extends Object
Job to run the actual decimation. Separate out from DecimatorProcess so that it can be used elsewhere.
Note that this can both decimate and upsample. If decimating, filtering takes place before data are copied to output array. If upsampling, filtering takes place AFTER data are copied to the output array.
Author:
dg50
  • Constructor Summary

    Constructors
    Constructor
    Description
    DecimatorWorker(int filterOrder, int channelMap, double inputRate, double outputRate)
    Make a decimator / upsampler
    DecimatorWorker(DecimatorParams decimatorParams, int channelMap, double inputRate, double outputRate)
    Make a decimator worker with given filter params, channel map and input and output rates.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Make the decimator filters.
    process(RawDataUnit inputData)
    Run the decimator on the input data, return null if it's not in the channel list.
    void
    Reset all counters and output buffers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DecimatorWorker

      public DecimatorWorker(DecimatorParams decimatorParams, int channelMap, double inputRate, double outputRate)
      Make a decimator worker with given filter params, channel map and input and output rates. Channels not in the map will be ignored.
      Parameters:
      decimatorParams - Filter parameters for Decimator filter
      channelMap - Channel map (channels not in map will return null)
      inputRate - input sample rate
      outputRate - output sample rate
    • DecimatorWorker

      public DecimatorWorker(int filterOrder, int channelMap, double inputRate, double outputRate)
      Make a decimator / upsampler
      Parameters:
      filterOrder - Filter order to use (Butterworth low pass applied before decimation or after upsampling
      channelMap - channel map
      inputRate - input sample rate
      outputRate - output sample rate
  • Method Details

    • reset

      public void reset()
      Reset all counters and output buffers.
    • createFilters

      protected void createFilters()
      Make the decimator filters. If reducing frequency, then the filter is applied before decimation (obviously!) so is set up based on the input sample rate. If however the 'decimator' is being used to upsample, then filtering takes place AFTER the transfer of data to the output arrays, so fitlering is set up based on the output sample rate.
    • process

      public RawDataUnit process(RawDataUnit inputData)
      Run the decimator on the input data, return null if it's not in the channel list.
      Also sometimes null if decimation ratio is not an integer factor
      Parameters:
      inputData -
      Returns:
      a new data unit or null